in src/main/java/org/apache/sling/launchpad/webapp/integrationtest/CreateNodeTest.java [29:63]
public void testCreateNode() throws IOException {
final String url = HTTP_BASE_URL + "/CreateNodeTest_1_" + System.currentTimeMillis();
// add some properties to the node
final Map<String,String> props = new HashMap<String,String>();
props.put("name1","value1");
props.put("name2","value2");
// POST and get URL of created node
String urlOfNewNode = null;
try {
urlOfNewNode = testClient.createNode(url, props);
} catch(IOException ioe) {
fail("createNode failed: " + ioe);
}
// get and check URL of created node
final GetMethod get = new GetMethod(urlOfNewNode + DEFAULT_EXT);
final int status = httpClient.executeMethod(get);
assertEquals(urlOfNewNode + " must be accessible after createNode",200,status);
final String responseBodyStr = get.getResponseBodyAsString();
assertTrue(responseBodyStr.contains("value1"));
assertTrue(responseBodyStr.contains("value2"));
// test default txt and html renderings
getContent(urlOfNewNode + DEFAULT_EXT, CONTENT_TYPE_PLAIN);
getContent(urlOfNewNode + ".txt", CONTENT_TYPE_PLAIN);
getContent(urlOfNewNode + ".html", CONTENT_TYPE_HTML);
getContent(urlOfNewNode + ".json", CONTENT_TYPE_JSON);
getContent(urlOfNewNode + ".xml", CONTENT_TYPE_XML);
// And extensions for which we have no renderer fail
assertHttpStatus(urlOfNewNode + ".pdf", 404);
assertHttpStatus(urlOfNewNode + ".someWeirdExtension", 404);
}