Package org.apache.hadoop.test.MultithreadedTestUtil

Examples of org.apache.hadoop.test.MultithreadedTestUtil.TestContext.addThread()


  }

  @Test
  public void testThreadFails() throws Exception {
    TestContext ctx = new TestContext();
    ctx.addThread(new TestingThread(ctx) {
      @Override
      public void doWork() throws Exception {
        fail(FAIL_MSG);
      }
    });
View Full Code Here


  }

  @Test
  public void testThreadThrowsCheckedException() throws Exception {
    TestContext ctx = new TestContext();
    ctx.addThread(new TestingThread(ctx) {
      @Override
      public void doWork() throws Exception {
        throw new IOException("my ioe");
      }
    });
View Full Code Here

  @Test
  public void testRepeatingThread() throws Exception {
    final AtomicInteger counter = new AtomicInteger();

    TestContext ctx = new TestContext();
    ctx.addThread(new RepeatingTestThread(ctx) {
      @Override
      public void doAnAction() throws Exception {
        counter.incrementAndGet();
      }
    });
View Full Code Here

          cluster, harness.conf);
     
      TestContext testers = new TestContext();
      for (int i = 0; i < STRESS_NUM_THREADS; i++) {
        Path p = new Path("/test-" + i);
        testers.addThread(new PipelineTestThread(
            testers, fs, fsAsOtherUser, p));
      }
     
      // Start a separate thread which will make sure that replication
      // happens quickly by triggering deletion reports and replication
View Full Code Here

          cluster, conf);
     
      TestContext ctx = new TestContext();
      for (int i = 0; i < 50; i++) {
        final int finalI = i;
        ctx.addThread(new RepeatingTestThread(ctx) {
          @Override
          public void doAnAction() throws Exception {
            Path p = new Path("/test-" + finalI);
            fs.mkdirs(p);
            fs.delete(p, true);
View Full Code Here

            fs.delete(p, true);
          }
        });
      }
     
      ctx.addThread(new RepeatingTestThread(ctx) {
        @Override
        public void doAnAction() throws Exception {
          cluster.transitionToStandby(0);
          Thread.sleep(50);
          cluster.transitionToActive(0);
View Full Code Here

  public void testNoErrors() throws Exception {
    final AtomicInteger threadsRun = new AtomicInteger();

    TestContext ctx = new TestContext();
    for (int i = 0; i < 3; i++) {
      ctx.addThread(new TestingThread(ctx) {
        @Override
        public void doWork() throws Exception {
          threadsRun.incrementAndGet();
        }
      });
View Full Code Here

  }

  @Test
  public void testThreadFails() throws Exception {
    TestContext ctx = new TestContext();
    ctx.addThread(new TestingThread(ctx) {
      @Override
      public void doWork() throws Exception {
        fail(FAIL_MSG);
      }
    });
View Full Code Here

  }

  @Test
  public void testThreadThrowsCheckedException() throws Exception {
    TestContext ctx = new TestContext();
    ctx.addThread(new TestingThread(ctx) {
      @Override
      public void doWork() throws Exception {
        throw new IOException("my ioe");
      }
    });
View Full Code Here

  @Test
  public void testRepeatingThread() throws Exception {
    final AtomicInteger counter = new AtomicInteger();

    TestContext ctx = new TestContext();
    ctx.addThread(new RepeatingTestThread(ctx) {
      @Override
      public void doAnAction() throws Exception {
        counter.incrementAndGet();
      }
    });
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.