Examples of ConditionCheck


Examples of com.linkedin.databus2.test.ConditionCheck

      // wait until client got all events or for maxTimeout;
      final long maxTimeOutMs = 5 * 1000;
      final DbusEventsTotalStats dbRelayStats = relay1
          .getInboundEventStatisticsCollector().getTotalStats();
      TestUtil.assertWithBackoff(new ConditionCheck() {
        @Override
        public boolean check() {
          return countingConsumer.getNumWindows() == dbRelayStats.getNumSysEvents();
        }
      }, "consumer caught up", maxTimeOutMs, log);

      log.info("Client stats=" + countingConsumer);
      log.info("Event windows generated="
          + dbRelayStats.getNumSysEvents());
      log.info("numDataEvents=" + dbRelayStats.getNumDataEvents()
          + " numWindows=" + dbRelayStats.getNumSysEvents() + " size="
          + dbRelayStats.getSizeDataEvents());

      Assert.assertEquals(dbRelayStats.getNumDataEvents(), countingConsumer
          .getNumDataEvents());
      Assert.assertEquals(countingConsumer.getNumSources(), 2);
      Assert.assertEquals(dbRelayStats.getNumSysEvents(), countingConsumer
          .getNumWindows());

      cr.shutdown();
      boolean s2= r2.shutdown(2000);
      Assert.assertTrue(s2);
      Assert.assertTrue(!r2.isAlive());

      //start r3; new chained relay with restart SCN offset; we get some data;
      chainedSrcConfigs[0].setRestartScnOffset(dbRelayStats.getMaxScn() - dbRelayStats.getPrevScn());
      DatabusRelayMain relay3 = DatabusRelayTestUtil.createDatabusRelayWithSchemaReg(1018,
          chainedRelayPort, 1 * 1024 * 1024, chainedSrcConfigs,SCHEMA_REGISTRY_DIR);
      r3 = new DatabusRelayTestUtil.RelayRunner(relay3);
      r3.start();

      final DbusEventsTotalStats newChainedRlyStats = relay3
          .getInboundEventStatisticsCollector().getTotalStats();

      TestUtil.assertWithBackoff(new ConditionCheck() {
        @Override
        public boolean check() {
          return newChainedRlyStats.getNumDataEvents() > 0;
        }
      }, "new chained relay running", 5000, log);
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.