[seam-commits] Seam SVN: r14586 - in branches/community/Seam_2_3/examples-ee6/itext/itext-tests: src/test/java/org/jboss/seam/example/itext/test and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Apr 16 10:28:05 EDT 2012


Author: maschmid
Date: 2012-04-16 10:28:04 -0400 (Mon, 16 Apr 2012)
New Revision: 14586

Added:
   branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java
   branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/resources-integration/arquillian.xml
   branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/resources-integration/web.xml
Removed:
   branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTests.java
Modified:
   branches/community/Seam_2_3/examples-ee6/itext/itext-tests/pom.xml
Log:
itext seamtest


Modified: branches/community/Seam_2_3/examples-ee6/itext/itext-tests/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/itext/itext-tests/pom.xml	2012-04-16 11:49:54 UTC (rev 14585)
+++ branches/community/Seam_2_3/examples-ee6/itext/itext-tests/pom.xml	2012-04-16 14:28:04 UTC (rev 14586)
@@ -50,6 +50,16 @@
             <artifactId>selenium-java-client-driver</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.jboss.arquillian.junit</groupId>
+            <artifactId>arquillian-junit-container</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.arquillian.protocol</groupId>
+            <artifactId>arquillian-protocol-servlet</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.jboss.seam</groupId>
             <artifactId>functional-tests</artifactId>
             <scope>test</scope>
@@ -80,9 +90,22 @@
             <groupId>jfree</groupId>
             <artifactId>jfreechart</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.jboss.spec.javax.el</groupId>
+            <artifactId>jboss-el-api_2.2_spec</artifactId>
+        </dependency>
     </dependencies>
     
     <build>
+        <testResources>
+            <testResource>
+                <directory>src/test/resources</directory>
+                <filtering>true</filtering>
+            </testResource>
+            <testResource>
+                <directory>src/test/resources-integration</directory>
+            </testResource>
+        </testResources>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -96,6 +119,43 @@
 
     <profiles>
         <profile>
+            <id>integration-tests</id>
+            <activation>
+                <property>
+                    <name>arquillian</name>
+                </property>
+            </activation> 
+        </profile>
+
+        <profile>
+            <id>arq-jbossas-7-managed</id>
+            <activation>
+                <property>
+                    <name>arquillian</name>
+                    <value>jbossas-managed-7</value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-dependency-plugin</artifactId>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
+            <id>arq-jbossas-7-remote</id>
+            <activation>
+                <property>
+                    <name>arquillian</name>
+                    <value>jbossas-remote-7</value>
+                </property>
+            </activation>
+        </profile>
+
+        <profile>
             <id>ftest-jbossas</id>
             <properties>
                 <example.context.path>seam-itext</example.context.path>

Added: branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTest.java	2012-04-16 14:28:04 UTC (rev 14586)
@@ -0,0 +1,112 @@
+package org.jboss.seam.example.itext.test;
+
+import java.io.File;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Conversation;
+import org.jboss.seam.document.ByteArrayDocumentData;
+import org.jboss.seam.document.DocumentData;
+import org.jboss.seam.document.DocumentStore;
+import org.jboss.seam.mock.JUnitSeamTest;
+import org.jboss.seam.pdf.ui.UIDocument;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.importer.ZipImporter;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * This is just a placeholder until I can find a way to actually test the UI
+ * components.
+ */
+ at RunWith(Arquillian.class)
+public class DocumentTest extends JUnitSeamTest
+{
+   @Deployment
+   @OverProtocol("Servlet 3.0")
+   public static Archive<?> createDeployment()
+   {
+       EnterpriseArchive er = ShrinkWrap.create(ZipImporter.class, "seam-itext.ear").importFrom(new File("../itext-ear/target/seam-itext.ear"))
+           .as(EnterpriseArchive.class);
+       WebArchive web = er.getAsType(WebArchive.class, "itext-web.war");
+       web.addAsWebInfResource(new StringAsset("org.jboss.seam.mock.MockFacesContextFactory"), "classes/META-INF/services/javax.faces.context.FacesContextFactory");
+       web.addClasses(DocumentTest.class);
+       
+       // Install org.jboss.seam.mock.MockSeamListener
+       web.delete("/WEB-INF/web.xml");
+       web.addAsWebInfResource("web.xml");
+
+       return er;
+   }
+   
+   @Test
+   public void documentStore() throws Exception
+   {
+      String conversationId = new FacesRequest("/whyseam.xhtml")
+      {
+
+         @Override
+         protected void invokeApplication() throws Exception
+         {
+            Conversation.instance().begin();
+
+            DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
+            String docId = store.newId();
+
+            Contexts.getSessionContext().set("docId", docId);
+
+            DocumentData documentData = new ByteArrayDocumentData("base", UIDocument.PDF, new byte[100]);
+            store.saveData(docId, documentData);
+         }
+
+         @Override
+         protected void renderResponse() throws Exception
+         {
+            String docId = (String) getValue("#{docId}");
+            assert docId != null;
+
+            DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
+            assert store.idIsValid(docId);
+
+         }
+      }.run();
+
+      // different conversation
+      new FacesRequest("/whyseam.xhtml")
+      {
+         @Override
+         protected void renderResponse() throws Exception
+         {
+            String docId = (String) getValue("#{docId}");
+            assert docId != null;
+
+            DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
+            assert !store.idIsValid(docId);
+         }
+      }.run();
+
+      new FacesRequest("/whyseam.xhtml", conversationId)
+      {
+         @Override
+         protected void renderResponse() throws Exception
+         {
+            String docId = (String) getValue("#{docId}");
+            assert docId != null;
+
+            DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
+            assert store.idIsValid(docId);
+
+            ByteArrayDocumentData data = (ByteArrayDocumentData)store.getDocumentData(docId);
+            assert data.getDocumentType().equals(UIDocument.PDF);
+            assert data.getData().length == 100;
+         }
+      }.run();
+   }
+
+}

Deleted: branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTests.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTests.java	2012-04-16 11:49:54 UTC (rev 14585)
+++ branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/java/org/jboss/seam/example/itext/test/DocumentTests.java	2012-04-16 14:28:04 UTC (rev 14586)
@@ -1,84 +0,0 @@
-package org.jboss.seam.example.itext.test;
-
-import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.core.Conversation;
-import org.jboss.seam.document.ByteArrayDocumentData;
-import org.jboss.seam.document.DocumentData;
-import org.jboss.seam.document.DocumentStore;
-import org.jboss.seam.mock.SeamTest;
-import org.jboss.seam.pdf.ui.UIDocument;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * This is just a placeholder until I can find a way to actually test the UI
- * components.
- */
- at Ignore
-public class DocumentTests extends SeamTest
-{
-   @Test
-   public void documentStore() throws Exception
-   {
-      String conversationId = new FacesRequest("/whyseam.xhtml")
-      {
-
-         @Override
-         protected void invokeApplication() throws Exception
-         {
-            Conversation.instance().begin();
-
-            DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
-            String docId = store.newId();
-
-            Contexts.getSessionContext().set("docId", docId);
-
-            DocumentData documentData = new ByteArrayDocumentData("base", UIDocument.PDF, new byte[100]);
-            store.saveData(docId, documentData);
-         }
-
-         @Override
-         protected void renderResponse() throws Exception
-         {
-            String docId = (String) getValue("#{docId}");
-            assert docId != null;
-
-            DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
-            assert store.idIsValid(docId);
-
-         }
-      }.run();
-
-      // different conversation
-      new FacesRequest("/whyseam.xhtml")
-      {
-         @Override
-         protected void renderResponse() throws Exception
-         {
-            String docId = (String) getValue("#{docId}");
-            assert docId != null;
-
-            DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
-            assert !store.idIsValid(docId);
-         }
-      }.run();
-
-      new FacesRequest("/whyseam.xhtml", conversationId)
-      {
-         @Override
-         protected void renderResponse() throws Exception
-         {
-            String docId = (String) getValue("#{docId}");
-            assert docId != null;
-
-            DocumentStore store = (DocumentStore) getValue("#{org.jboss.seam.document.documentStore}");
-            assert store.idIsValid(docId);
-
-            ByteArrayDocumentData data = (ByteArrayDocumentData)store.getDocumentData(docId);
-            assert data.getDocumentType().equals(UIDocument.PDF);
-            assert data.getData().length == 100;
-         }
-      }.run();
-   }
-
-}

Added: branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/resources-integration/arquillian.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/resources-integration/arquillian.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/resources-integration/arquillian.xml	2012-04-16 14:28:04 UTC (rev 14586)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns="http://jboss.org/schema/arquillian"
+    xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+    <engine>
+        <property name="deploymentExportPath">target/</property>
+    </engine>
+
+    <container qualifier="jboss" default="true">
+        <configuration>
+            <property name="javaVmArguments">-Xmx1024m -XX:MaxPermSize=512m</property>
+            <property name="jbossHome">target/jboss-as-${version.jbossas7}</property>
+        </configuration>
+    </container>
+
+</arquillian>

Added: branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/resources-integration/web.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/resources-integration/web.xml	                        (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/itext/itext-tests/src/test/resources-integration/web.xml	2012-04-16 14:28:04 UTC (rev 14586)
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+
+<web-app version="3.0"
+         xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+         
+    <listener>
+        <listener-class>org.jboss.seam.mock.MockSeamListener</listener-class>
+    </listener>
+
+</web-app>



More information about the seam-commits mailing list