geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject cvs commit: incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/control ControlProtocolTest.java
Date Sun, 14 Mar 2004 01:01:21 GMT
adc         2004/03/13 17:01:21

  Modified:    modules/network/src/java/org/apache/geronimo/network/protocol
                        ServerSocketAcceptor.java
               modules/network/src/test/org/apache/geronimo/network/protocol
                        GSSAPIProtocolTest.java ProtocolStackTest.java
                        SocketProtocolStressTest.java
                        SocketProtocolTest.java
               modules/network/src/test/org/apache/geronimo/network/protocol/control
                        ControlProtocolTest.java
  Log:
  Use connectURI
  
  Revision  Changes    Path
  1.3       +3 -13     incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/protocol/ServerSocketAcceptor.java
  
  Index: ServerSocketAcceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/protocol/ServerSocketAcceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServerSocketAcceptor.java	10 Mar 2004 09:59:13 -0000	1.2
  +++ ServerSocketAcceptor.java	14 Mar 2004 01:01:20 -0000	1.3
  @@ -125,17 +125,13 @@
   
       public void doStart() throws WaitingException, Exception {
           String serverBindAddress = uri.getHost();
  -        String clientConnectAddress = null;
           int serverBindPort = uri.getPort();
  -        int clientConnectPort = serverBindPort;
           int connectBackLog = 50;
           enableTcpNoDelay = true;
   
           Properties params = URISupport.parseQueryParameters(uri);
           enableTcpNoDelay = params.getProperty("tcp.nodelay", "true").equals("true");
           connectBackLog = Integer.parseInt(params.getProperty("tcp.backlog", "50"));
  -        clientConnectAddress = params.getProperty("client.host");
  -        clientConnectPort = Integer.parseInt(params.getProperty("client.port", "0"));
   
           serverSocketChannel = ServerSocketChannel.open();
           serverSocketChannel.socket().bind(new InetSocketAddress(InetAddress.getByName(serverBindAddress),
serverBindPort), connectBackLog);
  @@ -143,19 +139,13 @@
           serverSocketChannel.configureBlocking(false);
           selectionKey = selectorManager.register(serverSocketChannel, SelectionKey.OP_ACCEPT,
this);
   
  -        // Lookup the local host name if needed.
  -        clientConnectAddress = (clientConnectAddress == null || clientConnectAddress.length()
== 0)
  -                ? InetAddress.getLocalHost().getHostName()
  -                : clientConnectAddress;
  -        clientConnectPort = (clientConnectPort <= 0) ? serverSocketChannel.socket().getLocalPort()
: clientConnectPort;
  -
           // Create the client URI:
           Properties clientParms = new Properties();
           clientParms.put("tcp.nodelay", enableTcpNoDelay ? "true" : "false");
           connectURI = new URI("async",
                                null,
  -                             clientConnectAddress,
  -                             clientConnectPort,
  +                             InetAddress.getByName(serverBindAddress).getHostName(),
  +                             serverSocketChannel.socket().getLocalPort(),
                                "",
                                URISupport.toQueryString(clientParms),
                                null);
  
  
  
  1.4       +6 -5      incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/GSSAPIProtocolTest.java
  
  Index: GSSAPIProtocolTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/GSSAPIProtocolTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GSSAPIProtocolTest.java	13 Mar 2004 16:50:18 -0000	1.3
  +++ GSSAPIProtocolTest.java	14 Mar 2004 01:01:20 -0000	1.4
  @@ -62,6 +62,7 @@
       private Latch shutdownLatch;
       private Latch stopLatch;
       private ThreadGroup threadGroup;
  +    private ServerSocketAcceptor ssa;
   
       public void testDummy() throws Exception {
       }
  @@ -106,8 +107,8 @@
   
               SocketProtocol sp = new SocketProtocol();
               sp.setTimeout(1000 * 1000); //todo reset to 10s
  -            sp.setInterface(new InetSocketAddress("localhost", 0));
  -            sp.setAddress(new InetSocketAddress("localhost", 8081));
  +            sp.setInterface(new InetSocketAddress(ssa.getConnectURI().getHost(), 0));
  +            sp.setAddress(new InetSocketAddress(ssa.getConnectURI().getHost(), ssa.getConnectURI().getPort()));
               sp.setSelectorManager(sm);
   
               clientStack.push(sp);
  @@ -230,10 +231,10 @@
               pf.setReclaimPeriod(10 * 1000);
               pf.setTemplate(templateStack);
   
  -            ServerSocketAcceptor ssa = new ServerSocketAcceptor();
  +            ssa = new ServerSocketAcceptor();
               ssa.setSelectorManager(sm);
               ssa.setTimeOut(5 * 1000);
  -            ssa.setUri(new URI("async://localhost:8081/?tcp.nodelay=true&tcp.backlog=5#"));
  +            ssa.setUri(new URI("async://localhost:0/?tcp.nodelay=true&tcp.backlog=5#"));
               ssa.setAcceptorListener(pf);
               ssa.doStart();
   
  
  
  
  1.3       +4 -4      incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/ProtocolStackTest.java
  
  Index: ProtocolStackTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/ProtocolStackTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProtocolStackTest.java	10 Mar 2004 09:59:15 -0000	1.2
  +++ ProtocolStackTest.java	14 Mar 2004 01:01:20 -0000	1.3
  @@ -78,7 +78,7 @@
           ServerSocketAcceptor ssa = new ServerSocketAcceptor();
           ssa.setSelectorManager(sm);
           ssa.setTimeOut(5 * 1000);
  -        ssa.setUri(new URI("async://localhost:8081/?tcp.nodelay=true&tcp.backlog=5#"));
  +        ssa.setUri(new URI("async://localhost:0/?tcp.nodelay=true&tcp.backlog=5#"));
           ssa.setAcceptorListener(pf);
           ssa.doStart();
   
  @@ -122,8 +122,8 @@
           });
   
           sp.setTimeout(1000 * 1000);  //todo set back to 10s
  -        sp.setInterface(new InetSocketAddress("localhost", 0));
  -        sp.setAddress(new InetSocketAddress("localhost", 8081));
  +        sp.setInterface(new InetSocketAddress(ssa.getConnectURI().getHost(), 0));
  +        sp.setAddress(new InetSocketAddress(ssa.getConnectURI().getHost(), ssa.getConnectURI().getPort()));
           sp.setSelectorManager(sm);
   
           sp.doStart();
  
  
  
  1.3       +5 -4      incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/SocketProtocolStressTest.java
  
  Index: SocketProtocolStressTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/SocketProtocolStressTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SocketProtocolStressTest.java	13 Mar 2004 22:59:51 -0000	1.2
  +++ SocketProtocolStressTest.java	14 Mar 2004 01:01:20 -0000	1.3
  @@ -78,10 +78,11 @@
                           for (int i = 0; i < MESSAGE_COUNT; i++)
                               sp.sendDown(getDatagramPacket());
   
  -                        finished.release();
   
                       } catch (Exception e) {
                           e.printStackTrace();
  +                    } finally {
  +                        finished.release();
                       }
                   }
               }.start();
  @@ -166,7 +167,7 @@
           ssa = new ServerSocketAcceptor();
           ssa.setSelectorManager(sm);
           ssa.setTimeOut(5 * 1000);
  -        ssa.setUri(new URI("async://localhost:8081/?tcp.nodelay=true&tcp.backlog=5#"));
  +        ssa.setUri(new URI("async://localhost:0/?tcp.nodelay=true&tcp.backlog=5#"));
           ssa.setAcceptorListener(pf);
           ssa.doStart();
   
  @@ -211,7 +212,7 @@
   
           sp.setTimeout(10 * 1000);
           sp.setInterface(new InetSocketAddress("localhost", 0));
  -        sp.setAddress(new InetSocketAddress("localhost", 8081));
  +        sp.setAddress(new InetSocketAddress(ssa.getConnectURI().getHost(), ssa.getConnectURI().getPort()));
           sp.setSelectorManager(sm);
   
           sp.doStart();
  
  
  
  1.3       +4 -4      incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/SocketProtocolTest.java
  
  Index: SocketProtocolTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/SocketProtocolTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SocketProtocolTest.java	10 Mar 2004 09:59:15 -0000	1.2
  +++ SocketProtocolTest.java	14 Mar 2004 01:01:20 -0000	1.3
  @@ -105,7 +105,7 @@
           ServerSocketAcceptor ssa = new ServerSocketAcceptor();
           ssa.setSelectorManager(sm);
           ssa.setTimeOut(5 * 1000);
  -        ssa.setUri(new URI("async://localhost:8081/?tcp.nodelay=true&tcp.backlog=5#"));
  +        ssa.setUri(new URI("async://localhost:0/?tcp.nodelay=true&tcp.backlog=5#"));
           ssa.setAcceptorListener(pf);
           ssa.doStart();
   
  @@ -149,8 +149,8 @@
           });
   
           sp.setTimeout(10 * 1000);
  -        sp.setInterface(new InetSocketAddress("localhost", 0));
  -        sp.setAddress(new InetSocketAddress("localhost", 8081));
  +        sp.setInterface(new InetSocketAddress(ssa.getConnectURI().getHost(), 0));
  +        sp.setAddress(new InetSocketAddress(ssa.getConnectURI().getHost(), ssa.getConnectURI().getPort()));
           sp.setSelectorManager(sm);
   
           sp.doStart();
  
  
  
  1.3       +4 -4      incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/control/ControlProtocolTest.java
  
  Index: ControlProtocolTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/test/org/apache/geronimo/network/protocol/control/ControlProtocolTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ControlProtocolTest.java	10 Mar 2004 09:59:16 -0000	1.2
  +++ ControlProtocolTest.java	14 Mar 2004 01:01:21 -0000	1.3
  @@ -108,7 +108,7 @@
           ServerSocketAcceptor ssa = new ServerSocketAcceptor();
           ssa.setSelectorManager(sm);
           ssa.setTimeOut(5 * 1000);
  -        ssa.setUri(new URI("async://localhost:8081/?tcp.nodelay=true&tcp.backlog=5#"));
  +        ssa.setUri(new URI("async://localhost:0/?tcp.nodelay=true&tcp.backlog=5#"));
           ssa.setAcceptorListener(pf);
           ssa.doStart();
   
  @@ -120,8 +120,8 @@
   
           SocketProtocol sp = new SocketProtocol();
           sp.setTimeout(10 * 1000);
  -        sp.setInterface(new InetSocketAddress("localhost", 0));
  -        sp.setAddress(new InetSocketAddress("localhost", 8081));
  +        sp.setInterface(new InetSocketAddress(ssa.getConnectURI().getHost(), 0));
  +        sp.setAddress(new InetSocketAddress(ssa.getConnectURI().getHost(), ssa.getConnectURI().getPort()));
           sp.setSelectorManager(sm);
   
           clientStack.push(sp);
  
  
  

Mime
View raw message