~ubuntu-branches/ubuntu/raring/libjboss-remoting-java/raring

« back to all changes in this revision

Viewing changes to src/tests/org/jboss/test/remoting/transporter/multiInterface/TestClient.java

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-09 14:01:03 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: package-import@ubuntu.com-20110909140103-hqokx61534tas9rg
Tags: 2.5.3.SP1-1
* Newer but not newest upstream release. Do not build samples.
* Change debian/watch to upstream's svn repo.
* Add patch to fix compile error caused by tomcat update.
  (Closes: #628303)
* Switch to source format 3.0.
* Switch to debhelper level 7.
* Remove useless Depends.
* Update Standards-Version: 3.9.2.
* Update README.source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.jboss.test.remoting.transporter.multiInterface;
 
2
 
 
3
import junit.framework.TestCase;
 
4
import org.jboss.remoting.InvokerLocator;
 
5
import org.jboss.remoting.transporter.TransporterClient;
 
6
 
 
7
import java.io.IOException;
 
8
 
 
9
/**
 
10
 * @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
 
11
 */
 
12
public class TestClient extends TestCase
 
13
{
 
14
   public void testClientCall() throws Exception
 
15
   {
 
16
      String locatorURI = "socket://localhost:5400";
 
17
      InvokerLocator locator = new InvokerLocator(locatorURI);
 
18
      TestServer test = (TestServer) TransporterClient.createTransporterClient(locator, TestServer.class);
 
19
      Object response = test.processTestMessage("Hello");
 
20
      System.out.println("response is: " + response);
 
21
      assertEquals("response should be 'Hello - has been processed'", "Hello - has been processed", response);
 
22
 
 
23
      // now make call that should throw exception
 
24
      try
 
25
      {
 
26
         test.throwException();
 
27
         assertTrue("Should have received IOException thrown by server.", false);
 
28
      }
 
29
      catch(IOException ioex)
 
30
      {
 
31
         assertTrue("Should have received IOException thrown by server.", true);
 
32
      }
 
33
 
 
34
      TransporterClient.destroyTransporterClient(test);
 
35
 
 
36
 
 
37
      TestServer2 test2 = (TestServer2) TransporterClient.createTransporterClient(locator, TestServer2.class);
 
38
      Object response2 = test2.doIt("foobar");
 
39
      System.out.println("response2 is: " + response2);
 
40
      assertEquals("response should be 'foobar'", "foobar", response2);
 
41
 
 
42
      TransporterClient.destroyTransporterClient(test2);
 
43
 
 
44
   }
 
45
 
 
46
}