diff options
author | edwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-10 14:53:03 +0000 |
---|---|---|
committer | edwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-10 14:53:03 +0000 |
commit | 7d59dd8dbf5e2998d047cfa53289c7bdc7af1ec1 (patch) | |
tree | c176fe1e386b34064518199404ab02f5f3662a1e /sca-java-2.x/trunk | |
parent | 1c430adf36cc8f0b93e13bbd353c5abc632ad25e (diff) |
Adding a testcase that uses <binding.jms/> to connect reference to an async service
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1044379 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
4 files changed, 109 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/pom.xml b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/pom.xml index 7435c8dba0..94dbe0ddb7 100644 --- a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/pom.xml +++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/pom.xml @@ -42,6 +42,12 @@ <artifactId>tuscany-binding-ws-runtime-axis2</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java index eeadb48b24..f5198e7df0 100644 --- a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java +++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java @@ -43,7 +43,8 @@ public class SampleNativeAsyncTestCase { public static void setUp() throws Exception { final NodeFactory nf = NodeFactory.newInstance(); String here = SampleNativeAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString(); - node = nf.createNode(new Contribution("test", here)); + // Create the node using the pattern "name of composite file to start" / Contribution to use + node = nf.createNode("testnativeasync.composite", new Contribution("test", here)); node.start(); } diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java new file mode 100644 index 0000000000..ea988981ce --- /dev/null +++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java @@ -0,0 +1,64 @@ +/* + * 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 sample.impl; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import sample.Upper; + +/** + * Test how to run an SCA contribution containing a test composite on a + * Tuscany runtime node. + * + * @version $Rev$ $Date$ + */ +public class SampleNativeJMSAsyncTestCase { + static Node node; + + @BeforeClass + public static void setUp() throws Exception { + final NodeFactory nf = NodeFactory.newInstance(); + String here = SampleNativeJMSAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString(); + // Create the node using the pattern "name of composite file to start" / Contribution to use + node = nf.createNode("testnativejmsasync.composite", new Contribution("test", here)); + node.start(); + } + + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + } + + @Test + public void testReference() { + System.out.println("SampleNaiveAsyncTestCase.testReference"); + Upper upper = node.getService(Upper.class, "SampleNativeAsyncReference"); + final String r = upper.upper("async"); + System.out.println(r); + assertEquals("ASYNC", r); + } +} diff --git a/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite new file mode 100644 index 0000000000..6012cb25af --- /dev/null +++ b/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite @@ -0,0 +1,37 @@ +<?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://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://test" + name="testnativejmsasync"> + + <component name="SampleNativeAsyncReference"> + <t:implementation.sample class="sample.UpperSampleAsyncReferenceImpl"/> + <reference name="upper" target="SampleNativeAsyncService"/> + </component> + + <component name="SampleNativeAsyncService"> + <t:implementation.sample class="sample.UpperSampleAsyncServiceImpl"/> + <service name="Upper"> + <binding.jms/> + </service> + </component> + +</composite> |