|
|
|
@ -76,9 +76,9 @@ public class TaskPriorityQueueConsumerTest {
|
|
|
|
|
tenant.setCreateTime(new Date()); |
|
|
|
|
tenant.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
|
|
Mockito.when(processService.getTenantForProcess(1,2)).thenReturn(tenant); |
|
|
|
|
Mockito.doReturn(tenant).when(processService).getTenantForProcess(1,2); |
|
|
|
|
|
|
|
|
|
Mockito.when(processService.queryUserQueueByProcessInstanceId(1)).thenReturn("default"); |
|
|
|
|
Mockito.doReturn("default").when(processService).queryUserQueueByProcessInstanceId(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -105,7 +105,7 @@ public class TaskPriorityQueueConsumerTest {
|
|
|
|
|
processDefinition.setProjectId(1); |
|
|
|
|
taskInstance.setProcessDefine(processDefinition); |
|
|
|
|
|
|
|
|
|
Mockito.when(processService.getTaskInstanceDetailByTaskId(1)).thenReturn(taskInstance); |
|
|
|
|
Mockito.doReturn(taskInstance).when(processService).getTaskInstanceDetailByTaskId(1); |
|
|
|
|
taskPriorityQueue.put("2_1_2_1_default"); |
|
|
|
|
|
|
|
|
|
Thread.sleep(10000); |
|
|
|
@ -134,8 +134,7 @@ public class TaskPriorityQueueConsumerTest {
|
|
|
|
|
processDefinition.setUserId(2); |
|
|
|
|
processDefinition.setProjectId(1); |
|
|
|
|
taskInstance.setProcessDefine(processDefinition); |
|
|
|
|
|
|
|
|
|
Mockito.when(processService.getTaskInstanceDetailByTaskId(1)).thenReturn(taskInstance); |
|
|
|
|
Mockito.doReturn(taskInstance).when(processService).getTaskInstanceDetailByTaskId(1); |
|
|
|
|
taskPriorityQueue.put("2_1_2_1_default"); |
|
|
|
|
|
|
|
|
|
DataSource dataSource = new DataSource(); |
|
|
|
@ -147,7 +146,7 @@ public class TaskPriorityQueueConsumerTest {
|
|
|
|
|
dataSource.setCreateTime(new Date()); |
|
|
|
|
dataSource.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
|
|
Mockito.when(processService.findDataSourceById(1)).thenReturn(dataSource); |
|
|
|
|
Mockito.doReturn(dataSource).when(processService).findDataSourceById(1); |
|
|
|
|
|
|
|
|
|
Thread.sleep(10000); |
|
|
|
|
} |
|
|
|
@ -175,8 +174,7 @@ public class TaskPriorityQueueConsumerTest {
|
|
|
|
|
processDefinition.setUserId(2); |
|
|
|
|
processDefinition.setProjectId(1); |
|
|
|
|
taskInstance.setProcessDefine(processDefinition); |
|
|
|
|
|
|
|
|
|
Mockito.when(processService.getTaskInstanceDetailByTaskId(1)).thenReturn(taskInstance); |
|
|
|
|
Mockito.doReturn(taskInstance).when(processService).getTaskInstanceDetailByTaskId(1); |
|
|
|
|
taskPriorityQueue.put("2_1_2_1_default"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -189,9 +187,7 @@ public class TaskPriorityQueueConsumerTest {
|
|
|
|
|
dataSource.setConnectionParams("{\"address\":\"jdbc:mysql://192.168.221.185:3306\",\"database\":\"dolphinscheduler_qiaozhanwei\",\"jdbcUrl\":\"jdbc:mysql://192.168.221.185:3306/dolphinscheduler_qiaozhanwei\",\"user\":\"root\",\"password\":\"root@123\"}"); |
|
|
|
|
dataSource.setCreateTime(new Date()); |
|
|
|
|
dataSource.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
|
|
Mockito.when(processService.findDataSourceById(80)).thenReturn(dataSource); |
|
|
|
|
|
|
|
|
|
Mockito.doReturn(dataSource).when(processService).findDataSourceById(80); |
|
|
|
|
Thread.sleep(10000); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -218,12 +214,10 @@ public class TaskPriorityQueueConsumerTest {
|
|
|
|
|
processDefinition.setUserId(2); |
|
|
|
|
processDefinition.setProjectId(1); |
|
|
|
|
taskInstance.setProcessDefine(processDefinition); |
|
|
|
|
|
|
|
|
|
Mockito.when(processService.getTaskInstanceDetailByTaskId(1)).thenReturn(taskInstance); |
|
|
|
|
Mockito.doReturn(taskInstance).when(processService).getTaskInstanceDetailByTaskId(1); |
|
|
|
|
taskPriorityQueue.put("2_1_2_1_default"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DataSource dataSource = new DataSource(); |
|
|
|
|
dataSource.setId(1); |
|
|
|
|
dataSource.setName("datax"); |
|
|
|
@ -251,7 +245,7 @@ public class TaskPriorityQueueConsumerTest {
|
|
|
|
|
taskInstance.setExecutorId(2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mockito.when( processService.findTaskInstanceById(1)).thenReturn(taskInstance); |
|
|
|
|
Mockito.doReturn(taskInstance).when(processService).findTaskInstanceById(1); |
|
|
|
|
|
|
|
|
|
taskPriorityQueueConsumer.taskInstanceIsFinalState(1); |
|
|
|
|
} |
|
|
|
|