From 6d685c8e138af8d18bc71181ec630ccb9a17bdd9 Mon Sep 17 00:00:00 2001 From: nash Date: Wed, 6 Apr 2011 22:03:35 +0000 Subject: Tag for 1.6.2-RC1 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1089647 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tuscany/sca/itest/HelloWorldClient.java | 52 +++++++ .../apache/tuscany/sca/itest/SDOWSDLTestCase.java | 169 +++++++++++++++++++++ .../tuscany/sca/itest/WSDLImportsTestCase.java | 32 ++++ .../org/apache/tuscany/sca/itest/WSDLTestCase.java | 146 ++++++++++++++++++ 4 files changed, 399 insertions(+) create mode 100644 sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/HelloWorldClient.java create mode 100644 sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java create mode 100644 sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLImportsTestCase.java create mode 100644 sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java (limited to 'sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test') diff --git a/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/HelloWorldClient.java b/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/HelloWorldClient.java new file mode 100644 index 0000000000..f4edf7bef0 --- /dev/null +++ b/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/HelloWorldClient.java @@ -0,0 +1,52 @@ +/* + * 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 org.apache.tuscany.sca.itest; + +import java.io.File; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import helloworld.HelloWorldService; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class HelloWorldClient { + public static void main(String[] args) throws Exception { + + SCANodeFactory factory = SCANodeFactory.newInstance(); + SCANode node = factory.createSCANode(new File("src/main/resources/imports/wsdl/helloworldws.composite").toURL().toString(), + new SCAContribution("TestContribution", new File("src/main/resources/imports/wsdl/").toURL().toString())); + node.start(); + + HelloWorldService hwService = + ((SCAClient)node).getService(HelloWorldService.class, "HelloWorldServiceComponent"); + + System.out.println("Hello " + hwService.getGreetings("World")); + + node.stop(); + System.out.println("Bye"); + } + +} diff --git a/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java b/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java new file mode 100644 index 0000000000..12441753fb --- /dev/null +++ b/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java @@ -0,0 +1,169 @@ +/* + * 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 org.apache.tuscany.sca.itest; + +import static junit.framework.Assert.assertEquals; + +import java.rmi.RemoteException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import bigbank.account.services.accountdata.AccountDataService; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; + +/** + * Tests all the combinations of wiring services, components, and references + * which use either interface.java or interface.wsdl. + * + * The tests use a service (1) wired to a components (2) wired to another + * component (3) wired to a reference (4). Each of those uses either + * interface.java (a) or interface.wsdl (b). This results in 16 different + * combinations 1a2a3a4a thru 1b2b3b4b. + */ +public class SDOWSDLTestCase { + + private static SCADomain domain; + + @Test + public void testClient1a2a3a4a() throws RemoteException { + doit("Client1a2a3a4a"); + } + + @Test + public void testClient1a2a3a4b() throws RemoteException { + doit("Client1a2a3a4b"); + } + + @Test + public void testClient1a2a3b4a() throws RemoteException { + doit("Client1a2a3b4a"); + } + + @Test + public void testClient1a2a3b4b() throws RemoteException { + doit("Client1a2a3b4b"); + } + + @Test + public void testClient1a2b3a4a() throws RemoteException { + doit("Client1a2b3a4a"); + } + + @Test + public void testClient1a2b3a4b() throws RemoteException { + doit("Client1a2b3a4b"); + } + + @Test + public void testClient1a2b3b4a() throws RemoteException { + doit("Client1a2b3b4a"); + } + + @Test + public void testClient1a2b3b4b() throws RemoteException { + doit("Client1a2b3b4b"); + } + + @Test + public void testClient1b2a3a4a() throws RemoteException { + doit("Client1b2a3a4a"); + } + + @Test + public void testClient1b2a3a4b() throws RemoteException { + doit("Client1b2a3a4b"); + } + + @Test + public void testClient1b2a3b4a() throws RemoteException { + doit("Client1b2a3b4a"); + } + + @Test + public void testClient1b2a3b4b() throws RemoteException { + doit("Client1b2a3b4b"); + } + + @Test + public void testClient1b2b3a4a() throws RemoteException { + doit("Client1b2b3a4a"); + } + + @Test + public void testClient1b2b3a4b() throws RemoteException { + doit("Client1b2b3a4b"); + } + + @Test + public void testClient1b2b3b4a() throws RemoteException { + doit("Client1b2b3b4a"); + } + + @Test + public void testClient1b2b3b4b() throws RemoteException { + doit("Client1b2b3b4b"); + } + + private void doit(String compName) throws RemoteException { + AccountDataService client = domain.getService(AccountDataService.class, compName); + CustomerProfileData dataIn = AccountFactory.INSTANCE.createCustomerProfileData(); + dataIn.setAddress("home"); + dataIn.setEmail("petra@home"); + dataIn.setFirstName("petra"); + dataIn.setId(1); + dataIn.setLastName("A"); + dataIn.setLoginID("petra"); + dataIn.setPassword("ant"); + + CustomerProfileData dataOut = client.createAccount(dataIn , false, false); + + assertEquals(dataIn.getAddress(), dataOut.getAddress()); + assertEquals(dataIn.getEmail(), dataOut.getEmail()); + assertEquals(dataIn.getFirstName(), dataOut.getFirstName()); + assertEquals(dataIn.getId(), dataOut.getId()); + assertEquals(dataIn.getLastName(), dataOut.getLastName()); + assertEquals(dataIn.getLoginID(), dataOut.getLoginID()); + assertEquals(dataIn.getPassword(), dataOut.getPassword()); + + AccountReport report = client.getAccountReport(12345); + AccountSummary summary1 = (AccountSummary)report.getAccountSummaries().get(0); + assertEquals(summary1.getAccountType(), "checking"); + AccountSummary summary2 = (AccountSummary)report.getAccountSummaries().get(1); + assertEquals(summary2.getBalance(), 2000.f); + } + + @BeforeClass + public static void setUp() throws Exception { + domain = SCADomain.newInstance("SDOWSDLTest.composite"); + } + + @AfterClass + public static void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLImportsTestCase.java b/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLImportsTestCase.java new file mode 100644 index 0000000000..8026f93b80 --- /dev/null +++ b/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLImportsTestCase.java @@ -0,0 +1,32 @@ +/* + * 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 org.apache.tuscany.sca.itest; + +import junit.framework.TestCase; + +/** + * Tests out the big bank service + * + */ +public class WSDLImportsTestCase extends TestCase { + + public void testServer() throws Exception { + HelloWorldClient.main(new String[] {""}); + } +} diff --git a/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java b/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java new file mode 100644 index 0000000000..fd30d69c79 --- /dev/null +++ b/sca-java-1.x/tags/1.6.2-RC1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java @@ -0,0 +1,146 @@ +/* + * 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 org.apache.tuscany.sca.itest; + +import static junit.framework.Assert.assertEquals; +import helloworld.HelloWorldService; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Tests all the combinations of wiring services, components, and references + * which use either interface.java or interface.wsdl. The tests use a service + * (1) wired to a components (2) wired to another component (3) wired to a + * reference (4). Each of those uses either interface.java (a) or interface.wsdl + * (b). This results in 16 different combinations 1a2a3a4a thru 1b2b3b4b. + */ +public class WSDLTestCase { + + private static SCADomain domain; + + @Test + public void testClient1a2a3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2a3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2a3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2a3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @BeforeClass + public static void init() throws Throwable { + domain = SCADomain.newInstance("WSDLTest.composite"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } +} -- cgit v1.2.3