use of com.dtstack.taier.rdbs.common.executor.RdbsExeQueue in project Taier by DTStack.
the class AbstractRdbsClientTest method testCancelJob.
@Test
public void testCancelJob() throws Exception {
RdbsExeQueue rdbsExeQueue = PowerMockito.mock(RdbsExeQueue.class);
when(rdbsExeQueue.cancelJob(any(String.class))).thenReturn(true);
MemberModifier.field(TestRdbsClient.class, "exeQueue").set(testRdbsClient, rdbsExeQueue);
JobIdentifier jobIdentifier = JobIdentifier.createInstance("test", "test", "test");
JobResult jobResult = testRdbsClient.cancelJob(jobIdentifier);
Assert.assertNotNull(jobResult);
}
use of com.dtstack.taier.rdbs.common.executor.RdbsExeQueue in project Taier by DTStack.
the class AbstractRdbsClientTest method testProcessSubmitJobWithType.
@Test
public void testProcessSubmitJobWithType() throws Exception {
JobClient jobClient = new JobClient();
jobClient.setJobType(EJobType.MR);
AbstractRdbsClient abstractRdbsClient = PowerMockito.mock(AbstractRdbsClient.class, Mockito.CALLS_REAL_METHODS);
Boolean isMr = true;
try {
JobResult jobResult = abstractRdbsClient.processSubmitJobWithType(jobClient);
Assert.assertNotNull(jobResult);
} catch (Exception e) {
isMr = true;
}
Assert.assertTrue(isMr);
jobClient.setJobType(EJobType.SQL);
RdbsExeQueue rdbsExeQueue = PowerMockito.mock(RdbsExeQueue.class);
when(rdbsExeQueue.submit(any(JobClient.class))).thenReturn("test");
MemberModifier.field(AbstractRdbsClient.class, "exeQueue").set(abstractRdbsClient, rdbsExeQueue);
JobResult jobResult = abstractRdbsClient.processSubmitJobWithType(jobClient);
Assert.assertNotNull(jobResult);
}
use of com.dtstack.taier.rdbs.common.executor.RdbsExeQueue in project Taier by DTStack.
the class RdbsResourceInfoTest method testJudgeSlots.
@Test
public void testJudgeSlots() throws Exception {
RdbsExeQueue rdbsExeQueue = PowerMockito.mock(RdbsExeQueue.class);
when(rdbsExeQueue.checkCanSubmit()).thenReturn(true);
MemberModifier.field(RdbsResourceInfo.class, "rdbsExeQueue").set(rdbsResourceInfo, rdbsExeQueue);
JobClient jobClient = new JobClient();
JudgeResult judgeResult = rdbsResourceInfo.judgeSlots(jobClient);
Assert.assertTrue(judgeResult.available());
}
use of com.dtstack.taier.rdbs.common.executor.RdbsExeQueue in project Taier by DTStack.
the class AbstractRdbsClientTest method testGetJobStatus.
@Test
public void testGetJobStatus() throws Exception {
RdbsExeQueue rdbsExeQueue = PowerMockito.mock(RdbsExeQueue.class);
when(rdbsExeQueue.getJobStatus(any(String.class))).thenReturn(TaskStatus.RUNNING);
MemberModifier.field(TestRdbsClient.class, "exeQueue").set(testRdbsClient, rdbsExeQueue);
JobIdentifier jobIdentifier = JobIdentifier.createInstance("test", "test", "test");
TaskStatus status = testRdbsClient.getJobStatus(jobIdentifier);
Assert.assertEquals(status, TaskStatus.RUNNING);
}
use of com.dtstack.taier.rdbs.common.executor.RdbsExeQueue in project Taier by DTStack.
the class AbstractRdbsClientTest method testGetJobLog.
@Test
public void testGetJobLog() throws Exception {
RdbsExeQueue rdbsExeQueue = PowerMockito.mock(RdbsExeQueue.class);
when(rdbsExeQueue.getJobLog(any(String.class))).thenReturn("job log");
MemberModifier.field(TestRdbsClient.class, "exeQueue").set(testRdbsClient, rdbsExeQueue);
JobIdentifier jobIdentifier = JobIdentifier.createInstance("test", "test", "test");
String jobLog = testRdbsClient.getJobLog(jobIdentifier);
Assert.assertEquals(jobLog, "job log");
}
Aggregations