diff options
9 files changed, 248 insertions, 3 deletions
diff --git a/branches/sca-java-1.x/itest/jms-responsecf/pom.xml b/branches/sca-java-1.x/itest/jms-responsecf/pom.xml new file mode 100644 index 0000000000..502e0ca6f4 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-responsecf/pom.xml @@ -0,0 +1,109 @@ +<?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.5-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-jms-responsecf</artifactId>
+ <name>Apache Tuscany SCA iTest JMS Response ConnectionFactory</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.5-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-policy</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jms-asf</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/branches/sca-java-1.x/itest/jms-responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/branches/sca-java-1.x/itest/jms-responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java new file mode 100644 index 0000000000..1f310e0685 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java @@ -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 HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldClientImpl implements HelloWorldService {
+
+ private HelloWorldService serviceA;
+
+ @Reference
+ public void setServiceA(HelloWorldService service) {
+ this.serviceA = service;
+ }
+
+ public String sayHello(String name) {
+ return serviceA.sayHello(name);
+ }
+
+}
diff --git a/branches/sca-java-1.x/itest/jms-responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/branches/sca-java-1.x/itest/jms-responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java new file mode 100644 index 0000000000..28b281a0c4 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java @@ -0,0 +1,26 @@ +/*
+ * 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.Remotable;
+
+@Remotable
+public interface HelloWorldService {
+ String sayHello(String name);
+}
diff --git a/branches/sca-java-1.x/itest/jms-responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/branches/sca-java-1.x/itest/jms-responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..2c6d9d0d17 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java @@ -0,0 +1,30 @@ +/*
+ * 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 HelloWorldServiceImpl implements HelloWorldService {
+
+ public String sayHello(String name) {
+ if ("bang".equals(name)) {
+ throw new RuntimeException("blem wit");
+ }
+ return "jmsHello " + name;
+ }
+
+}
diff --git a/branches/sca-java-1.x/itest/jms/src/main/resources/cf/client.composite b/branches/sca-java-1.x/itest/jms-responsecf/src/main/resources/cf/client.composite index ed0c8bfcdd..3e16e794cb 100644 --- a/branches/sca-java-1.x/itest/jms/src/main/resources/cf/client.composite +++ b/branches/sca-java-1.x/itest/jms-responsecf/src/main/resources/cf/client.composite @@ -30,7 +30,6 @@ <binding.jms>
<destination name="DestQueueA"/>
<response>
- <connectionFactory name="ResponseCF"/>
<destination name="RespQueueA"/>
</response>
</binding.jms>
diff --git a/branches/sca-java-1.x/itest/jms/src/main/resources/cf/service.composite b/branches/sca-java-1.x/itest/jms-responsecf/src/main/resources/cf/service.composite index 2ab92923f6..e5fb258666 100644 --- a/branches/sca-java-1.x/itest/jms/src/main/resources/cf/service.composite +++ b/branches/sca-java-1.x/itest/jms-responsecf/src/main/resources/cf/service.composite @@ -26,6 +26,7 @@ <binding.jms>
<destination name="DestQueueA" create="always"/>
<response>
+ <connectionFactory name="ResponseCF"/>
<destination name="RespQueueA" create="always"/>
</response>
</binding.jms>
diff --git a/branches/sca-java-1.x/itest/jms-responsecf/src/main/resources/jndi.properties b/branches/sca-java-1.x/itest/jms-responsecf/src/main/resources/jndi.properties new file mode 100644 index 0000000000..5bbadf8306 --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-responsecf/src/main/resources/jndi.properties @@ -0,0 +1,39 @@ +## ---------------------------------------------------------------------------
+## 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
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory, ResponseCF
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.RequestQueue = RequestQueue
+queue.ResponseQueue = ResponseQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi
diff --git a/branches/sca-java-1.x/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ResponseCFTestCase.java b/branches/sca-java-1.x/itest/jms-responsecf/src/test/java/org/apache/tuscany/sca/binding/jms/ResponseCFTestCase.java index fd7b167963..fd7b167963 100644 --- a/branches/sca-java-1.x/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ResponseCFTestCase.java +++ b/branches/sca-java-1.x/itest/jms-responsecf/src/test/java/org/apache/tuscany/sca/binding/jms/ResponseCFTestCase.java diff --git a/branches/sca-java-1.x/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java b/branches/sca-java-1.x/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java index fc47211f46..eda9b5160e 100644 --- a/branches/sca-java-1.x/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java +++ b/branches/sca-java-1.x/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java @@ -121,7 +121,7 @@ public class NonSCAClientTestCase { } protected static void sendTextMessage(String destName, String payload) throws JMSException, NamingException { - JMSResourceFactory rf = new JMSResourceFactoryImpl(null, null, "tcp://localhost:61618"); + JMSResourceFactory rf = new JMSResourceFactoryImpl(null, null, null, "tcp://localhost:61618"); Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer p = session.createProducer(rf.lookupDestination(destName)); rf.getConnection().start(); @@ -131,7 +131,7 @@ public class NonSCAClientTestCase { } protected static void sendObjectMessage(String destName, Object payload) throws JMSException, NamingException { - JMSResourceFactory rf = new JMSResourceFactoryImpl(null, null, "tcp://localhost:61618"); + JMSResourceFactory rf = new JMSResourceFactoryImpl(null, null, null, "tcp://localhost:61618"); Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer p = session.createProducer(rf.lookupDestination(destName)); rf.getConnection().start(); |