Author: justin
Date: Tue Feb 23 19:01:08 2010
New Revision: 915491

URL: http://svn.apache.org/viewvc?rev=915491&view=rev
Log:
improving integration test for SLING-1395

Modified:
    
sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/content/property-types-test.json
    
sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/nodetypes/test.cnd
    
sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ContentLoaderMiscPropertyTest.java

Modified: 
sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/content/property-types-test.json
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/content/property-types-test.json?rev=915491&r1=915490&r2=915491&view=diff
==============================================================================
--- 
sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/content/property-types-test.json
 (original)
+++ 
sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/content/property-types-test.json
 Tue Feb 23 19:01:08 2010
@@ -1,8 +1,17 @@
 {
        "test-node" : {
                "jcr:primaryType" : "sling:propertySetTestNodeType",
+               "string" : "Sling",
+               "strings" : ["Apache", "Sling"],
+               "long" : 42,
+               "longs" : [4, 8, 15, 16, 23, 42],
+               "boolean" : true,
+               "booleans" : [true, false],
                "uri" : "http://www.google.com/";,
+               "uris" : ["http://sling.apache.org/";, "http://www.google.com/";],
                "name" : "sling:test",
-               "path" : 
"/sling-test/initial-content-folder/folder-content-test"
+               "names" : ["jcr:base", "sling:test"],
+               "path" : 
"/sling-test/initial-content-folder/folder-content-test",
+               "paths" : 
["/sling-test/initial-content-folder/folder-content-test", "/apps"]
        }
 }

Modified: 
sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/nodetypes/test.cnd
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/nodetypes/test.cnd?rev=915491&r1=915490&r2=915491&view=diff
==============================================================================
--- 
sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/nodetypes/test.cnd
 (original)
+++ 
sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/nodetypes/test.cnd
 Tue Feb 23 19:01:08 2010
@@ -19,6 +19,19 @@
 <sling = 'http://sling.apache.org/jcr/sling/1.0'>
 
 [sling:propertySetTestNodeType] > nt:base
+ - string (string)
+ - long (long)
+ - boolean (boolean)
  - uri (uri)
  - path (path)
- - name (name)
\ No newline at end of file
+ - name (name)
+ - ref (reference)
+ - weakref (weakreference)
+ - strings (string) multiple
+ - longs (long) multiple
+ - booleans (boolean) multiple
+ - uris (uri) multiple
+ - paths (path) multiple
+ - names (name) multiple
+ - refs (reference) multiple
+ - weakrefs (weakreference) multiple
\ No newline at end of file

Modified: 
sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ContentLoaderMiscPropertyTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ContentLoaderMiscPropertyTest.java?rev=915491&r1=915490&r2=915491&view=diff
==============================================================================
--- 
sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ContentLoaderMiscPropertyTest.java
 (original)
+++ 
sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ContentLoaderMiscPropertyTest.java
 Tue Feb 23 19:01:08 2010
@@ -21,55 +21,34 @@
 import org.apache.sling.commons.testing.integration.HttpTestBase;
 
 /**
- * Test that name, path, and (in JCR 2, uri) properties are set correctly.
+ * Test that property types are supported in initial content.
  */
 public class ContentLoaderMiscPropertyTest extends HttpTestBase {
 
     /**
-     * Verify that the test node's node type is set correctly.
+     * Verify that the test node's properties are set correctly.
      */
-    public void testLoadedNodeType() throws IOException {
-        final String expected = "sling:propertySetTestNodeType";
+    public void testLoaded() throws IOException {
         final String content = getContent(
                 HTTP_BASE_URL + 
"/sling-test/property-types-test/test-node.txt", CONTENT_TYPE_PLAIN);
-        assertTrue("Content contains " + expected + " (" + content + ")", 
content.contains(expected));
-    }
 
-    /**
-     * Verify that the URI-type property loaded correctly.
-     *
-     * This test is only really useful post-JCR 2 upgrade.
-     */
-    public void testLoadedURI() throws IOException {
-        final String expected = "http://www.google.com/";;
-        final String content = getContent(
-                HTTP_BASE_URL + 
"/sling-test/property-types-test/test-node/uri.txt", CONTENT_TYPE_PLAIN);
-        assertTrue("Content contains " + expected + " (" + content + ")", 
content.contains(expected));
+        assertPropertyValue(content, "Resource type", 
"sling:propertySetTestNodeType");
+        assertPropertyValue(content, "string", "Sling");
+        assertPropertyValue(content, "strings", "[Apache, Sling]");
+        assertPropertyValue(content, "long", "42");
+        assertPropertyValue(content, "longs", "[4, 8, 15, 16, 23, 42]");
+        assertPropertyValue(content, "boolean", "true");
+        assertPropertyValue(content, "booleans", "[true, false]");
+        assertPropertyValue(content, "uri", "http://www.google.com/";);
+        assertPropertyValue(content, "uris", "[http://sling.apache.org/, 
http://www.google.com/]";);
+        assertPropertyValue(content, "name", "sling:test");
+        assertPropertyValue(content, "names", "[jcr:base, sling:test]");
+        assertPropertyValue(content, "path", 
"/sling-test/initial-content-folder/folder-content-test");
+        assertPropertyValue(content, "paths", 
"[/sling-test/initial-content-folder/folder-content-test, /apps]");
     }
 
-    /**
-     * Verify that the Name-type property loaded correctly.
-     *
-     * This test is only really useful post-JCR 2 upgrade.
-     */
-
-    public void testLoadedName() throws IOException {
-        final String expected = "sling:test";
-        final String content = getContent(
-                HTTP_BASE_URL + 
"/sling-test/property-types-test/test-node/name.txt", CONTENT_TYPE_PLAIN);
-        assertTrue("Content contains " + expected + " (" + content + ")", 
content.contains(expected));
-    }
-
-    /**
-     * Verify that the Path-type property loaded correctly.
-     *
-     * This test is only really useful post-JCR 2 upgrade.
-     */
-
-    public void testLoadedPath() throws IOException {
-        final String expected = 
"/sling-test/initial-content-folder/folder-content-test";
-        final String content = getContent(
-                HTTP_BASE_URL + 
"/sling-test/property-types-test/test-node/path.txt", CONTENT_TYPE_PLAIN);
+    private void assertPropertyValue(String content, String name, String 
value) {
+        final String expected = String.format("%s: %s", name, value);
         assertTrue("Content contains " + expected + " (" + content + ")", 
content.contains(expected));
     }
 


Reply via email to