Package net.engio.mbassy.bus

Examples of net.engio.mbassy.bus.MBassador.publish()


  public void testSimpleStringCondition() throws Exception {
    MBassador bus = createBus(SyncAsync());
    bus.subscribe(new ConditionalMessageListener());

    TestEvent message = new TestEvent("TEST", 0);
    bus.publish(message);

    assertTrue(message.wasHandledBy("handleTypeMessage", "handleEnvelopedMessage"));
        assertFalse(message.wasHandledBy("handleInvalidEL"));
  }
View Full Code Here


  public void testSimpleNumberCondition() throws Exception {
    MBassador bus = new MBassador();
    bus.subscribe(new ConditionalMessageListener());

    TestEvent message = new TestEvent("", 5);
    bus.publish(message);

    assertTrue(message.wasHandledBy("handleSizeMessage"));
        assertFalse(message.wasHandledBy("handleInvalidEL"));
  }
 
View Full Code Here

  public void testHandleCombinedEL() throws Exception {
    MBassador bus = createBus(SyncAsync());
    bus.subscribe(new ConditionalMessageListener());

    TestEvent message = new TestEvent("", 3);
    bus.publish(message);

        assertTrue(message.wasHandledBy("handleCombinedEL"));
        assertFalse(message.wasHandledBy("handleInvalidEL"));
  }
 
View Full Code Here

  public void testNotMatchingAnyCondition() throws Exception {
    MBassador bus = createBus(SyncAsync());
    bus.subscribe(new ConditionalMessageListener());

    TestEvent message = new TestEvent("", 0);
    bus.publish(message);

    assertTrue(message.handledBy.isEmpty());
  }
 
  /*************************************************************************
 
View Full Code Here

  public void testHandleMethodAccessEL() throws Exception {
    MBassador bus = createBus(SyncAsync());
    bus.subscribe(new ConditionalMessageListener());

    TestEvent message = new TestEvent("XYZ", 1);
    bus.publish(message);

        assertTrue(message.wasHandledBy("handleMethodAccessEL"));
        assertFalse(message.wasHandledBy("handleInvalidEL"));

    }
View Full Code Here

        TestUtil.setup(bus, listeners, 10);

        TestMessage supertype = new TestMessage();
        TestMessage subtype = new SubTestMessage();

        bus.publish(supertype);
        bus.publish(subtype);

        assertEquals(100, subtype.counter.get());
        assertEquals(0, supertype.counter.get());
View Full Code Here

        TestMessage supertype = new TestMessage();
        TestMessage subtype = new SubTestMessage();

        bus.publish(supertype);
        bus.publish(subtype);

        assertEquals(100, subtype.counter.get());
        assertEquals(0, supertype.counter.get());

    }
View Full Code Here

    NamedMessage messageOne = new NamedMessage( "messageOne" );
    NamedMessage messageTwo = new NamedMessage( "messageTwo" );
    NamedMessage messageThree = new NamedMessage( "messageThree" );

    bus.publish( messageOne );
    bus.publish( messageTwo );
    bus.publish( messageThree );

        assertEquals(2, listener.handledByOne.size());
    assertTrue( listener.handledByOne.contains( messageOne ) );
View Full Code Here

    NamedMessage messageOne = new NamedMessage( "messageOne" );
    NamedMessage messageTwo = new NamedMessage( "messageTwo" );
    NamedMessage messageThree = new NamedMessage( "messageThree" );

    bus.publish( messageOne );
    bus.publish( messageTwo );
    bus.publish( messageThree );

        assertEquals(2, listener.handledByOne.size());
    assertTrue( listener.handledByOne.contains( messageOne ) );
    assertTrue(listener.handledByOne.contains(messageTwo));
View Full Code Here

    NamedMessage messageTwo = new NamedMessage( "messageTwo" );
    NamedMessage messageThree = new NamedMessage( "messageThree" );

    bus.publish( messageOne );
    bus.publish( messageTwo );
    bus.publish( messageThree );

        assertEquals(2, listener.handledByOne.size());
    assertTrue( listener.handledByOne.contains( messageOne ) );
    assertTrue(listener.handledByOne.contains(messageTwo));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.