You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2009/06/16 10:19:26 UTC

svn commit: r785108 - in /tuscany/java/sca/itest/nodes: one-node-test/src/test/java/itest/OneNodeTestCase.java two-nodes-test/src/test/java/itest/TwoNodesTestCase.java

Author: antelder
Date: Tue Jun 16 08:19:26 2009
New Revision: 785108

URL: http://svn.apache.org/viewvc?rev=785108&view=rev
Log:
Don't hard code the jar version name so its easy to make tuscany branches and releases

Modified:
    tuscany/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java
    tuscany/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java

Modified: tuscany/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java?rev=785108&r1=785107&r2=785108&view=diff
==============================================================================
--- tuscany/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java (original)
+++ tuscany/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java Tue Jun 16 08:19:26 2009
@@ -21,6 +21,9 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+
 import itest.nodes.Helloworld;
 
 import org.apache.tuscany.sca.node.Contribution;
@@ -42,11 +45,25 @@
         System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", "false");
         NodeFactory factory = NodeFactory.newInstance();
         node = factory.createNode(
-               new Contribution("service", "../helloworld-service/target/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"),
-               new Contribution("client", "../helloworld-client/target/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"));
+               new Contribution("service", getJar("../helloworld-service/target")),
+               new Contribution("client", getJar("../helloworld-client/target")));
         node.start();
     }
 
+    /**
+     * Get the jar in the target folder without being dependent on the version name to 
+     * make tuscany releases easier
+     */
+    private static String getJar(String targetDirectory) {
+        File f = new File(targetDirectory);
+        for (File file : f.listFiles()) {
+            if (file.getName().endsWith(".jar")) {
+                return file.toURI().toString();
+            }
+        }
+        throw new IllegalStateException("Can't find jar in: " + targetDirectory);
+    }
+    
     @Test
     public void testCalculator() throws Exception {
 

Modified: tuscany/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java?rev=785108&r1=785107&r2=785108&view=diff
==============================================================================
--- tuscany/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java (original)
+++ tuscany/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java Tue Jun 16 08:19:26 2009
@@ -46,12 +46,26 @@
     public static void setUpBeforeClass() throws Exception {
         System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", "false");
         NodeFactory factory = NodeFactory.newInstance();
-        serviceNode = factory.createNode(new Contribution("service", new File("../helloworld-service/target/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar").toURI().toString()));
+        serviceNode = factory.createNode(new Contribution("service", getJar("../helloworld-service/target")));
         serviceNode.start();
-        clientNode = factory.createNode(new Contribution("client", new File("../helloworld-client/target/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar").toURI().toString()));
+        clientNode = factory.createNode(new Contribution("client", getJar("../helloworld-client/target")));
         clientNode.start();
     }
 
+    /**
+     * Get the jar in the target folder without being dependent on the version name to 
+     * make tuscany releases easier
+     */
+    private static String getJar(String targetDirectory) {
+        File f = new File(targetDirectory);
+        for (File file : f.listFiles()) {
+            if (file.getName().endsWith(".jar")) {
+                return file.toURI().toString();
+            }
+        }
+        throw new IllegalStateException("Can't find jar in: " + targetDirectory);
+    }
+    
     @Test
     public void testCalculator() throws Exception {
         Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService");