From 818cab64a0e869011acb140271664c10707ef803 Mon Sep 17 00:00:00 2001 From: nash Date: Mon, 4 May 2009 20:21:55 +0000 Subject: Fix ant script problems and add a test case git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@771426 13f79535-47bb-0310-9956-ffa450edef68 --- sandbox/travelsample/chapter-02/build.xml | 45 +++++++ .../chapter-02/client-contribution/build.xml | 45 +++++++ .../chapter-02/client-contribution/pom.xml | 48 +++++++ .../src/main/java/scatours/client/TestClient.java | 46 +++++++ .../main/resources/META-INF/sca-contribution.xml | 25 ++++ .../src/main/resources/client.composite | 29 +++++ .../goodvaluetrips-contribution/build.xml | 44 +++++++ .../chapter-02/goodvaluetrips-contribution/pom.xml | 15 --- .../main/resources/META-INF/sca-contribution.xml | 5 +- .../src/main/resources/trips.composite | 2 +- sandbox/travelsample/chapter-02/node/build.xml | 144 ++------------------- sandbox/travelsample/chapter-02/node/pom.xml | 88 +------------ .../node/src/main/java/scatours/LaunchNode.java | 42 ++---- .../main/resources/META-INF/sca-contribution.xml | 26 ++++ .../node/src/main/resources/scatours.composite | 31 +++++ .../node/src/test/java/scatours/NodeTestCase.java | 60 +++++++++ sandbox/travelsample/chapter-02/pom.xml | 3 +- .../tuscanyscatours-contribution/build.xml | 44 +++++++ .../tuscanyscatours-contribution/pom.xml | 7 - .../main/resources/META-INF/sca-contribution.xml | 6 +- .../src/main/resources/tours.composite | 2 +- 21 files changed, 482 insertions(+), 275 deletions(-) create mode 100644 sandbox/travelsample/chapter-02/build.xml create mode 100644 sandbox/travelsample/chapter-02/client-contribution/build.xml create mode 100644 sandbox/travelsample/chapter-02/client-contribution/pom.xml create mode 100644 sandbox/travelsample/chapter-02/client-contribution/src/main/java/scatours/client/TestClient.java create mode 100644 sandbox/travelsample/chapter-02/client-contribution/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/chapter-02/client-contribution/src/main/resources/client.composite create mode 100644 sandbox/travelsample/chapter-02/goodvaluetrips-contribution/build.xml create mode 100644 sandbox/travelsample/chapter-02/node/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/chapter-02/node/src/main/resources/scatours.composite create mode 100644 sandbox/travelsample/chapter-02/node/src/test/java/scatours/NodeTestCase.java create mode 100644 sandbox/travelsample/chapter-02/tuscanyscatours-contribution/build.xml (limited to 'sandbox') diff --git a/sandbox/travelsample/chapter-02/build.xml b/sandbox/travelsample/chapter-02/build.xml new file mode 100644 index 0000000000..a58fed933a --- /dev/null +++ b/sandbox/travelsample/chapter-02/build.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/chapter-02/client-contribution/build.xml b/sandbox/travelsample/chapter-02/client-contribution/build.xml new file mode 100644 index 0000000000..17bc0d7d5b --- /dev/null +++ b/sandbox/travelsample/chapter-02/client-contribution/build.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/chapter-02/client-contribution/pom.xml b/sandbox/travelsample/chapter-02/client-contribution/pom.xml new file mode 100644 index 0000000000..81d6fe80ef --- /dev/null +++ b/sandbox/travelsample/chapter-02/client-contribution/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.5-SNAPSHOT + + + scatours-chapter-02-client-contribution + Apache Tuscany SCA Tours Chapter 02 Test Client Contribution + + + + org.apache.tuscany.sca + tuscany-sca-api + 1.5-SNAPSHOT + + + + org.apache.tuscany.sca + scatours-chapter-02-tuscanyscatours-contribution + 1.5-SNAPSHOT + + + + + ${artifactId} + + diff --git a/sandbox/travelsample/chapter-02/client-contribution/src/main/java/scatours/client/TestClient.java b/sandbox/travelsample/chapter-02/client-contribution/src/main/java/scatours/client/TestClient.java new file mode 100644 index 0000000000..cb80368918 --- /dev/null +++ b/sandbox/travelsample/chapter-02/client-contribution/src/main/java/scatours/client/TestClient.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 scatours.client; + +import com.tuscanyscatours.Bookings; +import com.tuscanyscatours.Checkout; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(Runnable.class) +public class TestClient { + @Reference + protected Bookings bookings; + + @Reference + protected Checkout checkout; + + public TestClient() { + } + + public void run() { + String bookingCode = bookings.newBooking("FS1APR4", 1); + System.out.println("Booking code is " + bookingCode); + + checkout.makePayment(1995.00, "1234567843218765 10/10"); + System.out.println("Paid $1995.00"); + } +} diff --git a/sandbox/travelsample/chapter-02/client-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/chapter-02/client-contribution/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..54ae0dbd0a --- /dev/null +++ b/sandbox/travelsample/chapter-02/client-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/sandbox/travelsample/chapter-02/client-contribution/src/main/resources/client.composite b/sandbox/travelsample/chapter-02/client-contribution/src/main/resources/client.composite new file mode 100644 index 0000000000..05c2755114 --- /dev/null +++ b/sandbox/travelsample/chapter-02/client-contribution/src/main/resources/client.composite @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/build.xml b/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/build.xml new file mode 100644 index 0000000000..fa67a921e2 --- /dev/null +++ b/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/build.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/pom.xml b/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/pom.xml index fe64ac94b3..6bbcf056af 100644 --- a/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/pom.xml +++ b/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/pom.xml @@ -34,21 +34,6 @@ tuscany-sca-api 1.5-SNAPSHOT - - - - - junit - junit - 4.5 - test - diff --git a/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/src/main/resources/META-INF/sca-contribution.xml index 38b94949ab..6ed07d5612 100644 --- a/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/src/main/resources/META-INF/sca-contribution.xml +++ b/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -18,6 +18,7 @@ * under the License. --> - + xmlns:gvt="http://goodvaluetrips.com/"> + + diff --git a/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/src/main/resources/trips.composite b/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/src/main/resources/trips.composite index cdd009b1b2..ab173e5ef7 100644 --- a/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/src/main/resources/trips.composite +++ b/sandbox/travelsample/chapter-02/goodvaluetrips-contribution/src/main/resources/trips.composite @@ -19,7 +19,7 @@ --> + name="Trips"> diff --git a/sandbox/travelsample/chapter-02/node/build.xml b/sandbox/travelsample/chapter-02/node/build.xml index 1d3e3adea3..0c3c506b67 100644 --- a/sandbox/travelsample/chapter-02/node/build.xml +++ b/sandbox/travelsample/chapter-02/node/build.xml @@ -18,34 +18,31 @@ --> + - + - - + - + - + - - - + - - - + + @@ -56,129 +53,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sandbox/travelsample/chapter-02/node/pom.xml b/sandbox/travelsample/chapter-02/node/pom.xml index 15fbfaf79c..737649372a 100644 --- a/sandbox/travelsample/chapter-02/node/pom.xml +++ b/sandbox/travelsample/chapter-02/node/pom.xml @@ -29,23 +29,10 @@ Apache Tuscany SCA Tours Chapter 02 Node - - org.apache.tuscany.sca - tuscany-node-api - 1.5-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-launcher - 1.5-SNAPSHOT - - org.apache.tuscany.sca - tuscany-implementation-node-runtime + tuscany-node-api 1.5-SNAPSHOT - runtime @@ -57,81 +44,20 @@ org.apache.tuscany.sca - tuscany-implementation-resource-runtime - 1.5-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jsonrpc-runtime - 1.5-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-http-runtime - 1.5-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 1.5-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-sca-axis2 + tuscany-implementation-node-runtime 1.5-SNAPSHOT - runtime + test - - org.apache.derby - derby - 10.3.1.5-SNAPSHOT - runtime + junit + junit + 4.5 + test - ${artifactId} - ${basedir}/src - - - ${basedir} - - **/*.java - **/.*/** - pom.xml - build.xml - target/** - src/** - - - - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 1.5-SNAPSHOT - - - - launch.LaunchTutorialAdmin - - - generate - - - - - diff --git a/sandbox/travelsample/chapter-02/node/src/main/java/scatours/LaunchNode.java b/sandbox/travelsample/chapter-02/node/src/main/java/scatours/LaunchNode.java index 777963c13e..b7888c8749 100644 --- a/sandbox/travelsample/chapter-02/node/src/main/java/scatours/LaunchNode.java +++ b/sandbox/travelsample/chapter-02/node/src/main/java/scatours/LaunchNode.java @@ -19,48 +19,34 @@ package scatours; -import java.io.IOException; - +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 org.apache.tuscany.sca.node.launcher.NodeLauncher; public class LaunchNode { + public static void main(String[] args) throws Exception { LaunchNode.launchFromFileSystemDir(); } // OK for development but you must launch the node from this module public static void launchFromFileSystemDir(){ - SCANode node = null; - try { - node = SCANodeFactory.newInstance().createSCANode("scatours.composite", - new SCAContribution("common", "../../shared-contributions/common-contribution/target/classes"), - new SCAContribution("currency", "../../shared-contributions/currency-contribution/target/classes"), - new SCAContribution("hotel", "../../shared-contributions/hotel-contribution/target/classes"), - new SCAContribution("flight", "../../shared-contributions/flight-contribution/target/classes"), - new SCAContribution("car", "../../shared-contributions/car-contribution/target/classes"), - new SCAContribution("trip", "../../shared-contributions/trip-contribution/target/classes"), - new SCAContribution("tripbooking", "../../shared-contributions/tripbooking-contribution/target/classes"), - new SCAContribution("travelcatalog", "../../shared-contributions/travelcatalog-contribution/target/classes"), - new SCAContribution("payment", "../../shared-contributions/payment-contribution/target/classes"), - new SCAContribution("emailgateway", "../../shared-contributions/emailgateway-contribution/target/classes"), - new SCAContribution("shoppingcart", "../../shared-contributions/shoppingcart-contribution/target/classes"), - new SCAContribution("scatours", "../../shared-contributions/scatours-contribution/target/classes"), - new SCAContribution("ui", "../ui-contribution/target/classes")); + SCANode node = SCANodeFactory.newInstance().createSCANode("scatours.composite", + new SCAContribution("goodvaluetrips", "../goodvaluetrips-contribution/target/classes"), + new SCAContribution("tuscanyscatours", "../tuscanyscatours-contribution/target/classes"), + new SCAContribution("client", "../client-contribution/target/classes"), + new SCAContribution("node", "./target/classes")); node.start(); - - System.out.println("Node started - Press enter to shutdown."); - try { - System.in.read(); - } catch (IOException e) {} - + + Runnable runner = ((SCAClient)node).getService(Runnable.class, "TestClient/Runnable"); + runner.run(); + node.stop(); - } catch (Exception ex) { - System.out.println(ex.toString()); + } catch (Throwable th) { + th.printStackTrace(); } - } + } } diff --git a/sandbox/travelsample/chapter-02/node/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/chapter-02/node/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..4a6250ad25 --- /dev/null +++ b/sandbox/travelsample/chapter-02/node/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/sandbox/travelsample/chapter-02/node/src/main/resources/scatours.composite b/sandbox/travelsample/chapter-02/node/src/main/resources/scatours.composite new file mode 100644 index 0000000000..a5e26fd7b7 --- /dev/null +++ b/sandbox/travelsample/chapter-02/node/src/main/resources/scatours.composite @@ -0,0 +1,31 @@ + + + + + + + + + diff --git a/sandbox/travelsample/chapter-02/node/src/test/java/scatours/NodeTestCase.java b/sandbox/travelsample/chapter-02/node/src/test/java/scatours/NodeTestCase.java new file mode 100644 index 0000000000..d37e52a409 --- /dev/null +++ b/sandbox/travelsample/chapter-02/node/src/test/java/scatours/NodeTestCase.java @@ -0,0 +1,60 @@ +/* + * 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 scatours; + +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 org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests all the components and services in chapter 2 + */ +public class NodeTestCase { + + private SCANode node; + + @Before + public void startServer() throws Exception { + try { + node = SCANodeFactory.newInstance().createSCANode("scatours.composite", + new SCAContribution("goodvaluetrips", "../goodvaluetrips-contribution/target/classes"), + new SCAContribution("tuscanyscatours", "../tuscanyscatours-contribution/target/classes"), + new SCAContribution("client", "../client-contribution/target/classes"), + new SCAContribution("node", "./target/classes")); + node.start(); + } catch (Exception ex) { + System.out.println(ex.toString()); + } + } + + @Test + public void testClient() throws Exception { + Runnable runner = ((SCAClient)node).getService(Runnable.class, "TestClient/Runnable"); + runner.run(); + } + + @After + public void stopServer() throws Exception { + node.stop(); + } +} diff --git a/sandbox/travelsample/chapter-02/pom.xml b/sandbox/travelsample/chapter-02/pom.xml index 61d99c1777..0132a445e5 100644 --- a/sandbox/travelsample/chapter-02/pom.xml +++ b/sandbox/travelsample/chapter-02/pom.xml @@ -38,9 +38,8 @@ goodvaluetrips-contribution tuscanyscatours-contribution - diff --git a/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/build.xml b/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/build.xml new file mode 100644 index 0000000000..d9961176f3 --- /dev/null +++ b/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/build.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/pom.xml b/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/pom.xml index dc6cea44ae..6913d7665d 100644 --- a/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/pom.xml +++ b/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/pom.xml @@ -34,13 +34,6 @@ tuscany-sca-api 1.5-SNAPSHOT - - - junit - junit - 4.5 - test - diff --git a/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/src/main/resources/META-INF/sca-contribution.xml index e3614abda3..cf1153ac14 100644 --- a/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/src/main/resources/META-INF/sca-contribution.xml +++ b/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -18,6 +18,8 @@ * under the License. --> - + xmlns:tst="http://tuscanyscatours.com/"> + + + diff --git a/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/src/main/resources/tours.composite b/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/src/main/resources/tours.composite index 62fa1fd792..f166a1635d 100644 --- a/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/src/main/resources/tours.composite +++ b/sandbox/travelsample/chapter-02/tuscanyscatours-contribution/src/main/resources/tours.composite @@ -19,7 +19,7 @@ --> + name="Tours"> -- cgit v1.2.3