[seam-commits] Seam SVN: r14497 - in branches/community/Seam_2_3/examples-ee6/jpa: jpa-tests and 3 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Apr 3 22:47:00 EDT 2012


Author: dhinojosa
Date: 2012-04-03 22:46:59 -0400 (Tue, 03 Apr 2012)
New Revision: 14497

Added:
   branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/Deployments.java
Modified:
   branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/pom.xml
   branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/BookingTest.java
   branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/ChangePasswordTest.java
   branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/LoginTest.java
   branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/pom.xml
   branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/Booking.java
   branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/Hotel.java
   branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/User.java
   branches/community/Seam_2_3/examples-ee6/jpa/pom.xml
Log:
Added setup of integration testing, almost got it, require some new information

Modified: branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/pom.xml	2012-04-03 21:08:11 UTC (rev 14496)
+++ branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/pom.xml	2012-04-04 02:46:59 UTC (rev 14497)
@@ -1,35 +1,43 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <artifactId>jpa</artifactId>
-        <groupId>org.jboss.seam.examples-ee6</groupId>
-        <version>2.3.0.Beta2-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    
-    <groupId>org.jboss.seam.examples-ee6</groupId>
-    <artifactId>jpa-tests</artifactId>
-    <name>JPA Integration Tests Module (EE6)</name>
-    
-    <dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+   <parent>
+      <artifactId>jpa</artifactId>
+      <groupId>org.jboss.seam.examples-ee6</groupId>
+      <version>2.3.0.Beta2-SNAPSHOT</version>
+      <relativePath>../pom.xml</relativePath>
+   </parent>
+
+   <groupId>org.jboss.seam.examples-ee6</groupId>
+   <artifactId>jpa-tests</artifactId>
+   <name>JPA Integration Tests Module (EE6)</name>
+
+   <dependencies>
       <dependency>
-         <groupId>org.testng</groupId>
-         <artifactId>testng</artifactId>
-         <classifier>jdk15</classifier>
-      </dependency>
-      <dependency>
          <groupId>org.jboss.seam</groupId>
          <artifactId>jboss-seam</artifactId>
          <type>ejb</type>
          <scope>test</scope>
       </dependency>
       <dependency>
-         <groupId>com.sun.faces</groupId>
-         <artifactId>jsf-api</artifactId>
-         <scope>provided</scope>
+         <groupId>org.slf4j</groupId>
+         <artifactId>slf4j-log4j12</artifactId>
+         <scope>test</scope>
       </dependency>
       <dependency>
+         <groupId>org.hibernate.javax.persistence</groupId>
+         <artifactId>hibernate-jpa-2.0-api</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.spec.javax.faces</groupId>
+         <artifactId>jboss-jsf-api_2.0_spec</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>javax.mail</groupId>
+         <artifactId>mail</artifactId>
+      </dependency>
+      <dependency>
          <groupId>org.seleniumhq.selenium.server</groupId>
          <artifactId>selenium-server</artifactId>
          <classifier>standalone</classifier>
@@ -43,6 +51,7 @@
          <artifactId>functional-tests</artifactId>
          <scope>test</scope>
       </dependency>
+
       <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
@@ -61,6 +70,29 @@
          <scope>test</scope>
       </dependency>
 
+      <dependency>
+         <groupId>org.jboss.shrinkwrap.resolver</groupId>
+         <artifactId>shrinkwrap-resolver-api-maven</artifactId>
+         <scope>test</scope>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.shrinkwrap.resolver</groupId>
+         <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.spec.javax.el</groupId>
+         <artifactId>jboss-el-api_2.2_spec</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>dom4j</groupId>
+         <artifactId>dom4j</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>javassist</groupId>
+         <artifactId>javassist</artifactId>
+      </dependency>
    </dependencies>
 
    <build>
@@ -81,6 +113,24 @@
                <skip>true</skip>
             </configuration>
          </plugin>
+         <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>build-helper-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>add-test-source</id>
+                  <phase>generate-test-sources</phase>
+                  <goals>
+                     <goal>add-test-source</goal>
+                  </goals>
+                  <configuration>
+                     <sources>
+                        <source>${basedir}/../jpa-web/src/main/java</source>
+                     </sources>
+                  </configuration>
+               </execution>
+            </executions>
+         </plugin>
       </plugins>
    </build>
 
@@ -136,7 +186,7 @@
                      <jbossHome>${jboss.home}</jbossHome>
                      <serverName>${jboss.domain}</serverName>
                      <fileNames>
-                        <param>${basedir}/../guice-ear/target/seam-guice.ear</param>
+                        <param>${basedir}/../guice-ear/target/jpa-web.war</param>
                      </fileNames>
                   </configuration>
                </plugin>

Modified: branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/BookingTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/BookingTest.java	2012-04-03 21:08:11 UTC (rev 14496)
+++ branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/BookingTest.java	2012-04-04 02:46:59 UTC (rev 14497)
@@ -10,17 +10,33 @@
 import javax.faces.model.DataModel;
 import javax.faces.model.ListDataModel;
 
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
 import org.jboss.seam.contexts.Contexts;
 import org.jboss.seam.core.Manager;
 import org.jboss.seam.example.jpa.Booking;
 import org.jboss.seam.example.jpa.Hotel;
 import org.jboss.seam.example.jpa.HotelBookingAction;
 import org.jboss.seam.example.jpa.User;
+import org.jboss.seam.mock.JUnitSeamTest;
 import org.jboss.seam.mock.SeamTest;
-import org.testng.annotations.Test;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
 
-public class BookingTest extends SeamTest
+public class BookingTest extends JUnitSeamTest
 {
+   @Deployment(name="BookingTest")
+   @OverProtocol("Servlet 3.0")
+   public static Archive<?> createDeployment()
+   {
+      WebArchive web = Deployments.jpaDeployment();
+
+      web.addClasses(BookingTest.class);
+
+      return web;
+   }
    
    @Test
    public void testBookHotel() throws Exception

Modified: branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/ChangePasswordTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/ChangePasswordTest.java	2012-04-03 21:08:11 UTC (rev 14496)
+++ branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/ChangePasswordTest.java	2012-04-04 02:46:59 UTC (rev 14497)
@@ -1,15 +1,32 @@
 //$Id: ChangePasswordTest.java 6505 2007-10-12 11:24:54Z pmuir $
 package org.jboss.seam.example.jpa.test;
 
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
 import org.jboss.seam.contexts.Contexts;
 import org.jboss.seam.core.Manager;
 import org.jboss.seam.example.jpa.User;
+import org.jboss.seam.mock.JUnitSeamTest;
 import org.jboss.seam.mock.SeamTest;
-import org.testng.annotations.Test;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
 
-public class ChangePasswordTest extends SeamTest
+public class ChangePasswordTest extends JUnitSeamTest
 {
-   
+
+   @Deployment(name="ChangePasswordTest")
+   @OverProtocol("Servlet 3.0")
+   public static Archive<?> createDeployment()
+   {
+      WebArchive er = Deployments.jpaDeployment();
+
+      er.addClasses(ChangePasswordTest.class);
+
+      return er;
+   }
+
    @Test
    public void testChangePassword() throws Exception
    {

Copied: branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/Deployments.java (from rev 14496, branches/community/Seam_2_3/examples-ee6/booking/booking-tests/src/test/java/org/jboss/seam/example/booking/test/Deployments.java)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/Deployments.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/Deployments.java	2012-04-04 02:46:59 UTC (rev 14497)
@@ -0,0 +1,15 @@
+package org.jboss.seam.example.jpa.test;
+
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.importer.ZipImporter;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+import java.io.File;
+
+public class Deployments {
+	public static WebArchive jpaDeployment() {
+		return ShrinkWrap.create(ZipImporter.class, "jpa.war").importFrom(new File("../booking-ear/target/jpa.war"))
+				.as(WebArchive.class);
+	}
+}

Modified: branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/LoginTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/LoginTest.java	2012-04-03 21:08:11 UTC (rev 14496)
+++ branches/community/Seam_2_3/examples-ee6/jpa/jpa-tests/src/test/java/org/jboss/seam/example/jpa/test/LoginTest.java	2012-04-04 02:46:59 UTC (rev 14497)
@@ -1,14 +1,32 @@
 //$Id: LoginTest.java 6505 2007-10-12 11:24:54Z pmuir $
 package org.jboss.seam.example.jpa.test;
 
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
 import org.jboss.seam.core.Manager;
+import org.jboss.seam.mock.JUnitSeamTest;
 import org.jboss.seam.web.Session;
 import org.jboss.seam.mock.SeamTest;
-import org.testng.annotations.Test;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
 
-public class LoginTest extends SeamTest
+public class LoginTest extends JUnitSeamTest
 {
-   
+
+   @Deployment(name="LoginTest")
+   @OverProtocol("Servlet 3.0")
+   public static Archive<?> createDeployment()
+   {
+      WebArchive er = Deployments.jpaDeployment();
+
+      er.addClasses(LoginTest.class);
+
+      return er;
+   }
+
+
    @Test
    public void testLoginComponent() throws Exception
    {

Modified: branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/pom.xml	2012-04-03 21:08:11 UTC (rev 14496)
+++ branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/pom.xml	2012-04-04 02:46:59 UTC (rev 14497)
@@ -106,7 +106,7 @@
         <dependency>
             <groupId>javax.faces</groupId>
             <artifactId>jsf-api</artifactId>
-            <version>2.1</version>
+            <version>1.2_15</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>

Modified: branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/Booking.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/Booking.java	2012-04-03 21:08:11 UTC (rev 14496)
+++ branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/Booking.java	2012-04-04 02:46:59 UTC (rev 14497)
@@ -14,10 +14,11 @@
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
 
-import org.hibernate.validator.Length;
-import org.hibernate.validator.NotNull;
-import org.hibernate.validator.Pattern;
+import org.hibernate.validator.constraints.Length;
 import org.jboss.seam.annotations.Name;
 
 @Entity
@@ -109,8 +110,8 @@
    }
    
    @NotNull(message="Credit card number is required")
-   @Length(min=16, max=16, message="Credit card number must 16 digits long")
-   @Pattern(regex="^\\d*$", message="Credit card number must be numeric")
+   @Size(min=16, max=16, message="Credit card number must 16 digits long")
+   @Pattern(regexp="^\\d*$", message="Credit card number must be numeric")
    public String getCreditCard()
    {
       return creditCard;
@@ -150,7 +151,7 @@
       this.beds = beds;
    }
    @NotNull(message="Credit card name is required")
-   @Length(min=3, max=70, message="Credit card name is required")
+   @Size(min=3, max=70, message="Credit card name is required")
    public String getCreditCardName()
    {
       return creditCardName;

Modified: branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/Hotel.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/Hotel.java	2012-04-03 21:08:11 UTC (rev 14496)
+++ branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/Hotel.java	2012-04-04 02:46:59 UTC (rev 14497)
@@ -8,9 +8,9 @@
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.Id;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
 
-import org.hibernate.validator.Length;
-import org.hibernate.validator.NotNull;
 import org.jboss.seam.annotations.Name;
 
 @Entity
@@ -36,7 +36,7 @@
       this.id = id;
    }
    
-   @Length(max=50) @NotNull
+   @Size(max=50) @NotNull
    public String getName()
    {
       return name;
@@ -46,7 +46,7 @@
       this.name = name;
    }
    
-   @Length(max=100) @NotNull
+   @Size(max=100) @NotNull
    public String getAddress()
    {
       return address;
@@ -56,7 +56,7 @@
       this.address = address;
    }
    
-   @Length(max=40) @NotNull
+   @Size(max=40) @NotNull
    public String getCity()
    {
       return city;
@@ -66,7 +66,7 @@
       this.city = city;
    }
    
-   @Length(min=4, max=6) @NotNull
+   @Size(min=4, max=6) @NotNull
    public String getZip()
    {
       return zip;
@@ -76,7 +76,7 @@
       this.zip = zip;
    }
    
-   @Length(min=2, max=10) @NotNull
+   @Size(min=2, max=10) @NotNull
    public String getState()
    {
       return state;
@@ -86,7 +86,7 @@
       this.state = state;
    }
    
-   @Length(min=2, max=40) @NotNull
+   @Size(min=2, max=40) @NotNull
    public String getCountry()
    {
       return country;

Modified: branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/User.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/User.java	2012-04-03 21:08:11 UTC (rev 14496)
+++ branches/community/Seam_2_3/examples-ee6/jpa/jpa-web/src/main/java/org/jboss/seam/example/jpa/User.java	2012-04-04 02:46:59 UTC (rev 14497)
@@ -8,10 +8,10 @@
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
 
-import org.hibernate.validator.Length;
-import org.hibernate.validator.NotNull;
-import org.hibernate.validator.Pattern;
 import org.jboss.seam.annotations.Name;
 import org.jboss.seam.annotations.Scope;
 
@@ -35,7 +35,7 @@
    public User() {}
 
    @NotNull
-   @Length(max=100)
+   @Size(max=100)
    public String getName()
    {
       return name;
@@ -46,7 +46,7 @@
    }
    
    @NotNull
-   @Length(min=5, max=15)
+   @Size(min=5, max=15)
    public String getPassword()
    {
       return password;
@@ -57,8 +57,8 @@
    }
    
    @Id
-   @Length(min=5, max=15)
-   @Pattern(regex="^\\w*$", message="not a valid username")
+   @Size(min=5, max=15)
+   @Pattern(regexp="^\\w*$", message="not a valid username")
    public String getUsername()
    {
       return username;

Modified: branches/community/Seam_2_3/examples-ee6/jpa/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/jpa/pom.xml	2012-04-03 21:08:11 UTC (rev 14496)
+++ branches/community/Seam_2_3/examples-ee6/jpa/pom.xml	2012-04-04 02:46:59 UTC (rev 14497)
@@ -23,7 +23,7 @@
     <dependencyManagement>
         <dependencies>
             <dependency>
-                <groupId>org.jboss.seam.examples</groupId>
+                <groupId>org.jboss.seam.examples-ee6</groupId>
                 <artifactId>jpa-web</artifactId>
                 <version>${project.version}</version>
                 <type>war</type>



More information about the seam-commits mailing list