diff options
Diffstat (limited to 'sandbox/travelsample/contributions/buildingblocks-client')
14 files changed, 649 insertions, 0 deletions
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/build.xml b/sandbox/travelsample/contributions/buildingblocks-client/build.xml new file mode 100644 index 0000000000..9ea7438516 --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/build.xml @@ -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-client" default="compile">
+ <import file="../../antdefs.xml"/>
+</project>
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/pom.xml b/sandbox/travelsample/contributions/buildingblocks-client/pom.xml new file mode 100644 index 0000000000..de4a711af0 --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/pom.xml @@ -0,0 +1,111 @@ +<?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-client</artifactId>
+ <name>Apache Tuscany SCA Tours Building Blocks Client 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-binding-ws-axis2</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms-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>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jms-asf</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-all</artifactId>
+ <version>5.2.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ </exclusions>
+ <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>
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/Bookings.java b/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/Bookings.java new file mode 100644 index 0000000000..e5e994b73c --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/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 scatours;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Bookings {
+ String newBooking(String trip, int people);
+}
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/Checkout.java b/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/Checkout.java new file mode 100644 index 0000000000..519b7779fa --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/Checkout.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 scatours;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Checkout {
+ void makePayment(BigDecimal amount, String cardInfo);
+}
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/impl/ApplClientImpl.java b/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/impl/ApplClientImpl.java new file mode 100644 index 0000000000..278673c67d --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/impl/ApplClientImpl.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.impl;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import scatours.Bookings;
+import scatours.Checkout;
+
+@Service(Runnable.class)
+public class ApplClientImpl {
+ @Reference
+ protected Bookings bookings1, bookings2;
+
+ @Reference
+ protected Checkout checkout1, checkout2;
+
+ public ApplClientImpl() {
+ }
+
+ public void run() {
+ String bookingCode = bookings1.newBooking("FS1APR4", 1);
+ System.out.println("Booking code is " + bookingCode);
+
+ checkout1.makePayment(new BigDecimal("1995.00"), "1234567843218765 10/10");
+
+ bookingCode = bookings2.newBooking("AC3MAY9", 2);
+ System.out.println("Booking code is " + bookingCode);
+
+ checkout2.makePayment(new BigDecimal("2295.00"), "9876123456784321 11/11");
+ }
+}
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/impl/ToursClientImpl.java b/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/impl/ToursClientImpl.java new file mode 100644 index 0000000000..16934872b9 --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/main/java/scatours/impl/ToursClientImpl.java @@ -0,0 +1,47 @@ +/*
+ * 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.impl;
+
+import java.math.BigDecimal;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import scatours.Bookings;
+import scatours.Checkout;
+
+@Service(Runnable.class)
+public class ToursClientImpl {
+ @Reference
+ protected Bookings bookings;
+
+ @Reference
+ protected Checkout checkout;
+
+ public ToursClientImpl() {
+ }
+
+ public void run() {
+ String bookingCode = bookings.newBooking("FS1APR4", 1);
+ System.out.println("Booking code is " + bookingCode);
+
+ checkout.makePayment(new BigDecimal("1995.00"), "1234567843218765 10/10");
+ }
+}
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e3f6effcee --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ +<?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://tuscanyscatours.com/" />
+ <deployable composite="tst:ToursApplClient" />
+ <deployable composite="tst:ToursImplClient" />
+ <deployable composite="tst:ToursImplIncludeClient" />
+</contribution>
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/tours-appl-client.composite b/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/tours-appl-client.composite new file mode 100644 index 0000000000..b9f9d59f43 --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/tours-appl-client.composite @@ -0,0 +1,40 @@ +<?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:tst="http://tuscanyscatours.com/"
+ name="ToursApplClient">
+
+ <component name="ApplClient">
+ <implementation.java class="scatours.impl.ApplClientImpl" />
+ <reference name="bookings1">
+ <binding.ws uri="http://localhost:8081/BookTrip" />
+ </reference>
+ <reference name="checkout1">
+ <binding.ws uri="http://localhost:8081/Checkout" />
+ </reference>
+ <reference name="bookings2">
+ <binding.jms uri="jms:BookTrip" />
+ </reference>
+ <reference name="checkout2">
+ <binding.jms uri="jms:Checkout" />
+ </reference>
+ </component>
+</composite>
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/tours-impl-client.composite b/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/tours-impl-client.composite new file mode 100644 index 0000000000..f8f0b3d4d1 --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/tours-impl-client.composite @@ -0,0 +1,32 @@ +<?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:tst="http://tuscanyscatours.com/"
+ name="ToursImplClient">
+
+ <component name="ToursClient">
+ <implementation.java class="scatours.impl.ToursClientImpl" />
+ <reference name="bookings" target="MyTours/BookTrip" />
+ <reference name="checkout" target="MyTours/Checkout" />
+ </component>
+
+ <include name="tst:ToursImpl" />
+</composite>
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/tours-impl-include-client.composite b/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/tours-impl-include-client.composite new file mode 100644 index 0000000000..7310d0540d --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/main/resources/tours-impl-include-client.composite @@ -0,0 +1,32 @@ +<?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:tst="http://tuscanyscatours.com/"
+ name="ToursImplIncludeClient">
+
+ <component name="ToursClient">
+ <implementation.java class="scatours.impl.ToursClientImpl" />
+ <reference name="bookings" target="MyTours/BookTrip" />
+ <reference name="checkout" target="MyTours/Checkout" />
+ </component>
+
+ <include name="tst:ToursImplInclude" />
+</composite>
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksApplTestCase.java b/sandbox/travelsample/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksApplTestCase.java new file mode 100644 index 0000000000..2cf08ec420 --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksApplTestCase.java @@ -0,0 +1,77 @@ +/*
+ * 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.activemq.broker.BrokerService;
+
+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 Application scenario
+ */
+public class BuildingBlocksApplTestCase {
+
+ private BrokerService jmsBroker;
+ private SCANode node1, node2;
+
+ @Before
+ public void startServer() throws Exception {
+ jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+
+ node1 = SCANodeFactory.newInstance().createSCANode("tours-appl.composite",
+ new SCAContribution("introducing-trips", "../introducing-trips/target/classes"),
+ new SCAContribution("buildingblocks", "../buildingblocks/target/classes"));
+
+ node2 = SCANodeFactory.newInstance().createSCANode("tours-appl-client.composite",
+ new SCAContribution("buildingblocks-client", "./target/classes"));
+
+ jmsBroker.start();
+ node1.start();
+ node2.start();
+ }
+
+ @Test
+ public void testAppl() {
+ Runnable client = ((SCAClient)node2).getService(Runnable.class, "ApplClient/Runnable");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node2 != null) {
+ node2.stop();
+ }
+ if (node1 != null) {
+ node1.stop();
+ }
+ if (jmsBroker != null) {
+ jmsBroker.stop();
+ }
+ }
+}
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java b/sandbox/travelsample/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java new file mode 100644 index 0000000000..ad48db5616 --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplIncludeTestCase.java @@ -0,0 +1,59 @@ +/*
+ * 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 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-client.composite",
+ new SCAContribution("introducing-trips", "../introducing-trips/target/classes"),
+ new SCAContribution("buildingblocks", "../buildingblocks/target/classes"),
+ new SCAContribution("buildingblocks-client", "./target/classes"));
+
+ node.start();
+ }
+
+ @Test
+ public void testImplInclude() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "ToursClient/Runnable");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplTestCase.java b/sandbox/travelsample/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplTestCase.java new file mode 100644 index 0000000000..c4cffa3e02 --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/test/java/scatours/BuildingBlocksImplTestCase.java @@ -0,0 +1,58 @@ +/*
+ * 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 the Building Blocks Composite Implementation scenario
+ */
+public class BuildingBlocksImplTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode("tours-impl-client.composite",
+ new SCAContribution("buildingblocks", "../buildingblocks/target/classes"),
+ new SCAContribution("buildingblocks-client", "./target/classes"));
+
+ node.start();
+ }
+
+ @Test
+ public void testImpl() {
+ Runnable client = ((SCAClient)node).getService(Runnable.class, "ToursClient/Runnable");
+ client.run();
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+}
diff --git a/sandbox/travelsample/contributions/buildingblocks-client/src/test/resources/jndi.properties b/sandbox/travelsample/contributions/buildingblocks-client/src/test/resources/jndi.properties new file mode 100644 index 0000000000..88270fd1e0 --- /dev/null +++ b/sandbox/travelsample/contributions/buildingblocks-client/src/test/resources/jndi.properties @@ -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.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.BookTrip = BookTripRequestQueue
+queue.Checkout = CheckoutRequestQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi
|