diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/build.properties b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/build.properties new file mode 100644 index 00000000..4bdc9a3a Binary files /dev/null and b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/build.properties differ diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/project.properties b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/project.properties new file mode 100644 index 00000000..2a7b215b --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/project.properties @@ -0,0 +1,7 @@ +maven.xdoc.date=left +#cactus.src.mergewebxml = src/conf/cactus-web.xml +maven.eclipse.classpath.include=src/test-cactus +cactus.is.ear=true +#cactus.src=${basedir}../../../src/test-cactus +#cactus.src.dir=${basedir}../../../src/test-cactus +#cactus.srcdir=${basedir}../../../src/test-cactus diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/project.xml b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/project.xml new file mode 100644 index 00000000..ae3ade60 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/project.xml @@ -0,0 +1,55 @@ + + + + ../../../project.xml + 3 + ear + Enterprise Application + 1.0 + example.ear + + An enterprise application + + + trajano + ejb + ejb + 1.0 + + true + + + + + trajano + web + war + 1.0 + + true + + ear + + + + + src/java + src/test + + + **/*Test.java + + + **/NaughtyTest.java + + + + + src/conf + + *.properties + + + + + diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/application/META-INF/application.xml b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/application/META-INF/application.xml new file mode 100644 index 00000000..a61efaa3 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/application/META-INF/application.xml @@ -0,0 +1,15 @@ + + + + + trajano:ear + + ejb-1.0.jar + + + + web-1.0.war + ear + + + \ No newline at end of file diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/conf/app.properties b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/conf/app.properties new file mode 100644 index 00000000..f2429655 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/conf/app.properties @@ -0,0 +1,2 @@ +# Sample app properties. +foo=bar diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test-cactus/example/ear/HttpUnitTest.java b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test-cactus/example/ear/HttpUnitTest.java new file mode 100644 index 00000000..d8de8e81 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test-cactus/example/ear/HttpUnitTest.java @@ -0,0 +1,59 @@ +package example.ear; + +import org.apache.cactus.ServletTestCase; + +import com.meterware.httpunit.WebConversation; + +public class HttpUnitTest extends ServletTestCase { + + /** + * This tests if the EJB Connection works + * + * @throws Exception + * thrown when there is a problem with the test + */ + public void testEjbConnection() throws Exception { + WebConversation wc = new WebConversation(); + wc.getResponse(requestUrl("/ejb")); + assertTrue(wc.getCurrentPage().getText().startsWith("Got ID ")); + } + + /** + * This tests if the Hello World servlet provides the correct output + * + * @throws Exception + * thrown when there is a problem with the test + */ + public void testHelloWorldServlet() throws Exception { + WebConversation wc = new WebConversation(); + wc.getResponse(requestUrl("/HelloWorld")); + assertTrue(wc.getCurrentPage().getText().startsWith("Hello world on")); + } + + /** + * This tests if the Hello World JSP provides the correct output + * + * @throws Exception + * thrown when there is a problem with the test + */ + public void testHelloWorldJsp() throws Exception { + WebConversation wc = new WebConversation(); + wc.getResponse(requestUrl("/sample.jsp")); + assertTrue(wc.getCurrentPage().getText().indexOf("Hello world JSP on") != -1); + } + + /** + * This is a helper method to create the URL string for the initial web + * conversation request + * + * @param relativeUrl + * the relative URL including the leading"/" + * @return the context url with the relative URL appended to it + */ + private String requestUrl(String relativeUrl) { + StringBuffer url = request.getRequestURL(); + url.delete(url.lastIndexOf("/"), url.length()); + url.append(relativeUrl); + return url.toString(); + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/AbstractTestCase.java b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/AbstractTestCase.java new file mode 100644 index 00000000..50d00496 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/AbstractTestCase.java @@ -0,0 +1,40 @@ +package example.ear; + +import java.io.File; + +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Abstract base class for test cases. + * + * @author Jason van Zyl + */ +public abstract class AbstractTestCase + extends TestCase +{ + /** + * Basedir for all file I/O. Important when running tests from + * the reactor. + */ + public String basedir = System.getProperty("basedir"); + + /** + * Constructor. + */ + public AbstractTestCase(String testName) + { + super(testName); + } + + /** + * Get test input file. + * + * @param path Path to test input file. + */ + public String getTestFile(String path) + { + return new File(basedir,path).getAbsolutePath(); + } +} + diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/AppTest.java b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/AppTest.java new file mode 100644 index 00000000..979c97ea --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/AppTest.java @@ -0,0 +1,40 @@ +package example.ear; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + * + * @author Jason van Zyl + */ +public class AppTest + extends AbstractTestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertEquals( "maven kicks ass", "maven kicks ass" ); + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/NaughtyTest.java b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/NaughtyTest.java new file mode 100644 index 00000000..3545800a --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/NaughtyTest.java @@ -0,0 +1,40 @@ +package example.ear; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + * + * @author Jason van Zyl + */ +public class NaughtyTest + extends AbstractTestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public NaughtyTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( NaughtyTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + // Crash and burn! + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/webapp2/WEB-INF/web.xml b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/webapp2/WEB-INF/web.xml new file mode 100644 index 00000000..bd4dabf3 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/webapp2/WEB-INF/web.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/build.properties b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/build.properties new file mode 100644 index 00000000..4bdc9a3a Binary files /dev/null and b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/build.properties differ diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/build.properties.jboss b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/build.properties.jboss new file mode 100644 index 00000000..4bdc9a3a Binary files /dev/null and b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/build.properties.jboss differ diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/maven.xml b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/maven.xml new file mode 100644 index 00000000..0d3b6d3c --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/maven.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/project.properties b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/project.properties new file mode 100644 index 00000000..5e3b141b --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/project.properties @@ -0,0 +1,11 @@ +maven.xdoc.date=left +maven.ejb.src=target/xdoclet/ejb +maven.eclipse.classpath.include=target/xdoclet/ejbdoclet,src/test-cactus +maven.xdoclet.ejbdoclet.utilobject.0.cacheHomes=true +maven.xdoclet.ejbdoclet.utilobject.0.includeGUID=true +maven.xdoclet.ejbdoclet.dataobject.0=true +maven.xdoclet.ejbdoclet.entityfacade.0=true +maven.xdoclet.ejbdoclet.valueobject.0=true +maven.xdoclet.ejbdoclet.deploymentdescriptor.0.validateXML=true +cactus.src.mergewebxml = src/conf/cactus-web.xml +cactus.is.ear=true \ No newline at end of file diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/project.xml b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/project.xml new file mode 100644 index 00000000..4bc5df6b --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/project.xml @@ -0,0 +1,102 @@ + + + + ../../../project.xml + 3 + ejb + EJB + 1.0 + example.ejb + An EJB + + + junit + 3.8.1 + + + ejb + 2.1 + + + xdoclet + 1.2 + + + xdoclet + xdoclet-ejb-module + 1.2 + http://xdoclet.sf.net/ + + + xjavadoc + xjavadoc + 1.0.2 + http://xdoclet.sf.net/ + + + xdoclet + xdoclet-jmx-module + 1.2 + http://xdoclet.sf.net/ + + + xdoclet + xdoclet-web-module + 1.2 + http://xdoclet.sf.net/ + + + xdoclet + xdoclet-jboss-module + 1.2 + http://xdoclet.sf.net/ + + + + jboss + jboss-j2ee + 3.2.1 + + + + commons-logging + commons-logging + 1.0.3 + + true + + + + + cactus + cactus + 13-1.6dev-20040115 + + + + jboss + jbossall-client + 3.2.1 + + + + src/java + src/test + + + **/*Test.java + + + **/NaughtyTest.java + + + + + src/conf + + *.properties + + + + + diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/conf/app.properties b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/conf/app.properties new file mode 100644 index 00000000..f2429655 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/conf/app.properties @@ -0,0 +1,2 @@ +# Sample app properties. +foo=bar diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/conf/cactus-web.xml b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/conf/cactus-web.xml new file mode 100644 index 00000000..f4400f13 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/conf/cactus-web.xml @@ -0,0 +1,12 @@ + + + + + + ejb/ExampleFacadeLocal + Session + example.ejb.ExampleFacadeLocalHome + + ExampleFacade + + diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/java/example/ejb/ExampleBean.java b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/java/example/ejb/ExampleBean.java new file mode 100644 index 00000000..7c19523e --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/java/example/ejb/ExampleBean.java @@ -0,0 +1,70 @@ +package example.ejb; + +import javax.ejb.CreateException; +import javax.ejb.EntityBean; + +/** + * This is a example of a CMP entity bean. + * @ejb.bean + * name="Example" + * cmp-version="2.x" + * primkey-field="id" + * @ejb.transaction + * type="Required" + * @ejb.finder + * signature="Example findByName(java.lang.String name)" + * query="SELECT DISTINCT e.id FROM Example AS e WHERE e.name = ?1" + * + * @author Archimedes Trajano + * @version $Id: ExampleBean.java,v 1.1 2004/03/07 00:21:19 evenisse Exp $ + */ +public abstract class ExampleBean implements EntityBean { + /** + * The primary key of the table is a number which the developer has to + * guarantee to be unique. + * @ejb.pk-field + * @ejb.interface-method + * @ejb.persistence + * + * @return an integer representing an ID on the keys table + */ + public abstract Integer getId(); + + /** + * This sets the primary key value. Not an actual interface method, but + * needed during bean creation. + * @param id the new primary key value + */ + public abstract void setId(final Integer id); + + /** + * Name is a field value, you can change or add on more fields as needed. + * @ejb.persistence + * @ejb.interface-method + * @return the name + */ + public abstract String getName(); + + /** + * Sets the name field + * @ejb.interface-method + * @param name new name + */ + public abstract void setName(final String name); + + /** + * The required EJB Creation method + * @ejb.create-method + * @param id a unique ID for the primary key + * @param name the value associated with the key + * @throws CreateException thrown when there is a problem creating + * @return the primary key + */ + public Integer ejbCreate(final Integer id, final String name) + throws CreateException { + setName(name); + setId(id); + + return getId(); + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/java/example/ejb/ExampleFacadeBean.java b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/java/example/ejb/ExampleFacadeBean.java new file mode 100644 index 00000000..a0c0759f --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/java/example/ejb/ExampleFacadeBean.java @@ -0,0 +1,139 @@ +package example.ejb; + +import java.math.BigInteger; +import javax.ejb.CreateException; +import javax.ejb.EJBException; +import javax.ejb.FinderException; +import javax.ejb.SessionBean; +import javax.naming.NamingException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This is a example of a stateless session bean facade to the entity bean. + * + * @ejb.bean + * name="ExampleFacade" + * @ejb.transaction + * type="Required" + * + * @ejb.ejb-ref + * ejb-name="Example" + * view-type="local" + * + * @author Archimedes Trajano + * @version $Id: ExampleFacadeBean.java,v 1.1 2004/03/07 00:21:19 evenisse Exp $ + */ +public abstract class ExampleFacadeBean implements SessionBean { + /** + * Log object + */ + private Log log = LogFactory.getLog(this.getClass()); + + /** + * The required EJB Creation method + * @ejb.create-method + * + * @throws CreateException + * thrown when there is a problem creating the object + */ + public void ejbCreate() + throws CreateException { + } + + /** + * This gets the name of the specified entity. + * + * @ejb.interface-method + * @param id + * Primary key of the entity + * @return value of the "name" field + * @throws EJBException + * thrown if there is a problem when getting the entity + * value. There will be a root exception in the + * exception. + */ + public final String getName(final Integer id) + throws EJBException { + try { + ExampleLocal entity = + ExampleUtil.getLocalHome().findByPrimaryKey(id); + return entity.getName(); + } catch (FinderException e) { + throw new EJBException(e); + } catch (NamingException e) { + throw new EJBException(e); + } + } + + /** + * This sets the name of the specified entity. Creates a new one if + * needed. + * + * @ejb.interface-method + * @param id + * Primary key of the entity + * @param name + * Value of the name field + * @throws EJBException + * thrown if there is a problem when getting the entity + * value. There will be a root exception in the + * exception. + */ + public final void setName(final Integer id, final String name) + throws EJBException { + try { + try { + ExampleLocal entity = ExampleUtil.getLocalHome().findByPrimaryKey(id); + entity.setName(name); + } catch (FinderException e) { + ExampleLocal entity = ExampleUtil.getLocalHome().create(id, name); + } + } catch (CreateException e) { + throw new EJBException(e); + } catch (NamingException e) { + throw new EJBException(e); + } + } + + /** + * This gets the primary key id based on the value of the name field. + * Creates a new one if needed. + * + * @ejb.interface-method + * @param name + * Value of the name field + * @return the primary key + * @throws EJBException + * thrown if there is a problem when getting the entity + * value. There will be a root exception in the + * exception. + */ + public Integer getId(final String name) + throws EJBException { + try { + ExampleLocalHome home = ExampleUtil.getLocalHome(); + ExampleLocal entity = null; + + try { + entity = home.findByPrimaryKey((Integer) (home + .findByName(name) + .getPrimaryKey())); + } catch (FinderException e) { + log.debug("Creating a new key set named " + name); + + final int hexadecimalRadix = 16; + + entity = home.create(new Integer( + new BigInteger(ExampleFacadeUtil.generateGUID(this), + hexadecimalRadix).intValue()), name); + } + + return entity.getId(); + } catch (CreateException e) { + throw new EJBException(e); + } catch (NamingException e) { + throw new EJBException(e); + } + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/test-cactus/example/ejb/SanityWithCactusTest.java b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/test-cactus/example/ejb/SanityWithCactusTest.java new file mode 100644 index 00000000..4eb9fbed --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/test-cactus/example/ejb/SanityWithCactusTest.java @@ -0,0 +1,31 @@ +package example.ejb; + +import org.apache.cactus.ServletTestCase; + +/** + * This tests the facade methods using the Cactus framework. + * + * @author Archimedes Trajano + * @version $Id: SanityWithCactusTest.java,v 1.1 2004/03/07 00:21:19 evenisse Exp $ + */ +public class SanityWithCactusTest extends ServletTestCase { + + public void testGetLocalHome() throws Exception { + ExampleFacadeUtil.getLocalHome(); + } + + public void testGetFacade() throws Exception { + ExampleFacadeUtil.getLocalHome().create(); + } + + public void testSetName() throws Exception { + ExampleFacadeLocal facade = ExampleFacadeUtil.getLocalHome().create(); + Integer id = facade.getId("Foo"); + assertEquals("Foo", facade.getName(id)); + facade.setName(id, "Bar"); + assertEquals(id,facade.getId("Bar")); + assertEquals("Bar", facade.getName(id)); + facade.setName(id, "Foo"); + assertEquals("Foo", facade.getName(id)); + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/test/example/ejb/SanityTest.java b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/test/example/ejb/SanityTest.java new file mode 100644 index 00000000..90bd68b9 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/test/example/ejb/SanityTest.java @@ -0,0 +1,15 @@ +package example.ejb; + +import junit.framework.TestCase; + +/** + * This is a simple JUnit test case to ensure that the environment is okay. + * + * @author Archimedes Trajano + * @version $Id: SanityTest.java,v 1.1 2004/03/07 00:21:19 evenisse Exp $ + */ +public class SanityTest extends TestCase { + public void testSanity() { + assertEquals( "test", "test" ); + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/webapp/WEB-INF/web.xml b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..bd4dabf3 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/webapp/WEB-INF/web.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/build.properties b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/build.properties new file mode 100644 index 00000000..936f4802 Binary files /dev/null and b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/build.properties differ diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/build.properties.jboss b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/build.properties.jboss new file mode 100644 index 00000000..936f4802 Binary files /dev/null and b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/build.properties.jboss differ diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/maven.xml b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/maven.xml new file mode 100644 index 00000000..ece109d8 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/maven.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/project.properties b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/project.properties new file mode 100644 index 00000000..1f41da45 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/project.properties @@ -0,0 +1,10 @@ +maven.xdoc.date=left +maven.eclipse.classpath.include=src/test-cactus +maven.war.webapp.dir=${maven.build.dir}/xdoclet/webdoclet +maven.xdoclet.webdoclet.0=true +maven.xdoclet.webdoclet.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF +maven.xdoclet.webdoclet.0.mergeDir=src/merge +maven.xdoclet.webdoclet.deploymentdescriptor.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF +maven.xdoclet.webdoclet.deploymentdescriptor.0.mergeDir=src/merge +maven.xdoclet.webdoclet.jsptaglib.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF/tld +cactus.src.mergewebxml = src/conf/cactus-web.xml diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/project.xml b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/project.xml new file mode 100644 index 00000000..439c7f58 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/project.xml @@ -0,0 +1,136 @@ + + + + ../../../project.xml + 3 + web + Web Application + example.web + This is the web application. + + + trajano + ejb-client + 1.0 + + true + + + + + junit + 3.8.1 + + + + servletapi + 2.3 + + + + jboss + jboss-j2ee + 3.2.1 + + + + jstl + 1.0.2 + + true + + + + + taglibs + standard + 1.0.4 + + true + + + + + cactus + cactus + 13-1.6dev-20040115 + + + + commons-logging + commons-logging + 1.0.3 + + true + + + + + + xdoclet + 1.2 + + + + xdoclet + xdoclet-web-module + 1.2 + http://xdoclet.sf.net/ + + + + xdoclet + xdoclet-ejb-module + 1.2 + http://xdoclet.sf.net/ + + + + xdoclet + xjavadoc + 1.0.2 + http://xdoclet.sf.net/ + + + + + httpunit + httpunit + 1.5.4 + + true + + + + + jtidy + jtidy + 4aug2000r7-dev + + true + + + + + + + src/java + src/test + + + **/*Test.java + + + **/NaughtyTest.java + + + + + src/conf + + *.properties + + + + + diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/conf/app.properties b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/conf/app.properties new file mode 100644 index 00000000..f2429655 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/conf/app.properties @@ -0,0 +1,2 @@ +# Sample app properties. +foo=bar diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/conf/cactus-web.xml b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/conf/cactus-web.xml new file mode 100644 index 00000000..1300e433 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/conf/cactus-web.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/java/example/web/EjbServlet.java b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/java/example/web/EjbServlet.java new file mode 100644 index 00000000..3496d21e --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/java/example/web/EjbServlet.java @@ -0,0 +1,54 @@ +package example.web; + +import java.io.IOException; +import java.util.Date; + +import javax.ejb.CreateException; +import javax.naming.NamingException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import example.ejb.ExampleFacadeLocal; +import example.ejb.ExampleFacadeUtil; + +/** + * This is a sample servlet, typically you would not use this, but it is useful + * for testing the sanity of your web application configuration. + * + * @web.servlet name="EjbConnect" + * @web.servlet-mapping url-pattern="/ejb" + * + * @web.ejb-local-ref + * type="Session" + * home="example.ejb.ExampleFacadeHomeLocal" + * local="example.ejb.ExampleFacadeLocal + * name="ejb/ExampleFacadeLocal" + * + * @author Archimedes Trajano + * @version $Id: EjbServlet.java,v 1.1 2004/03/07 00:21:19 evenisse Exp $ + */ +public class EjbServlet extends HttpServlet { + /** + * This servlet makes a connection to the HTTP Server. + * + * @param request + * the HTTP request object + * @param response + * the HTTP response object + * @throws IOException + * thrown when there is a problem getting the writer + */ + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + try { + ExampleFacadeLocal facade = ExampleFacadeUtil.getLocalHome().create(); + response.getWriter().println("Got ID " + facade.getId(request.getParameter("name"))); + } catch (NamingException e) { + throw new ServletException(e); + } catch (CreateException e) { + throw new ServletException(e); + } + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/java/example/web/HelloWorldServlet.java b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/java/example/web/HelloWorldServlet.java new file mode 100644 index 00000000..b3119e44 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/java/example/web/HelloWorldServlet.java @@ -0,0 +1,35 @@ +package example.web; + +import java.io.IOException; +import java.util.Date; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * This is a sample servlet, typically you would not use this, but it is useful + * for testing the sanity of your web application configuration. + * + * @web.servlet name="HelloWorld" + * @web.servlet-mapping url-pattern="/HelloWorld" + * + * @author Archimedes Trajano + * @version $Id: HelloWorldServlet.java,v 1.1 2004/03/07 00:21:19 evenisse Exp $ + */ +public class HelloWorldServlet extends HttpServlet { + /** + * This prints out the standard "Hello world" message with a date stamp. + * + * @param request + * the HTTP request object + * @param response + * the HTTP response object + * @throws IOException + * thrown when there is a problem getting the writer + */ + protected void doGet(HttpServletRequest request, + HttpServletResponse response) throws IOException { + response.getWriter().println("Hello world on " + new Date()); + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test-cactus/example/web/HelloWorldServletTest.java b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test-cactus/example/web/HelloWorldServletTest.java new file mode 100644 index 00000000..d4835cfc --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test-cactus/example/web/HelloWorldServletTest.java @@ -0,0 +1,24 @@ +package example.web; + +import org.apache.cactus.ServletTestCase; +import org.apache.cactus.WebResponse; + +import example.web.HelloWorldServlet; + +/** + * This tests that the HelloWorld servlet is functioning + * + * @author Archimedes Trajano + * @version $Id: HelloWorldServletTest.java,v 1.1 2004/03/07 00:21:19 evenisse Exp $ + */ +public class HelloWorldServletTest extends ServletTestCase { + + public void testHelloWorld() throws Exception { + HelloWorldServlet servlet = new HelloWorldServlet(); + servlet.doGet(request,response); + } + + public void endHelloWorld(WebResponse response) { + assertTrue(response.getText().startsWith("Hello world on")); + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test-cactus/example/web/HttpUnitTest.java b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test-cactus/example/web/HttpUnitTest.java new file mode 100644 index 00000000..4c9c7bef --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test-cactus/example/web/HttpUnitTest.java @@ -0,0 +1,52 @@ +package example.web; + +import org.apache.cactus.ServletTestCase; + +import com.meterware.httpunit.WebConversation; + +/** + * This tests the system using the HttpUnit + * @author Archimedes Trajano + * @version $Id: HttpUnitTest.java,v 1.1 2004/03/07 00:21:19 evenisse Exp $ + */ +public class HttpUnitTest extends ServletTestCase { + + /** + * This tests if the Hello World servlet provides the correct output + * + * @throws Exception + * thrown when there is a problem with the test + */ + public void testHelloWorldServlet() throws Exception { + WebConversation wc = new WebConversation(); + wc.getResponse(requestUrl("/HelloWorld")); + assertTrue(wc.getCurrentPage().getText().startsWith("Hello world on")); + } + + /** + * This tests if the Hello World JSP provides the correct output + * + * @throws Exception + * thrown when there is a problem with the test + */ + public void testHelloWorldJsp() throws Exception { + WebConversation wc = new WebConversation(); + wc.getResponse(requestUrl("/sample.jsp")); + assertTrue(wc.getCurrentPage().getText().indexOf("Hello world JSP on") != -1); + } + + /** + * This is a helper method to create the URL string for the initial web + * conversation request + * + * @param relativeUrl + * the relative URL including the leading"/" + * @return the context url with the relative URL appended to it + */ + private String requestUrl(String relativeUrl) { + StringBuffer url = request.getRequestURL(); + url.delete(url.lastIndexOf("/"), url.length()); + url.append(relativeUrl); + return url.toString(); + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test/example/web/SanityTest.java b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test/example/web/SanityTest.java new file mode 100644 index 00000000..c3e9bcc7 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test/example/web/SanityTest.java @@ -0,0 +1,15 @@ +package example.web; + +import junit.framework.TestCase; + +/** + * This is a simple JUnit test case to ensure that the environment is okay. + * + * @author Archimedes Trajano + * @version $Id: SanityTest.java,v 1.1 2004/03/07 00:21:19 evenisse Exp $ + */ +public class SanityTest extends TestCase { + public void testSanity() { + assertEquals( "test", "test" ); + } +} diff --git a/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/webapp/sample.jsp b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/webapp/sample.jsp new file mode 100644 index 00000000..24de79b6 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/webapp/sample.jsp @@ -0,0 +1,10 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %> +<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %> +<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %> + + + +Hello world JSP on + + diff --git a/genapp/src/plugin-resources/complex/template-resources/maven.xml b/genapp/src/plugin-resources/complex/template-resources/maven.xml new file mode 100644 index 00000000..cf8a8248 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/maven.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/genapp/src/plugin-resources/complex/template-resources/project.properties b/genapp/src/plugin-resources/complex/template-resources/project.properties new file mode 100644 index 00000000..dbf6748d --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/project.properties @@ -0,0 +1,5 @@ +maven.xdoc.date=left +maven.multiproject.includes=components/*/*/project.xml +maven.multiproject.war.includes=components/wars/*/project.xml +maven.multiproject.ejb.includes=components/ejbs/*/project.xml +maven.multiproject.ear.includes=components/ears/*/project.xml diff --git a/genapp/src/plugin-resources/complex/template-resources/project.xml b/genapp/src/plugin-resources/complex/template-resources/project.xml new file mode 100644 index 00000000..da23f6aa --- /dev/null +++ b/genapp/src/plugin-resources/complex/template-resources/project.xml @@ -0,0 +1,66 @@ + + + + + + 3 + + + @ID@ + @ID@ + + + @NAME@ + + + 1.0 + + + + Apache Software Foundation + http://www.apache.org/ + http://maven.apache.org/images/jakarta-logo-blue.gif + + + + 2002 + @PACKAGE@ + http://maven.apache.org/images/maven.jpg + This is an example of an application with a complex architecture that uses XDoclet, EJB, EAR and servlets that can be used as a basis for your applications. + + + How to use maven in different situations + + + http://maven.apache.org/reference/plugins/examples/ + + http://nagoya.apache.org/scarab/servlet/scarab/ + jakarta.apache.org + /www/maven.apache.org/reference/plugins/examples/ + /www/maven.apache.org/builds/ + + + + scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/examples + http://cvs.apache.org/viewcvs/maven-plugins/examples/ + + + + + + + + + + + + + + maven-changelog-plugin + maven-developer-activity-plugin + maven-file-activity-plugin + + diff --git a/genapp/src/plugin-resources/complex/template.properties b/genapp/src/plugin-resources/complex/template.properties new file mode 100644 index 00000000..6d226d70 --- /dev/null +++ b/genapp/src/plugin-resources/complex/template.properties @@ -0,0 +1,20 @@ +# ------------------------------------------------------------------- +# Copyright 2001-2004 The Apache Software Foundation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ------------------------------------------------------------------- + +maven.genapp.repackage= +maven.genapp.filter=project.xml + +maven.genapp.default.package=default.example.app