Пример #1
0
  /**
   * Shuts down the test harness, and makes the best attempt possible to delete dataDir, unless the
   * system property "solr.test.leavedatadir" is set.
   */
  @Override
  public void tearDown() throws Exception {
    log.info("####TEARDOWN_START " + getTestName());
    if (factoryProp == null) {
      System.clearProperty("solr.directoryFactory");
    }

    if (h != null) {
      h.close();
    }
    String skip = System.getProperty("solr.test.leavedatadir");
    if (null != skip && 0 != skip.trim().length()) {
      System.err.println(
          "NOTE: per solr.test.leavedatadir, dataDir will not be removed: "
              + dataDir.getAbsolutePath());
    } else {
      if (!recurseDelete(dataDir)) {
        System.err.println(
            "!!!! WARNING: best effort to remove " + dataDir.getAbsolutePath() + " FAILED !!!!!");
      }
    }

    resetExceptionIgnores();
    super.tearDown();
  }
  @Test
  public void testRedisToNats() throws Exception {

    System.clearProperty(RedisPubSubPlugin.CONFIG_URL);

    Connector c = new Connector();

    ExecutorService executor = Executors.newFixedThreadPool(6);

    RedisPublisher rp = new RedisPublisher("rp", "Export_NATS", 5);
    NatsSubscriber ns = new NatsSubscriber("ns", "Import.Redis", 5);

    // start the connector
    executor.execute(c);

    // start the subsciber app
    executor.execute(ns);

    // wait for subscriber to be ready.
    ns.waitUntilReady();

    // let the connector start
    Thread.sleep(2000);

    // start the publisher
    executor.execute(rp);

    // wait for the subscriber to complete.
    ns.waitForCompletion();

    Assert.assertTrue("Invalid count", ns.getMessageCount() == 5);

    c.shutdown();
  }
  private void testOneToOneWithDefaultConfig(int count) throws Exception {

    System.clearProperty(RedisPubSubPlugin.CONFIG_URL);

    Connector c = new Connector();

    ExecutorService executor = Executors.newFixedThreadPool(6);

    RedisSubscriber rs = new RedisSubscriber("rs", "Import_NATS", count);
    RedisPublisher rp = new RedisPublisher("rp", "Export_NATS", count);

    NatsPublisher np = new NatsPublisher("np", "Export.Redis", count);
    NatsSubscriber ns = new NatsSubscriber("ns", "Import.Redis", count);

    // start the connector
    executor.execute(c);

    // start the subsciber apps
    executor.execute(rs);
    executor.execute(ns);

    // wait for subscribers to be ready.
    rs.waitUntilReady();
    ns.waitUntilReady();

    // let the connector start
    Thread.sleep(1000);

    // start the publishers
    executor.execute(np);
    executor.execute(rp);

    // wait for the subscribers to complete.
    rs.waitForCompletion();
    ns.waitForCompletion();

    Assert.assertTrue("Invalid count", rs.getMessageCount() == count);
    Assert.assertTrue("Invalid count", ns.getMessageCount() == count);

    c.shutdown();
  }
 @AfterClass
 public static void cleanup() {
   System.clearProperty("org.kie.nio.git.dir");
 }
 @AfterClass
 public static void afterClass() {
   System.clearProperty(GP_MAIL_KEY);
 }