incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1468358 - /sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/SlingAutoPropertiesTest.java
Date Tue, 16 Apr 2013 10:46:36 GMT
Author: bdelacretaz
Date: Tue Apr 16 10:46:36 2013
New Revision: 1468358

URL: http://svn.apache.org/r1468358
Log:
SLING-1619 - testSlingFolderCreated tests sling:Folder and auto properties

Modified:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/SlingAutoPropertiesTest.java

Modified: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/SlingAutoPropertiesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/SlingAutoPropertiesTest.java?rev=1468358&r1=1468357&r2=1468358&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/SlingAutoPropertiesTest.java
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/SlingAutoPropertiesTest.java
Tue Apr 16 10:46:36 2013
@@ -19,6 +19,7 @@ package org.apache.sling.launchpad.webap
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.servlet.http.HttpServletResponse;
 
@@ -33,14 +34,13 @@ public class SlingAutoPropertiesTest ext
 
     public static final String TEST_BASE_PATH = "/sling-tests";
     private String postUrl;
+    private static final AtomicInteger counter = new AtomicInteger();
 
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        postUrl = HTTP_BASE_URL + TEST_BASE_PATH + "/" + System.currentTimeMillis();
-    }
-
-   public void testPostPathIsUnique() throws IOException {
+        postUrl = HTTP_BASE_URL + TEST_BASE_PATH + "/" + getClass().getSimpleName() + System.currentTimeMillis()
+ "_" + counter.incrementAndGet();
+        
         assertHttpStatus(postUrl, HttpServletResponse.SC_NOT_FOUND,
                 "Path must not exist before test: " + postUrl);
     }
@@ -100,4 +100,23 @@ public class SlingAutoPropertiesTest ext
         assertJavascript("c", content, "out.println(data.lastModified)");
         assertJavascript("d", content, "out.println(data.lastModifiedBy)");
     }
+    
+    public void testSlingFolderCreated() throws IOException {
+        final Map <String, String> props = new HashMap <String, String> ();
+        props.put("a","456");
+        props.put("jcr:created","");
+        props.put("jcr:lastModified","");
+        props.put("jcr:lastModifiedBy","");
+        props.put("jcr:primaryType","sling:Folder");
+        
+        final String createdNodeUrl = testClient.createNode(postUrl + SlingPostConstants.DEFAULT_CREATE_SUFFIX,
props);
+        final String content = getContent(createdNodeUrl + ".json", CONTENT_TYPE_JSON);
+
+        assertJavascript("456", content, "out.println(data.a)");
+        assertJavascript("admin", content, "out.println(data['jcr:createdBy'])");
+        assertJavascript("admin", content, "out.println(data['jcr:lastModifiedBy'])");
+        assertJavascript("true", content, "out.println(data['jcr:created'].length > 0)");
+        assertJavascript("true", content, "out.println(data['jcr:lastModified'].length >
0)");
+        assertJavascript("true", content, "out.println(data['jcr:lastModified'] == data['jcr:created'])");
+    }
 }



Mime
View raw message