From 4ff6f4fdd56ae6ef5085fbdd73525526fbc93139 Mon Sep 17 00:00:00 2001 From: nash Date: Thu, 21 Jan 2010 10:31:55 +0000 Subject: Add new launcher buildingblocks git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@901640 13f79535-47bb-0310-9956-ffa450edef68 --- .../launchers/buildingblocks/build.xml | 35 ++++++ .../travelsample/launchers/buildingblocks/pom.xml | 130 +++++++++++++++++++++ .../main/java/scatours/BuildingBlocksLauncher.java | 92 +++++++++++++++ .../src/main/resources/jndi.properties | 39 +++++++ .../test/java/scatours/BuildingBlocksTestCase.java | 42 +++++++ 5 files changed, 338 insertions(+) create mode 100644 sandbox/travelsample/launchers/buildingblocks/build.xml create mode 100644 sandbox/travelsample/launchers/buildingblocks/pom.xml create mode 100644 sandbox/travelsample/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java create mode 100644 sandbox/travelsample/launchers/buildingblocks/src/main/resources/jndi.properties create mode 100644 sandbox/travelsample/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java (limited to 'sandbox/travelsample') diff --git a/sandbox/travelsample/launchers/buildingblocks/build.xml b/sandbox/travelsample/launchers/buildingblocks/build.xml new file mode 100644 index 0000000000..127afa94d7 --- /dev/null +++ b/sandbox/travelsample/launchers/buildingblocks/build.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/launchers/buildingblocks/pom.xml b/sandbox/travelsample/launchers/buildingblocks/pom.xml new file mode 100644 index 0000000000..81c13098f4 --- /dev/null +++ b/sandbox/travelsample/launchers/buildingblocks/pom.xml @@ -0,0 +1,130 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + scatours + 1.0-SNAPSHOT + ../../pom.xml + 1.0-SNAPSHOT + scatours-launcher-buildingblocks + Apache Tuscany SCA Tours Building Blocks Launcher + + + + + org.apache.tuscany.sca + scatours-util-launcher-common + ${pom.version} + provided + + + + org.apache.tuscany.sca + tuscany-node-api + ${tuscany.version} + + + + org.apache.activemq + activemq-all + 5.2.0 + + + org.apache.activemq + activemq-web-demo + + + + + + org.apache.tuscany.sca + tuscany-node-impl + ${tuscany.version} + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + ${tuscany.version} + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + ${tuscany.version} + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + ${tuscany.version} + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + ${tuscany.version} + runtime + + + + org.apache.tuscany.sca + tuscany-host-jms-asf + ${tuscany.version} + runtime + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + ../util/scatours-util-launcher-common.jar + + + true + ../lib/ + scatours.BuildingBlocksLauncher + + + + + + + diff --git a/sandbox/travelsample/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java b/sandbox/travelsample/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java new file mode 100644 index 0000000000..aaca0f44fa --- /dev/null +++ b/sandbox/travelsample/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java @@ -0,0 +1,92 @@ +/* + * 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.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import static scatours.launcher.LauncherUtil.locate; + +public class BuildingBlocksLauncher { + + public static void main(String[] args) throws Exception { + runImpl(); + runImplInclude(); + runAppl(); + } + + private static void runImpl() throws Exception { + SCANode node = + SCANodeFactory.newInstance().createSCANode("tours-impl-client.composite", + locate("buildingblocks"), + locate("buildingblocks-client")); + + node.start(); + + Runnable client = ((SCAClient)node).getService(Runnable.class, "ToursClient/Runnable"); + client.run(); + + node.stop(); + } + + private static void runImplInclude() throws Exception { + SCANode node = + SCANodeFactory.newInstance().createSCANode("tours-impl-include-client.composite", + locate("introducing-trips"), + locate("buildingblocks"), + locate("buildingblocks-client")); + + node.start(); + + Runnable client = ((SCAClient)node).getService(Runnable.class, "ToursClient/Runnable"); + client.run(); + + node.stop(); + } + + private static void runAppl() throws Exception { + final BrokerService jmsBroker = new BrokerService(); + jmsBroker.setPersistent(false); + jmsBroker.setUseJmx(false); + jmsBroker.addConnector("tcp://localhost:61619"); + + SCANode node1 = + SCANodeFactory.newInstance().createSCANode("tours-appl.composite", + locate("introducing-trips"), + locate("buildingblocks")); + + SCANode node2 = + SCANodeFactory.newInstance().createSCANode("tours-appl-client.composite", + locate("buildingblocks-client")); + + jmsBroker.start(); + node1.start(); + node2.start(); + + Runnable client = ((SCAClient)node2).getService(Runnable.class, "ApplClient/Runnable"); + client.run(); + + node2.stop(); + node1.stop(); + jmsBroker.stop(); + } +} diff --git a/sandbox/travelsample/launchers/buildingblocks/src/main/resources/jndi.properties b/sandbox/travelsample/launchers/buildingblocks/src/main/resources/jndi.properties new file mode 100644 index 0000000000..88270fd1e0 --- /dev/null +++ b/sandbox/travelsample/launchers/buildingblocks/src/main/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 diff --git a/sandbox/travelsample/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java b/sandbox/travelsample/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java new file mode 100644 index 0000000000..55943e2f45 --- /dev/null +++ b/sandbox/travelsample/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java @@ -0,0 +1,42 @@ +/* + * 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.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests the launcher + */ +public class BuildingBlocksTestCase { + + @Before + public void startServer() throws Exception { + } + + @Test + public void testLauncher() throws Exception { + BuildingBlocksLauncher.main(null); + } + + @After + public void stopServer() throws Exception { + } +} -- cgit v1.2.3