You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ed...@apache.org on 2010/12/10 15:53:03 UTC
svn commit: r1044379 - in
/tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample:
./ src/test/java/sample/impl/ src/test/resources/
Author: edwardsmj
Date: Fri Dec 10 14:53:03 2010
New Revision: 1044379
URL: http://svn.apache.org/viewvc?rev=1044379&view=rev
Log:
Adding a testcase that uses <binding.jms/> to connect reference to an async service
Added:
tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java (with props)
tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite (with props)
Modified:
tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/pom.xml
tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java
Modified: tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/pom.xml?rev=1044379&r1=1044378&r2=1044379&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/pom.xml Fri Dec 10 14:53:03 2010
@@ -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>
Modified: tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java?rev=1044379&r1=1044378&r2=1044379&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeAsyncTestCase.java Fri Dec 10 14:53:03 2010
@@ -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();
}
Added: tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java?rev=1044379&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java (added)
+++ tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java Fri Dec 10 14:53:03 2010
@@ -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);
+ }
+}
Propchange: tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/java/sample/impl/SampleNativeJMSAsyncTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite?rev=1044379&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite (added)
+++ tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite Fri Dec 10 14:53:03 2010
@@ -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>
Propchange: tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sca-java-2.x/trunk/samples/extending-tuscany/implementation-sample/src/test/resources/testnativejmsasync.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date