use of com.dangdang.ddframe.job.cloud.executor.TaskExecutor.TaskThread in project elastic-job by dangdangdotcom.
the class TaskExecutorThreadTest method assertLaunchTaskWithWrongElasticJobClass.
@Test
public void assertLaunchTaskWithWrongElasticJobClass() {
TaskInfo taskInfo = buildWrongElasticJobClass();
TaskThread taskThread = new TaskExecutor().new TaskThread(executorDriver, taskInfo);
try {
taskThread.run();
} catch (final JobSystemException ex) {
assertTrue(ex.getMessage().startsWith("Elastic-Job: Class 'com.dangdang.ddframe.job.cloud.executor.TaskExecutorThreadTest' must implements ElasticJob interface."));
}
}
use of com.dangdang.ddframe.job.cloud.executor.TaskExecutor.TaskThread in project elastic-job by dangdangdotcom.
the class TaskExecutorThreadTest method assertLaunchTaskWithDaemonTaskAndJavaScriptJob.
@Test
public void assertLaunchTaskWithDaemonTaskAndJavaScriptJob() {
TaskInfo taskInfo = buildSpringScriptTransientTaskInfo();
TaskThread taskThread = new TaskExecutor().new TaskThread(executorDriver, taskInfo);
taskThread.run();
verify(executorDriver).sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(TaskState.TASK_RUNNING).build());
verify(executorDriver).sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(Protos.TaskState.TASK_FINISHED).build());
}
use of com.dangdang.ddframe.job.cloud.executor.TaskExecutor.TaskThread in project elastic-job by dangdangdotcom.
the class TaskExecutorThreadTest method assertLaunchTaskWithDaemonTaskAndJavaSimpleJob.
@Test
public void assertLaunchTaskWithDaemonTaskAndJavaSimpleJob() {
TaskInfo taskInfo = buildJavaTransientTaskInfo();
TaskThread taskThread = new TaskExecutor().new TaskThread(executorDriver, taskInfo);
taskThread.run();
verify(executorDriver).sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(TaskState.TASK_RUNNING).build());
verify(executorDriver).sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(Protos.TaskState.TASK_FINISHED).build());
}
use of com.dangdang.ddframe.job.cloud.executor.TaskExecutor.TaskThread in project elastic-job by dangdangdotcom.
the class TaskExecutorThreadTest method assertLaunchTaskWithTransientTaskAndSpringSimpleJob.
@Test
public void assertLaunchTaskWithTransientTaskAndSpringSimpleJob() {
TaskInfo taskInfo = buildSpringDaemonTaskInfo();
TaskThread taskThread = new TaskExecutor().new TaskThread(executorDriver, taskInfo);
taskThread.run();
verify(executorDriver).sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(TaskState.TASK_RUNNING).build());
}
use of com.dangdang.ddframe.job.cloud.executor.TaskExecutor.TaskThread in project elastic-job by dangdangdotcom.
the class TaskExecutorThreadTest method assertLaunchTaskWithWrongClass.
@Test
public void assertLaunchTaskWithWrongClass() {
TaskInfo taskInfo = buildWrongClass();
TaskThread taskThread = new TaskExecutor().new TaskThread(executorDriver, taskInfo);
try {
taskThread.run();
} catch (final JobSystemException ex) {
assertTrue(ex.getMessage().startsWith("Elastic-Job: Class 'WrongClass' initialize failure, the error message is 'WrongClass'."));
}
}
Aggregations