public void setUp()

in src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspForwardTest.java [61:114]


    public void setUp() throws Exception {
        H.setUp();

        // Create the test nodes under a path that's specific to this class to
        // allow collisions
        final String url = HttpTest.HTTP_BASE_URL + "/" + getClass().getSimpleName() + "/" + System.currentTimeMillis()
                + SlingPostConstants.DEFAULT_CREATE_SUFFIX;
        final Map<String, String> props = new HashMap<String, String>();

        // Create two test nodes and store their paths
        testTextA = "Text A " + System.currentTimeMillis();
        props.put("text", testTextA);
        nodeUrlA = H.getTestClient().createNode(url, props);
        String pathToInclude = nodeUrlA.substring(HttpTest.HTTP_BASE_URL.length());

        // Node B stores the path of A, so that the test script can
        // forward A when rendering B
        testTextB = "Text B " + System.currentTimeMillis();
        props.put("text", testTextB);
        props.put("pathToInclude", pathToInclude);
        nodeUrlB = H.getTestClient().createNode(url, props);

        // Node E is like B but with an extension on the forward path
        props.put("pathToInclude", pathToInclude + ".html");
        nodeUrlE = H.getTestClient().createNode(url, props);

        // Node F is like E but uses jsp:include
        props.put("pathToInclude", pathToInclude + ".html");
        props.put("forwardStyle", "jsp");
        nodeUrlF = H.getTestClient().createNode(url, props);

        // Node C is used for the infinite loop detection test
        props.remove("pathToInclude");
        props.remove("forwardStyle");
        props.put("testInfiniteLoop", "true");
        nodeUrlC = H.getTestClient().createNode(url, props);

        // Node D is used for the "force resource type" test
        forcedResourceType = getClass().getSimpleName() + "/" + System.currentTimeMillis();
        props.remove("testInfiniteLoop");
        props.put("forceResourceType", forcedResourceType);
        props.put("pathToInclude", pathToInclude);
        nodeUrlD = H.getTestClient().createNode(url, props);

        // Script for forced resource type
        scriptPath = "/apps/" + forcedResourceType;
        H.getTestClient().mkdirs(HttpTest.WEBDAV_BASE_URL, scriptPath);
        toDelete.add(H.uploadTestScript(scriptPath, "forward-forced.jsp", "html.jsp"));

        // The main rendering script goes under /apps in the repository
        scriptPath = "/apps/nt/unstructured";
        H.getTestClient().mkdirs(HttpTest.WEBDAV_BASE_URL, scriptPath);
        toDelete.add(H.uploadTestScript(scriptPath, "forward-test.jsp", "html.jsp"));
    }