protected String importNodeWithExactName()

in src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletImportTest.java [700:737]


    protected String importNodeWithExactName(String testNodeName) throws IOException, JsonException {
        final String testPath = TEST_BASE_PATH;
        Map<String, String> props = new HashMap<String, String>();
        String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);
        urlsToDelete.add(testNode);

        props.clear();
        props.put(SlingPostConstants.RP_OPERATION,
        		SlingPostConstants.OPERATION_IMPORT);

        props.put(SlingPostConstants.RP_NODE_NAME, testNodeName);
        String jsonContent = getStreamAsString(getClass().getResourceAsStream("/integration-test/servlets/post/testimport.json"));
        props.put(SlingPostConstants.RP_CONTENT, jsonContent);
        props.put(SlingPostConstants.RP_CONTENT_TYPE, "json");
        props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + "/*");
        String location = testClient.createNode(HTTP_BASE_URL + testPath, props);

        // assert content at new location
        String content = getContent(location + ".3.json", CONTENT_TYPE_JSON);

		JsonObject jsonObj = JsonUtil.parseObject(content);
		assertNotNull(jsonObj);

		//assert the imported content is there.
        String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream("/integration-test/servlets/post/importresults.json"));
		assertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);

    	assertHttpStatus(location + DEFAULT_EXT, HttpServletResponse.SC_OK,
                "POST must redirect to created resource (" + location + ")");
        assertTrue("Node (" + location + ") must have exact name",
                !location.endsWith("/*"));
        assertTrue("Node (" + location + ") must created be under POST URL (" + testNode + ")",
                location.contains(testNode + "/"));
        assertTrue("Node (" + location + ") must have exact name '" + testNodeName + "'",
        		location.endsWith("/" + testNodeName));

		return location;
    }