Category Archives: automation

Access Page Name from Tiles Attribute

Our automation team would like us to 'embed' the page names in a hidden field on our page to help them confirm they have navigated properly.

We use Apache tiles to construct our pages using a frame (header, body, footer) where the body holds most of our content.

Is there a way from within the frame to access what the body element is?

Here is our structure:

<div id="content-wrapper">
  <tiles:insertAttribute name="header" ignore="true" />
    <div id="content" class="container">
      <tiles:insertAttribute name="message" ignore="true" />
      <tiles:insertAttribute name="body" ignore="true" />
    <tiles:insertAttribute name="footer" ignore="true" /> 

Upload web app to tomcat using Java

In my unit test I am using org.apache.catalina.startup.Tomcat to deploy a web app. I am able to deploy a webapp with .war format without any problem. But in my case I want to add a value from java code to index.html of the webapp and then upload. So I can't stick with .war format for this. I tried to upload the web app as directory.Following is my java code to upload the "examplewebapp" as directory.

    String appPath="/home/examplewebapp"; // webapp
    String currentDir = new File(".").getCanonicalPath();
    String tomcatDir = currentDir + File.separatorChar + "tomcat";

    Tomcat tomcat = new Tomcat();
    tomcat.addWebapp("/examplewebapp", appPath);        

but web app is not deployed on server as expected. I need to know whether tomcat.addWebapp() method supports only to .war format or there is any bug in my code.