You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by na...@apache.org on 2010/01/21 11:38:08 UTC
svn commit: r901645 - in
/tuscany/sandbox/travelsample/contributions/buildingblocks: ./ src/
src/main/ src/main/java/ src/main/java/com/ src/main/java/com/budgettours/
src/main/java/com/budgettours/impl/ src/main/java/com/goodvaluetrips/
src/main/java/...
Author: nash
Date: Thu Jan 21 10:38:07 2010
New Revision: 901645
URL: http://svn.apache.org/viewvc?rev=901645&view=rev
Log:
Add new contribution buildingblocks
Added:
tuscany/sandbox/travelsample/contributions/buildingblocks/
tuscany/sandbox/travelsample/contributions/buildingblocks/build.xml
tuscany/sandbox/travelsample/contributions/buildingblocks/pom.xml
tuscany/sandbox/travelsample/contributions/buildingblocks/src/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/Tours.java
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/impl/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/impl/TourProviderImpl.java
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/Trips.java
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/impl/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/impl/TripProviderImpl.java
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Bookings.java
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Checkout.java
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Updates.java
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/META-INF/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/META-INF/sca-contribution.xml
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-appl.composite
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-impl-include.composite
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-impl.composite
tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours.composite
tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/scatours/
tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java
tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplTestCase.java
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/build.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/build.xml?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/build.xml (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/build.xml Thu Jan 21 10:38:07 2010
@@ -0,0 +1,22 @@
+<!--
+ * 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.
+-->
+
+<project name="scatours-contribution-buildingblocks" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/pom.xml?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/pom.xml (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/pom.xml Thu Jan 21 10:38:07 2010
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-buildingblocks</artifactId>
+ <name>Apache Tuscany SCA Tours Building Blocks Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${tuscany.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/Tours.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/Tours.java?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/Tours.java (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/Tours.java Thu Jan 21 10:38:07 2010
@@ -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.budgettours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Tours {
+ String checkAvailability(String trip, int people);
+}
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/impl/TourProviderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/impl/TourProviderImpl.java?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/impl/TourProviderImpl.java (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/budgettours/impl/TourProviderImpl.java Thu Jan 21 10:38:07 2010
@@ -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.budgettours.impl;
+
+import com.budgettours.Tours;
+
+public class TourProviderImpl implements Tours {
+ public String checkAvailability(String trip, int people) {
+ // call non-SCA code to reserve trip and return booking code
+ return "5Q87X";
+ }
+}
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/Trips.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/Trips.java?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/Trips.java (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/Trips.java Thu Jan 21 10:38:07 2010
@@ -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);
+}
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/impl/TripProviderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/impl/TripProviderImpl.java?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/impl/TripProviderImpl.java (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/goodvaluetrips/impl/TripProviderImpl.java Thu Jan 21 10:38:07 2010
@@ -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.goodvaluetrips.impl;
+
+import com.goodvaluetrips.Trips;
+
+public class TripProviderImpl implements Trips {
+ public String checkAvailability(String trip, int people) {
+ // call non-SCA code to reserve trip and return booking code
+ return "6R98Y";
+ }
+}
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Bookings.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Bookings.java?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Bookings.java (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Bookings.java Thu Jan 21 10:38:07 2010
@@ -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);
+}
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Checkout.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Checkout.java?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Checkout.java (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Checkout.java Thu Jan 21 10:38:07 2010
@@ -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;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Checkout {
+ void makePayment(BigDecimal amount, String cardInfo);
+}
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Updates.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Updates.java?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Updates.java (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/Updates.java Thu Jan 21 10:38:07 2010
@@ -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);
+}
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/ShoppingCartImpl.java Thu Jan 21 10:38:07 2010
@@ -0,0 +1,49 @@
+/*
+ * 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.impl;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.tuscanyscatours.Checkout;
+import com.tuscanyscatours.Updates;
+
+public class ShoppingCartImpl implements Checkout, Updates {
+ private static List<String> bookedTrips = new ArrayList<String>();
+
+ protected String currency = "USD";
+
+ public void makePayment(BigDecimal amount, String cardInfo) {
+ System.out.print("Charged " + currency + " " + amount
+ + " to card "
+ + cardInfo
+ + " for "
+ + (bookedTrips.size() > 1 ? "trips" : "trip"));
+ for (String trip : bookedTrips) {
+ System.out.print(" " + trip);
+ }
+ System.out.println();
+ bookedTrips.clear();
+ }
+
+ public void addTrip(String resCode) {
+ bookedTrips.add(resCode);
+ }
+}
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/java/com/tuscanyscatours/impl/TripBookingImpl.java Thu Jan 21 10:38:07 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.impl;
+
+import org.osoa.sca.annotations.Reference;
+
+import com.goodvaluetrips.Trips;
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Updates;
+
+public class TripBookingImpl implements Bookings {
+ @Reference
+ protected 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;
+ }
+}
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/META-INF/sca-contribution.xml?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/META-INF/sca-contribution.xml (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/META-INF/sca-contribution.xml Thu Jan 21 10:38:07 2010
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tst="http://tuscanyscatours.com/">
+ <import namespace="http://goodvaluetrips.com/" />
+ <export namespace="http://tuscanyscatours.com/" />
+ <deployable composite="tst:ToursAppl" />
+ <deployable composite="tst:ToursImpl" />
+ <deployable composite="tst:ToursImplInclude" />
+</contribution>
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-appl.composite
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-appl.composite?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-appl.composite (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-appl.composite Thu Jan 21 10:38:07 2010
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:bb="http://bb.tuscanyscatours.com/"
+ xmlns:gvt="http://goodvaluetrips.com/"
+ name="ToursAppl">
+
+ <component name="WSTours">
+ <implementation.composite name="bb:Tours" />
+ <service name="BookTrip">
+ <binding.ws uri="http://localhost:8081/BookTrip" />
+ </service>
+ <service name="Checkout">
+ <binding.ws uri="http://localhost:8081/Checkout" />
+ </service>
+ <reference name="trips" target="TripProvider/Trips" />
+ </component>
+
+ <component name="JMSTours">
+ <implementation.composite name="bb:Tours" />
+ <service name="BookTrip">
+ <binding.jms uri="jms:BookTrip" />
+ </service>
+ <service name="Checkout">
+ <binding.jms uri="jms:Checkout" />
+ </service>
+ <reference name="trips" target="TourProvider/Tours" />
+ </component>
+
+ <include name="gvt:Trips" />
+
+ <component name="TourProvider">
+ <implementation.java class="com.budgettours.impl.TourProviderImpl" />
+ <service name="Tours" />
+ </component>
+</composite>
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-impl-include.composite
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-impl-include.composite?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-impl-include.composite (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-impl-include.composite Thu Jan 21 10:38:07 2010
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:bb="http://bb.tuscanyscatours.com/"
+ xmlns:gvt="http://goodvaluetrips.com/"
+ name="ToursImplInclude">
+
+ <component name="MyTours">
+ <implementation.composite name="bb:Tours" />
+ <reference name="trips" target="TripProvider/Trips" />
+ <property name="currency">GBP</property>
+ </component>
+
+ <include name="gvt:Trips" />
+</composite>
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-impl.composite
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-impl.composite?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-impl.composite (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours-impl.composite Thu Jan 21 10:38:07 2010
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscanyscatours.com/"
+ xmlns:bb="http://bb.tuscanyscatours.com/"
+ name="ToursImpl">
+
+ <component name="MyTours">
+ <implementation.composite name="bb:Tours" />
+ <reference name="trips" target="TripProvider/Trips" />
+ <property name="currency">GBP</property>
+ </component>
+
+ <component name="TripProvider">
+ <implementation.java class="com.goodvaluetrips.impl.TripProviderImpl" />
+ <service name="Trips" />
+ </component>
+</composite>
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours.composite
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours.composite?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours.composite (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/main/resources/tours.composite Thu Jan 21 10:38:07 2010
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bb.tuscanyscatours.com/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ name="Tours">
+
+ <service name="BookTrip" promote="TripBooking/Bookings" />
+ <service name="Checkout" promote="ShoppingCart/Checkout" />
+ <reference name="trips" promote="TripBooking/mytrips" />
+ <property name="currency" type="xs:string">USD</property>
+
+ <component name="TripBooking">
+ <implementation.java class="com.tuscanyscatours.impl.TripBookingImpl" />
+ <service name="Bookings" />
+ <reference name="mytrips" />
+ <reference name="cart" target="ShoppingCart/Updates" />
+ </component>
+
+ <component name="ShoppingCart">
+ <implementation.java class="com.tuscanyscatours.impl.ShoppingCartImpl"/>
+ <service name="Updates" />
+ <service name="Checkout" />
+ <property name="currency" source="$currency"/>
+ </component>
+</composite>
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java Thu Jan 21 10:38:07 2010
@@ -0,0 +1,66 @@
+/*
+ * 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 java.math.BigDecimal;
+
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Checkout;
+
+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 the Building Blocks Composite Implementation Include scenario
+ */
+public class BuildingBlocksImplIncludeTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("tours-impl-include.composite",
+ new SCAContribution("introducing-trips", "../introducing-trips/target/classes"),
+ new SCAContribution("buildingblocks", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImplInclude() {
+ Bookings bookings = ((SCAClient)node).getService(Bookings.class, "MyTours/BookTrip");
+ String bookingCode = bookings.newBooking("FS1APR4", 1);
+ System.out.println("Booking code is " + bookingCode);
+
+ Checkout checkout = ((SCAClient)node).getService(Checkout.class, "MyTours/Checkout");
+ checkout.makePayment(new BigDecimal("1995.00"), "1234567801234567 11/10");
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
Added: tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplTestCase.java?rev=901645&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplTestCase.java (added)
+++ tuscany/sandbox/travelsample/contributions/buildingblocks/src/test/java/scatours/BuildingBlocksImplTestCase.java Thu Jan 21 10:38:07 2010
@@ -0,0 +1,65 @@
+/*
+ * 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 java.math.BigDecimal;
+
+import com.tuscanyscatours.Bookings;
+import com.tuscanyscatours.Checkout;
+
+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 the Building Blocks Composite Implementation scenario
+ */
+public class BuildingBlocksImplTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("tours-impl.composite",
+ new SCAContribution("buildingblocks", "./target/classes"));
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Bookings bookings = ((SCAClient)node).getService(Bookings.class, "MyTours/BookTrip");
+ String bookingCode = bookings.newBooking("FS1APR4", 1);
+ System.out.println("Booking code is " + bookingCode);
+
+ Checkout checkout = ((SCAClient)node).getService(Checkout.class, "MyTours/Checkout");
+ checkout.makePayment(new BigDecimal("1995.00"), "1234567843218765 10/10");
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}