[seam-commits] Seam SVN: r12693 - in modules/jms/trunk: impl/src/main/java/org/jboss/seam/jms and 3 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu May 6 23:17:45 EDT 2010


Author: jganoff
Date: 2010-05-06 23:17:44 -0400 (Thu, 06 May 2010)
New Revision: 12693

Added:
   modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/JmsForwarding.java
   modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/Bridged.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyForwarding.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyTopic.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/SimpleBridgedEventTest.java
Removed:
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/Bridged.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyForwarding.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyTopic.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/SimpleBridgedEventTest.java
Modified:
   modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java
Log:
First attempt at event forwarding

Copied: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/JmsForwarding.java (from rev 12692, modules/jms/branches/simple-forwarding/api/src/main/java/org/jboss/seam/jms/JmsForwarding.java)
===================================================================
--- modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/JmsForwarding.java	                        (rev 0)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/JmsForwarding.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+import javax.jms.Destination;
+
+/**
+ * Configuration for the forwarding of events to JMS.
+ * 
+ * @author Jordan Ganoff
+ */
+ at Named
+ at ApplicationScoped
+public interface JmsForwarding
+{
+   /**
+    * Destinations to forward events to.
+    */
+   public Set<? extends Destination> getDestinations();
+
+   /**
+    * Event type to observe and forward.
+    */
+   public Type getEventType();
+   
+   /**
+    * Set of qualifiers that must exist on each event of type {@link #getEventType()}.
+    */
+   public Set<Annotation> getQualifiers();
+}

Copied: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java (from rev 12692, modules/jms/branches/simple-forwarding/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java)
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java	                        (rev 0)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -0,0 +1,110 @@
+package org.jboss.seam.jms;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.inject.Named;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Observer Method to observe events and forward (bridge) them over JMS.
+ * 
+ * @author Jordan Ganoff
+ */
+ at Named
+ at ApplicationScoped
+public class BridgedObserver implements ObserverMethod<Object>
+{
+   private Logger log = LoggerFactory.getLogger(getClass());
+
+   private BeanManager bm;
+   private JmsForwarding config;
+
+   public BridgedObserver(BeanManager bm, JmsForwarding config)
+   {
+      this.bm = bm;
+      this.config = config;
+   }
+
+   public Class<?> getBeanClass()
+   {
+      return null;
+   }
+
+   public Set<Annotation> getObservedQualifiers()
+   {
+      return config.getQualifiers();
+   }
+
+   public Type getObservedType()
+   {
+      return config.getEventType();
+   }
+
+   public Reception getReception()
+   {
+      return Reception.ALWAYS;
+   }
+
+   public TransactionPhase getTransactionPhase()
+   {
+      return TransactionPhase.AFTER_SUCCESS;
+   }
+
+   public void notify(Object evt)
+   {
+      // FIXME Include qualifiers once CDI 1.0 MR is complete and
+      // notify(Event, Set<Annotation>) is added
+      forwardEvent(evt, null);
+   }
+
+   private void forwardEvent(Object event, Set<Annotation> qualifiers)
+   {
+      Set<Bean<?>> beans = bm.getBeans(Session.class);
+      Bean<?> bean = bm.resolve(beans);
+      Session s = (Session) bm.getReference(bean, Session.class, bm.createCreationalContext(bean));
+      try
+      {
+         for (Destination d : config.getDestinations())
+         {
+            try
+            {
+               Message m = s.createObjectMessage((Serializable) event);
+               // Safe to create producers here always? In an app server these
+               // should be cached via JCA managed connection factory but what
+               // about other environments?
+               s.createProducer(d).send(m);
+            }
+            catch (JMSException ex)
+            {
+               log.error("Unable to forward event", ex);
+            }
+         }
+      }
+      finally
+      {
+         try
+         {
+            s.close();
+         }
+         catch (JMSException ex)
+         {
+            log.error("Unable to close session", ex);
+         }
+      }
+   }
+}

Modified: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java	2010-05-07 02:25:15 UTC (rev 12692)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -21,11 +21,19 @@
  */
 package org.jboss.seam.jms;
 
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.ProcessAnnotatedType;
 
 import org.jboss.seam.jms.impl.wrapper.JmsAnnotatedTypeWrapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Seam 3 JMS Portable Extension
@@ -34,8 +42,34 @@
  */
 public class Seam3JmsExtension implements Extension
 {
+   private static final Logger log = LoggerFactory.getLogger(Seam3JmsExtension.class);
+   
+   public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm)
+   {
+      Set<Bean<?>> configuration = bm.getBeans(JmsForwarding.class);
+      
+      if(configuration == null || configuration.isEmpty())
+      {
+         log.info("No {} registered.  Event forwarding disabled.", JmsForwarding.class.getSimpleName());
+      } else
+      {
+         for(Bean<?> c : configuration)
+         {
+            log.info("Creating {} for configuration {}", BridgedObserver.class.getSimpleName(), c);
+            CreationalContext<?> context = bm.createCreationalContext(c);
+            // TODO Verify configuration for correctness (e.g. getQualifiers() must contain only @Qualifier annotations)
+            JmsForwarding config = JmsForwarding.class.cast(bm.getReference(c, JmsForwarding.class, context));
+            BridgedObserver b = new BridgedObserver(bm, config);
+            abd.addObserverMethod(b);
+         }
+      }
+   }
+   
    public <X> void decorateAnnotatedType(@Observes ProcessAnnotatedType<X> pat)
    {
+      /**
+       * Flatten all @Annotated that define @JmsDestinations so that they may be injected  
+       */
       pat.setAnnotatedType(JmsAnnotatedTypeWrapper.decorate(pat.getAnnotatedType()));
    }
 }

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-05-07 02:25:15 UTC (rev 12692)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -52,4 +52,20 @@
 
       return archive;
    }
+
+   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));
+   }
 }

Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge (from rev 12692, modules/jms/branches/simple-forwarding/impl/src/test/java/org/jboss/seam/jms/test/bridge)

Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple (from rev 12692, modules/jms/branches/simple-forwarding/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple)

Deleted: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/Bridged.java
===================================================================
--- modules/jms/branches/simple-forwarding/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/Bridged.java	2010-05-07 02:25:15 UTC (rev 12692)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/Bridged.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -1,49 +0,0 @@
-/*
- * 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.bridge.simple;
-
-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.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * Bridged Event Qualifer that denotes the implicit forwarding over JMS
- * 
- * @author Jordan Ganoff
- */
- at Qualifier
- at Documented
- at Inherited
- at Target( { FIELD, METHOD, TYPE, PARAMETER })
- at Retention(RUNTIME)
-public @interface Bridged
-{
-}
\ No newline at end of file

Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/Bridged.java (from rev 12692, modules/jms/branches/simple-forwarding/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/Bridged.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/Bridged.java	                        (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/Bridged.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -0,0 +1,49 @@
+/*
+ * 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.bridge.simple;
+
+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.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Bridged Event Qualifer that denotes the implicit forwarding over JMS
+ * 
+ * @author Jordan Ganoff
+ */
+ at Qualifier
+ at Documented
+ at Inherited
+ at Target( { FIELD, METHOD, TYPE, PARAMETER })
+ at Retention(RUNTIME)
+public @interface Bridged
+{
+}
\ No newline at end of file

Deleted: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyForwarding.java
===================================================================
--- modules/jms/branches/simple-forwarding/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyForwarding.java	2010-05-07 02:25:15 UTC (rev 12692)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyForwarding.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -1,49 +0,0 @@
-package org.jboss.seam.jms.test.bridge.simple;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.Set;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Instance;
-import javax.enterprise.util.AnnotationLiteral;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.jms.Destination;
-import javax.jms.Topic;
-
-import org.jboss.seam.jms.JmsForwarding;
-import org.jboss.seam.jms.annotations.JmsDestination;
-
- at Named
- at ApplicationScoped
-public class MyForwarding implements JmsForwarding
-{
-   private static final Set<Annotation> BRIDGED = Collections.<Annotation> singleton(new AnnotationLiteral<Bridged>()
-   {
-      private static final long serialVersionUID = 1L;
-   });
-
-   // Use Instance<?> here to get around problem of topic not being deployed before Weld processes 
-   // deployment and tries to inject topics
-   @Inject
-   @JmsDestination(jndiName="jms/T")
-   private Instance<Topic> t;
-   
-   public Set<? extends Destination> getDestinations()
-   {
-      return Collections.singleton(t.get());
-   }
-
-   public Type getEventType()
-   {
-      return Object.class;
-   }
-
-   public Set<Annotation> getQualifiers()
-   {
-      return BRIDGED;
-   }
-
-}

Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyForwarding.java (from rev 12692, modules/jms/branches/simple-forwarding/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyForwarding.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyForwarding.java	                        (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyForwarding.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -0,0 +1,70 @@
+/*
+ * 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.bridge.simple;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.jms.Destination;
+import javax.jms.Topic;
+
+import org.jboss.seam.jms.JmsForwarding;
+import org.jboss.seam.jms.annotations.JmsDestination;
+
+ at Named
+ at ApplicationScoped
+public class MyForwarding implements JmsForwarding
+{
+   private static final Set<Annotation> BRIDGED = Collections.<Annotation> singleton(new AnnotationLiteral<Bridged>()
+   {
+      private static final long serialVersionUID = 1L;
+   });
+
+   // Use Instance<?> here to get around problem of topic not being deployed before Weld processes 
+   // deployment and tries to inject topics
+   @Inject
+   @JmsDestination(jndiName="jms/T")
+   private Instance<Topic> t;
+   
+   public Set<? extends Destination> getDestinations()
+   {
+      return Collections.singleton(t.get());
+   }
+
+   public Type getEventType()
+   {
+      return Object.class;
+   }
+
+   public Set<Annotation> getQualifiers()
+   {
+      return BRIDGED;
+   }
+
+}

Deleted: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyTopic.java
===================================================================
--- modules/jms/branches/simple-forwarding/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyTopic.java	2010-05-07 02:25:15 UTC (rev 12692)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyTopic.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -1,12 +0,0 @@
-package org.jboss.seam.jms.test.bridge.simple;
-
-import javax.inject.Qualifier;
-
-import org.jboss.seam.jms.annotations.JmsDestination;
-
- at Qualifier
- at JmsDestination(jndiName="jms/T")
-public @interface MyTopic
-{
-
-}

Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyTopic.java (from rev 12692, modules/jms/branches/simple-forwarding/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyTopic.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyTopic.java	                        (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/MyTopic.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -0,0 +1,33 @@
+/*
+ * 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.bridge.simple;
+
+import javax.inject.Qualifier;
+
+import org.jboss.seam.jms.annotations.JmsDestination;
+
+ at Qualifier
+ at JmsDestination(jndiName="jms/T")
+public @interface MyTopic
+{
+
+}

Deleted: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/SimpleBridgedEventTest.java
===================================================================
--- modules/jms/branches/simple-forwarding/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/SimpleBridgedEventTest.java	2010-05-07 02:25:15 UTC (rev 12692)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/SimpleBridgedEventTest.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -1,46 +0,0 @@
-package org.jboss.seam.jms.test.bridge.simple;
-
-import javax.enterprise.event.Event;
-import javax.inject.Inject;
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-import javax.jms.TopicSubscriber;
-
-import org.jboss.arquillian.api.Deployment;
-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.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
- at RunWith(Arquillian.class)
-public class SimpleBridgedEventTest
-{
-   @Deployment
-   public static JavaArchive createDeployment()
-   {
-      return Util.createDeployment(SimpleBridgedEventTest.class);
-   }
-   
-   @Inject Connection c;
-   @Inject Session s;
-   @Inject @JmsDestination(jndiName="jms/T") TopicSubscriber ts;
-   @Inject @Bridged Event<String> event;
-   
-   @Test
-   public void forwardSimpleEvent() throws JMSException
-   {
-      String expected = "test";
-      c.start();
-      event.fire(expected);
-      Message m = ts.receive(3000);
-      Assert.assertTrue(m != null);
-      Assert.assertTrue(m instanceof ObjectMessage);
-      Assert.assertEquals(expected, ((ObjectMessage) m).getObject());
-   }
-}

Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/SimpleBridgedEventTest.java (from rev 12692, modules/jms/branches/simple-forwarding/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/SimpleBridgedEventTest.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/SimpleBridgedEventTest.java	                        (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/SimpleBridgedEventTest.java	2010-05-07 03:17:44 UTC (rev 12693)
@@ -0,0 +1,67 @@
+/*
+ * 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.bridge.simple;
+
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.jms.TopicSubscriber;
+
+import org.jboss.arquillian.api.Deployment;
+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.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class SimpleBridgedEventTest
+{
+   @Deployment
+   public static JavaArchive createDeployment()
+   {
+      return Util.createDeployment(SimpleBridgedEventTest.class);
+   }
+   
+   @Inject Connection c;
+   @Inject Session s;
+   @Inject @JmsDestination(jndiName="jms/T") TopicSubscriber ts;
+   @Inject @Bridged Event<String> event;
+   
+   @Test
+   public void forwardSimpleEvent() throws JMSException
+   {
+      String expected = "test";
+      c.start();
+      event.fire(expected);
+      Message m = ts.receive(3000);
+      Assert.assertTrue(m != null);
+      Assert.assertTrue(m instanceof ObjectMessage);
+      Assert.assertEquals(expected, ((ObjectMessage) m).getObject());
+   }
+}



More information about the seam-commits mailing list