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

« back to all changes in this revision

Viewing changes to src/tests/org/jboss/test/remoting/lease/socket/ClientLeasePeriodTestServer.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
 * JBoss, Home of Professional Open Source
 
3
 *
 
4
 * Distributable under LGPL license.
 
5
 * See terms of license at gnu.org.
 
6
 */
 
7
package org.jboss.test.remoting.lease.socket;
 
8
 
 
9
import org.jboss.jrunit.extensions.ServerTestCase;
 
10
import org.jboss.logging.Logger;
 
11
import org.jboss.remoting.transport.Connector;
 
12
import org.jboss.remoting.ConnectionListener;
 
13
import org.jboss.remoting.Client;
 
14
 
 
15
/**
 
16
 * @author <a href="mailto:ovidiu@jboss.org">Ovidiu Feodorov</a>
 
17
 * @version <tt>$Revision: 2171 $</tt>
 
18
 * $Id: ClientLeasePeriodTestServer.java 2171 2007-02-16 05:09:03Z rsigal $
 
19
 */
 
20
public class ClientLeasePeriodTestServer extends ServerTestCase
 
21
{
 
22
   // Constants ------------------------------------------------------------------------------------
 
23
 
 
24
   public static String locatorURINoLease = "socket://localhost:9900";
 
25
   public static String locatorURILease = "socket://localhost:9909";
 
26
   protected static Logger log = Logger.getLogger(ClientLeasePeriodTestServer.class);
 
27
 
 
28
   // Static ---------------------------------------------------------------------------------------
 
29
 
 
30
   public static void main(String[] args)
 
31
   {
 
32
      try
 
33
      {
 
34
         ClientLeasePeriodTestServer server = new ClientLeasePeriodTestServer();
 
35
         server.setUp();
 
36
         Thread.sleep(600000);
 
37
         server.tearDown();
 
38
      }
 
39
      catch (Exception e)
 
40
      {
 
41
         log.error(e);
 
42
      }
 
43
   }
 
44
   
 
45
   
 
46
   // Attributes -----------------------------------------------------------------------------------
 
47
 
 
48
   private Connector connectorNoLease;
 
49
   private Connector connectorLease;
 
50
   private ConnectionListener connectionListener;
 
51
 
 
52
   // Constructors ---------------------------------------------------------------------------------
 
53
 
 
54
   // Public ---------------------------------------------------------------------------------------
 
55
 
 
56
   // Package protected ----------------------------------------------------------------------------
 
57
 
 
58
   // Protected ------------------------------------------------------------------------------------
 
59
 
 
60
   protected void setUp() throws Exception
 
61
   {
 
62
      connectorNoLease = new Connector(ClientLeasePeriodTestServer.locatorURINoLease);
 
63
      connectorNoLease.create();
 
64
      connectorNoLease.start();
 
65
 
 
66
      connectorLease = new Connector(ClientLeasePeriodTestServer.locatorURILease);
 
67
      connectorLease.create();
 
68
      connectorLease.start();
 
69
 
 
70
      connectionListener = new ConnectionListener()
 
71
      {
 
72
         public void handleConnectionException(Throwable throwable, Client client)
 
73
         {
 
74
         }
 
75
      };
 
76
 
 
77
      // activate leases
 
78
      connectorLease.addConnectionListener(connectionListener);
 
79
 
 
80
      super.setUp();
 
81
   }
 
82
 
 
83
   protected void tearDown() throws Exception
 
84
   {
 
85
      if(connectorLease != null)
 
86
      {
 
87
         connectorLease.removeConnectionListener(connectionListener);
 
88
         connectorLease.stop();
 
89
         connectorLease.destroy();
 
90
      }
 
91
 
 
92
      if(connectorNoLease != null)
 
93
      {
 
94
         connectorNoLease.stop();
 
95
         connectorNoLease.destroy();
 
96
      }
 
97
 
 
98
      super.tearDown();
 
99
   }
 
100
 
 
101
   // Private --------------------------------------------------------------------------------------
 
102
 
 
103
   // Inner classes --------------------------------------------------------------------------------
 
104
}