You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2008/02/19 10:02:15 UTC

svn commit: r629033 - in /incubator/tuscany/java/sca/itest/jms: ./ src/main/resources/ src/main/resources/dynamic/ src/main/resources/oneway/ src/main/resources/simple/ src/test/java/org/apache/tuscany/sca/binding/jms/

Author: antelder
Date: Tue Feb 19 01:02:12 2008
New Revision: 629033

URL: http://svn.apache.org/viewvc?rev=629033&view=rev
Log:
Update jms itest to work with jndi resources

Added:
    incubator/tuscany/java/sca/itest/jms/src/main/resources/jndi.properties   (with props)
    incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java
Modified:
    incubator/tuscany/java/sca/itest/jms/pom.xml
    incubator/tuscany/java/sca/itest/jms/src/main/resources/dynamic/client.composite
    incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayClient.composite
    incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayService.composite
    incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/client.composite
    incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/mpclient.composite
    incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/service.composite

Modified: incubator/tuscany/java/sca/itest/jms/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/pom.xml?rev=629033&r1=629032&r2=629033&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/pom.xml (original)
+++ incubator/tuscany/java/sca/itest/jms/pom.xml Tue Feb 19 01:02:12 2008
@@ -64,16 +64,16 @@
         </dependency>
 
         <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-host-jms-activemq</artifactId>
-            <version>1.2-incubating-SNAPSHOT</version>
-            <scope>runtime</scope>
-        </dependency>
-
-        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>4.2</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-core</artifactId>
+            <version>4.1.1</version>
             <scope>test</scope>
         </dependency>
                 

Modified: incubator/tuscany/java/sca/itest/jms/src/main/resources/dynamic/client.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/resources/dynamic/client.composite?rev=629033&r1=629032&r2=629033&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/resources/dynamic/client.composite (original)
+++ incubator/tuscany/java/sca/itest/jms/src/main/resources/dynamic/client.composite Tue Feb 19 01:02:12 2008
@@ -27,7 +27,7 @@
 
     <reference name="serviceA" promote="HelloWorldClient/serviceA">
         <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
-        <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61619">
+        <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="vm://localhost">
             <destination name="DestQueueA"/>
             <response>
                <destination create="always"/>  <!-- create always with no name will create a temporary queue -->

Added: incubator/tuscany/java/sca/itest/jms/src/main/resources/jndi.properties
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/resources/jndi.properties?rev=629033&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/resources/jndi.properties (added)
+++ incubator/tuscany/java/sca/itest/jms/src/main/resources/jndi.properties Tue Feb 19 01:02:12 2008
@@ -0,0 +1,38 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+## 
+## http://www.apache.org/licenses/LICENSE-2.0
+## 
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false&useJmx=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as. 
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.MyQueue = example.MyQueue
+
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi

Propchange: incubator/tuscany/java/sca/itest/jms/src/main/resources/jndi.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/jms/src/main/resources/jndi.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/itest/jms/src/main/resources/jndi.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayClient.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayClient.composite?rev=629033&r1=629032&r2=629033&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayClient.composite (original)
+++ incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayClient.composite Tue Feb 19 01:02:12 2008
@@ -27,7 +27,7 @@
 
     <reference name="serviceA" promote="OneWayClient/serviceA">
         <interface.java interface="org.apache.tuscany.sca.binding.jms.OneWayService" />
-        <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61619">
+        <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="vm://localhost" >
             <destination name="DestQueueA"/>
         </binding.jms>  
     </reference>

Modified: incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayService.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayService.composite?rev=629033&r1=629032&r2=629033&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayService.composite (original)
+++ incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayService.composite Tue Feb 19 01:02:12 2008
@@ -23,7 +23,7 @@
     <component name="OneWayService">
         <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayServiceImpl"/>
         <service name="OneWayService">
-            <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61619">
+            <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="vm://localhost?broker.persistent=false">
                <destination name="DestQueueA" create="always"/>
             </binding.jms>  
         </service> 

Modified: incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/client.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/client.composite?rev=629033&r1=629032&r2=629033&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/client.composite (original)
+++ incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/client.composite Tue Feb 19 01:02:12 2008
@@ -27,7 +27,7 @@
 
     <reference name="serviceA" promote="HelloWorldClient/serviceA">
         <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
-        <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61619">
+        <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="vm://localhost">
             <destination name="DestQueueA"/>
             <response>
                <destination name="RespQueueA"/>

Modified: incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/mpclient.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/mpclient.composite?rev=629033&r1=629032&r2=629033&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/mpclient.composite (original)
+++ incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/mpclient.composite Tue Feb 19 01:02:12 2008
@@ -27,8 +27,8 @@
 
     <reference name="serviceA" promote="HelloWorldClient/serviceA">
         <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
-        <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
-                     jndiURL="tcp://localhost:61619" messageProcessor="org.apache.tuscany.sca.binding.jms.TestMessageProcessor">
+        <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" 
+                         jndiURL="vm://localhost" messageProcessor="org.apache.tuscany.sca.binding.jms.TestMessageProcessor">
             <destination name="DestQueueA"/>
             <response>
                <destination name="RespQueueA"/>

Modified: incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/service.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/service.composite?rev=629033&r1=629032&r2=629033&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/service.composite (original)
+++ incubator/tuscany/java/sca/itest/jms/src/main/resources/simple/service.composite Tue Feb 19 01:02:12 2008
@@ -23,7 +23,7 @@
     <component name="HelloWorldService">
         <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
         <service name="HelloWorldService">
-            <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61619">
+            <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="vm://localhost?broker.persistent=false">
                <destination name="DestQueueA" create="always"/>
                <response>
                   <destination name="RespQueueA" create="always"/>

Added: incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java?rev=629033&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java Tue Feb 19 01:02:12 2008
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.sca.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests using the JMS binding with an external JMS broker
+ */
+public class ExternalBrokerTestCase {
+
+    private static SCADomain scaDomain;
+    private BrokerService broker;
+
+    @Before
+    public void init() throws Exception {
+        startBroker();
+        scaDomain = SCADomain.newInstance("http://localhost", "/", "external/client.composite", "external/service.composite");
+    }
+
+    @Test
+    public void testHelloWorldCreate() throws Exception {
+        HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+        assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+    }
+
+    @After
+    public void end() throws Exception {
+        if (scaDomain != null) {
+            scaDomain.close();
+        }
+        stopBroker();
+    }
+
+    protected void startBroker() throws Exception {
+        broker = new BrokerService();
+        broker.setPersistent(false);
+        broker.setUseJmx(false);
+        broker.addConnector("tcp://localhost:61616");
+        broker.start();
+    }
+    protected void stopBroker() throws Exception {
+        if (broker != null) {
+            broker.stop();
+        }
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org