use of org.finra.herd.model.api.xml.JobSignalRequest in project herd by FINRAOS.
the class JobServiceTest method testSignalJobWithS3PropertiesPrecedenceRequestParamsOverridesS3.
/**
* 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());
}
use of org.finra.herd.model.api.xml.JobSignalRequest in project herd by FINRAOS.
the class JobRestControllerTest method testSignalJob.
@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);
}
Aggregations