You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ju...@apache.org on 2010/02/09 02:29:37 UTC

svn commit: r907873 - in /sling/trunk/launchpad: test-services/ test-services/src/main/resources/SLING-INF/ test-services/src/main/resources/SLING-INF/content/ test-services/src/main/resources/SLING-INF/nodetypes/ testing/src/test/java/org/apache/sling...

Author: justin
Date: Tue Feb  9 01:29:36 2010
New Revision: 907873

URL: http://svn.apache.org/viewvc?rev=907873&view=rev
Log:
SLING-1359 - adding tests

Added:
    sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/
    sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/content/
    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/
    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/pom.xml

Modified: sling/trunk/launchpad/test-services/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/pom.xml?rev=907873&r1=907872&r2=907873&view=diff
==============================================================================
--- sling/trunk/launchpad/test-services/pom.xml (original)
+++ sling/trunk/launchpad/test-services/pom.xml Tue Feb  9 01:29:36 2010
@@ -57,6 +57,10 @@
                         <Private-Package>
                             org.apache.sling.launchpad.testservices.*
                         </Private-Package>
+                        <Sling-Nodetypes>
+                            SLING-INF/nodetypes/test.cnd
+                        </Sling-Nodetypes>
+                        <Sling-Initial-Content>SLING-INF/content;path:=/sling-test</Sling-Initial-Content>
                     </instructions>
                 </configuration>
             </plugin>

Added: 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=907873&view=auto
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/content/property-types-test.json (added)
+++ sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/content/property-types-test.json Tue Feb  9 01:29:36 2010
@@ -0,0 +1,8 @@
+{
+	"test-node" : {
+		"jcr:primaryType" : "sling:propertySetTestNodeType",
+		"uri" : "http://www.google.com/",
+		"name" : "sling:test",
+		"path" : "/sling-test/initial-content-folder/folder-content-test"
+	}
+}

Added: 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=907873&view=auto
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/nodetypes/test.cnd (added)
+++ sling/trunk/launchpad/test-services/src/main/resources/SLING-INF/nodetypes/test.cnd Tue Feb  9 01:29:36 2010
@@ -0,0 +1,8 @@
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<sling = 'http://sling.apache.org/jcr/sling/1.0'>
+
+[sling:propertySetTestNodeType] > nt:base
+/* post jcr-2 upgrade, change property type below to be 'uri' */
+ - uri (string)
+ - path (path)
+ - name (name)
\ No newline at end of file

Added: 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=907873&view=auto
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ContentLoaderMiscPropertyTest.java (added)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ContentLoaderMiscPropertyTest.java Tue Feb  9 01:29:36 2010
@@ -0,0 +1,61 @@
+package org.apache.sling.launchpad.webapp.integrationtest;
+
+import java.io.IOException;
+
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+
+/**
+ * @author justin
+ *
+ */
+public class ContentLoaderMiscPropertyTest extends HttpTestBase {
+
+    /**
+     * Verify that the test node's node type is set correctly.
+     */
+    public void testLoadedNodeType() throws IOException {
+        final String expected = "sling:propertySetTestNodeType";
+        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));
+    }
+
+    /**
+     * 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);
+        assertTrue("Content contains " + expected + " (" + content + ")", content.contains(expected));
+    }
+
+}