testClient.createNode(HTTP_BASE_URL + testPath + "/src1", props);
testClient.createNode(HTTP_BASE_URL + testPath + "/src2", props);
// copy the src? nodes
List<NameValuePair> nvPairs = new ArrayList<NameValuePair>();
nvPairs.add(new NameValuePair(SlingPostConstants.RP_OPERATION,
SlingPostConstants.OPERATION_COPY));
nvPairs.add(new NameValuePair(SlingPostConstants.RP_DEST, testPath
+ "/dest/"));
nvPairs.add(new NameValuePair(SlingPostConstants.RP_APPLY_TO, testPath
+ "/src1"));
nvPairs.add(new NameValuePair(SlingPostConstants.RP_APPLY_TO, testPath
+ "/src2"));
assertPostStatus(testRoot, HttpServletResponse.SC_PRECONDITION_FAILED,
nvPairs, "Expecting Copy Failure: dest parent does not exist");
// create destination parent
testClient.createNode(HTTP_BASE_URL + testPath + "/dest", null);
// now dest exists, so we expect success
assertPostStatus(testRoot, HttpServletResponse.SC_OK, nvPairs,
"Expecting Copy Success");
// assert partial existence of the src?/text properties
assertHttpStatus(HTTP_BASE_URL + testPath + "/dest/src1/text",
HttpServletResponse.SC_OK);
assertHttpStatus(HTTP_BASE_URL + testPath + "/dest/src2/text",
HttpServletResponse.SC_OK);
assertHttpStatus(HTTP_BASE_URL + testPath + "/dest/src3/text",
HttpServletResponse.SC_NOT_FOUND);
assertHttpStatus(HTTP_BASE_URL + testPath + "/dest/src4/text",
HttpServletResponse.SC_NOT_FOUND);
// assert content test
String content = getContent(HTTP_BASE_URL + testPath
+ "/dest/src1.json", CONTENT_TYPE_JSON);
JSONObject json = new JSONObject(content);
assertEquals("Hello", json.get("text"));
// modify src1 content
nvPairs.clear();
nvPairs.add(new NameValuePair("text", "Modified Hello"));
assertPostStatus(HTTP_BASE_URL + testPath + "/src1",
HttpServletResponse.SC_OK, nvPairs, "Expect Content Update Success");
// copy the src? nodes
nvPairs.clear();
nvPairs.add(new NameValuePair(SlingPostConstants.RP_OPERATION,
SlingPostConstants.OPERATION_COPY));
nvPairs.add(new NameValuePair(SlingPostConstants.RP_DEST, testPath
+ "/dest/"));
nvPairs.add(new NameValuePair(SlingPostConstants.RP_APPLY_TO, testPath
+ "/src1"));
nvPairs.add(new NameValuePair(SlingPostConstants.RP_APPLY_TO, testPath
+ "/src2"));
assertPostStatus(testRoot, HttpServletResponse.SC_OK, nvPairs,
"Expecting Copy Success");
// assert content test