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/23 20:00:33 UTC
svn commit: r915486 - in
/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post:
ReferenceTypeHintTest.java TypeHintTest.java
Author: justin
Date: Tue Feb 23 19:00:33 2010
New Revision: 915486
URL: http://svn.apache.org/viewvc?rev=915486&view=rev
Log:
changing scope
Added:
sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/ReferenceTypeHintTest.java
- copied, changed from r915485, sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/TypeHintTest.java
Removed:
sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/TypeHintTest.java
Copied: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/ReferenceTypeHintTest.java (from r915485, sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/TypeHintTest.java)
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/ReferenceTypeHintTest.java?p2=sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/ReferenceTypeHintTest.java&p1=sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/TypeHintTest.java&r1=915485&r2=915486&rev=915486&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/TypeHintTest.java (original)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/ReferenceTypeHintTest.java Tue Feb 23 19:00:33 2010
@@ -19,14 +19,13 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.sling.commons.json.JSONObject;
import org.apache.sling.commons.testing.integration.HttpTestBase;
import org.apache.sling.servlets.post.SlingPostConstants;
/**
- * Integration test of type hints in the post servlet.
+ * Integration test of reference type hints in the post servlet.
*/
-public class TypeHintTest extends HttpTestBase {
+public class ReferenceTypeHintTest extends HttpTestBase {
public static final String TEST_BASE_PATH = "/sling-tests";
private String postUrl;
@@ -41,22 +40,31 @@
props.put("a", "");
props.put("jcr:mixinTypes", "mix:referenceable");
- final String createdNodeUrl = testClient.createNode(postUrl + SlingPostConstants.DEFAULT_CREATE_SUFFIX, props);
- String uuid = getProperty(createdNodeUrl, "jcr:uuid");
- String path = getPath(createdNodeUrl);
+ final String firstCreatedNodeUrl = testClient.createNode(postUrl + SlingPostConstants.DEFAULT_CREATE_SUFFIX, props);
+ final String firstUuid = getProperty(firstCreatedNodeUrl, "jcr:uuid");
+ final String firstPath = getPath(firstCreatedNodeUrl);
+
+ final String secondCreatedNodeUrl = testClient.createNode(postUrl + SlingPostConstants.DEFAULT_CREATE_SUFFIX, props);
+ final String secondUuid = getProperty(firstCreatedNodeUrl, "jcr:uuid");
+ final String secondPath = getPath(firstCreatedNodeUrl);
props.clear();
- props.put("a", path);
+ props.put("a", firstPath);
props.put("a@TypeHint", "Reference");
- props.put("b", path);
+ props.put("b", firstPath);
props.put("b@TypeHint", "WeakReference");
- final String referencingNodeUrl = testClient.createNode(postUrl + SlingPostConstants.DEFAULT_CREATE_SUFFIX, props);
+ props.put("as", firstPath);
+ props.put("as@TypeHint", "Reference");
+ props.put("bs", firstPath);
+ props.put("bs@TypeHint", "WeakReference");
+ final String referencingNodeUrl = testClient.createNode(postUrl + SlingPostConstants.DEFAULT_CREATE_SUFFIX,
+ props);
String refCreatedValue = getProperty(referencingNodeUrl, "a");
String weakrefCreatedValue = getProperty(referencingNodeUrl, "b");
- assertEquals(uuid, refCreatedValue);
- assertEquals(uuid, weakrefCreatedValue);
+ assertEquals(firstUuid, refCreatedValue);
+ assertEquals(firstUuid, weakrefCreatedValue);
}
private String getPath(String url) {
@@ -64,8 +72,6 @@
}
private String getProperty(String url, String name) throws Exception {
- String content = getContent(url + ".json", CONTENT_TYPE_JSON);
- JSONObject jo = new JSONObject(content);
- return jo.getString(name);
+ return getContent(url + "/" + name + ".txt", CONTENT_TYPE_PLAIN);
}
}