From f55c4b03b728a7e5e7a0d418dfac66072c0fc10e Mon Sep 17 00:00:00 2001 From: rfeng Date: Fri, 15 May 2009 04:54:19 +0000 Subject: Enable more test cases git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@775004 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tuscany/sca/node/impl/NodeUtil.java | 5 +- .../tuscany/sca/node/impl/NodeImplTestCase.java | 59 +++++++++++++--------- 2 files changed, 37 insertions(+), 27 deletions(-) (limited to 'java') diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeUtil.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeUtil.java index beb378ff5d..c46d2116a3 100644 --- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeUtil.java +++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeUtil.java @@ -24,7 +24,6 @@ import java.io.InputStream; import java.net.URI; import java.net.URL; import java.net.URLConnection; -import java.util.logging.Logger; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.ContributionFactory; @@ -35,7 +34,9 @@ import org.apache.tuscany.sca.contribution.ContributionFactory; * @version $Rev: $ $Date: $ */ public class NodeUtil { - private static final Logger logger = Logger.getLogger(NodeImpl.class.getName()); + + private NodeUtil() { + } static Contribution contribution(ContributionFactory contributionFactory, org.apache.tuscany.sca.node.Contribution c) { Contribution contribution = contributionFactory.createContribution(); diff --git a/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java b/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java index dc0f37b987..877e4e3643 100644 --- a/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java +++ b/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.node.impl; @@ -51,28 +51,37 @@ public class NodeImplTestCase { Node node = factory.createNode(compositeURI, composite, contribution); testNode2(node); } - -// @Test -// public void testNodeWithRelativeCompositeURI() { -// NodeFactory factory = new NodeFactoryImpl(); -// Contribution contribution = new Contribution("c1", new File("target/test-classes").toURI().toString()); -// String compositeURI = "HelloWorld.composite"; -// Node node = factory.createNode(compositeURI, contribution); -// testNode(node); -// } -// -// @Test -// public void testDefaultNode() { -// testNode(new NodeFactoryImpl().createNode()); -// } -// -// private void testNode(Node node) { -// node.start(); -// HelloWorld hw = node.getService(HelloWorld.class, "HelloWorld"); -// Assert.assertEquals("Hello, Node", hw.hello("Node")); -// node.stop(); -// } - + + @Test + public void testNodeWithRelativeCompositeURI() { + NodeFactory factory = new NodeFactoryImpl(); + Contribution contribution = new Contribution("c1", new File("target/test-classes").toURI().toString()); + String compositeURI = "HelloWorld.composite"; + Node node = factory.createNode(compositeURI, contribution); + testNode(node); + } + + @Test + public void testNodeWithAbsoluteCompositeURI() { + NodeFactory factory = new NodeFactoryImpl(); + Contribution contribution = new Contribution("c1", new File("target/test-classes").toURI().toString()); + String compositeURI = new File("target/test-classes/HelloWorld.composite").toURI().toString(); + Node node = factory.createNode(compositeURI, contribution); + testNode(node); + } + + @Test + public void testDefaultNode() { + testNode(new NodeFactoryImpl().createNode()); + } + + private void testNode(Node node) { + node.start(); + HelloWorld hw = node.getService(HelloWorld.class, "HelloWorld"); + Assert.assertEquals("Hello, Node", hw.hello("Node")); + node.stop(); + } + private void testNode2(Node node) { node.start(); HelloWorld hw = node.getService(HelloWorld.class, "HelloWorld2"); -- cgit v1.2.3