コード例 #1
0
ファイル: TriggerTest.java プロジェクト: kishoreg/s4-piper
 @After
 public void cleanup() throws IOException, InterruptedException {
   if (app != null) {
     app.close();
     app = null;
   }
   TestUtils.stopZookeeperServer(zookeeperServerConnectionFactory);
 }
コード例 #2
0
ファイル: TriggerTest.java プロジェクト: kishoreg/s4-piper
  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;
  }
コード例 #3
0
ファイル: TriggerTest.java プロジェクト: kishoreg/s4-piper
 @Before
 public void prepare() throws IOException, InterruptedException, KeeperException {
   TestUtils.cleanupTmpDirs();
   zookeeperServerConnectionFactory = TestUtils.startZookeeperServer();
 }