Package org.jboss.test.messaging.core

Examples of org.jboss.test.messaging.core.SimpleReceiver


      {
         return null;
      }
      for(Iterator i = receivers.iterator(); i.hasNext();)
      {
         SimpleReceiver r = (SimpleReceiver)i.next();
         if (name.equals(r.getName()))
         {
            return r;
         }
      }
      SimpleReceiver r = new SimpleReceiver(name);
      receivers.add(r);
      return r;
   }
View Full Code Here


   public String dump()
   {
      StringBuffer sb = new StringBuffer("{");
      for(Iterator i = receivers.iterator(); i.hasNext();)
      {
         SimpleReceiver r = (SimpleReceiver)i.next();
         sb.append(r.toString());
         if (i.hasNext())
         {
            sb.append(", ");
         }
      }
View Full Code Here

         // we test only non-recoverable channels now
         return;
      }

      SimpleDeliveryObserver observer = new SimpleDeliveryObserver();
      SimpleReceiver r1 = new SimpleReceiver("ONE", SimpleReceiver.ACKING);
      SimpleReceiver r2 = new SimpleReceiver("TWO", SimpleReceiver.ACKING);
     
      queue.add(r1);
      queue.add(r2);
     
      Delivery d = queue.handle(observer, createReference(0, false, "payload"), null);
     
      assertTrue(d.isDone());
      List l1 = r1.getMessages();
      List l2 = r2.getMessages();
      if (l2.isEmpty())
      {
         assertEquals(1, l1.size());
         Message m = (Message)l1.get(0);
         assertEquals("payload", m.getPayload());
View Full Code Here

         // we test only recoverable channels now
         return;
      }

      SimpleDeliveryObserver observer = new SimpleDeliveryObserver();
      SimpleReceiver r1 = new SimpleReceiver("ONE", SimpleReceiver.ACKING);
      SimpleReceiver r2 = new SimpleReceiver("TWO", SimpleReceiver.ACKING);
      assertTrue(queue.add(r1));
      assertTrue(queue.add(r2));

      Delivery d = queue.handle(observer, createReference(0, true, "payload"), null);

      assertTrue(d.isDone());
      List l1 = r1.getMessages();
      List l2 = r2.getMessages();
      if (l2.isEmpty())
      {
         assertEquals(1, l1.size());
         Message m = (Message)l1.get(0);
         assertEquals("payload", m.getPayload());
View Full Code Here

    * If a channel has a set a receiver and remove is called with a different receiver
    * need to ensure the receiver is not removed (since it doesn't match)
    */
   public void testRemoveDifferentReceiver() throws Exception
   {
      Receiver receiver1 = new SimpleReceiver();
     
      Receiver receiver2 = new SimpleReceiver();
     
      assertFalse(queue.iterator().hasNext());
     
      queue.add(receiver1);
     
View Full Code Here

      Message sm = (Message)stored.iterator().next();
      assertFalse(sm.isReliable());
      assertEquals(0, sm.getMessageID());

      SimpleReceiver receiver = new SimpleReceiver("ACKING", SimpleReceiver.ACKING);
      queue.add(receiver);
      queue.deliver();
      assertEquals(1, receiver.getMessages().size());
      assertEquals(0, ((Message)receiver.getMessages().get(0)).getMessageID());

      queue.deliver();
      assertEquals(1, receiver.getMessages().size());


   }
View Full Code Here

      }

      List stored = queue.browse();
      assertEqualSets(refs, stored);

      SimpleReceiver receiver = new SimpleReceiver("ACKING", SimpleReceiver.ACKING);
      queue.add(receiver);
      queue.deliver();
      assertEquals(10, receiver.getMessages().size());
      for(int i = 0; i < NUMBER_OF_MESSAGES; i++)
      {
         assertEquals(i, ((Message)receiver.getMessages().get(i)).getMessageID());        
      }
      receiver.clear();

      queue.deliver();
      assertEquals(0, receiver.getMessages().size());
   }
View Full Code Here

      assertTrue(queue.browse().isEmpty());

      queue.deliver();
     
      Receiver r = new SimpleReceiver("ACKING", SimpleReceiver.ACKING);
     
      queue.add(r);
     
      queue.deliver();
   }
View Full Code Here

      assertTrue(sm.isReliable());
      assertEquals(0, sm.getMessageID());

      queue.deliver();

      SimpleReceiver receiver = new SimpleReceiver("ACKING", SimpleReceiver.ACKING);
      queue.add(receiver);
      queue.deliver();
      assertEquals(1, receiver.getMessages().size());
      assertEquals(0, ((Message)receiver.getMessages().get(0)).getMessageID());

      queue.deliver();
      assertEquals(1, receiver.getMessages().size());
   }
View Full Code Here

         // the channel must not accept the message
         assertNull(delivery);

         queue.deliver();
        
         Receiver r = new SimpleReceiver("ACKING", SimpleReceiver.ACKING);
        
         queue.add(r);
        
         queue.deliver();
      }
View Full Code Here

TOP

Related Classes of org.jboss.test.messaging.core.SimpleReceiver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.