summaryrefslogtreecommitdiffstats
path: root/sandbox/travelsample/launchers/buildingblocks/src
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-01-21 10:31:55 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-01-21 10:31:55 +0000
commit4ff6f4fdd56ae6ef5085fbdd73525526fbc93139 (patch)
treecbc0ce9b04bb3353aa9d876c972986a046d56ca0 /sandbox/travelsample/launchers/buildingblocks/src
parentcc8b7885905b7990c2fde8a6503e369c45d6e6aa (diff)
Add new launcher buildingblocks
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@901640 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sandbox/travelsample/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java92
-rw-r--r--sandbox/travelsample/launchers/buildingblocks/src/main/resources/jndi.properties39
-rw-r--r--sandbox/travelsample/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java42
3 files changed, 173 insertions, 0 deletions
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 {
+ }
+}