From a40e527938d76ba71f211da7e327adb50384ba69 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:26:33 +0000 Subject: Moving 1.x tags git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835157 13f79535-47bb-0310-9956-ffa450edef68 --- .../wsdlgen/src/main/java/helloworld/ABean.java | 42 +++++ .../src/main/java/helloworld/HelloWorldImpl.java | 48 +++++ .../main/java/helloworld/HelloWorldService.java | 36 ++++ .../src/main/java/helloworld/package-info.java | 20 ++ .../main/resources/META-INF/sca-contribution.xml | 23 +++ .../wsdlgen/src/main/resources/definitions.xml | 66 +++++++ .../src/main/resources/helloworld.composite | 71 +++++++ .../src/main/resources/wsdl/helloworld.wsdl | 210 +++++++++++++++++++++ .../test/java/helloworld/JmsTransportTestCase.java | 121 ++++++++++++ 9 files changed, 637 insertions(+) create mode 100644 sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/ABean.java create mode 100644 sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/package-info.java create mode 100644 sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/definitions.xml create mode 100644 sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/helloworld.composite create mode 100644 sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/test/java/helloworld/JmsTransportTestCase.java (limited to 'sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src') diff --git a/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/ABean.java b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/ABean.java new file mode 100644 index 0000000000..8a99a81132 --- /dev/null +++ b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/ABean.java @@ -0,0 +1,42 @@ +/* + * 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; + +public class ABean { + + protected String field1; + protected String field2; + + public String getField1() { + return field1; + } + + public void setField1(String field1) { + this.field1 = field1; + } + + public String getField2() { + return field2; + } + + public void setField2(String field2) { + this.field2 = field2; + } +} + diff --git a/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..83165307af --- /dev/null +++ b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,48 @@ +/* + * 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.util.Vector; + +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; + } + + public String getGreetingsBean(ABean bean){ + return "Hello " + bean.getField1() + " " + bean.getField2(); + } + + public String getGreetingsBeanArray(ABean[] bean){ + return "Hello " + bean[0].getField1() + " " + bean[0].getField2(); + } + + /* + public String getGreetingsBeanVector(Vector bean){ + return "Hello " + bean.get(0).getField1() + " " + bean.get(0).getField2(); + } + */ +} diff --git a/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..6f3d57e6f7 --- /dev/null +++ b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,36 @@ +/* + * 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.util.Vector; + +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); + public String getGreetingsBean(ABean bean); + public String getGreetingsBeanArray(ABean[] bean); + //public String getGreetingsBeanVector(Vector bean); +} + diff --git a/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/package-info.java b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/package-info.java new file mode 100644 index 0000000000..45bc473320 --- /dev/null +++ b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/java/helloworld/package-info.java @@ -0,0 +1,20 @@ +/* + * 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. + */ +@javax.xml.bind.annotation.XmlSchema(namespace="http://test") +package helloworld; diff --git a/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c7797931d2 --- /dev/null +++ b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/definitions.xml b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/definitions.xml new file mode 100644 index 0000000000..e1b316dcc6 --- /dev/null +++ b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/definitions.xml @@ -0,0 +1,66 @@ + + + + + + + The general intent that a transport is available over which SOAP messages flow + + + + + + A JMS transport is required + + + + + + An HTTP transport is required + + + + + + + An HTTPS transport is required + + + + + + + org.apache.activemq.jndi.ActiveMQInitialContextFactory + tcp://localhost:61982 + QueueConnectionFactory + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/helloworld.composite b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/helloworld.composite new file mode 100644 index 0000000000..2b5d51b71e --- /dev/null +++ b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/helloworld.composite @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..c76ed7b338 --- /dev/null +++ b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/test/java/helloworld/JmsTransportTestCase.java b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/test/java/helloworld/JmsTransportTestCase.java new file mode 100644 index 0000000000..fe74ef1a3d --- /dev/null +++ b/sca-java-1.x/tags/1.5.1-RC1/itest/wsdlgen/src/test/java/helloworld/JmsTransportTestCase.java @@ -0,0 +1,121 @@ +/* + * 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 org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Tests that the helloworld server is available + */ +public class JmsTransportTestCase{ + + private SCADomain scaDomain; + private BrokerService jmsBroker; + + @Before + public void startServer() throws Exception { + startBroker(); + scaDomain = SCADomain.newInstance("helloworld.composite"); + } + + protected void startBroker() throws Exception { + jmsBroker = new BrokerService(); + jmsBroker.setPersistent(false); + jmsBroker.setUseJmx(false); + jmsBroker.addConnector("tcp://localhost:51293"); + jmsBroker.start(); + } + + //@Ignore + @Test + public void testComponent1() throws IOException { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent1/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + //@Ignore + @Test + public void testComponent2() throws IOException { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent2/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @Ignore + @Test + public void testComponent3() throws IOException { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent3/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @Ignore + @Test + public void testComponent4() throws IOException { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent4/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @Ignore + @Test + public void testComponent5() throws IOException { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent5/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @Ignore + @Test + public void testWaitForInput() { + System.out.println("Press a key to end"); + try { + System.in.read(); + } catch (Exception ex) { + } + System.out.println("Shutting down"); + } + + @After + public void stopServer() throws Exception { + if (scaDomain != null) { + scaDomain.close(); + } + if (jmsBroker != null) { + jmsBroker.stop(); + } + } + +} -- cgit v1.2.3