Package fm.last.citrine.model

Examples of fm.last.citrine.model.TaskRun


  @Test
  public void testGetDisplayLogUrl() {
    String baseUrl = "http://test.com/citrine/";
    notifier.setBaseCitrineUrl(baseUrl);
    TaskRun taskRun = new TaskRun();
    taskRun.setId(1);
    // bit of a lame assertion but don't want to expose too much of the URL internals
    assertTrue(notifier.getDisplayLogUrl(taskRun).contains(String.valueOf(taskRun.getId())));
  }
View Full Code Here


  @Test
  public void testStartAndCancel() {
    JobExecutionContext context = createJobExecutionContext(testTask);
    taskRunManager.jobToBeExecuted(context);

    TaskRun taskRun = taskRunManager.getMostRecent(testTaskId);
    assertTrue(taskRunManager.isRunning(taskRun.getTaskId()));

    taskRunManager.stop(taskRun.getId());
    taskRun = taskRunManager.get(taskRun.getId());
    assertEquals(Status.CANCELLING, taskRun.getStatus());
    assertFalse(taskRunManager.isRunning(taskRun.getTaskId()));

    taskRunManager.jobWasExecuted(context, new JobExecutionException());
    assertFalse(taskRunManager.isRunning(taskRun.getTaskId()));
    taskRun = taskRunManager.get(taskRun.getId());
    assertEquals(Status.CANCELLED, taskRun.getStatus());
  }
View Full Code Here

    taskManager.save(testTask);

    JobExecutionContext context = createJobExecutionContext(testTask);
    taskRunManager.jobToBeExecuted(context);

    TaskRun taskRun = taskRunManager.getMostRecent(testTaskId);
    assertTrue(taskRunManager.isRunning(taskRun.getTaskId()));

    taskRunManager.stop(taskRun.getId());
    taskRun = taskRunManager.get(taskRun.getId());
    taskRunManager.jobWasExecuted(context, new JobExecutionException());
    assertFalse(taskRunManager.isRunning(taskRun.getTaskId()));

    Thread.sleep(1000); // give scheduler time to start child

    // parent was cancelled, so no child should run
    assertNull(taskRunManager.getMostRecent(childTask.getId()));
View Full Code Here

    Task task1 = new Task("name", "groupName", "sysExecTask", false, true, "command", defaultTimerSchedule);
    taskManager.save(task1);
    Task task2 = new Task("name", "groupName", "sysExecTask", false, true, "command", defaultTimerSchedule);
    taskManager.save(task2);

    TaskRun taskRun1 = new TaskRun(Status.SUCCESS, new Date(), new Date(), "out", "err", "stack", task1.getId());
    TaskRun taskRun2 = new TaskRun(Status.SUCCESS, new Date(), new Date(), "out", "err", "stack", task1.getId());
    TaskRun taskRun3 = new TaskRun(Status.SUCCESS, new Date(), new Date(), "out", "err", "stack", task2.getId());
    taskRunManager.save(taskRun1);
    taskRunManager.save(taskRun2);
    taskRunManager.save(taskRun3);

    taskManager.delete(task1);
View Full Code Here

    schedulerManager.runTaskNow(task1);
    waitForTask(task4); // task 4 should run

    List<TaskRun> taskRuns = taskRunManager.findByTaskId(task2.getId());
    assertEquals(1, taskRuns.size());
    TaskRun taskRun = taskRuns.get(0);
    assertEquals(Status.FAILED, taskRun.getStatus());

    taskRuns = taskRunManager.findByTaskId(task4.getId());
    assertEquals(1, taskRuns.size());
    taskRun = taskRuns.get(0);
    assertEquals(Status.SUCCESS, taskRun.getStatus());
  }
View Full Code Here

    taskRunManager.stop(taskRunId);
    Thread.sleep(1000); // give job time to die
    assertFalse(taskRunManager.isRunning(task.getId()));
    List<TaskRun> taskRuns = taskRunManager.findByTaskId(task.getId());
    assertEquals(1, taskRuns.size());
    TaskRun taskRun = taskRuns.get(0);
    assertEquals(Status.CANCELLED, taskRun.getStatus());

    assertNotNull(taskRun.getStackTrace());
    assertTrue(StringUtils.isEmpty(taskRun.getSysOut()));
    assertTrue(StringUtils.isEmpty(taskRun.getSysErr()));
  }
View Full Code Here

    taskManager.save(task);
    waitForTask(task);

    List<TaskRun> taskRuns = taskRunManager.findByTaskId(task.getId());
    assertEquals(1, taskRuns.size());
    TaskRun taskRun = taskRuns.get(0);
    assertEquals(Status.SUCCESS, taskRun.getStatus());
  }
View Full Code Here

    waitForTask(task);

    List<TaskRun> taskRuns = taskRunManager.findByTaskId(task.getId());
    int runCount = taskRuns.size();
    assertTrue(runCount >= 1); // in most cases will be 1, but might get triggered again before we get here
    TaskRun taskRun = taskRuns.get(0);
    assertEquals(Status.SUCCESS, taskRun.getStatus());

    schedulerManager.resetTask(task); // this will delete the job and reschedule it
    Thread.sleep(5000); // wait for job to run at least one more time to check reschedule worked
    waitForTask(task);
View Full Code Here

    taskManager.save(task);
    schedulerManager.runTaskNow(task);
    waitForTask(task);
    List<TaskRun> taskRuns = taskRunManager.findByTaskId(task.getId());
    assertEquals(1, taskRuns.size());
    TaskRun taskRun = taskRuns.get(0);
    assertEquals(Status.FAILED, taskRun.getStatus());

    // only stack trace should be filled in
    assertNotNull(taskRun.getStackTrace());
    assertNull(taskRun.getSysOut());
    assertNull(taskRun.getSysErr());
  }
View Full Code Here

    taskManager.save(task);
    schedulerManager.runTaskNow(task);
    waitForTask(task);
    List<TaskRun> taskRuns = taskRunManager.findByTaskId(task.getId());
    assertEquals(1, taskRuns.size());
    TaskRun taskRun = taskRuns.get(0);
    assertEquals(Status.FAILED, taskRun.getStatus());

    // stack trace and sys err should be filled in
    assertNotNull(taskRun.getStackTrace());
    assertTrue(StringUtils.isEmpty(taskRun.getSysOut()));
    assertFalse("Expected a string but got '" + taskRun.getSysErr() + "'", StringUtils.isEmpty(taskRun.getSysErr()));
  }
View Full Code Here

TOP

Related Classes of fm.last.citrine.model.TaskRun

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.