From 23297fa3b1f66d74325c8352cb8f5aae599a3090 Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 11 Aug 2008 07:29:53 +0000 Subject: Start branch for 1.3.1, the only changes in this commit are for the version git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@684661 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/helloworld/HelloWorldImpl.java | 33 +++++++++ .../src/main/java/helloworld/HelloWorldServer.java | 46 +++++++++++++ .../main/java/helloworld/HelloWorldService.java | 31 +++++++++ .../sca-deployables/helloworldws.composite | 33 +++++++++ .../src/main/resources/wsdl/helloworld.wsdl | 79 ++++++++++++++++++++++ .../java/helloworld/HelloWorldServerTestCase.java | 62 +++++++++++++++++ 6 files changed, 284 insertions(+) create mode 100644 branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java create mode 100644 branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java create mode 100644 branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite create mode 100644 branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl create mode 100644 branches/sca-java-1.3.1/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java (limited to 'branches/sca-java-1.3.1/samples/helloworld-ws-service/src') diff --git a/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..0de3c70303 --- /dev/null +++ b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * 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 helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..c37bfcda65 --- /dev/null +++ b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,46 @@ +/* + * 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 helloworld; + +import java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This server program shows how to create an SCA runtime, and start it which + * activates the helloworld Web service endpoint. + */ +public class HelloWorldServer { + + public static void main(String[] args) { + + SCADomain scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite"); + + try { + System.out.println("HelloWorld server started (press enter to shutdown)"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + scaDomain.close(); + System.out.println("HelloWorld server stopped"); + } + +} diff --git a/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..7245513b2a --- /dev/null +++ b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,31 @@ +/* + * 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 helloworld; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite new file mode 100644 index 0000000000..d767625ae7 --- /dev/null +++ b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..454763410c --- /dev/null +++ b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..189332be91 --- /dev/null +++ b/branches/sca-java-1.3.1/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java @@ -0,0 +1,62 @@ +/* + * 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 helloworld; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests that the helloworld server is available + */ +public class HelloWorldServerTestCase{ + + private SCADomain scaDomain; + + @Before + public void startServer() throws Exception { + scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite"); + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + @Test + public void testServiceCall() throws IOException { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @After + public void stopServer() throws Exception { + scaDomain.close(); + } + +} -- cgit v1.2.3