Esempio n. 1
0
  @AfterTest
  public void end() throws InterruptedException {
    PollableChannel out =
        (PollableChannel) tm.getMessageChannel(new NamedChannelReference("output"));
    List<String> nonSingleton = new LinkedList<String>();
    String singleton = "";

    for (int i = 0; i < 50; ++i) {
      Message<?> msg = out.receive();
      Assert.assertNotNull(msg);

      String msgSingl = (String) msg.getHeader().get("SINGLETON");
      String msgNonSingl = (String) msg.getHeader().get("NONSINGLETON");
      System.out.println("msgSingl:" + msgSingl + " msgNonSingl:" + msgNonSingl);

      if (singleton.isEmpty()) {
        singleton = msgSingl;
      } else {
        Assert.assertTrue(singleton.equals(msgSingl));
      }

      if (!nonSingleton.contains(msgNonSingl)) {
        nonSingleton.add(msgNonSingl);
      }
    }

    for (String x : nonSingleton) {
      System.out.println(x);
    }

    Assert.assertTrue(nonSingleton.size() > 1);

    tm.shutdown();
  }
Esempio n. 2
0
 @Test
 public void test() {
   MessageChannel input = tm.getMessageChannel(new NamedChannelReference("input"));
   for (int i = 0; i < 50; i++) {
     input.send(new Message<Integer>(i));
   }
 }
Esempio n. 3
0
 @BeforeTest
 public void init() {
   tm = new TestModule();
   Guice.createInjector(tm);
   tm.start();
 }