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:31:56 UTC

svn commit: r901640 - in /tuscany/sandbox/travelsample/launchers/buildingblocks: ./ src/ src/main/ src/main/java/ src/main/java/scatours/ src/main/resources/ src/test/ src/test/java/ src/test/java/scatours/

Author: nash
Date: Thu Jan 21 10:31:55 2010
New Revision: 901640

URL: http://svn.apache.org/viewvc?rev=901640&view=rev
Log:
Add new launcher buildingblocks

Added:
    tuscany/sandbox/travelsample/launchers/buildingblocks/
    tuscany/sandbox/travelsample/launchers/buildingblocks/build.xml
    tuscany/sandbox/travelsample/launchers/buildingblocks/pom.xml
    tuscany/sandbox/travelsample/launchers/buildingblocks/src/
    tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/
    tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/java/
    tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/java/scatours/
    tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java
    tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/resources/
    tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/resources/jndi.properties
    tuscany/sandbox/travelsample/launchers/buildingblocks/src/test/
    tuscany/sandbox/travelsample/launchers/buildingblocks/src/test/java/
    tuscany/sandbox/travelsample/launchers/buildingblocks/src/test/java/scatours/
    tuscany/sandbox/travelsample/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java

Added: tuscany/sandbox/travelsample/launchers/buildingblocks/build.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/launchers/buildingblocks/build.xml?rev=901640&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/launchers/buildingblocks/build.xml (added)
+++ tuscany/sandbox/travelsample/launchers/buildingblocks/build.xml Thu Jan 21 10:31:55 2010
@@ -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>

Added: tuscany/sandbox/travelsample/launchers/buildingblocks/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/launchers/buildingblocks/pom.xml?rev=901640&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/launchers/buildingblocks/pom.xml (added)
+++ tuscany/sandbox/travelsample/launchers/buildingblocks/pom.xml Thu Jan 21 10:31:55 2010
@@ -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>

Added: tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java?rev=901640&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java (added)
+++ tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/java/scatours/BuildingBlocksLauncher.java Thu Jan 21 10:31:55 2010
@@ -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();
+    }
+}

Added: tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/resources/jndi.properties
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/resources/jndi.properties?rev=901640&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/resources/jndi.properties (added)
+++ tuscany/sandbox/travelsample/launchers/buildingblocks/src/main/resources/jndi.properties Thu Jan 21 10:31:55 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.
+## ---------------------------------------------------------------------------
+
+# 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

Added: tuscany/sandbox/travelsample/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java?rev=901640&view=auto
==============================================================================
--- tuscany/sandbox/travelsample/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java (added)
+++ tuscany/sandbox/travelsample/launchers/buildingblocks/src/test/java/scatours/BuildingBlocksTestCase.java Thu Jan 21 10:31:55 2010
@@ -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 {
+    }
+}