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

« back to all changes in this revision

Viewing changes to src/tests/org/jboss/test/remoting/transporter/proxy/local/Client.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
/***************************************
 
2
 *                                     *
 
3
 *  JBoss: The OpenSource J2EE WebOS   *
 
4
 *                                     *
 
5
 *  Distributable under LGPL license.  *
 
6
 *  See terms of license at gnu.org.   *
 
7
 *                                     *
 
8
 ***************************************/
 
9
package org.jboss.test.remoting.transporter.proxy.local;
 
10
 
 
11
import junit.framework.TestCase;
 
12
import org.jboss.remoting.transporter.TransporterClient;
 
13
import org.jboss.remoting.transporter.TransporterServer;
 
14
 
 
15
/**
 
16
 * @author <a href="mailto:tom@jboss.org">Tom Elrod</a>
 
17
 */
 
18
public class Client extends TestCase
 
19
{
 
20
   private TransporterServer server;
 
21
   private DateProcessor dateProcessor;
 
22
 
 
23
   public void setUp() throws Exception
 
24
   {
 
25
      server = TransporterServer.createTransporterServer("socket://localhost:5400", new DateProcessorImpl(), DateProcessor.class.getName());
 
26
      dateProcessor = (DateProcessor) TransporterClient.createTransporterClient("socket://localhost:5400", DateProcessor.class);
 
27
   }
 
28
 
 
29
   public void testDateFormatting() throws Exception
 
30
   {
 
31
      DateConsumer consumer = (DateConsumer) TransporterClient.createTransporterClient("socket://localhost:5401", DateConsumer.class);
 
32
      String response = consumer.consumeDate(dateProcessor);
 
33
      System.out.println("Response from date consumer is " + response);
 
34
      assertTrue("The DateProcessor within this jvm should have been called to format date and was not.", DateProcessorImpl.formatDateCalled);
 
35
   }
 
36
 
 
37
   public void tearDown()
 
38
   {
 
39
      if (dateProcessor != null)
 
40
      {
 
41
         TransporterClient.destroyTransporterClient(dateProcessor);
 
42
      }
 
43
      if (server != null)
 
44
      {
 
45
         server.stop();
 
46
      }
 
47
   }
 
48
 
 
49
   public static void main(String[] args)
 
50
   {
 
51
      try
 
52
      {
 
53
         Client client = new Client();
 
54
         client.setUp();
 
55
         client.testDateFormatting();
 
56
         client.tearDown();
 
57
      }
 
58
      catch (Exception e)
 
59
      {
 
60
         e.printStackTrace();
 
61
      }
 
62
   }
 
63
}
 
 
b'\\ No newline at end of file'