summaryrefslogtreecommitdiffstats
path: root/sandbox/travelsample
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
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 'sandbox/travelsample')
-rw-r--r--sandbox/travelsample/launchers/buildingblocks/build.xml35
-rw-r--r--sandbox/travelsample/launchers/buildingblocks/pom.xml130
-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
5 files changed, 338 insertions, 0 deletions
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 @@
+<!--
+ * 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-launcher-buildingblocks" default="compile">
+ <import file="../../antdefs.xml"/>
+ <path id="compile-path">
+ <pathelement path="../../util/launcher-common/target/scatours-util-launcher-common.jar"/>
+ </path>
+
+ <target name="run">
+ <java classname="scatours.BuildingBlocksLauncher" fork="true">
+ <classpath>
+ <pathelement location="target/${ant.project.name}.jar"/>
+ <path refid="compile-path"/>
+ <pathelement location="${env.TUSCANY_HOME}/lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+</project>
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 @@
+<?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-launcher-buildingblocks</artifactId>
+ <name>Apache Tuscany SCA Tours Building Blocks Launcher</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>scatours-util-launcher-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${tuscany.version}</version>
+ </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>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </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-host-jetty</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-host-jms-asf</artifactId>
+ <version>${tuscany.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Class-Path>../util/scatours-util-launcher-common.jar</Class-Path>
+ </manifestEntries>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>../lib/</classpathPrefix>
+ <mainClass>scatours.BuildingBlocksLauncher</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 {
+ }
+}