From 38ebe24c08241e09ac0c1c5e257a25583a868566 Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 1 Jun 2009 19:00:22 +0000 Subject: Move redundant modules into contrib git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@780781 13f79535-47bb-0310-9956-ffa450edef68 --- sandbox/travelsample/contrib/chapter-02/build.xml | 45 ++++++++++++++ .../chapter-02/client-contribution/build.xml | 45 ++++++++++++++ .../contrib/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 | 42 +++++++++++++ .../main/java/com/goodvaluetrips/TripProvider.java | 26 ++++++++ .../src/main/java/com/goodvaluetrips/Trips.java | 26 ++++++++ .../main/resources/META-INF/sca-contribution.xml | 24 ++++++++ .../src/main/resources/trips.composite | 30 ++++++++++ .../contrib/chapter-02/node-jumpstart/build.xml | 56 +++++++++++++++++ .../contrib/chapter-02/node-jumpstart/pom.xml | 70 ++++++++++++++++++++++ .../src/main/java/scatours/LaunchNode.java | 53 ++++++++++++++++ .../main/resources/META-INF/sca-contribution.xml | 26 ++++++++ .../src/main/resources/scatours.composite | 31 ++++++++++ .../src/test/java/scatours/NodeTestCase.java | 60 +++++++++++++++++++ .../travelsample/contrib/chapter-02/node/build.xml | 56 +++++++++++++++++ .../travelsample/contrib/chapter-02/node/pom.xml | 63 +++++++++++++++++++ .../node/src/main/java/scatours/LaunchNode.java | 52 ++++++++++++++++ .../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/contrib/chapter-02/pom.xml | 48 +++++++++++++++ .../tuscanyscatours-contribution/build.xml | 44 ++++++++++++++ .../tuscanyscatours-contribution/pom.xml | 42 +++++++++++++ .../src/main/java/com/goodvaluetrips/Trips.java | 26 ++++++++ .../main/java/com/tuscanyscatours/Bookings.java | 26 ++++++++ .../main/java/com/tuscanyscatours/Checkout.java | 26 ++++++++ .../java/com/tuscanyscatours/ShoppingCart.java | 28 +++++++++ .../main/java/com/tuscanyscatours/TripBooking.java | 35 +++++++++++ .../src/main/java/com/tuscanyscatours/Updates.java | 26 ++++++++ .../main/resources/META-INF/sca-contribution.xml | 25 ++++++++ .../src/main/resources/tours.composite | 46 ++++++++++++++ 35 files changed, 1386 insertions(+) create mode 100644 sandbox/travelsample/contrib/chapter-02/build.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/client-contribution/build.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/client-contribution/pom.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/client-contribution/src/main/java/scatours/client/TestClient.java create mode 100644 sandbox/travelsample/contrib/chapter-02/client-contribution/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/client-contribution/src/main/resources/client.composite create mode 100644 sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/build.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/pom.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/java/com/goodvaluetrips/TripProvider.java create mode 100644 sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/java/com/goodvaluetrips/Trips.java create mode 100644 sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/resources/trips.composite create mode 100644 sandbox/travelsample/contrib/chapter-02/node-jumpstart/build.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/node-jumpstart/pom.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/java/scatours/LaunchNode.java create mode 100644 sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/resources/scatours.composite create mode 100644 sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/test/java/scatours/NodeTestCase.java create mode 100644 sandbox/travelsample/contrib/chapter-02/node/build.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/node/pom.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/node/src/main/java/scatours/LaunchNode.java create mode 100644 sandbox/travelsample/contrib/chapter-02/node/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/node/src/main/resources/scatours.composite create mode 100644 sandbox/travelsample/contrib/chapter-02/node/src/test/java/scatours/NodeTestCase.java create mode 100644 sandbox/travelsample/contrib/chapter-02/pom.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/build.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/pom.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/goodvaluetrips/Trips.java create mode 100644 sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Bookings.java create mode 100644 sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java create mode 100644 sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java create mode 100644 sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/TripBooking.java create mode 100644 sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Updates.java create mode 100644 sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/resources/tours.composite (limited to 'sandbox/travelsample/contrib/chapter-02') diff --git a/sandbox/travelsample/contrib/chapter-02/build.xml b/sandbox/travelsample/contrib/chapter-02/build.xml new file mode 100644 index 0000000000..a58fed933a --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/build.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/client-contribution/build.xml b/sandbox/travelsample/contrib/chapter-02/client-contribution/build.xml new file mode 100644 index 0000000000..17bc0d7d5b --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/client-contribution/build.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/client-contribution/pom.xml b/sandbox/travelsample/contrib/chapter-02/client-contribution/pom.xml new file mode 100644 index 0000000000..e5982fe7bd --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/client-contribution/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.6-SNAPSHOT + + + scatours-chapter-02-client-contribution + Apache Tuscany SCA Tours Chapter 02 Test Client Contribution + + + + org.apache.tuscany.sca + tuscany-sca-api + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + scatours-chapter-02-tuscanyscatours-contribution + 1.6-SNAPSHOT + + + + + ${artifactId} + + diff --git a/sandbox/travelsample/contrib/chapter-02/client-contribution/src/main/java/scatours/client/TestClient.java b/sandbox/travelsample/contrib/chapter-02/client-contribution/src/main/java/scatours/client/TestClient.java new file mode 100644 index 0000000000..cb80368918 --- /dev/null +++ b/sandbox/travelsample/contrib/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/contrib/chapter-02/client-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/contrib/chapter-02/client-contribution/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..54ae0dbd0a --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/client-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/client-contribution/src/main/resources/client.composite b/sandbox/travelsample/contrib/chapter-02/client-contribution/src/main/resources/client.composite new file mode 100644 index 0000000000..05c2755114 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/client-contribution/src/main/resources/client.composite @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/build.xml b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/build.xml new file mode 100644 index 0000000000..fa67a921e2 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/build.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/pom.xml b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/pom.xml new file mode 100644 index 0000000000..5ff8cc8382 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.6-SNAPSHOT + + + scatours-chapter-02-goodvaluetrips-contribution + Apache Tuscany SCA Tours Chapter 02 Good Value Trips Contribution + + + + org.apache.tuscany.sca + tuscany-sca-api + 1.6-SNAPSHOT + + + + + ${artifactId} + + diff --git a/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/java/com/goodvaluetrips/TripProvider.java b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/java/com/goodvaluetrips/TripProvider.java new file mode 100644 index 0000000000..d30046aaef --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/java/com/goodvaluetrips/TripProvider.java @@ -0,0 +1,26 @@ +/* + * 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 com.goodvaluetrips; + +public class TripProvider implements Trips { + public String checkAvailability(String trip, int people) { + // call non-SCA code to reserve trip and return booking code + return "6R98Y"; + } +} diff --git a/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/java/com/goodvaluetrips/Trips.java b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/java/com/goodvaluetrips/Trips.java new file mode 100644 index 0000000000..365a210368 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/java/com/goodvaluetrips/Trips.java @@ -0,0 +1,26 @@ +/* + * 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 com.goodvaluetrips; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Trips { + String checkAvailability(String trip, int people); +} diff --git a/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..6ed07d5612 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/resources/trips.composite b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/resources/trips.composite new file mode 100644 index 0000000000..ab173e5ef7 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/goodvaluetrips-contribution/src/main/resources/trips.composite @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/node-jumpstart/build.xml b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/build.xml new file mode 100644 index 0000000000..0c3c506b67 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/build.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/node-jumpstart/pom.xml b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/pom.xml new file mode 100644 index 0000000000..f858f9f7e7 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/pom.xml @@ -0,0 +1,70 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.6-SNAPSHOT + + + scatours-chapter-02-node-jumpstart + Apache Tuscany SCA Tours Chapter 02 Node Jumpstart + + + + org.apache.tuscany.sca + tuscany-node-api + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-node-runtime + 1.6-SNAPSHOT + test + + + + org.apache.tuscany.sca + scatours-chapter-02-goodvaluetrips-contribution + 1.6-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + diff --git a/sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/java/scatours/LaunchNode.java b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/java/scatours/LaunchNode.java new file mode 100644 index 0000000000..b09939e49f --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/java/scatours/LaunchNode.java @@ -0,0 +1,53 @@ +/* + * 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 com.goodvaluetrips.Trips; + +public class LaunchNode { + + public static void main(String[] args) throws Exception { + try { + SCAContribution gvtContribution = + new SCAContribution("goodvaluetrips", + "../goodvaluetrips-contribution/target/classes"); + SCANode node = SCANodeFactory.newInstance(). + createSCANode("trips.composite", + gvtContribution); + node.start(); + + Trips tripProvider = ((SCAClient)node).getService(Trips.class, + "TripProvider/Trips"); + + System.out.println("Trip boooking code = " + + tripProvider.checkAvailability("FS1APR4", 2)); + + node.stop(); + + } catch (Throwable th) { + th.printStackTrace(); + } + } +} diff --git a/sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e3ac806b9a --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/resources/scatours.composite b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/resources/scatours.composite new file mode 100644 index 0000000000..6524f078f5 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/main/resources/scatours.composite @@ -0,0 +1,31 @@ + + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/test/java/scatours/NodeTestCase.java b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/src/test/java/scatours/NodeTestCase.java new file mode 100644 index 0000000000..16cff30934 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/node-jumpstart/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/contrib/chapter-02/node/build.xml b/sandbox/travelsample/contrib/chapter-02/node/build.xml new file mode 100644 index 0000000000..0c3c506b67 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/node/build.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/node/pom.xml b/sandbox/travelsample/contrib/chapter-02/node/pom.xml new file mode 100644 index 0000000000..849bfef794 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/node/pom.xml @@ -0,0 +1,63 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.6-SNAPSHOT + + + scatours-chapter-02-node + Apache Tuscany SCA Tours Chapter 02 Node + + + + org.apache.tuscany.sca + tuscany-node-api + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-node-runtime + 1.6-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + diff --git a/sandbox/travelsample/contrib/chapter-02/node/src/main/java/scatours/LaunchNode.java b/sandbox/travelsample/contrib/chapter-02/node/src/main/java/scatours/LaunchNode.java new file mode 100644 index 0000000000..b7888c8749 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/node/src/main/java/scatours/LaunchNode.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 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; + +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(){ + try { + 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(); + + Runnable runner = ((SCAClient)node).getService(Runnable.class, "TestClient/Runnable"); + runner.run(); + + node.stop(); + + } catch (Throwable th) { + th.printStackTrace(); + } + } +} diff --git a/sandbox/travelsample/contrib/chapter-02/node/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/contrib/chapter-02/node/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..4a6250ad25 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/node/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/node/src/main/resources/scatours.composite b/sandbox/travelsample/contrib/chapter-02/node/src/main/resources/scatours.composite new file mode 100644 index 0000000000..a5e26fd7b7 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/node/src/main/resources/scatours.composite @@ -0,0 +1,31 @@ + + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/node/src/test/java/scatours/NodeTestCase.java b/sandbox/travelsample/contrib/chapter-02/node/src/test/java/scatours/NodeTestCase.java new file mode 100644 index 0000000000..d37e52a409 --- /dev/null +++ b/sandbox/travelsample/contrib/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/contrib/chapter-02/pom.xml b/sandbox/travelsample/contrib/chapter-02/pom.xml new file mode 100644 index 0000000000..0132a445e5 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.5-SNAPSHOT + + + tuscany-scatours-chapter-02 + pom + Apache Tuscany SCA Tours Chapter 02 Examples + + + + default + + true + + + goodvaluetrips-contribution + tuscanyscatours-contribution + client-contribution + node + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/build.xml b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/build.xml new file mode 100644 index 0000000000..d9961176f3 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/build.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/pom.xml b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/pom.xml new file mode 100644 index 0000000000..6296c58e95 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.6-SNAPSHOT + + + scatours-chapter-02-tuscanyscatours-contribution + Apache Tuscany SCA Tours Chapter 02 SCA Tours Contribution + + + + org.apache.tuscany.sca + tuscany-sca-api + 1.6-SNAPSHOT + + + + + ${artifactId} + + diff --git a/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/goodvaluetrips/Trips.java b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/goodvaluetrips/Trips.java new file mode 100644 index 0000000000..365a210368 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/goodvaluetrips/Trips.java @@ -0,0 +1,26 @@ +/* + * 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 com.goodvaluetrips; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Trips { + String checkAvailability(String trip, int people); +} diff --git a/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Bookings.java b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Bookings.java new file mode 100644 index 0000000000..9d54d46bb6 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Bookings.java @@ -0,0 +1,26 @@ +/* + * 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 com.tuscanyscatours; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Bookings { + String newBooking(String trip, int people); +} diff --git a/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java new file mode 100644 index 0000000000..688fc7e83b --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Checkout.java @@ -0,0 +1,26 @@ +/* + * 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 com.tuscanyscatours; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Checkout { + void makePayment(double amount, String cardInfo); +} diff --git a/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java new file mode 100644 index 0000000000..68bf25a8cd --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/ShoppingCart.java @@ -0,0 +1,28 @@ +/* + * 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 com.tuscanyscatours; + +public class ShoppingCart implements Checkout, Updates { + public void makePayment(double amount, String cardInfo) { + // make payment for trips in cart giving card details + } + public void addTrip(String resCode) { + // add the booked trip to the cart + } +} diff --git a/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/TripBooking.java b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/TripBooking.java new file mode 100644 index 0000000000..e64d60545e --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/TripBooking.java @@ -0,0 +1,35 @@ +/* + * 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 com.tuscanyscatours; + +import org.osoa.sca.annotations.Reference; + +public class TripBooking implements Bookings { + @Reference + protected com.goodvaluetrips.Trips mytrips; + + @Reference + protected Updates cart; + + public String newBooking(String trip, int people) { + String resCode = mytrips.checkAvailability(trip, people); + cart.addTrip(resCode); + return "GV" + resCode; + } +} diff --git a/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Updates.java b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Updates.java new file mode 100644 index 0000000000..e33b0399cb --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/java/com/tuscanyscatours/Updates.java @@ -0,0 +1,26 @@ +/* + * 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 com.tuscanyscatours; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Updates { + void addTrip(String resCode); +} diff --git a/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..cf1153ac14 --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/resources/tours.composite b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/resources/tours.composite new file mode 100644 index 0000000000..f166a1635d --- /dev/null +++ b/sandbox/travelsample/contrib/chapter-02/tuscanyscatours-contribution/src/main/resources/tours.composite @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3