Search in sources :

Example 6 with JobSignalRequest

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());
}
Also used : S3PropertiesLocation(org.finra.herd.model.api.xml.S3PropertiesLocation) Parameter(org.finra.herd.model.api.xml.Parameter) JobSignalRequest(org.finra.herd.model.api.xml.JobSignalRequest) Job(org.finra.herd.model.api.xml.Job) Test(org.junit.Test)

Example 7 with JobSignalRequest

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);
}
Also used : S3PropertiesLocation(org.finra.herd.model.api.xml.S3PropertiesLocation) JobSignalRequest(org.finra.herd.model.api.xml.JobSignalRequest) Parameter(org.finra.herd.model.api.xml.Parameter) Job(org.finra.herd.model.api.xml.Job) Test(org.junit.Test)

Aggregations

Job (org.finra.herd.model.api.xml.Job)7 JobSignalRequest (org.finra.herd.model.api.xml.JobSignalRequest)7 Test (org.junit.Test)7 Parameter (org.finra.herd.model.api.xml.Parameter)5 S3PropertiesLocation (org.finra.herd.model.api.xml.S3PropertiesLocation)3 ArrayList (java.util.ArrayList)2 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)1 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)1