From ea2e710442179cdb42ef593c34ff691b5acb4145 Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 16 Jun 2009 08:19:26 +0000 Subject: Don't hard code the jar version name so its easy to make tuscany branches and releases git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@785108 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/java/itest/OneNodeTestCase.java | 21 +++++++++++++++++++-- .../src/test/java/itest/TwoNodesTestCase.java | 18 ++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java b/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java index f05851a117..63ddc789db 100644 --- a/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java +++ b/java/sca/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java @@ -21,6 +21,9 @@ package itest; 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 @@ public class OneNodeTestCase{ 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 { diff --git a/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java b/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java index 4659b717fb..8352f70e17 100644 --- a/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java +++ b/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java @@ -46,12 +46,26 @@ public class TwoNodesTestCase{ 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"); -- cgit v1.2.3