From 2d891c3c5df80825e9ff2bf5b6a4e15042a17c1d Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 10 Jun 2009 06:51:43 +0000 Subject: Migrating test case to jUnit 4.5 style git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@783233 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/java/greetings/GreetingsService.java | 2 +- .../test/java/greetings/GreetingsServiceImpl.java | 2 +- .../src/test/java/greetings/GreetingsTestCase.java | 67 ++++++++++++---------- .../test/java/helloworld/HelloWorldService.java | 2 +- .../java/helloworld/HelloWorldServiceImpl.java | 2 +- .../test/java/helloworld/HelloWorldTestCase.java | 27 +++++---- 6 files changed, 57 insertions(+), 45 deletions(-) (limited to 'java/sca') diff --git a/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java b/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java index 532b84bd22..d7dff093f9 100644 --- a/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java +++ b/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java @@ -18,7 +18,7 @@ */ package greetings; -import org.osoa.sca.annotations.Remotable; +import org.oasisopen.sca.annotation.Remotable; /** * This is the business interface of the HelloWorld greetings service. diff --git a/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java b/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java index 86d7f245e8..5ecf5494be 100644 --- a/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java +++ b/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java @@ -18,7 +18,7 @@ */ package greetings; -import org.osoa.sca.annotations.Service; +import org.oasisopen.sca.annotation.Service; /** * This class implements the HelloWorld service. diff --git a/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java b/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java index 8dea2715bf..1035641947 100644 --- a/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java +++ b/java/sca/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java @@ -19,42 +19,47 @@ package greetings; -import java.io.IOException; -import java.net.Socket; +import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; /** * Tests the Greetings service * * @version $Rev$ $Date$ */ -public class GreetingsTestCase extends TestCase { - - private SCADomain scaDomain; - GreetingsService greetingsService = null; - - /** - * @throws java.lang.Exception - */ - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("greetings/greetings.composite"); - greetingsService = scaDomain.getService(GreetingsService.class, "GreetingsServiceComponent"); - } - - /** - * @throws java.lang.Exception - */ - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testInvoke() { - String response = greetingsService.getGreetings("Luciano"); - assertEquals("Hello Luciano", response); - } +public class GreetingsTestCase { + + private Node node; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + protected void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("greetings/greetings.composite"); + node = NodeFactory.newInstance().createNode("CallBackApiTest.composite", new Contribution("c1", location)); + node.start(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + protected void tearDown() throws Exception { + node.stop(); + } + + @Test + public void testInvoke() { + GreetingsService greetingsService = node.getService(GreetingsService.class, "GreetingsServiceComponent"); + String response = greetingsService.getGreetings("Luciano"); + Assert.assertEquals("Hello Luciano", response); + } } diff --git a/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java b/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java index 672dbdc0b5..f46893481b 100644 --- a/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java +++ b/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java @@ -18,7 +18,7 @@ */ package helloworld; -import org.osoa.sca.annotations.Remotable; +import org.oasisopen.sca.annotation.Remotable; /** * The interface for the helloworld service diff --git a/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java b/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java index d7ebd5cbb8..a687534bb2 100644 --- a/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java +++ b/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java @@ -20,7 +20,7 @@ package helloworld; import greetings.GreetingsService; -import org.osoa.sca.annotations.Reference; +import org.oasisopen.sca.annotation.Reference; /** * The HelloWorld service implementation diff --git a/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java b/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java index bdfedee2f8..5bf064b701 100644 --- a/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java +++ b/java/sca/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java @@ -19,37 +19,44 @@ package helloworld; -import junit.framework.TestCase; +import junit.framework.Assert; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; /** * Tests the BPEL Helloworld Service * * @version $Rev$ $Date$ */ -public class HelloWorldTestCase extends TestCase { - private SCADomain scaDomain; +public class HelloWorldTestCase { + private Node node; /** * @throws java.lang.Exception */ - @Override + @BeforeClass protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("helloworld/helloworld.composite"); + String location = ContributionLocationHelper.getContributionLocation("helloworld/helloworld.composite"); + node = NodeFactory.newInstance().createNode("CallBackApiTest.composite", new Contribution("c1", location)); + node.start(); } /** * @throws java.lang.Exception */ - @Override + @AfterClass protected void tearDown() throws Exception { - scaDomain.close(); + node.stop(); } public void testServiceInvocation() { - HelloWorldService bpelService = scaDomain.getService(HelloWorldService.class, "HelloWorldService"); + HelloWorldService bpelService = node.getService(HelloWorldService.class, "HelloWorldService"); String response = bpelService.hello("Luciano"); - assertEquals("Hello Luciano", response); + Assert.assertEquals("Hello Luciano", response); } } -- cgit v1.2.3