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 SocketProtocolStressTest.java
Date Tue, 27 Jul 2004 01:55:45 GMT
adc         2004/07/26 18:55:45

  Modified:    modules/network/src/test/org/apache/geronimo/network/protocol
                        SocketProtocolStressTest.java
  Log:
  A tad more stressful as it sends the packet back.
  
  Revision  Changes    Path
  1.11      +21 -38    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SocketProtocolStressTest.java	8 Jul 2004 22:07:54 -0000	1.10
  +++ SocketProtocolStressTest.java	27 Jul 2004 01:55:45 -0000	1.11
  @@ -39,7 +39,7 @@
       protected ThreadPool tp;
       protected ClockPool cp;
       protected SelectorManager sm;
  -    protected SocketProtocol spt;
  +    protected AcceptableProtocolStack aps;
       protected ProtocolFactory pf;
       protected ServerSocketAcceptor ssa;
       protected SocketProtocol sp;
  @@ -48,11 +48,11 @@
       public void testNothing() {}
   
       public void testSimple() throws Exception {
  -        sp.sendDown(getDatagramPacket());
  -        sp.sendDown(getDatagramPacket());
  -        sp.sendDown(getDatagramPacket());
  +        sp.sendDown(allocateDownPacket());
  +        sp.sendDown(allocateDownPacket());
  +        sp.sendDown(allocateDownPacket());
   
  -        DatagramDownPacket packet = getDatagramPacket();
  +        DatagramDownPacket packet = allocateDownPacket();
           sp.sendDown(packet);
           sp.sendDown(packet);
   
  @@ -77,7 +77,7 @@
                           barrier.barrier();
   
                           for (int i = 0; i < MESSAGE_COUNT; i++)
  -                            sp.sendDown(getDatagramPacket());
  +                            sp.sendDown(allocateDownPacket());
   
   
                       } catch (Exception e) {
  @@ -112,60 +112,43 @@
           sm = new SelectorManager();
           sm.setThreadPool(tp);
           sm.setThreadName("SM");
  -        sm.setTimeout(500);
  +        sm.setTimeout(0);
           sm.doStart();
   
  -        spt = new SocketProtocol();
  -        spt.setUpProtocol(new Protocol() {
  -            public Protocol getUpProtocol() {
  -                throw new NoSuchMethodError();
  -            }
  +        aps = new AcceptableProtocolStack();
   
  -            public void setUpProtocol(Protocol up) {
  -                throw new NoSuchMethodError();
  -            }
  +        SocketProtocol adc = new SocketProtocol();
  +        adc.setTimeout(10 * 1000);
  +        adc.setSelectorManager(sm);
   
  -            public Protocol getDownProtocol() {
  -                throw new NoSuchMethodError();
  -            }
  -
  -            public void setDownProtocol(Protocol down) {
  -                throw new NoSuchMethodError();
  -            }
  -
  -            public void clearLinks() {
  -            }
  -
  -            public Protocol cloneProtocol() throws CloneNotSupportedException {
  -                return (Protocol) super.clone();
  -            }
  +        aps.push(adc);
   
  +        aps.push(new AbstractProtocol() {
               public void setup() {
               }
   
               public void drain() {
               }
   
  -            public void teardown() throws ProtocolException {
  +            public void teardown() {
               }
   
  -            public void sendUp(UpPacket packet) {
  +            public void sendUp(UpPacket packet) throws ProtocolException {
                   count++;
  +                this.getDownProtocol().sendDown(allocateDownPacket());
               }
   
               public void sendDown(DownPacket packet) {
               }
   
           });
  -        spt.setTimeout(10 * 1000);
  -        spt.setSelectorManager(sm);
   
           pf = new ProtocolFactory();
           pf.setClockPool(cp);
           pf.setMaxAge(Long.MAX_VALUE);
           pf.setMaxInactivity(1 * 60 * 60 * 1000);
           pf.setReclaimPeriod(10 * 1000);
  -        pf.setTemplate(spt);
  +        pf.setTemplate(aps);
   
           ssa = new ServerSocketAcceptor();
           ssa.setSelectorManager(sm);
  @@ -205,7 +188,7 @@
               public void drain() {
               }
   
  -            public void teardown() throws ProtocolException {
  +            public void teardown() {
               }
   
               public void sendUp(UpPacket packet) {
  @@ -231,7 +214,7 @@
   
           pf.drain();
   
  -        spt.drain();
  +        aps.drain();
   
           sm.doStop();
   
  @@ -240,7 +223,7 @@
           tp.doStop();
       }
   
  -    public DatagramDownPacket getDatagramPacket() {
  +    public DatagramDownPacket allocateDownPacket() {
           DatagramDownPacket packet = new DatagramDownPacket();
           ArrayList list = new ArrayList();
   
  
  
  

Mime
View raw message