Package net.sourceforge.groboutils.junit.v1

Examples of net.sourceforge.groboutils.junit.v1.TestRunnable


    for (int i = 0; i < NUM_PEER; i++) {
      conf.set(Constants.PEER_PORT, String.valueOf(30000 + i));
      threads[i] = new BSPPeerThread(conf);
    }

    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(threads);
    mttr.runTestRunnables();
  }
View Full Code Here


      ConnectionWorker worker = new ConnectionWorker(createConnection(t), t);
      trs[t] = worker;
      workerList.add(worker.getName());
    }

    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(trs);

    long start = System.nanoTime();
    mttr.runTestRunnables(40000L); // max runtime 40s
    log.info("Runtime: {} ns", (System.nanoTime() - start));

    for (TestRunnable r : trs) {
      ConnectionWorker wkr = (ConnectionWorker) r;
      String name = (wkr.getName());
View Full Code Here

    // test runnables represent clients
    trs = new TestRunnable[21];
    for (int t = 0; t < trs.length; t++) {
      trs[t] = new ScopeClientWorker(t, app, room);
    }
    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(trs);
    // fires off threads
    long start = System.nanoTime();
    mttr.runTestRunnables();
    System.out.println("Runtime: " + (System.nanoTime() - start) + "ns");
    // go to sleep
    try {
      Thread.sleep(3000);
    } catch (Exception e) {
View Full Code Here

    assertNotNull(app.getSharedObject(room2, soName, false));
    // test runnables represent clients
    trs = new TestRunnable[2];
    trs[0] = new ScopeClientWorkerA(0, app, room1);
    trs[1] = new ScopeClientWorkerB(1, app, room2);
    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(trs);
    // fires off threads
    long start = System.nanoTime();
    mttr.runTestRunnables();
    System.out.println("Runtime: " + (System.nanoTime() - start) + "ns");
    ScopeClientWorkerA soa = (ScopeClientWorkerA) trs[0];
    log.debug("Worker: {} shared object: {}", soa.getId(), soa.getSharedObject().getAttributes());
    ScopeClientWorkerB sob = (ScopeClientWorkerB) trs[1];
    log.debug("Worker: {} shared object: {}", sob.getId(), sob.getSharedObject().getAttributes());
View Full Code Here

      trs[t] = new HeaderWorker();
    }
    Runtime rt = Runtime.getRuntime();
    long startFreeMem = rt.freeMemory();
    System.out.printf("Free mem: %s\n", startFreeMem);
    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(trs);
    long start = System.nanoTime();
    mttr.runTestRunnables();
    System.out.printf("Runtime: %s ns\n", (System.nanoTime() - start));
    for (TestRunnable r : trs) {
      Header hdr = ((HeaderWorker) r).getHeader();
      Assert.assertTrue(hdr == null);
    }   
View Full Code Here

    for (int t = 0; t < threads; t++) {
      trs[t] = new HeaderWorker();
    }
    // update the timer to extended time
    timer.set(16777215); //16777215, or 4hrs 39 minutes 37.215 seconds
    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(trs);
    long start = System.nanoTime();
    mttr.runTestRunnables();
    System.out.printf("Runtime: %s ns\n", (System.nanoTime() - start));
    for (TestRunnable r : trs) {
      Header hdr = ((HeaderWorker) r).getHeader();
      Assert.assertTrue(hdr == null);
    }   
View Full Code Here

    TestRunnable[] trs = new TestRunnable[threads];
    for (int t = 0; t < threads; t++) {
      trs[t] = new HostAddWorker(server, t);
    }

    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(trs);

    //kickstarts the MTTR & fires off threads
    long start = System.nanoTime();
    mttr.runTestRunnables();
    log.info("Runtime: {} ns", (System.nanoTime() - start));

    for (TestRunnable r : trs) {
      String name = ((HostAddWorker) r).getName();
      Assert.assertTrue(server.lookupGlobal(name + ".localdomain", "nonexistentscope") != null);
View Full Code Here

    TestRunnable[] synced = new TestRunnable[threads];
    for (int t = 0; t < threads; t++) {
      synced[t] = new SynchedWorker(stream);
    }

    MultiThreadedTestRunner syncedrunner = new MultiThreadedTestRunner(synced);

    // kickstarts the MTTR & fires off threads
    long start = System.nanoTime();
    try {
      syncedrunner.runTestRunnables();
    } catch (Throwable e) {
      log.warn("Exception {}", e);
      fail();
    }
    System.out.println("Runtime for synced runner: " + (System.nanoTime() - start) + "ns");

    // test unsynchronized
    name = "non-synchronized";
    NoSyncServerStream nstream = new NoSyncServerStream();
    nstream.setName(name);
    nstream.setPublishedName(name);

    // pass that instance to the MTTR
    TestRunnable[] unsynced = new TestRunnable[threads];
    for (int t = 0; t < threads; t++) {
      unsynced[t] = new UnSynchedWorker(nstream);
    }

    MultiThreadedTestRunner unsyncedrunner = new MultiThreadedTestRunner(unsynced);

    // kickstarts the MTTR & fires off threads
    start = System.nanoTime();
    try {
      unsyncedrunner.runTestRunnables();
    } catch (Throwable e) {
      log.warn("Exception {}", e);
      fail();
    }
    System.out.println("Runtime for unsynced runner: " + (System.nanoTime() - start) + "ns");
View Full Code Here

    TestRunnable[] trs = new TestRunnable[threads];
    for (int t = 0; t < threads; t++) {
      trs[t] = new IntCountWorker(i);
    }

    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(trs);

    //kickstarts the MTTR & fires off threads
    long start = System.nanoTime();
    mttr.runTestRunnables();
    System.out.println("Runtime for int primative with synchronized: "
        + (System.nanoTime() - start) + "ns");

    //dump our ints into a set
    Set<Integer> intList = new HashSet<Integer>(setSize);
View Full Code Here

    TestRunnable[] trs = new TestRunnable[threads];
    for (int t = 0; t < threads; t++) {
      trs[t] = new AtomicIntCountWorker(i);
    }

    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(trs);

    //kickstarts the MTTR & fires off threads
    long start = System.nanoTime();
    mttr.runTestRunnables();
    System.out.println("Runtime for Atomic: " + (System.nanoTime() - start)
        + "ns");

    //dump our ints into a set
    Set<Integer> intList = new HashSet<Integer>(setSize);
View Full Code Here

TOP

Related Classes of net.sourceforge.groboutils.junit.v1.TestRunnable

Copyright © 2018 www.massapicom. 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.