diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-20 18:05:26 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-20 18:05:26 +0000 |
commit | 4c2bb0cebb0caff68e32c2f32d9e4e1c0310b33e (patch) | |
tree | 0217eebf7a156409f84a220b817c89e6c3830ef2 /sca-java-2.x/trunk/itest/ws-jaxws/launcher-ri | |
parent | f6ff505e5bbfe699127f5c468562b4609b8c0f41 (diff) |
Add exceptions to the test and make the launchers a bit more generic
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@936018 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/itest/ws-jaxws/launcher-ri')
-rw-r--r-- | sca-java-2.x/trunk/itest/ws-jaxws/launcher-ri/src/test/java/org/apache/tuscany/sca/binding/ws/jaxws/launcher/JavaFirstTestCase.java | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/sca-java-2.x/trunk/itest/ws-jaxws/launcher-ri/src/test/java/org/apache/tuscany/sca/binding/ws/jaxws/launcher/JavaFirstTestCase.java b/sca-java-2.x/trunk/itest/ws-jaxws/launcher-ri/src/test/java/org/apache/tuscany/sca/binding/ws/jaxws/launcher/JavaFirstTestCase.java index 22ed3d17b4..3c14218118 100644 --- a/sca-java-2.x/trunk/itest/ws-jaxws/launcher-ri/src/test/java/org/apache/tuscany/sca/binding/ws/jaxws/launcher/JavaFirstTestCase.java +++ b/sca-java-2.x/trunk/itest/ws-jaxws/launcher-ri/src/test/java/org/apache/tuscany/sca/binding/ws/jaxws/launcher/JavaFirstTestCase.java @@ -19,26 +19,42 @@ package org.apache.tuscany.sca.binding.ws.jaxws.launcher; -import junit.framework.TestCase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import org.apache.tuscany.sca.binding.ws.jaxws.external.client.HelloWorldClientLauncher; import org.apache.tuscany.sca.binding.ws.jaxws.external.service.HelloWorldServiceLauncher; import org.apache.tuscany.sca.node.Contribution; import org.apache.tuscany.sca.node.Node; import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; -public class JavaFirstTestCase extends TestCase { +public class JavaFirstTestCase { private Node node; + private HelloWorldServiceLauncher externalService; + private HelloWorldClientLauncher externalClient; - @Override - protected void setUp() throws Exception { + @Before + public void setUp() throws Exception { // Start the external service - HelloWorldServiceLauncher.main(null); + externalService = new HelloWorldServiceLauncher(); + externalService.createService(); // Start the SCA contribution node = NodeFactory.newInstance().createNode(new Contribution("java-first", "../contribution-java-first/target/classes")); node.start(); + + // start the external client + try { + externalClient = new HelloWorldClientLauncher(); + externalClient.createClient(); + } catch (Exception ex) { + ex.printStackTrace(); + throw ex; + } } /* @@ -46,16 +62,26 @@ public class JavaFirstTestCase extends TestCase { System.out.println("Press a key"); System.in.read(); } -*/ +*/ + + @Test + public void testGetGreetings() throws Exception { + assertEquals("Hello Fred", externalClient.getGreetings("Fred")); + } - public void testCalculator() throws Exception { + @Test + public void testGetGreetingsException() throws Exception { try { - HelloWorldClientLauncher.main(null); + externalClient.getGreetingsException("Fred"); } catch (Exception ex) { - ex.printStackTrace(); - throw ex; + return; } + fail("expecting exception"); + } + + public void testGetGreetingsComplex() throws Exception { + /* Foo f = new Foo(); Bar b1 = new Bar(); @@ -83,9 +109,11 @@ public class JavaFirstTestCase extends TestCase { */ } - @Override - protected void tearDown() throws Exception { + @After + public void tearDown() throws Exception { node.stop(); + externalClient.destroyClient(); + externalService.destoryService(); } } |