Esempio n. 1
0
 @After
 public void cleanup() throws IOException, InterruptedException {
   if (app != null) {
     app.close();
     app = null;
   }
   TestUtils.stopZookeeperServer(zookeeperServerConnectionFactory);
 }
Esempio n. 2
0
  protected CountDownLatch createTriggerAppAndSendEvent()
      throws IOException, KeeperException, InterruptedException {
    final ZooKeeper zk = TestUtils.createZkClient();
    Injector injector = Guice.createInjector(new TriggeredModule());
    app = injector.getInstance(TriggeredApp.class);
    app.init();
    app.start();

    String time1 = String.valueOf(System.currentTimeMillis());

    CountDownLatch signalEvent1Processed = new CountDownLatch(1);
    TestUtils.watchAndSignalCreation("/onEvent@" + time1, signalEvent1Processed, zk);

    CountDownLatch signalEvent1Triggered = new CountDownLatch(1);
    TestUtils.watchAndSignalCreation("/onTrigger[StringEvent]@" + time1, signalEvent1Triggered, zk);

    TestUtils.injectIntoStringSocketAdapter(time1);

    // check event processed
    Assert.assertTrue(signalEvent1Processed.await(5, TimeUnit.SECONDS));

    // return latch on trigger signal
    return signalEvent1Triggered;
  }
Esempio n. 3
0
 @Before
 public void prepare() throws IOException, InterruptedException, KeeperException {
   TestUtils.cleanupTmpDirs();
   zookeeperServerConnectionFactory = TestUtils.startZookeeperServer();
 }