tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r718645 - in /tuscany/branches/sca-java-1.x/itest/jms-topics: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/sca/ src/main/java/org/apache/tus...
Date Tue, 18 Nov 2008 16:40:29 GMT
Author: antelder
Date: Tue Nov 18 08:40:28 2008
New Revision: 718645

URL: http://svn.apache.org/viewvc?rev=718645&view=rev
Log:
Add a jms itest using topics

Added:
    tuscany/branches/sca-java-1.x/itest/jms-topics/   (with props)
    tuscany/branches/sca-java-1.x/itest/jms-topics/pom.xml
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/jndi.properties
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsClient.composite
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsService.composite
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/
    tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java

Propchange: tuscany/branches/sca-java-1.x/itest/jms-topics/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Nov 18 08:40:28 2008
@@ -0,0 +1,20 @@
+target
+work
+dojo
+*.iws
+*.ipr
+*.iml
+derby.log
+maven.log
+maven-eclipse.xml
+build.xml
+build-dependency.xml
+velocity.log*
+junit*.properties
+surefire*.properties
+.project
+.classpath
+.settings
+.deployables
+.wtpmodules
+.externalToolBuilders

Added: tuscany/branches/sca-java-1.x/itest/jms-topics/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/pom.xml?rev=718645&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/jms-topics/pom.xml (added)
+++ tuscany/branches/sca-java-1.x/itest/jms-topics/pom.xml Tue Nov 18 08:40:28 2008
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * 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.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-itest</artifactId>
+        <version>1.4-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <artifactId>itest-jms-topics</artifactId>
+    <name>Apache Tuscany SCA JMS Tests for topics</name>
+
+    <repositories>
+       <repository>
+          <id>apache.incubator</id>
+          <url>http://people.apache.org/repo/m2-incubating-repository</url>
+       </repository>
+    </repositories>
+
+    <dependencies>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>        
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-embedded</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency> 
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-jms-runtime</artifactId>
+            <version>1.4-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.5</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-node-impl</artifactId>
+            <version>1.4-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+
+        <!--  uses ActiveMQ 5.1 as 4.1 Session.createQueue does not work using
+              a temporary queue name -->
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-core</artifactId>
+            <version>5.1.0</version>
+            <scope>test</scope>
+        </dependency>
+                
+    </dependencies>
+
+    <build>
+       <finalName>${artifactId}</finalName>
+    </build>
+</project>

Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java?rev=718645&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
(added)
+++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
Tue Nov 18 08:40:28 2008
@@ -0,0 +1,41 @@
+/*
+ * 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 org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the OneWay service.
+ */
+@Service(OneWayService.class)
+public class OneWayClientImpl implements OneWayService {
+
+    private OneWayService serviceA;
+
+    @Reference
+    public void setServiceA(OneWayService service) {
+        this.serviceA = service;
+    }
+
+    public void sayHello(String name) {
+        serviceA.sayHello(name);
+    }
+
+}

Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java?rev=718645&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
(added)
+++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
Tue Nov 18 08:40:28 2008
@@ -0,0 +1,29 @@
+/*
+ * 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 org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface OneWayService {
+    
+    @OneWay
+    void sayHello(String name);
+}

Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java?rev=718645&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
(added)
+++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
Tue Nov 18 08:40:28 2008
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+public class OneWayServiceImpl implements OneWayService {
+
+    public static Object mutex = new Object();
+    public static String name;
+    
+    public void sayHello(String name) {
+        OneWayServiceImpl.name = name;
+        synchronized (OneWayServiceImpl.mutex) {
+            OneWayServiceImpl.mutex.notify();
+        }
+    }
+
+}

Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/jndi.properties
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/jndi.properties?rev=718645&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/jndi.properties (added)
+++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/jndi.properties Tue
Nov 18 08:40:28 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&broker.useJmx=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as. 
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi

Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsClient.composite
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsClient.composite?rev=718645&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsClient.composite
(added)
+++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsClient.composite
Tue Nov 18 08:40:28 2008
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           name="TopicsClientComposite">
+
+    <component name="OneWayClient">
+        <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayClientImpl"/>
+        <reference name="serviceA" />
+    </component>
+
+    <reference name="serviceA" promote="OneWayClient/serviceA">
+        <interface.java interface="org.apache.tuscany.sca.binding.jms.OneWayService" />
+        <binding.jms>
+            <destination name="MyTopic" type="topic" create="never"/>
+        </binding.jms>  
+    </reference>
+
+</composite>

Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsService.composite
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsService.composite?rev=718645&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsService.composite
(added)
+++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/main/resources/topics/TopicsService.composite
Tue Nov 18 08:40:28 2008
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           name="OneWayServiceComposite">
+
+    <component name="OneWayService">
+        <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayServiceImpl"/>
+        <service name="OneWayService">
+            <binding.jms>
+               <destination name="MyTopic" type="topic" create="never"/>
+            </binding.jms>  
+        </service> 
+    </component>       
+
+</composite>

Added: tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java?rev=718645&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java
(added)
+++ tuscany/branches/sca-java-1.x/itest/jms-topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java
Tue Nov 18 08:40:28 2008
@@ -0,0 +1,58 @@
+/*
+ * 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.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class TopicsTestCase {
+
+    private static SCADomain scaDomain;
+
+    @Before
+    public void init() {
+        scaDomain = SCADomain.newInstance("http://localhost", "/", "topics/TopicsClient.composite",
"topics/TopicsService.composite");
+    }
+
+    @Test
+    public void testOneWayInvoked() throws Exception {
+        OneWayService oneWayService = scaDomain.getService(OneWayService.class, "OneWayClient");
+        oneWayService.sayHello("Petra");
+        synchronized (OneWayServiceImpl.mutex) {
+            // wait up to 10 seconds but it will likely be a lot less 
+            // as the service invocation will wake this up earlier 
+            OneWayServiceImpl.mutex.wait(10000);
+        }
+        assertEquals("Petra", OneWayServiceImpl.name);
+    }
+
+    @After
+    public void end() {
+        if (scaDomain != null) {
+            scaDomain.close();
+        }
+    }
+}



Mime
View raw message