hi,

I'm taking the following approach to write integration tests.

I want to verify whether it's correct.

This is how i create nodes and upload scripts.


        Map<String,String> props = new HashMap<String,String>();

        rootNodeUrl = testClient.createNode(HTTP_BASE_URL +pathToRoot, null);

        testTextA = pathToRoot + "/foo";
        testClient.createNode(HTTP_BASE_URL +testTextA, null);

        testTextB = pathToRoot + "/bar";
        props.put("sling:resourceSuperType", testTextA);
        NodeUrlB = testClient.createNode(HTTP_BASE_URL +testTextB , props);

        testTextC = testTextB + "/childOfBar";
        props.clear();
        props.put("sling:resourceType", testTextB);
        NodeUrlC = testClient.createNode(HTTP_BASE_URL +testTextC, props);


        uploadTestScript(testTextA,"html.jsp","html.jsp");
        uploadTestScript(testTextB,"include-test.jsp","bar.jsp");


The picture in my mind about the above code is as follows.

                        rootNode (rootNodeUrl == /)
                            |
                            |
         --------------------------------------------
        |                                            |
        |                                            |
      foo (testTextA == /foo ) <--------------------bar(testTextB ==
/bar) <-----------------
        |                                       include-test.jsp attached as
bar.jsp               |
      html.jsp attached as html.jsp                  |
                   |
                                                                  |             
                                  |
                                                childOfBar (testTextC == 
/bar/childOfBar)------|
                                                
                                        



key:

X<-----Y  : Y is of resourceType X.

|         : node hierarchy.


Now when I use

 final String content = getContent(NodeUrlC + ".html", CONTENT_TYPE_HTML);

since contentUrl is /bar/childOfBar and because there is no "html.jsp"
in the server it execute the code in bar.jsp
which is the code in include-test.jsp.

if I have,

       uploadTestScript(testTextB,"html.jsp","html.jsp");
       uploadTestScript(testTextB,"selector-test.jsp","bar.jsp");
then,


                        rootNode (rootNodeUrl == /)
                            |
                            |
         --------------------------------------------
        |                                            |
        |                                            |
      foo (testTextA == /foo ) <--------------------bar(testTextB ==
/bar) <------------------------------------------------------
                                                     |                          
            |
          |
                                               selector-test.jsp attached as
bar.jsp    + html.jsp attached as html.jsp  |
                                                     |
                   |
       |
                                                     |                          
            |
                                      |
                                                childOfBar (testTextC ==
/bar/childOfBar)-------------------------------------------

 final String content = getContent(NodeUrlB + ".html", CONTENT_TYPE_HTML);

and use,

<sling:include addSelectors="bar" /> in html.jsp to include the script
in selector-test.jsp (bar.jsp in server) I don't get the content
in selector-test.jsp which is simply

<h1>"Including Selector"</h1>.



Which should be the reason the test fails when building using

mvn clean install.

I have the following questions,


1. Do I have the wrong Idea in my mind.
2. Where should I upload the scripts to acheive same node selector work.
3. Is there any other error In my approach.



janandith

Reply via email to