diff options
Diffstat (limited to '')
6 files changed, 0 insertions, 354 deletions
diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleGenericAsyncTestCase.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleGenericAsyncTestCase.java deleted file mode 100644 index 36fdb76424..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleGenericAsyncTestCase.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 sampleasync.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 sampleasync.Upper; - -/** - * Test how to run an SCA contribution containing a test composite on a - * Tuscany runtime node. - * - * @version $Rev$ $Date$ - */ -public class SampleGenericAsyncTestCase { - static Node node; - - @BeforeClass - public static void setUp() throws Exception { - final NodeFactory nf = NodeFactory.newInstance(); - String here = SampleGenericAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString(); - node = nf.createNode(new Contribution("test", here)); - node.start(); - } - - @AfterClass - public static void tearDown() throws Exception { - node.stop(); - } - - @Test - public void testReference() { - System.out.println("SampleAsyncReferenceTestCase.testReference"); - Upper upper = node.getService(Upper.class, "SampleAsyncReference"); - final String r = upper.upper("async"); - System.out.println(r); - assertEquals("ASYNC", r); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleNativeAsyncTestCase.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleNativeAsyncTestCase.java deleted file mode 100644 index bc35a637d1..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/SampleNativeAsyncTestCase.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 sampleasync.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 sampleasync.Upper; - -/** - * Test how to run an SCA contribution containing a test composite on a - * Tuscany runtime node. - * - * @version $Rev$ $Date$ - */ -public class SampleNativeAsyncTestCase { - static Node node; - - @BeforeClass - 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)); - 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/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncReferenceImpl.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncReferenceImpl.java deleted file mode 100644 index 9cf7ff9883..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncReferenceImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 sampleasync.impl; - -import static java.lang.System.out; - -import java.util.concurrent.ExecutionException; - -import javax.xml.ws.Response; - -import org.oasisopen.sca.annotation.Reference; - -import sampleasync.Upper; -import sampleasync.UpperAsyncReference; - -/** - * Sample service interface. - * - * @version $Rev$ $Date$ - */ -public class UpperJavaAsyncReferenceImpl implements Upper { - - @Reference - UpperAsyncReference upper; - - public String upper(String s) { - out.println("UpperAsyncReferenceImpl.upper(" + s + ")"); - - // async poll - Response<String> response = upper.upperAsync(s); - - while (!response.isDone()){ - System.out.println("Waiting for poll"); - try { - Thread.sleep(500); - } catch (Exception ex) { - // do nothing - } - } - - String result = null; - - try { - result = response.get(); - System.out.println("Async client poll patern: result = " + result); - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (ExecutionException e) { - e.printStackTrace(); - } - return result; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncServiceImpl.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncServiceImpl.java deleted file mode 100644 index fb9ad065ad..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperJavaAsyncServiceImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 sampleasync.impl; - -import static java.lang.System.out; - -import org.oasisopen.sca.ResponseDispatch; - -import sampleasync.UpperAsyncService; - -/** - * Sample component implementation that uses Java interfaces. - * - * @version $Rev$ $Date$ - */ -public class UpperJavaAsyncServiceImpl implements UpperAsyncService { - - public void upperAsync(String s,ResponseDispatch<String> response) { - out.println("UpperJavaAsyncServiceImpl.upperAsync(" + s + ")"); - response.sendResponse(s.toUpperCase()); - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java deleted file mode 100644 index 101c6a4399..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 sampleasync.impl; - -import static java.lang.System.out; -import static sample.Xutil.elem; -import static sample.Xutil.text; -import static sample.Xutil.xdom; - -import org.w3c.dom.Element; - -import sample.api.Java; -import sample.api.WSDL; -import sample.api.WSDLReference; -import sampleasync.Upper; - -/** - * Sample component implementation that uses Java interfaces. - * - * @version $Rev$ $Date$ - */ -@Java(Upper.class) -public class UpperSampleAsyncReferenceImpl { - - @WSDL("http://sample/upper#Upper") - WSDLReference upper; - Element response; - - public String upper(String s) { - out.println("UpperSampleAsyncReferenceImpl.upper(" + s + ")"); - - // TODO - I'm passing in the non-wrapped version of the parameter - // here which doesn't seem right. If I pass in the wrapped - // version then the databinding won't unwrap on the reference - // side as it thinks the target Java interface is bare? - final Element ureq = xdom("http://sample/upper", "s", text(s)); - upper.callAsync("upper", ureq); - - try { - Thread.sleep(500); - } catch (Exception ex) { - // do nothing - } - - return response.getTextContent(); - } - - /** - * In this implementation the convention is that the - * async callback arrives at an operation named - * operationName + Callback - */ - public void upperCallback(Element response) { - out.println("UpperSampleAsyncReferenceImpl.upperCallback(" + response.getTextContent() + ")"); - this.response = response; - } -} diff --git a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncServiceImpl.java b/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncServiceImpl.java deleted file mode 100644 index 41a85e44a0..0000000000 --- a/sca-java-2.x/branches/2.0-Beta2/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncServiceImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 sampleasync.impl; - -import static java.lang.System.out; -import static sample.Xutil.elem; -import static sample.Xutil.text; -import static sample.Xutil.xdom; - -import org.w3c.dom.Element; - -import sample.api.WSDL; - -/** - * Sample component implementation that uses Java interfaces. - * - * @version $Rev$ $Date$ - */ -@WSDL("http://sample/upper#Upper") -public class UpperSampleAsyncServiceImpl { - - public Element call(String op, Element e) { - String input = e.getTextContent(); - out.println("UpperSampleAsyncServiceImpl.upper(" + input + ")"); - String output = input.toUpperCase(); - return xdom("http://sample/upper", "upperResponse", elem("result", text(output))); - } -} |