com.xebialabs.deployit.test.support.onthefly
Class WarOnTheFly

java.lang.Object
  extended by com.xebialabs.deployit.test.support.onthefly.JarOnTheFly
      extended by com.xebialabs.deployit.test.support.onthefly.WarOnTheFly

public class WarOnTheFly
extends JarOnTheFly

Constructs a WAR for testing, accepting multiple resources and test servlets as entries. Test servlets are automatically mapped to a path that is the servlet class' simple name, so e.g. a com.acme.package.TestJeeResourceServlet will be bound to http://myhost:myport/context-root/TestJeeResourceServlet. The actual WAR file is finally written to a temporary directory. Example:

 WarOnTheFly warOnTheFly = new WarOnTheFly("myWar");
 warOnTheFly.addFile("foo", someFile);
 warOnTheFly.addFile("bar", someResource);
 ...
 warOnTheFly.addServlet(FooServlet.class); // will be mapped to http://myhost:myport/context-root/FooServlet
 warOnTheFly.addServlet(BarServlet.class);
 ...
 File war = warOnTheFly.writeToTemporaryFile(); // something like myWarXX.war
 
See also " Middleware integration testing with JUnit, Maven and VMware: part 2".

See Also:
JarOnTheFly

Constructor Summary
WarOnTheFly(java.lang.String name)
           
 
Method Summary
 void addServlet(java.lang.Class<? extends javax.servlet.Servlet> servletClass)
           
 void addWebXml()
           
 java.lang.String getName()
           
 java.io.File writeToTemporaryFile()
           
 
Methods inherited from class com.xebialabs.deployit.test.support.onthefly.JarOnTheFly
addFile, write, writeToTemporaryFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WarOnTheFly

public WarOnTheFly(java.lang.String name)
Method Detail

addServlet

public void addServlet(java.lang.Class<? extends javax.servlet.Servlet> servletClass)

writeToTemporaryFile

public java.io.File writeToTemporaryFile()
                                  throws java.io.IOException
Throws:
java.io.IOException

addWebXml

public void addWebXml()

getName

public java.lang.String getName()


Copyright © 2009. All Rights Reserved.