/** * Create an instance of {@link JobSignalRequest } * */ public JobSignalRequest createJobSignalRequest() { return new JobSignalRequest(); }
/** * Create an instance of {@link JobSignalRequest } * */ public JobSignalRequest createJobSignalRequest() { return new JobSignalRequest(); }
/** * Create an instance of {@link JobSignalRequest } * */ public JobSignalRequest createJobSignalRequest() { return new JobSignalRequest(); }
public Object createNewInstance() { return new JobSignalRequest(); }
public Object createNewInstance() { return new JobSignalRequest(); }
public Object createNewInstance() { return new JobSignalRequest(); }
@Test public void testSignalJob() throws Exception { // Create a job signal request. JobSignalRequest jobSignalRequest = new JobSignalRequest(JOB_ID, JOB_RECEIVE_TASK_ID, Arrays.asList(new Parameter(ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1)), new S3PropertiesLocation(S3_BUCKET_NAME, S3_KEY)); // Create a job. Job job = new Job(); job.setId(JOB_ID); // Mock the external calls. when(jobService.signalJob(jobSignalRequest)).thenReturn(job); // Call the method under test. Job result = jobRestController.signalJob(jobSignalRequest); // Verify the external calls. verify(jobService).signalJob(jobSignalRequest); verifyNoMoreInteractionsHelper(); // Validate the results. assertEquals(job, result); }
JobSignalRequest jobSignalRequest = new JobSignalRequest(job.getId(), "receiveTask", Collections.singletonList(signalParameter), null); Job signalJobResponse = jobService.signalJob(jobSignalRequest);
/** * Signals job with both S3 properties and request parameters set. If there are name clashes, the request parameter should take precedence. * * @throws Exception */ @Test public void testSignalJobWithS3PropertiesPrecedenceRequestParamsOverridesS3() throws Exception { jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH); Parameter s3Parameter = new Parameter("testName", "testValue"); Parameter requestParameter = new Parameter("testName", "expectedValue"); S3PropertiesLocation s3PropertiesLocation = getS3PropertiesLocation("s3BucketName", "s3ObjectKey", s3Parameter); // Start the job. Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME)); JobSignalRequest jobSignalRequest = new JobSignalRequest(job.getId(), "receivetask1", null, null); jobSignalRequest.setS3PropertiesLocation(s3PropertiesLocation); jobSignalRequest.setParameters(Arrays.asList(requestParameter)); Job signalJob = jobService.signalJob(jobSignalRequest); assertParameterEquals(requestParameter, signalJob.getParameters()); }
jobService.signalJob(new JobSignalRequest("job_does_not_exist", "receivetask1", null, null)); fail("Should throw an ObjectNotFoundException."); assertEquals("receivetask1", jobGet.getCurrentWorkflowStep().getId()); jobService.signalJob(new JobSignalRequest(job.getId(), "receivetask_does_not_exist", null, null)); fail("Should throw an ObjectNotFoundException.");
@Test public void testSignalJob() throws Exception { jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH); // Start the job. Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME)); // Job should be waiting at Receive task. Job jobGet = jobService.getJob(job.getId(), false); assertEquals(JobStatusEnum.RUNNING, jobGet.getStatus()); assertEquals("receivetask1", jobGet.getCurrentWorkflowStep().getId()); // Signal job to continue. List<Parameter> signalParameters = new ArrayList<>(); Parameter signalPameter1 = new Parameter("UT_SIGNAL_PARAM_1", "UT_SIGNAL_VALUE_1"); signalParameters.add(signalPameter1); JobSignalRequest jobSignalRequest = new JobSignalRequest(job.getId(), "receivetask1", signalParameters, null); Job signalJob = jobService.signalJob(jobSignalRequest); assertEquals(JobStatusEnum.RUNNING, signalJob.getStatus()); assertEquals("receivetask1", signalJob.getCurrentWorkflowStep().getId()); assertTrue(signalJob.getParameters().contains(signalPameter1)); // Job should have been completed. jobGet = jobService.getJob(job.getId(), true); assertEquals(JobStatusEnum.COMPLETED, jobGet.getStatus()); assertTrue(jobGet.getParameters().contains(signalPameter1)); }
/** * Signals job with S3 properties set. Parameters should be populated from the properties. * * @throws Exception */ @Test public void testSignalJobWithS3Properties() throws Exception { jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH); Parameter parameter = new Parameter("testName", "testValue"); S3PropertiesLocation s3PropertiesLocation = getS3PropertiesLocation("s3BucketName", "s3ObjectKey", parameter); // Start the job. Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME)); JobSignalRequest jobSignalRequest = new JobSignalRequest(job.getId(), "receivetask1", null, null); jobSignalRequest.setS3PropertiesLocation(s3PropertiesLocation); Job signalJob = jobService.signalJob(jobSignalRequest); assertParameterEquals(parameter, signalJob.getParameters()); }
@Test public void testSignalJobNoParameters() throws Exception { jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH); // Start the job. Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME)); // Job should be waiting at Receive task. Job jobGet = jobService.getJob(job.getId(), false); assertEquals(JobStatusEnum.RUNNING, jobGet.getStatus()); assertEquals("receivetask1", jobGet.getCurrentWorkflowStep().getId()); // Signal job to continue. JobSignalRequest jobSignalRequest = new JobSignalRequest(job.getId(), "receivetask1", null, null); Job signalJob = jobService.signalJob(jobSignalRequest); assertEquals(JobStatusEnum.RUNNING, signalJob.getStatus()); assertEquals("receivetask1", signalJob.getCurrentWorkflowStep().getId()); // Job should have been completed. jobGet = jobService.getJob(job.getId(), true); assertEquals(JobStatusEnum.COMPLETED, jobGet.getStatus()); }