evenisse    2004/03/06 16:21:19

  Added:       
genapp/src/plugin-resources/complex/template-resources/components/ears/ear
                        build.properties project.properties project.xml
               
genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/application/META-INF
                        application.xml
               
genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/conf
                        app.properties
               
genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test-cactus/example/ear
                        HttpUnitTest.java
               
genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear
                        AbstractTestCase.java AppTest.java NaughtyTest.java
               
genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/webapp2/WEB-INF
                        web.xml
               
genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb
                        build.properties build.properties.jboss maven.xml
                        project.properties project.xml
               
genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/conf
                        app.properties cactus-web.xml
               
genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/java/example/ejb
                        ExampleBean.java ExampleFacadeBean.java
               
genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/test-cactus/example/ejb
                        SanityWithCactusTest.java
               
genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/test/example/ejb
                        SanityTest.java
               
genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/webapp/WEB-INF
                        web.xml
               
genapp/src/plugin-resources/complex/template-resources/components/wars/web
                        build.properties build.properties.jboss maven.xml
                        project.properties project.xml
               
genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/conf
                        app.properties cactus-web.xml
               
genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/java/example/web
                        EjbServlet.java HelloWorldServlet.java
               
genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test-cactus/example/web
                        HelloWorldServletTest.java HttpUnitTest.java
               
genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test/example/web
                        SanityTest.java
               
genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/webapp
                        sample.jsp
               genapp/src/plugin-resources/complex/template-resources
                        maven.xml project.properties project.xml
               genapp/src/plugin-resources/complex template.properties
  Log:
  MPGENAPP-6. Add a complex application.
  
  Revision  Changes    Path
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/build.properties
  
        <<Binary file>>
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/project.properties
  
  Index: project.properties
  ===================================================================
  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
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
    <extend>../../../project.xml</extend>
    <pomVersion>3</pomVersion>
    <id>ear</id>
    <name>Enterprise Application</name>
    <currentVersion>1.0</currentVersion>
    <package>example.ear</package>
  
    <description>An enterprise application</description>
    <dependencies>
      <dependency>
        <groupId>trajano</groupId>
        <artifactId>ejb</artifactId>
        <type>ejb</type>
        <version>1.0</version>
        <properties>
          <ear.bundle>true</ear.bundle>
        </properties>
      </dependency>
        
      <dependency>
        <groupId>trajano</groupId>
        <artifactId>web</artifactId>
        <type>war</type>
        <version>1.0</version>
        <properties>
          <ear.bundle>true</ear.bundle>
          <!-- the context root has to match the name of your ear project -->
          <ear.appxml.war.context-root>ear</ear.appxml.war.context-root>
        </properties>
      </dependency>
    </dependencies>
    <build>
      <sourceDirectory>src/java</sourceDirectory>
      <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
      <unitTest>
        <includes>
          <include>**/*Test.java</include>
        </includes>
        <excludes>
          <exclude>**/NaughtyTest.java</exclude>
        </excludes>
      </unitTest>
      <resources>
        <resource>
          <directory>src/conf</directory>
          <includes>
            <include>*.properties</include>
          </includes>
        </resource>
      </resources>
    </build>
  </project>
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/application/META-INF/application.xml
  
  Index: application.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 
1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd";>
  
  <application>
    <display-name>trajano:ear</display-name>
    <module>
      <ejb>ejb-1.0.jar</ejb>
    </module>
    <module>
      <web>
        <web-uri>web-1.0.war</web-uri>
        <context-root>ear</context-root>
      </web>
    </module>
  </application>
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/conf/app.properties
  
  Index: app.properties
  ===================================================================
  # Sample app properties.
  foo=bar
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test-cactus/example/ear/HttpUnitTest.java
  
  Index: HttpUnitTest.java
  ===================================================================
  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();
      }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/AbstractTestCase.java
  
  Index: AbstractTestCase.java
  ===================================================================
  package example.ear;
  
  import java.io.File;
  
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  /**
   * Abstract base class for test cases.
   *
   * @author <a href="[EMAIL PROTECTED]">Jason van Zyl</a>
   */
  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();
      }
  }
  
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/AppTest.java
  
  Index: AppTest.java
  ===================================================================
  package example.ear;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  /**
   * Unit test for simple App.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
   */
  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" );
      }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/test/example/ear/NaughtyTest.java
  
  Index: NaughtyTest.java
  ===================================================================
  package example.ear;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  
  /**
   * Unit test for simple App.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
   */
  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!
      }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ears/ear/src/webapp2/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
"http://java.sun.com/dtd/web-app_2_3.dtd";>
  
  <web-app >
  </web-app>
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/build.properties
  
        <<Binary file>>
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/build.properties.jboss
  
        <<Binary file>>
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/maven.xml
  
  Index: maven.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <project xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="ejb">
    <preGoal name="java:compile">
        <attainGoal name="xdoclet:ejbdoclet" />
    </preGoal>
  </project>
  
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/project.properties
  
  Index: project.properties
  ===================================================================
  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
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
    <extend>../../../project.xml</extend>
    <pomVersion>3</pomVersion>
    <id>ejb</id>
    <name>EJB</name>
    <currentVersion>1.0</currentVersion>
    <package>example.ejb</package>
    <description>An EJB</description>
    <dependencies>
      <dependency>
        <id>junit</id>
        <version>3.8.1</version>
      </dependency>
      <dependency>
        <id>ejb</id>
        <version>2.1</version>
      </dependency>
      <dependency>
        <id>xdoclet</id>
        <version>1.2</version>
      </dependency>
      <dependency>
        <groupId>xdoclet</groupId>
        <artifactId>xdoclet-ejb-module</artifactId>
        <version>1.2</version>
        <url>http://xdoclet.sf.net/</url>
      </dependency>
      <dependency>
        <groupId>xjavadoc</groupId>
        <artifactId>xjavadoc</artifactId>
        <version>1.0.2</version>
        <url>http://xdoclet.sf.net/</url>
      </dependency>
      <dependency>
        <groupId>xdoclet</groupId>
        <artifactId>xdoclet-jmx-module</artifactId>
        <version>1.2</version>
        <url>http://xdoclet.sf.net/</url>
      </dependency>
      <dependency>
        <groupId>xdoclet</groupId>
        <artifactId>xdoclet-web-module</artifactId>
        <version>1.2</version>
        <url>http://xdoclet.sf.net/</url>
      </dependency>
      <dependency>
        <groupId>xdoclet</groupId>
        <artifactId>xdoclet-jboss-module</artifactId>
        <version>1.2</version>
        <url>http://xdoclet.sf.net/</url>
      </dependency>
  
       <dependency>
        <groupId>jboss</groupId>
        <artifactId>jboss-j2ee</artifactId>
        <version>3.2.1</version>
      </dependency>
      
       <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.0.3</version>
        <properties>
          <ejb.bundle>true</ejb.bundle>
        </properties>
      </dependency>
      
       <dependency>
        <groupId>cactus</groupId>
        <artifactId>cactus</artifactId>
        <version>13-1.6dev-20040115</version>
      </dependency>
      
      <dependency>
        <groupId>jboss</groupId>
        <artifactId>jbossall-client</artifactId>
        <version>3.2.1</version>
      </dependency>
    </dependencies>
    <build>
      <sourceDirectory>src/java</sourceDirectory>
      <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
      <unitTest>
        <includes>
          <include>**/*Test.java</include>
        </includes>
        <excludes>
          <exclude>**/NaughtyTest.java</exclude>
        </excludes>
      </unitTest>
      <resources>
        <resource>
          <directory>src/conf</directory>
          <includes>
            <include>*.properties</include>
          </includes>
        </resource>
      </resources>
    </build>
  </project>
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/conf/app.properties
  
  Index: app.properties
  ===================================================================
  # Sample app properties.
  foo=bar
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/conf/cactus-web.xml
  
  Index: cactus-web.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
"http://java.sun.com/dtd/web-app_2_3.dtd";>
  
  <web-app>
     <ejb-local-ref>
        <ejb-ref-name>ejb/ExampleFacadeLocal</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local-home>example.ejb.ExampleFacadeLocalHome</local-home>
        <local></local>
        <ejb-link>ExampleFacade</ejb-link>
     </ejb-local-ref>
  </web-app>
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/java/example/ejb/ExampleBean.java
  
  Index: ExampleBean.java
  ===================================================================
  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 <a href="[EMAIL PROTECTED]">Archimedes Trajano</a>
   * @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();
      }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/java/example/ejb/ExampleFacadeBean.java
  
  Index: ExampleFacadeBean.java
  ===================================================================
  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 <a href="[EMAIL PROTECTED]">Archimedes Trajano</a>
   * @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);
          }
      }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/test-cactus/example/ejb/SanityWithCactusTest.java
  
  Index: SanityWithCactusTest.java
  ===================================================================
  package example.ejb;
  
  import org.apache.cactus.ServletTestCase;
  
  /**
   * This tests the facade methods using the Cactus framework.
   *
   * @author <a href="[EMAIL PROTECTED]">Archimedes Trajano</a>
   * @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));
      }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/test/example/ejb/SanityTest.java
  
  Index: SanityTest.java
  ===================================================================
  package example.ejb;
  
  import junit.framework.TestCase;
  
  /**
   * This is a simple JUnit test case to ensure that the environment is okay.
   *
   * @author <a href="[EMAIL PROTECTED]">Archimedes Trajano</a>
   * @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" );
    }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/ejbs/ejb/src/webapp/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
"http://java.sun.com/dtd/web-app_2_3.dtd";>
  
  <web-app >
  </web-app>
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/build.properties
  
        <<Binary file>>
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/build.properties.jboss
  
        <<Binary file>>
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/maven.xml
  
  Index: maven.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <project xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="war">
    <preGoal name="java:compile">
      <mkdir dir="target\xdoclet\webdoclet\WEB-INF" />
        <attainGoal name="xdoclet:webdoclet" />
    </preGoal>
  </project>
  
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/project.properties
  
  Index: project.properties
  ===================================================================
  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
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
    <extend>../../../project.xml</extend>
    <pomVersion>3</pomVersion>
    <id>web</id>
    <name>Web Application</name>
    <package>example.web</package>
    <description>This is the web application.</description>
    <dependencies>
      <dependency>
        <groupId>trajano</groupId>
        <artifactId>ejb-client</artifactId>
        <version>1.0</version>
        <properties>
          <war.bundle>true</war.bundle>
        </properties>
      </dependency>
  
      <dependency>
        <id>junit</id>
        <version>3.8.1</version>
      </dependency>
      
      <dependency>
        <id>servletapi</id>
        <version>2.3</version>
      </dependency>
  
      <dependency>
        <groupId>jboss</groupId>
        <artifactId>jboss-j2ee</artifactId>
        <version>3.2.1</version>
      </dependency>
      
      <dependency>
        <id>jstl</id>
        <version>1.0.2</version>
        <properties>
          <war.bundle>true</war.bundle>
        </properties>      
      </dependency>
      
      <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.0.4</version>
        <properties>
          <war.bundle>true</war.bundle>
        </properties>      
      </dependency>
      
      <dependency>
        <groupId>cactus</groupId>
        <artifactId>cactus</artifactId>
        <version>13-1.6dev-20040115</version>
      </dependency>
  
       <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.0.3</version>
        <properties>
          <war.bundle>true</war.bundle>
        </properties>
      </dependency>
  
      <!-- XDoclet dependencies -->
      <dependency>
        <id>xdoclet</id>
        <version>1.2</version>
      </dependency>
  
      <dependency>
        <groupId>xdoclet</groupId>
        <artifactId>xdoclet-web-module</artifactId>
        <version>1.2</version>
        <url>http://xdoclet.sf.net/</url>
      </dependency>
      
      <dependency>
        <groupId>xdoclet</groupId>
        <artifactId>xdoclet-ejb-module</artifactId>
        <version>1.2</version>
        <url>http://xdoclet.sf.net/</url>
      </dependency>
      
      <dependency>
        <groupId>xdoclet</groupId>
        <artifactId>xjavadoc</artifactId>
        <version>1.0.2</version>
        <url>http://xdoclet.sf.net/</url>
      </dependency>
  
      <!-- HttpUnit dependencies -->
     <dependency>
        <groupId>httpunit</groupId>
        <artifactId>httpunit</artifactId>
        <version>1.5.4</version>
        <properties>
          <cactus.bundle>true</cactus.bundle>
        </properties>
      </dependency>
      
      <dependency>
        <groupId>jtidy</groupId>
        <artifactId>jtidy</artifactId>
        <version>4aug2000r7-dev</version>
        <properties>
          <cactus.bundle>true</cactus.bundle>
        </properties>
      </dependency>
      
    </dependencies>
  
    <build>
      <sourceDirectory>src/java</sourceDirectory>
      <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
      <unitTest>
        <includes>
          <include>**/*Test.java</include>
        </includes>
        <excludes>
          <exclude>**/NaughtyTest.java</exclude>
        </excludes>
      </unitTest>
      <resources>
        <resource>
          <directory>src/conf</directory>
          <includes>
            <include>*.properties</include>
          </includes>
        </resource>
      </resources>
    </build>
  </project>
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/conf/app.properties
  
  Index: app.properties
  ===================================================================
  # Sample app properties.
  foo=bar
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/conf/cactus-web.xml
  
  Index: cactus-web.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
"http://java.sun.com/dtd/web-app_2_3.dtd";>
  
  <web-app>
  </web-app>
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/java/example/web/EjbServlet.java
  
  Index: EjbServlet.java
  ===================================================================
  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 <a href="[EMAIL PROTECTED]">Archimedes Trajano</a>
   * @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);
        }
      }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/java/example/web/HelloWorldServlet.java
  
  Index: HelloWorldServlet.java
  ===================================================================
  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 <a href="[EMAIL PROTECTED]">Archimedes Trajano</a>
   * @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());
      }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test-cactus/example/web/HelloWorldServletTest.java
  
  Index: HelloWorldServletTest.java
  ===================================================================
  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 <a href="[EMAIL PROTECTED]">Archimedes Trajano</a>
   * @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"));
      }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test-cactus/example/web/HttpUnitTest.java
  
  Index: HttpUnitTest.java
  ===================================================================
  package example.web;
  
  import org.apache.cactus.ServletTestCase;
  
  import com.meterware.httpunit.WebConversation;
  
  /**
   * This tests the system using the HttpUnit
   * @author <a href="[EMAIL PROTECTED]">Archimedes Trajano</a>
   * @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();
      }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/test/example/web/SanityTest.java
  
  Index: SanityTest.java
  ===================================================================
  package example.web;
  
  import junit.framework.TestCase;
  
  /**
   * This is a simple JUnit test case to ensure that the environment is okay.
   *
   * @author <a href="[EMAIL PROTECTED]">Archimedes Trajano</a>
   * @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" );
    }
  }
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/components/wars/web/src/webapp/sample.jsp
  
  Index: sample.jsp
  ===================================================================
  <%@ 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"; %>
  <jsp:useBean id="now" class="java.util.Date" />
  <html>
  <body>
  Hello world JSP on<fmt:formatDate value="${now}" dateStyle="full" />
  </body>
  </html>
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/maven.xml
  
  Index: maven.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven" 
default="multiproject">
    <goal name="multiproject:build">
      <attainGoal name="multiproject:war-install" />
      <attainGoal name="multiproject:ejb-install" />
      <attainGoal name="multiproject:ear" />
    </goal>
    <goal name="multiproject:war">
      <maven:reactor
        basedir="."
        banner="Creating WAR files"
        includes="${maven.multiproject.war.includes}"
        excludes="${maven.multiproject.war.excludes}"
        postProcessing="true"
        goals="war"
        ignoreFailures="${maven.multiproject.ignoreFailures}"
      />
    </goal>
    <goal name="multiproject:ear">
      <maven:reactor
        basedir="."
        banner="Creating EAR files"
        includes="${maven.multiproject.ear.includes}"
        excludes="${maven.multiproject.ear.excludes}"
        postProcessing="true"
        goals="ear"
        ignoreFailures="${maven.multiproject.ignoreFailures}"
      />
    </goal>
    <goal name="multiproject:ejb">
      <maven:reactor
        basedir="."
        banner="Creating EJB files"
        includes="${maven.multiproject.ejb.includes}"
        excludes="${maven.multiproject.ejb.excludes}"
        postProcessing="true"
        goals="war"
        ignoreFailures="${maven.multiproject.ignoreFailures}"
      />
    </goal>
    <goal name="multiproject:war-install">
      <maven:reactor
        basedir="."
        banner="Installing WAR files"
        includes="${maven.multiproject.war.includes}"
        excludes="${maven.multiproject.war.excludes}"
        postProcessing="true"
        goals="war:install"
        ignoreFailures="${maven.multiproject.ignoreFailures}"
      />
    </goal>
    <goal name="multiproject:ejb-install">
      <maven:reactor
        basedir="."
        banner="Installing EJB files"
        includes="${maven.multiproject.ejb.includes}"
        excludes="${maven.multiproject.ejb.excludes}"
        postProcessing="true"
        goals="ejb:install"
        ignoreFailures="${maven.multiproject.ignoreFailures}"
      />
    </goal>
    <goal name="multiproject:cactus">
  <!--    <attainGoal name="multiproject:build" />-->
  <!--    <maven:maven descriptor="components/ears/ear/project.xml" 
goals="cactus:test-ear" />-->
      <maven:reactor
        basedir="."
        banner="Testing EAR files"
        includes="${maven.multiproject.ear.includes}"
        excludes="${maven.multiproject.ear.excludes}"
        postProcessing="false"
        goals="cactus:test-ear"
        ignoreFailures="${maven.multiproject.ignoreFailures}"
      />
    </goal>
  </project>
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/project.properties
  
  Index: project.properties
  ===================================================================
  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
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template-resources/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <project>
    <!-- the version of maven's project object model -->
  
    <pomVersion>3</pomVersion>
    <!-- a unique name for this project -->
  
    <id>@ID@</id>
    <groupId>@ID@</groupId>
    <!-- a short but descriptive name for the project -->
  
    <name>@NAME@</name>
    <!-- The version of the project under development, e.g.
         1.1, 1.2, 2.0-SNAPSHOT -->
  
    <currentVersion>1.0</currentVersion>
    <!-- details about the organization that 'owns' the project -->
  
    <organization>
      <name>Apache Software Foundation</name>
      <url>http://www.apache.org/</url>
      <logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>
    </organization>
    <!-- the year the project started -->
  
    <inceptionYear>2002</inceptionYear>
    <package>@PACKAGE@</package>
    <logo>http://maven.apache.org/images/maven.jpg</logo>
    <description>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.</description>
  
    <!-- a short description of what the project does -->
    <shortDescription>How to use maven in different situations</shortDescription>
  
    <!-- the project home page -->
    <url>http://maven.apache.org/reference/plugins/examples/</url>
  
    
<issueTrackingUrl>http://nagoya.apache.org/scarab/servlet/scarab/</issueTrackingUrl>
    <siteAddress>jakarta.apache.org</siteAddress>
    <siteDirectory>/www/maven.apache.org/reference/plugins/examples/</siteDirectory>
    <distributionDirectory>/www/maven.apache.org/builds/</distributionDirectory>
    <!-- the version control repository and http url for online access
         the connection element has the form:
         scm:<system>:<system specific connection string> -->
  
    <repository>
      <connection>scm:cvs:pserver:[EMAIL 
PROTECTED]:/home/cvspublic:maven-plugins/examples</connection>
      <url>http://cvs.apache.org/viewcvs/maven-plugins/examples/</url>
    </repository>
    <!-- any mailing lists for the project -->
  
    <mailingLists/>
    <!-- who the developers are for the project -->
  
    <developers/>
    <!-- jar files the project is dependent on -->
  
    <dependencies/>
    <!-- build information for the project -->
  
    <reports>
      <report>maven-changelog-plugin</report>
      <report>maven-developer-activity-plugin</report>
      <report>maven-file-activity-plugin</report>
    </reports>
  </project>
  
  
  
  1.1                  
maven-plugins/genapp/src/plugin-resources/complex/template.properties
  
  Index: template.properties
  ===================================================================
  # -------------------------------------------------------------------
  # 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
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to