[jboss-svn-commits] JBL Code SVN: r11915 - in labs/jbossesb/trunk/qa/junit: resources/server and 5 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu May 17 16:33:30 EDT 2007


Author: bill.burke at jboss.com
Date: 2007-05-17 16:33:30 -0400 (Thu, 17 May 2007)
New Revision: 11915

Added:
   labs/jbossesb/trunk/qa/junit/resources/server/jca/
   labs/jbossesb/trunk/qa/junit/resources/server/jca/META-INF/
   labs/jbossesb/trunk/qa/junit/resources/server/jca/META-INF/jboss-esb.xml
   labs/jbossesb/trunk/qa/junit/resources/server/jca/esb-jbm-service.xml
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/CustomGateway.java
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/MdbEndpoint.java
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/unit/
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/unit/JcaUnitTestCase.java
Modified:
   labs/jbossesb/trunk/qa/junit/build.xml
Log:
jca gateway tests.  Forgot to check them in yesterday

Modified: labs/jbossesb/trunk/qa/junit/build.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/build.xml	2007-05-17 20:25:57 UTC (rev 11914)
+++ labs/jbossesb/trunk/qa/junit/build.xml	2007-05-17 20:33:30 UTC (rev 11915)
@@ -102,6 +102,21 @@
             <include name="META-INF/*.xml"/>
          </fileset>
       </jar>
+      <jar jarfile="${qa.build.lib}/jca-test.esb">
+         <fileset dir="${qa.junit.classes}">
+            <include name="org/jboss/soa/esb/server/*.class"/>
+         </fileset>
+         <fileset dir="${qa.junit.classes}">
+            <include name="org/jboss/soa/esb/server/jca/*.class"/>
+         </fileset>
+         <fileset dir="${qa.junit.resources}/server/simple">
+            <include name="test-service.xml"/>
+         </fileset>
+         <fileset dir="${qa.junit.resources}/server/jca">
+            <include name="esb-jbm-service.xml"/>
+            <include name="META-INF/*.xml"/>
+         </fileset>
+      </jar>
    </target>
 
    <target name="one-test" if="test"

Added: labs/jbossesb/trunk/qa/junit/resources/server/jca/META-INF/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/jca/META-INF/jboss-esb.xml	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/jca/META-INF/jboss-esb.xml	2007-05-17 20:33:30 UTC (rev 11915)
@@ -0,0 +1,69 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
+          parameterReloadSecs="5">
+
+   <providers>
+      <jms-provider name="JBossMQ" connection-factory="ConnectionFactory"
+                    jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+                    jndi-URL="localhost">
+
+         <jms-bus busid="esb-channel">
+            <jms-message-filter
+                    dest-type="QUEUE"
+                    dest-name="queue/esb_channel"
+                    />
+         </jms-bus>
+      </jms-provider>
+      <provider name="syntax-sugar">
+         <bus busid="syntax-sugar-bus"/>
+      </provider>
+   </providers>
+
+   <services>
+
+      <service category="HelloWorld_ActionESB"
+               name="SimpleListener"
+               description="Hello World">
+         <listeners>
+            <listener name="JMS-JCA-Gateway"
+                      busidref="syntax-sugar-bus"
+                      is-gateway="true">
+               <property name="gatewayClass" value="org.jboss.soa.esb.listeners.jca.JcaInflowGateway"/>
+               <property name="adapter" value="jms-ra.rar"/>
+               <property name="endpointClass" value="org.jboss.soa.esb.server.jca.MdbEndpoint"/>
+               <property name="activation">
+                  <activation-config>
+                     <activation-config-property>
+                        <activation-config-property-name>
+                           destinationType
+                        </activation-config-property-name>
+                        <activation-config-property-value>
+                           javax.jms.Queue
+                        </activation-config-property-value>
+                     </activation-config-property>
+                     <activation-config-property>
+                        <activation-config-property-name>
+                           destination
+                        </activation-config-property-name>
+                        <activation-config-property-value>
+                           queue/esb_gateway_channel
+                        </activation-config-property-value>
+                     </activation-config-property>
+                  </activation-config>
+               </property>
+            </listener>
+            <jms-listener name="JMS-ESBListener"
+                          busidref="esb-channel"
+                          maxThreads="1"
+                    />
+         </listeners>
+         <actions>
+            <action name="displayAction"
+                    class="org.jboss.soa.esb.server.MyAction"
+                    process="process">
+            </action>
+         </actions>
+      </service>
+   </services>
+
+</jbossesb>

Added: labs/jbossesb/trunk/qa/junit/resources/server/jca/esb-jbm-service.xml
===================================================================
--- labs/jbossesb/trunk/qa/junit/resources/server/jca/esb-jbm-service.xml	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/resources/server/jca/esb-jbm-service.xml	2007-05-17 20:33:30 UTC (rev 11915)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=esb_gateway_channel"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+
+   <mbean code="org.jboss.jms.server.destination.QueueService"
+      name="jboss.messaging.destination:service=Queue,name=esb_channel"
+      xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+      <depends>jboss.messaging:service=PostOffice</depends>
+   </mbean>
+</server>

Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/CustomGateway.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/CustomGateway.java	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/CustomGateway.java	2007-05-17 20:33:30 UTC (rev 11915)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.soa.esb.server.jca;
+
+import org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.ConfigurationException;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class CustomGateway  extends AbstractThreadedManagedLifecycle
+{
+
+
+   public CustomGateway(final ConfigTree config)
+           throws ConfigurationException
+   {
+      super(config);
+      System.out.println("\n\n********** YO CONFIG****: \n" + config.toString());
+   }
+
+   protected void doRun()
+   {
+      System.out.println("DO RUN");
+
+   }
+
+   protected void doInitialise() throws ManagedLifecycleException
+   {
+      System.out.println("DO INITIALISE");
+   }
+}

Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/MdbEndpoint.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/MdbEndpoint.java	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/MdbEndpoint.java	2007-05-17 20:33:30 UTC (rev 11915)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.soa.esb.server.jca;
+
+import org.jboss.soa.esb.listeners.ServiceInvoker;
+import org.jboss.soa.esb.listeners.gateway.PackageJmsMessageContents;
+import org.jboss.soa.esb.listeners.jca.InflowGateway;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class MdbEndpoint implements InflowGateway, MessageListener
+{
+   private ServiceInvoker service;
+   private PackageJmsMessageContents transformer = new PackageJmsMessageContents();
+
+   public void setServiceInvoker(ServiceInvoker invoker)
+   {
+      this.service = invoker;
+   }
+
+   public void onMessage(Message message)
+   {
+      try
+      {
+         System.out.println("HERE in ENDPOINT!!!!!");
+         org.jboss.soa.esb.message.Message esbMessage = transformer.process(message);
+         service.postMessage(esbMessage);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+}

Added: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/unit/JcaUnitTestCase.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/unit/JcaUnitTestCase.java	                        (rev 0)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/jca/unit/JcaUnitTestCase.java	2007-05-17 20:33:30 UTC (rev 11915)
@@ -0,0 +1,92 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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.soa.esb.server.jca.unit;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.soa.esb.server.StatsMBean;
+import org.jboss.soa.esb.server.unit.SimpleDeployUnitTestCase;
+
+import javax.naming.InitialContext;
+import javax.jms.ConnectionFactory;
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.QueueSession;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+/**
+ * Sample client for the jboss container.
+ *
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Id: BlobUnitTestCase.java 58110 2006-11-04 08:34:21Z scott.stark at jboss.org $
+ */
+
+public class JcaUnitTestCase
+        extends JBossTestCase
+{
+   org.jboss.logging.Logger log = getLog();
+
+   static boolean deployed = false;
+   static int test = 0;
+
+   public JcaUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void sendAMessage(String msg, String destination) throws Exception
+   {
+
+      InitialContext iniCtx = getInitialContext();
+      Object tmp = iniCtx.lookup("ConnectionFactory");
+      ConnectionFactory qcf = (ConnectionFactory) tmp;
+      Connection conn = qcf.createConnection();
+      Destination que = (Queue) iniCtx.lookup(destination);
+      Session session = conn.createSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+      conn.start();
+      MessageProducer send = session.createProducer(que);
+      ObjectMessage tm = session.createObjectMessage(msg);
+      send.send(tm);
+      send.close();
+      conn.close();
+   }
+
+   public void testSimple() throws Exception
+   {
+      sendAMessage("Hello World", "queue/esb_gateway_channel");
+      Thread.sleep(2000); // wait for message to post.
+      String version = (String)getServer().getAttribute(new ObjectName(StatsMBean.objectName), "ExecutedVersion");
+      assertEquals(version, "scope1");
+
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(JcaUnitTestCase.class, "jca-test.esb");
+   }
+
+}




More information about the jboss-svn-commits mailing list