summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache')
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java109
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java142
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java58
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PolicyHeadersTestCase.java95
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java93
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java54
11 files changed, 839 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java
new file mode 100644
index 0000000000..dca9386637
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java
@@ -0,0 +1,54 @@
+/*
+ * 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 DefaultsTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "defaults/client.composite", "defaults/service.composite");
+ // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java
new file mode 100644
index 0000000000..f4750e5453
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java
@@ -0,0 +1,53 @@
+/*
+ * 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 DynamicReplyQTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "dynamic/client.composite", "simple/service.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Beate", helloWorldService.sayHello("Beate"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
new file mode 100644
index 0000000000..05001d2ad2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
@@ -0,0 +1,109 @@
+/*
+ * 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 static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+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 ExceptionsTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "exceptions/client.composite", "exceptions/service.composite");
+ }
+
+ @Test
+ public void testChecked() {
+ ExceptionService service = scaDomain.getService(ExceptionService.class, "ExceptionServiceClient");
+ try {
+ service.throwChecked();
+ fail();
+ } catch (CheckedExcpetion e) {
+ assertEquals("foo", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testCheckedNoArgs() {
+ ExceptionService service = scaDomain.getService(ExceptionService.class, "ExceptionServiceClient");
+ try {
+ service.throwCheckedNoArgs();
+ fail();
+ } catch (CheckedExcpetionNoArgs e) {
+ // ok
+ }
+ }
+
+ @Test
+ public void testChecked2Args() {
+ ExceptionService service = scaDomain.getService(ExceptionService.class, "ExceptionServiceClient");
+ try {
+ service.throwChecked2Args();
+ fail();
+ } catch (CheckedExcpetion2Args e) {
+ assertEquals("foo", e.getMessage());
+// FIXME: TUSCANY-2848: lost the cause!
+// assertNotNull(e.getCause());
+// assertEquals("bla", e.getCause().getMessage());
+ }
+ }
+
+ @Test
+ public void testCheckedChained() {
+ ExceptionService service = scaDomain.getService(ExceptionService.class, "ExceptionServiceClient");
+ try {
+ service.throwCheckedChained();
+ fail();
+ } catch (CheckedExcpetionChained e) {
+ // FIXME: TUSCANY-2848: lost the cause!
+// assertNotNull(e.getCause());
+// assertEquals("bla", e.getCause().getMessage());
+ }
+ }
+
+ @Test
+ public void testUnChecked() {
+ ExceptionService service = scaDomain.getService(ExceptionService.class, "ExceptionServiceClient");
+ try {
+ service.throwUnChecked();
+ fail();
+ } catch (Exception e) {
+ assertTrue(e.getCause().getMessage().startsWith("Message = java.lang.RuntimeException: bla"));
+ }
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java
new file mode 100644
index 0000000000..c34ad07901
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java
@@ -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();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java
new file mode 100644
index 0000000000..44f9754e29
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java
@@ -0,0 +1,57 @@
+/*
+ * 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 static org.junit.Assert.assertTrue;
+
+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 MessageProcessorTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "simple/mpclient.composite", "simple/mpservice.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClientMP");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ assertTrue(TestMessageProcessor.extractPayloadFromJMSMessageCalled);
+ assertTrue(TestMessageProcessor.insertPayloadIntoJMSMessageCalled);
+ assertTrue(TestMessageProcessor.setOperationNameCalled);
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java
new file mode 100644
index 0000000000..d982e651cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java
@@ -0,0 +1,142 @@
+/*
+ * 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 java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryImpl;
+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 NonSCAClientTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() throws Exception {
+ startBroker();
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "nonSCAclient/service.composite");
+ OneWayServiceImpl.name = null;
+ }
+
+ @Test
+ public void testXMLText() throws Exception {
+
+ synchronized (OneWayServiceImpl.mutex) {
+
+ sendTextMessage("dynamicQueues/OneWayService", "<ns2:sayHello xmlns:ns2=\"http://jms.binding.sca.tuscany.apache.org/\"><arg0>Petra</arg0></ns2:sayHello>");
+
+ // wait up to 10 seconds but it will likely be a lot less
+ // as the service invocation will wake this up earlier
+ if (OneWayServiceImpl.name == null) {
+ OneWayServiceImpl.mutex.wait(10000);
+ }
+ }
+ assertEquals("Petra", OneWayServiceImpl.name);
+ }
+
+ @Test
+ public void testText() throws Exception {
+
+ synchronized (OneWayServiceImpl.mutex) {
+
+ sendTextMessage("dynamicQueues/TextDest", "Petra");
+
+ // 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);
+ }
+
+ @Test
+ public void testObject() throws Exception {
+
+ Set<Integer> arg = new HashSet<Integer>();
+ arg.add(new Integer(3));
+
+ synchronized (OneWayObjectServiceImpl.mutex) {
+
+ sendObjectMessage("dynamicQueues/ObjectDest", arg);
+
+ // wait up to 10 seconds but it will likely be a lot less
+ // as the service invocation will wake this up earlier
+ OneWayObjectServiceImpl.mutex.wait(10000);
+ }
+ assertEquals(arg, OneWayObjectServiceImpl.name);
+ }
+
+ @After
+ public void end() throws Exception {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ stopBroker();
+ }
+
+ private BrokerService broker;
+ protected void startBroker() throws Exception {
+ broker = new BrokerService();
+ broker.setPersistent(false);
+ broker.setUseJmx(false);
+ broker.addConnector("tcp://localhost:61623");
+ broker.start();
+ }
+ protected void stopBroker() throws Exception {
+ if (broker != null) {
+ broker.stop();
+ }
+ }
+
+ protected static void sendTextMessage(String destName, String payload) throws JMSException, NamingException {
+ JMSResourceFactory rf = new JMSResourceFactoryImpl(null, null, null, "tcp://localhost:61623");
+ Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer p = session.createProducer(rf.lookupDestination(destName));
+ rf.getConnection().start();
+ session.run();
+ p.send(session.createTextMessage(payload));
+ rf.closeConnection();
+ }
+
+ protected static void sendObjectMessage(String destName, Object payload) throws JMSException, NamingException {
+ JMSResourceFactory rf = new JMSResourceFactoryImpl(null, null, null, "tcp://localhost:61623");
+ Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer p = session.createProducer(rf.lookupDestination(destName));
+ rf.getConnection().start();
+ session.run();
+ p.send(session.createObjectMessage((Serializable)payload));
+ rf.closeConnection();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java
new file mode 100644
index 0000000000..26dda13cf9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java
@@ -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();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PolicyHeadersTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PolicyHeadersTestCase.java
new file mode 100644
index 0000000000..5e208a3081
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PolicyHeadersTestCase.java
@@ -0,0 +1,95 @@
+/*
+ * 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 static org.junit.Assert.assertNotNull;
+
+import javax.jms.DeliveryMode;
+import javax.jms.Message;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ */
+public class PolicyHeadersTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "policyHeaders/policyHeaders.composite");
+ }
+
+ @Test
+ public void testProps1() throws Exception {
+ JMSClient client = scaDomain.getService(JMSClient.class, "ClientComponent");
+
+ client.aClientMethod();
+
+ // wait for up to 5 seconds but should wake up as soon as done
+ synchronized(MsgServiceImpl.lock) {
+ if (MsgServiceImpl.msg == null) {
+ MsgServiceImpl.lock.wait(5000); // For debugging set higher.
+ }
+ }
+ assertNotNull(MsgServiceImpl.msg);
+
+ assertEquals("myType", MsgServiceImpl.msg.getJMSType());
+ assertEquals("xyz", MsgServiceImpl.msg.getJMSCorrelationID());
+ assertEquals(DeliveryMode.PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode());
+ assertEquals(7, MsgServiceImpl.msg.getJMSPriority());
+ assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1"));
+ }
+
+ @Test
+ @Ignore
+ public void testOp2() throws Exception {
+ MsgClient client = scaDomain.getService(MsgClient.class, "ClientComponent");
+
+ client.op2();
+
+ // wait for up to 5 seconds but should wake up as soon as done
+ synchronized(MsgServiceImpl.lock) {
+ if (MsgServiceImpl.msg == null) {
+ MsgServiceImpl.lock.wait(5000);
+ }
+ }
+ assertNotNull(MsgServiceImpl.msg);
+
+ assertEquals("op2Type", MsgServiceImpl.msg.getJMSType());
+ assertEquals("op2CID", MsgServiceImpl.msg.getJMSCorrelationID());
+ assertEquals(DeliveryMode.NON_PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode());
+ assertEquals(3, MsgServiceImpl.msg.getJMSPriority());
+ assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1"));
+ assertEquals("foo", MsgServiceImpl.msg.getStringProperty("op2P2"));
+ assertEquals("nativeOp2", MsgServiceImpl.msg.getStringProperty("scaOperationName"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java
new file mode 100644
index 0000000000..e38f9104c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java
@@ -0,0 +1,93 @@
+/*
+ * 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 static org.junit.Assert.assertNotNull;
+
+import javax.jms.DeliveryMode;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ */
+public class PropertiesTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "properties/properties.composite");
+ }
+
+ @Test
+ public void testProps1() throws Exception {
+ JMSClient client = scaDomain.getService(JMSClient.class, "ClientComponent");
+
+ client.aClientMethod();
+
+ // wait for up to 10 seconds but should wake up as soon as done
+ synchronized(MsgServiceImpl.lock) {
+ if (MsgServiceImpl.msg == null) {
+ MsgServiceImpl.lock.wait(10000);
+ }
+ }
+ assertNotNull(MsgServiceImpl.msg);
+
+ assertEquals("myType", MsgServiceImpl.msg.getJMSType());
+ assertEquals("xyz", MsgServiceImpl.msg.getJMSCorrelationID());
+ assertEquals(DeliveryMode.PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode());
+ // assertEquals(3, MsgServiceImpl.msg.getJMSPriority()); // Doesn't seem to work with ActiveMQ
+ assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1"));
+ }
+
+ @Test
+ public void testOp2() throws Exception {
+ MsgClient client = scaDomain.getService(MsgClient.class, "ClientComponent");
+
+ client.op2();
+
+ // wait for up to 10 seconds but should wake up as soon as done
+ synchronized(MsgServiceImpl.lock) {
+ if (MsgServiceImpl.msg == null) {
+ MsgServiceImpl.lock.wait(10000);
+ }
+ }
+ assertNotNull(MsgServiceImpl.msg);
+
+ assertEquals("op2Type", MsgServiceImpl.msg.getJMSType());
+ assertEquals("op2CID", MsgServiceImpl.msg.getJMSCorrelationID());
+ // assertEquals(DeliveryMode.NON_PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode()); // Doesn't seem to work with ActiveMQ
+ // assertEquals(3, MsgServiceImpl.msg.getJMSPriority()); // Doesn't seem to work with ActiveMQ
+ assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1"));
+ assertEquals("foo", MsgServiceImpl.msg.getStringProperty("op2P2"));
+ //operation properties are a service side thing
+ //assertEquals("nativeOp2", MsgServiceImpl.msg.getStringProperty("scaOperationName"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java
new file mode 100644
index 0000000000..c1882a1e26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java
@@ -0,0 +1,54 @@
+/*
+ * 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 RPCTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "simple/client.composite", "simple/service.composite");
+ // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java
new file mode 100644
index 0000000000..bed5515d7f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-1.6.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java
@@ -0,0 +1,54 @@
+/*
+ * 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 URIRPCTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "simple/uriclient.composite", "simple/service.composite");
+ // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}