tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r609150 - in /incubator/tuscany/java/sca/itest/jms/src: main/java/org/apache/tuscany/sca/binding/jms/ main/resources/oneway/ test/java/org/apache/tuscany/sca/binding/jms/
Date Sat, 05 Jan 2008 15:17:28 GMT
Author: antelder
Date: Sat Jan  5 07:16:30 2008
New Revision: 609150

URL: http://svn.apache.org/viewvc?rev=609150&view=rev
Log:
Add jms itest for oneway invocations

Added:
    incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
  (with props)
    incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
  (with props)
    incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
  (with props)
    incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/
    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/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java
  (with props)

Added: incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java?rev=609150&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
(added)
+++ incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
Sat Jan  5 07:16:30 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);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java?rev=609150&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
(added)
+++ incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
Sat Jan  5 07:16:30 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);
+}

Propchange: incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java?rev=609150&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
(added)
+++ incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
Sat Jan  5 07:16:30 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();
+        }
+    }
+
+}

Propchange: incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 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=609150&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayClient.composite
(added)
+++ incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayClient.composite
Sat Jan  5 07:16:30 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="OneWayComposite">
+
+    <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 initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
jndiURL="tcp://localhost:61616">
+            <destination name="DestQueueA"/>
+        </binding.jms>  
+    </reference>
+
+</composite>

Added: 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=609150&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayService.composite
(added)
+++ incubator/tuscany/java/sca/itest/jms/src/main/resources/oneway/OneWayService.composite
Sat Jan  5 07:16:30 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="OneWayComposite">
+
+    <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:61616">
+               <destination name="DestQueueA" create="always"/>
+            </binding.jms>  
+        </service> 
+    </component>       
+
+</composite>

Added: incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java?rev=609150&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java
(added)
+++ incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java
Sat Jan  5 07:16:30 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 OneWayTestCase {
+
+    private static SCADomain scaDomain;
+
+    @Before
+    public void init() {
+        scaDomain = SCADomain.newInstance("http://localhost", "/", "oneway/OneWayClient.composite",
"oneway/OneWayService.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();
+        }
+    }
+}

Propchange: incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



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


Mime
View raw message