Package uk.ac.uea.threadr

Examples of uk.ac.uea.threadr.Threadr


    ParallelTask task1 = new ReferenceTask();
    tasks.put(task1, ThreadSafety.SEQUENTIAL);
    tasks.put(new ReferenceVMTask(), ThreadSafety.VM);
    tasks.put(new ReferenceUnsafeTask(), ThreadSafety.THREAD);
   
    instance = new Threadr();
    Map<? extends ParallelTask, ThreadSafety> old = instance.addTasks(tasks);
    assertNotNull("Null Map returned when empty Map expected.", old);
    assertTrue("Found existing safety results when none should exist.",
        old.isEmpty());
    assertNotNull("Instance returned null tasks.", instance.getTasks());
View Full Code Here


  @Test
  public final void testAddTest() {
   
    ThreadTest test = new ReferenceTest();

    instance = new Threadr();
    instance.addTest(test);
   
    Set<? extends ThreadTest> tests = instance.getTests();
    assertNotNull("Stored tests are null.", tests);
    assertEquals("Incorrect number of tests found.", 1, tests.size());
View Full Code Here

   * stored.
   */
  @Test
  public final void testAddTestsList() {
   
    instance = new Threadr();   
    List<ThreadTest> tests = new ArrayList<>();
   
    for (int i = 0; i < REFERENCE_COUNT; i++) {
      tests.add(new ReferenceTest());
    }
View Full Code Here

   * The test fails if there is an incorrect number of tasks stored.
   */
  @Test
  public final void testAddTestsArray() {
   
    instance = new Threadr();
    ThreadTest[] tests = new ThreadTest[REFERENCE_COUNT];
   
    for (int i = 0; i < REFERENCE_COUNT; i++) {
      tests[i] = new ReferenceTest();
    }
View Full Code Here

   * if Threadr returns incorrect stored parameters.
   */
  @Test
  public final void testSetVMParameters() {
   
    instance = new Threadr();
   
    String[] params = {"param1", "param2", "param3"};
    instance.setVMParameters(params);
   
    String[] storedParams = instance.getVMParameters();
View Full Code Here

   * returned properly from the {@link Threadr#execute()} method.
   */
  @Test
  public final void testExecute() {
   
    instance = new Threadr();
    ReferenceTask task = new ReferenceTask();
    ReferenceVMTask vmTask = new ReferenceVMTask();
    ReferenceUnsafeTask unsafeTask = new ReferenceUnsafeTask();
    /* Create copies of the arrays as a reference. */
    int[] refData = Arrays.copyOf(task.getData(), ReferenceTask.SIZE);
View Full Code Here

   * returned MemoryMonitor is for this process.
   */
  @Test
  public final void testGetMemoryMonitor() {
       
    instance = new Threadr();
    MemoryMonitor monitor = instance.getMemoryMonitor();
    String pid = ManagementFactory.getRuntimeMXBean().getName();
   
    /* Make sure the MemoryMonitor for this process was returned. */
    assertNotNull("Returned MemoryMonitor was null.", monitor);
View Full Code Here

    }
  }
 
  public static void main(String...args) {
   
    Threadr threadr = new Threadr();
    threadr.enableLogging();
    threadr.setOutputLevel(Level.FINER);
    threadr.setSequentialHandler(new PostSequentialHandler());
   
    StringTest[] stringTests = new StringTest[5];
    Test2[] test2Tests = new Test2[5];
   
    for (int i = 0; i < 5; i++) {
      stringTests[i] = new StringTest();
      test2Tests[i] = new Test2();
    }
   
    threadr.addTasks(stringTests);
    threadr.addTasks(test2Tests);
   
    ThreadrResult results = threadr.execute();
   
    for (AbstractReturnType<?> result : results.getResults()) {
      if (result != null) {
        System.out.println(result.toString());
      } else {
View Full Code Here

    tasks.add(new ThreadrTest2());
    tasks.add(new FirstParallelSafe());
    tasks.add(new FirstParallelSafe());
    tasks.add(new FirstParallelSafe());
   
    Threadr threadr = new Threadr(tasks);
    threadr.enableLogging();
   
    ThreadrResult results = threadr.execute();
   
    for (Object result : results.getResults()) {
      try {
        SomeReturnType r = (SomeReturnType)result;
        if (r == null) {
View Full Code Here

  }
 
  public static void main(String[] args) {
   
    ComplexObjectTest test = new ComplexObjectTest();
    Threadr framework = new Threadr(test.objects);
    framework.enableLogging();
    framework.setOutputLevel(Level.FINE);
    framework.execute();
    Threadr.logger.info("Done");
  }
View Full Code Here

TOP

Related Classes of uk.ac.uea.threadr.Threadr

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.