summaryrefslogtreecommitdiffstats
path: root/sandbox/sebastien/java/extend/samples/implementation-extension/src/test
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-08-29 17:44:58 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-08-29 17:44:58 +0000
commit3518556b241cf0ae6f71be798a35eeed4e3c8502 (patch)
treee0eef5fbafe7878d4c1455748abc0ed373199606 /sandbox/sebastien/java/extend/samples/implementation-extension/src/test
parentc6b787e89938ab5d3241094b2e31eb0c00e9f2f9 (diff)
Sample implementation extension that shows how to support both Java and WSDL interfaces and different data bindings.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@990608 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Client.java30
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/ClientTest.java59
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Hello.java28
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/JelloTest.java40
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Upper.java28
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/UpperTest.java37
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/WelloTest.java50
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Xutil.java142
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java83
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java70
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Hello.wsdl62
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Upper.wsdl62
-rw-r--r--sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/test.composite45
13 files changed, 736 insertions, 0 deletions
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Client.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Client.java
new file mode 100644
index 0000000000..4c473c987f
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Client.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 sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Client {
+
+ String jello(String s);
+
+ String wello(String s);
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/ClientTest.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/ClientTest.java
new file mode 100644
index 0000000000..46350e26d6
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/ClientTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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;
+
+import static java.lang.System.out;
+import static sample.Xutil.dom;
+import static sample.Xutil.elem;
+import static sample.Xutil.text;
+import static sample.Xutil.xpath;
+
+import org.w3c.dom.Element;
+
+import sample.api.Java;
+import sample.api.WSDL;
+import sample.api.WSDLReference;
+
+/**
+ * Sample component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Java(Client.class)
+public class ClientTest {
+
+ @Java(Hello.class)
+ Hello jello;
+
+ @WSDL("http://sample#Hello")
+ WSDLReference wello;
+
+ public String jello(String s) {
+ out.println("ClientTest.jello(" + s + ")");
+ return jello.hello(s);
+ }
+
+ public String wello(String s) {
+ out.println("ClientTest.wello(" + s + ")");
+ final Element hreq = dom("http://sample", "hello", elem("name", text(s)));
+ final Element hres = wello.call("hello", hreq);
+ return xpath("//*", hres);
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Hello.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Hello.java
new file mode 100644
index 0000000000..f6e02591e5
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Hello.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Hello {
+
+ String hello(String s);
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/JelloTest.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/JelloTest.java
new file mode 100644
index 0000000000..53ed006132
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/JelloTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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;
+
+import static java.lang.System.out;
+import sample.api.Java;
+
+/**
+ * Sample component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Java(Hello.class)
+public class JelloTest {
+
+ @Java(Upper.class)
+ Upper upper;
+
+ public String hello(String s) {
+ out.println("JelloTest.hello(" + s + ")");
+ return upper.upper("Hello " + s);
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Upper.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Upper.java
new file mode 100644
index 0000000000..04e929ade7
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Upper.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Upper {
+
+ String upper(String s);
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/UpperTest.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/UpperTest.java
new file mode 100644
index 0000000000..fe90097efa
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/UpperTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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;
+
+import static java.lang.System.out;
+import sample.api.Java;
+
+/**
+ * Sample component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Java(Upper.class)
+public class UpperTest {
+
+ public String upper(String s) {
+ out.println("UpperTest.upper(" + s + ")");
+ return s.toUpperCase();
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/WelloTest.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/WelloTest.java
new file mode 100644
index 0000000000..2f647d1a8f
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/WelloTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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;
+
+import static java.lang.System.out;
+import static sample.Xutil.dom;
+import static sample.Xutil.elem;
+import static sample.Xutil.text;
+import static sample.Xutil.xpath;
+
+import org.w3c.dom.Element;
+
+import sample.api.WSDL;
+import sample.api.WSDLReference;
+
+/**
+ * Sample component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+@WSDL("http://sample#Hello")
+public class WelloTest {
+
+ @WSDL("http://sample#Upper")
+ WSDLReference upper;
+
+ public Element call(String op, Element e) {
+ out.println("WelloTest." + op + "(" + Xutil.xml(e) + ")");
+ final Element ureq = dom("http://sample", "upper", elem("s", text("Hello " + xpath("//name", e))));
+ final Element ures = upper.call("upper", ureq);
+ return dom("http://sample", "helloResponse", elem("result", text(xpath("//*", ures))));
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Xutil.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Xutil.java
new file mode 100644
index 0000000000..91af7c47e9
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/Xutil.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 sample;
+
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * A little bit of magic code and utility functions to help work with DOM.
+ */
+class Xutil {
+ static class NodeBuilder {
+ String ns;
+ String name;
+ NodeBuilder[] children;
+ String text;
+ }
+
+ /**
+ * Convert a name and a list of children to a document element.
+ */
+ static Element dom(String ns, String name, final NodeBuilder... nodes) {
+ return (Element)node(elem(ns, name, nodes), db.newDocument());
+ }
+
+ /**
+ * Convert a name and children to an element.
+ */
+ static NodeBuilder elem(final String uri, final String n, final NodeBuilder... nodes) {
+ return new NodeBuilder() {
+ {
+ this.ns = uri;
+ this.name = n;
+ this.children = nodes;
+ }
+ };
+ }
+
+ static NodeBuilder elem(final String n, final NodeBuilder... nodes) {
+ return new NodeBuilder() {
+ {
+ this.name = n;
+ this.children = nodes;
+ }
+ };
+ }
+
+ /**
+ * Convert a string to a text element.
+ */
+ static NodeBuilder text(final String t) {
+ return new NodeBuilder() {
+ {
+ this.text = t;
+ }
+ };
+ }
+
+ private final static DocumentBuilder db = db();
+
+ private static DocumentBuilder db() {
+ try {
+ return DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ } catch(ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static Element link(final Element e, final Document doc, final NodeBuilder... nodes) {
+ for(final NodeBuilder c: nodes)
+ e.appendChild(node(c, doc));
+ return e;
+ }
+
+ private static Node node(NodeBuilder node, Document doc) {
+ if(node.text != null)
+ return doc.createTextNode(node.text);
+ return link(doc.createElementNS(node.ns, node.name), doc, node.children);
+ }
+
+ /**
+ * Convert an element to XML.
+ */
+ static TransformerFactory trf = TransformerFactory.newInstance();
+
+ static String xml(final Node node) {
+ try {
+ final StreamResult r = new StreamResult(new StringWriter());
+ trf.newTransformer().transform(new DOMSource(node), r);
+ return r.getWriter().toString();
+ } catch(TransformerException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Evaluate an xpath expression.
+ */
+ private static XPathFactory xpf = XPathFactory.newInstance();
+
+ static String xpath(final String expr, final Node node) {
+ final XPath xp = xpf.newXPath();
+ try {
+ return (String)xp.evaluate(expr, node, XPathConstants.STRING);
+ } catch(XPathExpressionException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java
new file mode 100644
index 0000000000..8d01c82edf
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/ReadWriteTestCase.java
@@ -0,0 +1,83 @@
+/*
+ * 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 static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test reading/writing Sample implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadWriteTestCase {
+ static XMLInputFactory xif;
+ static XMLOutputFactory xof;
+ static StAXArtifactProcessor<Object> xproc;
+ static ProcessorContext ctx;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ final DefaultExtensionPointRegistry ep = new DefaultExtensionPointRegistry();
+ final Contribution contrib = new DefaultContributionFactory().createContribution();
+ contrib.setLocation(ReadWriteTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString());
+ ctx = new ProcessorContext(contrib, null);
+ xif = XMLInputFactory.newInstance();
+ xof = XMLOutputFactory.newInstance();
+ final StAXArtifactProcessorExtensionPoint xpep = new DefaultStAXArtifactProcessorExtensionPoint(ep);
+ xproc = new ExtensibleStAXArtifactProcessor(xpep, xif, xof);
+ }
+
+ @Test
+ public void testRead() throws Exception {
+ final InputStream is = getClass().getClassLoader().getResourceAsStream("test.composite");
+ final Composite c = (Composite)xproc.read(xif.createXMLStreamReader(is), ctx);
+ assertNotNull(c);
+ assertEquals("sample.ClientTest", ((SampleImplementation)c.getComponents().get(0).getImplementation()).name);
+ }
+
+ @Test
+ public void testReadWrite() throws Exception {
+ final InputStream is = getClass().getClassLoader().getResourceAsStream("test.composite");
+ final Composite c = (Composite)xproc.read(xif.createXMLStreamReader(is), ctx);
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ xproc.write(c, xof.createXMLStreamWriter(bos), ctx);
+ assertTrue(bos.toString().contains("class=\"sample.WelloTest\""));
+ }
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.java
new file mode 100644
index 0000000000..26cbd5d3e4
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/java/sample/impl/RunTestCase.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 sample.impl;
+
+import static java.lang.System.out;
+
+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.Client;
+
+/**
+ * Test run.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RunTestCase {
+ static Node node;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ final NodeFactory nf = NodeFactory.newInstance();
+ final String here = RunTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString();
+ node = nf.createNode(new Contribution("test", here));
+ node.start();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.stop();
+ }
+
+ Client client() {
+ return node.getService(Client.class, "client-test/Client");
+ }
+
+ @Test
+ public void jello() {
+ out.println("RunTestCase.jello");
+ out.println(client().jello("Java"));
+ }
+
+ @Test
+ public void wello() {
+ out.println("RunTestCase.wello");
+ out.println(client().wello("WSDL"));
+ }
+
+}
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Hello.wsdl b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Hello.wsdl
new file mode 100644
index 0000000000..561e560e7a
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Hello.wsdl
@@ -0,0 +1,62 @@
+<?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.
+-->
+<wsdl:definitions targetNamespace="http://sample" xmlns:tns="http://sample"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Hello">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://sample"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="helloResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="helloRequest">
+ <wsdl:part element="tns:hello" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="helloResponse">
+ <wsdl:part element="tns:helloResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="Hello">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:helloRequest" name="helloRequest" />
+ <wsdl:output message="tns:helloResponse" name="helloResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Upper.wsdl b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Upper.wsdl
new file mode 100644
index 0000000000..60eaec9f27
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/Upper.wsdl
@@ -0,0 +1,62 @@
+<?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.
+-->
+<wsdl:definitions targetNamespace="http://sample" xmlns:tns="http://sample"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Upper">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://sample"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="upper">
+ <complexType>
+ <sequence>
+ <element name="s" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="upperResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="upperRequest">
+ <wsdl:part element="tns:upper" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="upperResponse">
+ <wsdl:part element="tns:upperResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="Upper">
+ <wsdl:operation name="upper">
+ <wsdl:input message="tns:upperRequest" name="upperRequest" />
+ <wsdl:output message="tns:upperResponse" name="upperResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/test.composite b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/test.composite
new file mode 100644
index 0000000000..535488b74e
--- /dev/null
+++ b/sandbox/sebastien/java/extend/samples/implementation-extension/src/test/resources/test.composite
@@ -0,0 +1,45 @@
+<?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="test">
+
+ <component name="client-test">
+ <t:implementation.sample class="sample.ClientTest"/>
+ <reference name="wello" target="wello-test"/>
+ <reference name="jello" target="jello-test"/>
+ </component>
+
+ <component name="wello-test">
+ <t:implementation.sample class="sample.WelloTest"/>
+ <reference name="upper" target="upper-test"/>
+ </component>
+
+ <component name="jello-test">
+ <t:implementation.sample class="sample.JelloTest"/>
+ <reference name="upper" target="upper-test"/>
+ </component>
+
+ <component name="upper-test">
+ <t:implementation.sample class="sample.UpperTest"/>
+ </component>
+
+</composite>