[seam-commits] Seam SVN: r13552 - in modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject: destination and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Aug 3 22:45:11 EDT 2010


Author: jganoff
Date: 2010-08-03 22:45:10 -0400 (Tue, 03 Aug 2010)
New Revision: 13552

Added:
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/destination/
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/destination/DestinationProducers.java
   modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/destination/InjectDestinationViaResource.java
Log:
SEAMJMS-2: Created tests for @Resource injection of destinations

Added: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/destination/DestinationProducers.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/destination/DestinationProducers.java	                        (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/destination/DestinationProducers.java	2010-08-04 02:45:10 UTC (rev 13552)
@@ -0,0 +1,42 @@
+/*
+ * 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.destination;
+
+import javax.annotation.Resource;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+import javax.jms.Queue;
+import javax.jms.Topic;
+
+import org.jboss.seam.jms.test.inject.destination.InjectDestinationViaResource.Q;
+import org.jboss.seam.jms.test.inject.destination.InjectDestinationViaResource.T;
+
+ at Named
+public class DestinationProducers
+{
+
+   @Resource(mappedName="/jms/T")
+   @Produces @T Topic t;
+   
+   @Resource(mappedName="/jms/Q")
+   @Produces @Q Queue q;
+}

Added: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/destination/InjectDestinationViaResource.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/destination/InjectDestinationViaResource.java	                        (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/inject/destination/InjectDestinationViaResource.java	2010-08-04 02:45:10 UTC (rev 13552)
@@ -0,0 +1,78 @@
+/*
+ * 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.destination;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+import javax.inject.Qualifier;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.Topic;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.jms.test.Util;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class InjectDestinationViaResource 
+{
+   @Qualifier
+   @Retention(RUNTIME)
+   public @interface Q {}
+
+   @Qualifier
+   @Retention(RUNTIME)
+   public @interface T {}
+   
+   @Deployment
+   public static Archive<?> createDeployment()
+   {
+      return Util.createDeployment(InjectDestinationViaResource.class);
+   }
+   
+   @Inject @T Instance<Topic> t;
+   @Inject @Q Instance<Queue> q;
+   
+   @Test
+   public void injectTopic() throws JMSException
+   {
+      Topic topic = t.get();
+      Assert.assertNotNull(topic);
+      Assert.assertEquals("T", topic.getTopicName());
+   }
+   
+   @Test
+   public void injectQueue() throws JMSException
+   {
+      Queue queue = q.get();
+      Assert.assertNotNull(queue);
+      Assert.assertNotNull("Q", queue.getQueueName());
+   }
+}



More information about the seam-commits mailing list