Package org.japura.message

Examples of org.japura.message.Message


  @Test
  public void publisherTest() {
  SubscriberTest st = new SubscriberTest();
  Application.getMessageManager().register(st);

  Message msg1 = new Message();
  Application.getMessageManager().publish(true, msg1);
  Assert.assertNotNull(st.getLastPublisher());
  Assert.assertEquals(st.getLastPublisher(), Application.getMessageManager());

  String publisher = "PUBLISHER";
  Message msg2 = new Message();
  Application.getMessageManager().publish(true, msg2, publisher);
  Assert.assertNotNull(st.getLastPublisher());
  Assert.assertEquals(st.getLastPublisher(), publisher);
  }
View Full Code Here


  public void multiPublisherTest() {
  DelaySubscriberTest dst = new DelaySubscriberTest(150);

  Application.getMessageManager().register(dst);

  Message msg = new Message();

  String p1 = "1";
  String p2 = "2";

  Application.getMessageManager().publish(false, msg, p1);
View Full Code Here

  @Test(timeout = 5000)
  public void massivePublisherTest() {
  MassiveSubscriberTest s = new MassiveSubscriberTest();
  Application.getMessageManager().register(s);
  Message msg = new Message();
  String publisher = "publisher";
  int total = 5000;
  for (int i = 0; i < total; i++) {
    Application.getMessageManager().publish(false, msg, publisher);
  }
View Full Code Here

  @Test
  public void publishTest() {
  SubscriberTest st = new SubscriberTest();
  Application.getMessageManager().register(st);
  Message msg = new Message();
  Application.getMessageManager().publish(true, msg);
  Assert.assertEquals(msg, st.getReceivedMessage());
  }
View Full Code Here

  @Test
  public void subscriberFilterTest() {
  SubscriberTest st = new SubscriberTest();
  Application.getMessageManager().register(st);
  Message msg = new Message();
  msg.addSubscriberFilter(new SubscriberFilter() {
    @Override
    public boolean accepts(Subscriber subscriber) {
    return false;
    }
  });
View Full Code Here

    public boolean accepts(Message message) {
    return false;
    }
  });

  Message msg = new Message();
  Application.getMessageManager().publish(true, msg);
  Assert.assertNull(st.getReceivedMessage());
  }
View Full Code Here

TOP

Related Classes of org.japura.message.Message

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.