[seam-commits] Seam SVN: r13545 - in modules/jms/trunk: api/src/main/java/org/jboss/seam/jms/annotations and 11 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Aug 2 23:22:58 EDT 2010


Author: jganoff
Date: 2010-08-02 23:22:56 -0400 (Mon, 02 Aug 2010)
New Revision: 13545

Added:
   modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/annotations/JmsSessionSelector.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/EventSession.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/InjectSessionTest.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/SessionSelectorBean.java
   modules/jms/trunk/impl/src/test/resources-jbossas/
   modules/jms/trunk/impl/src/test/resources-jbossas/hornetq-jms.xml
   modules/jms/trunk/impl/src/test/resources-jbossas/jndi.properties
Removed:
   modules/jms/trunk/impl/src/test/resources/
Modified:
   modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/annotations/JmsSession.java
   modules/jms/trunk/docs/reference/src/main/docbook/en-US/resource-injection.xml
   modules/jms/trunk/impl/pom.xml
   modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/impl/inject/SessionProducer.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectConnectionTest.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectDestinationTest.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectMessageProducerConsumerTest.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/transmit/SimpleTransmitMessageTest.java
   modules/jms/trunk/pom.xml
Log:
Updated Arquillian to 1.0.0-Alpha3.  Added jbossas-remote-6 and jbossas-managed-6 profiles, updated for JBoss AS 6 M4 with HornetQ.  Started work on SEAMJMS-1.

Modified: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/annotations/JmsSession.java
===================================================================
--- modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/annotations/JmsSession.java	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/annotations/JmsSession.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -21,6 +21,7 @@
  */
 package org.jboss.seam.jms.annotations;
 
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
 import static java.lang.annotation.ElementType.PARAMETER;
@@ -36,7 +37,7 @@
  * @author Jordan Ganoff
  */
 @Documented
- at Target( { FIELD, METHOD, PARAMETER })
+ at Target( { FIELD, METHOD, ANNOTATION_TYPE, PARAMETER })
 @Retention(RUNTIME)
 public @interface JmsSession
 {

Added: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/annotations/JmsSessionSelector.java
===================================================================
--- modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/annotations/JmsSessionSelector.java	                        (rev 0)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/annotations/JmsSessionSelector.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -0,0 +1,27 @@
+package org.jboss.seam.jms.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Target( { FIELD, METHOD, PARAMETER })
+ at Retention(RUNTIME)
+public @interface JmsSessionSelector
+{
+   /**
+    * @see javax.jms.Session#getTransacted()
+    */
+   boolean transacted() default false;
+
+   /**
+    * @see javax.jms.Session#getAcknowledgeMode()
+    */
+   int acknowledgementMode() default javax.jms.Session.AUTO_ACKNOWLEDGE;
+}

Modified: modules/jms/trunk/docs/reference/src/main/docbook/en-US/resource-injection.xml
===================================================================
--- modules/jms/trunk/docs/reference/src/main/docbook/en-US/resource-injection.xml	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/docs/reference/src/main/docbook/en-US/resource-injection.xml	2010-08-03 03:22:56 UTC (rev 13545)
@@ -100,9 +100,9 @@
          <title>Resource Configuration</title>
          
          <para>
-             You can use the <literal>@JmsSession</literal> qualifier when injecting <literal>javax.jms.Session</literal> to specify transacted and acknowledgement type:
+             You can use the <literal>@JmsSession</literal> annotation when injecting <literal>javax.jms.Session</literal> to specify transacted and acknowledgement mode:
       <programlisting role="Java">
- at Inject @JmsSession(transacted=true, acknowledgementType=Session.CLIENT_ACKNOWLEDGE) Session s;
+ at Inject @JmsSession(transacted=false, acknowledgementMode=Session.CLIENT_ACKNOWLEDGE) Session s;
 </programlisting>
          </para>
          

Modified: modules/jms/trunk/impl/pom.xml
===================================================================
--- modules/jms/trunk/impl/pom.xml	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/impl/pom.xml	2010-08-03 03:22:56 UTC (rev 13545)
@@ -1,96 +1,156 @@
 <?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>
+<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>
-		<groupId>org.jboss.seam.jms</groupId>
-		<artifactId>seam-jms-parent</artifactId>
-		<version>3.0.0-SNAPSHOT</version>
-		<relativePath>../pom.xml</relativePath>
-	</parent>
+   <parent>
+      <groupId>org.jboss.seam.jms</groupId>
+      <artifactId>seam-jms-parent</artifactId>
+      <version>3.0.0-SNAPSHOT</version>
+      <relativePath>../pom.xml</relativePath>
+   </parent>
 
-	<artifactId>seam-jms</artifactId>
-	<name>Seam JMS Implementation</name>
-	<description>Implementation of the Seam JMS Module</description>
+   <artifactId>seam-jms</artifactId>
+   <name>Seam JMS Implementation</name>
+   <description>Implementation of the Seam JMS Module</description>
    <packaging>jar</packaging>
 
-	<dependencies>
-		<dependency>
-			<groupId>javax.enterprise</groupId>
-			<artifactId>cdi-api</artifactId>
-			<scope>provided</scope>
-		</dependency>
+   <properties>
+      <jbossas.version>6.0.0.20100721-M4</jbossas.version>
+   </properties>
 
-		<dependency>
-			<groupId>org.jboss.seam.jms</groupId>
-			<artifactId>seam-jms-api</artifactId>
+   <dependencies>
+      <dependency>
+         <groupId>javax.enterprise</groupId>
+         <artifactId>cdi-api</artifactId>
+         <scope>provided</scope>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.seam.jms</groupId>
+         <artifactId>seam-jms-api</artifactId>
          <version>${project.version}</version>
-		</dependency>
+      </dependency>
 
-		<dependency>
-			<groupId>org.jboss.weld</groupId>
-			<artifactId>weld-extensions</artifactId>
-			<scope>runtime</scope>
-		</dependency>
+      <dependency>
+         <groupId>org.jboss.weld</groupId>
+         <artifactId>weld-extensions</artifactId>
+         <scope>runtime</scope>
+      </dependency>
 
-		<dependency>
-			<groupId>javax.jms</groupId>
-			<artifactId>jms</artifactId>
-			<scope>provided</scope>
-		</dependency>
+      <dependency>
+         <groupId>javax.jms</groupId>
+         <artifactId>jms</artifactId>
+         <scope>provided</scope>
+      </dependency>
 
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<scope>test</scope>
-		</dependency>
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <scope>test</scope>
+      </dependency>
 
-		<dependency>
-			<groupId>org.jboss.arquillian</groupId>
-			<artifactId>arquillian-junit</artifactId>
-			<scope>test</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>org.jboss.arquillian.container</groupId>
-			<artifactId>arquillian-jbossas-remote-60</artifactId>
-			<scope>test</scope>
-		</dependency>
-
       <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
       </dependency>
-	</dependencies>
 
-	<profiles>
-		<profile>
-			<id>code-coverage</id>
-			<build>
-				<plugins>
-					<plugin>
-						<groupId>org.codehaus.mojo</groupId>
-						<artifactId>emma-maven-plugin</artifactId>
-					</plugin>
-					<plugin>
-						<groupId>org.apache.maven.plugins</groupId>
-						<artifactId>maven-surefire-plugin</artifactId>
-					</plugin>
-					<plugin>
-						<groupId>org.codehaus.cargo</groupId>
-						<artifactId>cargo-maven2-plugin</artifactId>
-					</plugin>
-					<plugin>
-						<groupId>org.apache.maven.plugins</groupId>
-						<artifactId>maven-antrun-plugin</artifactId>
-					</plugin>
-					<plugin>
-						<groupId>org.sonatype.maven.plugin</groupId>
-						<artifactId>emma4it-maven-plugin</artifactId>
-					</plugin>
-				</plugins>
-			</build>
-		</profile>
-	</profiles>
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-junit</artifactId>
+         <scope>test</scope>
+      </dependency>
+   </dependencies>
 
+   <profiles>
+      <profile>
+         <id>code-coverage</id>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>emma-maven-plugin</artifactId>
+               </plugin>
+               <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-surefire-plugin</artifactId>
+               </plugin>
+               <plugin>
+                  <groupId>org.codehaus.cargo</groupId>
+                  <artifactId>cargo-maven2-plugin</artifactId>
+               </plugin>
+               <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-antrun-plugin</artifactId>
+               </plugin>
+               <plugin>
+                  <groupId>org.sonatype.maven.plugin</groupId>
+                  <artifactId>emma4it-maven-plugin</artifactId>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+      <profile>
+         <id>jbossas-remote-6</id>
+         <dependencies>
+            <dependency>
+               <groupId>org.jboss.arquillian.container</groupId>
+               <artifactId>arquillian-jbossas-remote-6</artifactId>
+               <version>${arquillian.version}</version>
+            </dependency>
+            <dependency>
+               <groupId>org.jboss.jbossas</groupId>
+               <artifactId>jboss-as-client</artifactId>
+               <version>${jbossas.version}</version>
+               <type>pom</type>
+            </dependency>
+        </dependencies>
+        <build>
+            <testResources>
+               <testResource>
+                  <directory>src/test/resources</directory>
+               </testResource>
+               <testResource>
+                  <directory>src/test/resources-jbossas</directory>
+               </testResource>
+            </testResources>
+         </build>
+      </profile>
+      <profile>
+         <id>jbossas-managed-6</id>
+         <properties>
+            <bindAddress>localhost</bindAddress>
+            <httpPort>8080</httpPort>
+         </properties>
+         <dependencies>
+            <dependency>
+               <groupId>org.jboss.arquillian.container</groupId>
+               <artifactId>arquillian-jbossas-managed-6</artifactId>
+               <version>${arquillian.version}</version>
+            </dependency>
+            <dependency>
+               <groupId>org.jboss.jbossas</groupId>
+               <artifactId>jboss-server-manager</artifactId>
+               <version>1.0.3.GA</version>
+            </dependency>
+            <dependency>
+               <groupId>org.jboss.jbossas</groupId>
+               <artifactId>jboss-as-client</artifactId>
+               <version>${jbossas.version}</version>
+               <type>pom</type>
+            </dependency>
+         </dependencies>
+         <build>
+            <testResources>
+               <testResource>
+                  <directory>src/test/resources</directory>
+               </testResource>
+               <testResource>
+                  <directory>src/test/resources-jbossas</directory>
+               </testResource>
+            </testResources>
+         </build>
+      </profile>
+   </profiles>
+
 </project>

Modified: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/impl/inject/SessionProducer.java
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/impl/inject/SessionProducer.java	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/impl/inject/SessionProducer.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -21,6 +21,8 @@
  */
 package org.jboss.seam.jms.impl.inject;
 
+import java.lang.annotation.Annotation;
+
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.inject.Disposes;
 import javax.enterprise.inject.Produces;
@@ -30,6 +32,7 @@
 import javax.jms.Session;
 
 import org.jboss.seam.jms.annotations.JmsSession;
+import org.jboss.seam.jms.annotations.JmsSessionSelector;
 
 public @RequestScoped
 class SessionProducer
@@ -37,19 +40,50 @@
    @Produces
    public Session getSession(InjectionPoint ip, Connection c) throws JMSException
    {
-      if (ip != null && ip.getAnnotated().isAnnotationPresent(JmsSession.class))
+      JmsSession s = null;
+      if (ip != null)
       {
-         JmsSession s = ip.getAnnotated().getAnnotation(JmsSession.class);
-         return c.createSession(s.transacted(), s.acknowledgementMode());
+         // Check for JmsSession annotation
+         if (ip.getAnnotated().isAnnotationPresent(JmsSession.class))
+         {
+            s = ip.getAnnotated().getAnnotation(JmsSession.class);
+         }
+         else
+         {
+            // Check meta-annotations
+            for (Annotation a : ip.getAnnotated().getAnnotations())
+            {
+               if (a.annotationType().isAnnotationPresent(JmsSession.class))
+               {
+                  s = a.annotationType().getAnnotation(JmsSession.class);
+               }
+            }
+         }
+         if (s != null)
+         {
+            return c.createSession(s.transacted(), s.acknowledgementMode());
+         }
       }
-      else
-      {
-         return c.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      }
+
+      // Default case where we cannot find an annotation
+      return c.createSession(false, Session.AUTO_ACKNOWLEDGE);
    }
 
    public void closeSession(@Disposes Session s) throws JMSException
    {
       s.close();
    }
+
+   @Produces
+   @JmsSessionSelector
+   public Session getSelectedSession(InjectionPoint ip, Connection c) throws JMSException
+   {
+      JmsSessionSelector s = ip.getAnnotated().getAnnotation(JmsSessionSelector.class);
+      return c.createSession(s.transacted(), s.acknowledgementMode());
+   }
+   
+   public void closeSelectedSession(@Disposes @JmsSessionSelector Session s) throws JMSException
+   {
+      s.close();
+   }
 }

Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -31,7 +31,7 @@
 
 @Qualifier
 @Retention(RUNTIME)
- at JmsDestination(jndiName = "jms/Q")
+ at JmsDestination(jndiName = "/jms/Q")
 public @interface MyQueue
 {
 

Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -31,7 +31,7 @@
 
 @Qualifier
 @Retention(RUNTIME)
- at JmsDestination(jndiName = "jms/T")
+ at JmsDestination(jndiName = "/jms/T")
 public @interface MyTopic
 {
 }

Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -28,46 +28,37 @@
 import org.jboss.seam.jms.bridge.Route;
 import org.jboss.seam.jms.impl.inject.ConnectionProducer;
 import org.jboss.seam.jms.impl.wrapper.JmsAnnotatedTypeWrapper;
+import org.jboss.shrinkwrap.api.Archive;
 import org.jboss.shrinkwrap.api.ArchivePaths;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
 
 public class Util
 {
+   private static final String HORNETQ_JMS_DEPLOYMENT_CONFIG = "hornetq-jms.xml";
 
-   public static JavaArchive createDeployment(Class<?> c)
+   public static Archive<?> createDeployment(Class<?>... classes)
    {
-      JavaArchive archive = ShrinkWrap.create("test.jar", JavaArchive.class);
-      archive.addPackage(Util.class.getPackage());
-      archive.addPackage(Seam3JmsExtension.class.getPackage());
-      archive.addPackage(JmsSession.class.getPackage());
-      archive.addPackage(ConnectionProducer.class.getPackage());
-      archive.addPackage(JmsAnnotatedTypeWrapper.class.getPackage());
-      archive.addPackage(Route.class.getPackage());
-      archive.addManifestResource(new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml"));
-      archive.addServiceProvider(Extension.class, Seam3JmsExtension.class);
-      archive.addManifestResource("topic_T-service.xml");
-      archive.addManifestResource("queue_Q-service.xml");
+      JavaArchive ejbModule = ShrinkWrap.create(JavaArchive.class, "test.jar");
+      ejbModule.addPackage(Util.class.getPackage());
+      ejbModule.addPackage(Seam3JmsExtension.class.getPackage());
+      ejbModule.addPackage(JmsSession.class.getPackage());
+      ejbModule.addPackage(ConnectionProducer.class.getPackage());
+      ejbModule.addPackage(JmsAnnotatedTypeWrapper.class.getPackage());
+      ejbModule.addPackage(Route.class.getPackage());
+      ejbModule.addManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
+      ejbModule.addServiceProvider(Extension.class, Seam3JmsExtension.class);
+      for (Class<?> c : classes)
+      {
+         ejbModule.addPackage(c.getPackage());
+      }
 
-      archive.addPackage(c.getPackage());
+      EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear");
+      ear.addModule(ejbModule);
+      ear.addResource(HORNETQ_JMS_DEPLOYMENT_CONFIG); // TODO Add this conditionally based on test profile to support other containers
 
-      return archive;
+      return ear;
    }
-
-   public static JavaArchive addBeansXml(JavaArchive a, Class<?> c)
-   {
-      return addBeansXml(a, c, "beans.xml");
-   }
-   
-   public static JavaArchive addBeansXml(JavaArchive a, Class<?> c, String beansXmlLocalName)
-   {
-      return addManifestResource(a, c, beansXmlLocalName, "beans.xml");
-   }
-
-   public static JavaArchive addManifestResource(JavaArchive a, Class<?> c, String name, String archivePath)
-   {
-      String basePkg = c.getPackage().getName().replaceAll("\\.", "/");
-      return a.addManifestResource(basePkg + "/" + name, ArchivePaths.create(archivePath));
-   }
 }

Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -30,7 +30,7 @@
 import org.jboss.seam.jms.bridge.Route;
 import org.jboss.seam.jms.bridge.RouteType;
 import org.jboss.seam.jms.test.Util;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.Archive;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -40,7 +40,7 @@
 {
 
    @Deployment
-   public static JavaArchive createDeployment()
+   public static Archive<?> createDeployment()
    {
       return Util.createDeployment(JmsEventBridgeTest.class);
    }
@@ -62,6 +62,4 @@
       Assert.assertEquals(RouteType.EGRESS, r.getType());
       Assert.assertEquals(Object.class, r.getPayloadType());
    }
-   
-   
 }

Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -33,7 +33,7 @@
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.jms.annotations.JmsDestination;
 import org.jboss.seam.jms.test.Util;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.Archive;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -42,7 +42,7 @@
 public class RouteTest
 {
    @Deployment
-   public static JavaArchive createDeployment()
+   public static Archive<?> createDeployment()
    {
       return Util.createDeployment(RouteTest.class);
    }

Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectConnectionTest.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectConnectionTest.java	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectConnectionTest.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -24,14 +24,11 @@
 import javax.enterprise.inject.Instance;
 import javax.inject.Inject;
 import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Session;
 
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.jms.annotations.JmsSession;
 import org.jboss.seam.jms.test.Util;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.Archive;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -41,24 +38,17 @@
 {
 
    @Deployment
-   public static JavaArchive createDeployment()
+   public static Archive<?> createDeployment()
    {
       return Util.createDeployment(InjectConnectionTest.class);
    }
 
    @Inject
    private Instance<Connection> c;
-   
+
    @Inject
    private Instance<Connection> c2;
 
-   @Inject
-   private Instance<Session> s;
-   
-   @Inject
-   @JmsSession(transacted=false, acknowledgementMode=Session.CLIENT_ACKNOWLEDGE)
-   private Instance<Session> configuredSession;
-
    @Test
    public void injectConnection()
    {
@@ -66,23 +56,8 @@
    }
 
    @Test
-   public void injectSession()
-   {
-      Assert.assertNotNull(s.get());
-   }
-   
-   @Test
    public void sameConnection()
    {
       Assert.assertEquals(c.get(), c2.get());
    }
-   
-   @Test
-   public void configuredSession() throws JMSException
-   {
-      Session s = configuredSession.get();
-      Assert.assertNotNull(s);
-      Assert.assertFalse(s.getTransacted());
-      Assert.assertEquals(Session.CLIENT_ACKNOWLEDGE, s.getAcknowledgeMode());
-   }
 }

Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectDestinationTest.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectDestinationTest.java	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectDestinationTest.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -27,17 +27,17 @@
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.jms.test.Util;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.Archive;
 import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
- at RunWith(Arquillian.class)
+ at RunWith(Arquillian.class) 
 public class InjectDestinationTest
 {
    @Deployment
-   public static JavaArchive createDeployment()
+   public static Archive<?> createDeployment()
    {
       return Util.createDeployment(InjectDestinationTest.class);
    }

Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectMessageProducerConsumerTest.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectMessageProducerConsumerTest.java	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/InjectMessageProducerConsumerTest.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -31,7 +31,7 @@
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.jms.test.Util;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.Archive;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -40,7 +40,7 @@
 public class InjectMessageProducerConsumerTest
 {
    @Deployment
-   public static JavaArchive createDeployment()
+   public static Archive<?> createDeployment()
    {
       return Util.createDeployment(InjectMessageProducerConsumerTest.class);
    }

Added: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/EventSession.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/EventSession.java	                        (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/EventSession.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.inject.session;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.jms.Session;
+
+import org.jboss.seam.jms.annotations.JmsSession;
+
+ at Retention(RetentionPolicy.RUNTIME)
+ at JmsSession(transacted = false, acknowledgementMode = Session.DUPS_OK_ACKNOWLEDGE)
+public @interface EventSession
+{
+}

Added: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/InjectSessionTest.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/InjectSessionTest.java	                        (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/InjectSessionTest.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.inject.session;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+import javax.jms.JMSException;
+import javax.jms.Session;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.jms.annotations.JmsSession;
+import org.jboss.seam.jms.annotations.JmsSessionSelector;
+import org.jboss.seam.jms.test.Util;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class InjectSessionTest
+{
+
+   @Deployment
+   public static Archive<?> createDeployment()
+   {
+      return Util.createDeployment(InjectSessionTest.class);
+   }
+
+   @Inject
+   private Instance<Session> s;
+   
+   @Inject
+   @JmsSessionSelector(transacted=false, acknowledgementMode=Session.AUTO_ACKNOWLEDGE)
+   private Instance<Session> qualified;
+
+   @Inject
+   @JmsSession(transacted = false, acknowledgementMode = Session.CLIENT_ACKNOWLEDGE)
+   private Instance<Session> configuredSession;
+
+   @Inject
+   @EventSession
+   private Instance<Session> eventSession;
+
+   @Inject
+   SessionSelectorBean selectorBean;
+   
+   @Test
+   public void injectSession()
+   {
+      Assert.assertNotNull(s.get());
+   }
+
+   @Test
+   public void injectSession_annotated() throws JMSException
+   {
+      Session s = configuredSession.get();
+      Assert.assertNotNull(s);
+      Assert.assertFalse(s.getTransacted());
+      Assert.assertEquals(Session.CLIENT_ACKNOWLEDGE, s.getAcknowledgeMode());
+   }
+
+   @Test
+   public void injectSession_meta_annotated() throws JMSException
+   {
+      Session s = eventSession.get();
+      Assert.assertNotNull(s);
+      Assert.assertFalse(s.getTransacted());
+      Assert.assertEquals(Session.DUPS_OK_ACKNOWLEDGE, s.getAcknowledgeMode());
+   }
+
+   @Test
+   public void injectQualifiedSession() throws JMSException
+   {
+      Session s = qualified.get();
+      Assert.assertNotNull(s);
+      Assert.assertFalse(s.getTransacted());
+      Assert.assertEquals(Session.AUTO_ACKNOWLEDGE, s.getAcknowledgeMode());
+   }
+
+   // TODO Fix this so session selectors work
+   @Ignore
+   @Test
+   public void injectSessionWithLiteral() throws JMSException
+   {
+      Session session = selectorBean.get();
+      Assert.assertNotNull(session);
+      Assert.assertFalse(session.getTransacted());
+      Assert.assertEquals(Session.DUPS_OK_ACKNOWLEDGE, session.getAcknowledgeMode());
+   }
+}
\ No newline at end of file

Added: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/SessionSelectorBean.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/SessionSelectorBean.java	                        (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/session/SessionSelectorBean.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -0,0 +1,33 @@
+package org.jboss.seam.jms.test.inject.session;
+
+import javax.enterprise.inject.Instance;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+import javax.jms.Session;
+
+import org.jboss.seam.jms.annotations.JmsSessionSelector;
+
+public class SessionSelectorBean
+{
+
+   class SessionQualifier extends AnnotationLiteral<JmsSessionSelector> implements JmsSessionSelector
+   {
+      public int acknowledgementMode()
+      {
+         return Session.DUPS_OK_ACKNOWLEDGE;
+      }
+      
+      public boolean transacted()
+      {
+         return false;
+      }
+   }
+   
+   @Inject
+   Instance<Session> s;
+   
+   public Session get()
+   {
+      return s.select(new SessionQualifier()).get();
+   }
+}

Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/transmit/SimpleTransmitMessageTest.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/transmit/SimpleTransmitMessageTest.java	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/transmit/SimpleTransmitMessageTest.java	2010-08-03 03:22:56 UTC (rev 13545)
@@ -36,7 +36,7 @@
 import org.jboss.seam.jms.test.Util;
 import org.jboss.seam.jms.test.inject.InjectMessageConsumer;
 import org.jboss.seam.jms.test.inject.InjectMessageProducer;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.Archive;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -45,11 +45,9 @@
 public class SimpleTransmitMessageTest
 {
    @Deployment
-   public static JavaArchive createDeployment()
+   public static Archive<?> createDeployment()
    {
-      JavaArchive a = Util.createDeployment(SimpleTransmitMessageTest.class);
-      a.addPackage(InjectMessageConsumer.class.getPackage());
-      return a;
+      return Util.createDeployment(SimpleTransmitMessageTest.class, InjectMessageConsumer.class);
    }
 
    @Inject

Added: modules/jms/trunk/impl/src/test/resources-jbossas/hornetq-jms.xml
===================================================================
--- modules/jms/trunk/impl/src/test/resources-jbossas/hornetq-jms.xml	                        (rev 0)
+++ modules/jms/trunk/impl/src/test/resources-jbossas/hornetq-jms.xml	2010-08-03 03:22:56 UTC (rev 13545)
@@ -0,0 +1,13 @@
+<configuration xmlns="urn:hornetq"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
+
+   <topic name="T">
+      <entry name="/jms/T" />
+   </topic>
+   
+   <queue name="Q">
+      <entry name="/jms/Q" />
+   </queue>
+
+</configuration>
\ No newline at end of file

Added: modules/jms/trunk/impl/src/test/resources-jbossas/jndi.properties
===================================================================
--- modules/jms/trunk/impl/src/test/resources-jbossas/jndi.properties	                        (rev 0)
+++ modules/jms/trunk/impl/src/test/resources-jbossas/jndi.properties	2010-08-03 03:22:56 UTC (rev 13545)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces 
+java.naming.provider.url=jnp://localhost:1099

Modified: modules/jms/trunk/pom.xml
===================================================================
--- modules/jms/trunk/pom.xml	2010-08-01 21:47:03 UTC (rev 13544)
+++ modules/jms/trunk/pom.xml	2010-08-03 03:22:56 UTC (rev 13545)
@@ -19,6 +19,7 @@
 
    <properties>
       <seam.version>3.0.0.b01</seam.version>
+      <arquillian.version>1.0.0.Alpha3</arquillian.version>
    </properties>
 
    <modules>



More information about the seam-commits mailing list