Search in sources :

Example 1 with SystemJobRunResponse

use of org.finra.herd.model.api.xml.SystemJobRunResponse in project herd by FINRAOS.

the class SystemJobServiceImpl method runSystemJob.

@Override
public SystemJobRunResponse runSystemJob(SystemJobRunRequest request) throws SchedulerException {
    // Validate and trim the request.
    validateSystemJobRunRequest(request);
    // Schedule the system job to run once right away.
    systemJobHelper.runSystemJob(request.getJobName(), request.getParameters());
    // Create and populate the response.
    SystemJobRunResponse response = new SystemJobRunResponse();
    response.setJobName(request.getJobName());
    response.setParameters(request.getParameters());
    return response;
}
Also used : SystemJobRunResponse(org.finra.herd.model.api.xml.SystemJobRunResponse)

Example 2 with SystemJobRunResponse

use of org.finra.herd.model.api.xml.SystemJobRunResponse in project herd by FINRAOS.

the class SystemJobRestControllerTest method testRunSystemJobJmsPublisher.

@Test
public void testRunSystemJobJmsPublisher() throws Exception {
    // Create the system job run request.
    SystemJobRunRequest systemJobRunRequest = new SystemJobRunRequest(JmsPublishingJob.JOB_NAME, null);
    SystemJobRunResponse systemJobRunResponse = new SystemJobRunResponse(JmsPublishingJob.JOB_NAME, null);
    when(systemJobService.runSystemJob(systemJobRunRequest)).thenReturn(systemJobRunResponse);
    // Request to run the system job.
    SystemJobRunResponse resultSystemJobRunResponse = systemJobRestController.runSystemJob(systemJobRunRequest);
    // Verify the external calls.
    verify(systemJobService).runSystemJob(systemJobRunRequest);
    verifyNoMoreInteractions(systemJobService);
    // Validate the returned object.
    assertEquals(systemJobRunResponse, resultSystemJobRunResponse);
}
Also used : SystemJobRunRequest(org.finra.herd.model.api.xml.SystemJobRunRequest) SystemJobRunResponse(org.finra.herd.model.api.xml.SystemJobRunResponse) Test(org.junit.Test)

Example 3 with SystemJobRunResponse

use of org.finra.herd.model.api.xml.SystemJobRunResponse in project herd by FINRAOS.

the class SystemJobServiceTest method testRunSystemJobBusinessObjectDataFinalizeRestoreUpperCaseParameters.

@Test
public void testRunSystemJobBusinessObjectDataFinalizeRestoreUpperCaseParameters() throws Exception {
    // Create a system job run request using upper case input parameters (except for case-sensitive job name).
    SystemJobRunRequest systemJobRunRequest = new SystemJobRunRequest(BusinessObjectDataFinalizeRestoreJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.BDATA_FINALIZE_RESTORE_JOB_MAX_BDATA_INSTANCES.getKey().toUpperCase(), String.valueOf(INTEGER_VALUE))));
    // Request to run the system job.
    SystemJobRunResponse resultSystemJobRunResponse = systemJobService.runSystemJob(systemJobRunRequest);
    // Validate the returned object.
    assertEquals(new SystemJobRunResponse(BusinessObjectDataFinalizeRestoreJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.BDATA_FINALIZE_RESTORE_JOB_MAX_BDATA_INSTANCES.getKey().toUpperCase(), String.valueOf(INTEGER_VALUE)))), resultSystemJobRunResponse);
}
Also used : SystemJobRunRequest(org.finra.herd.model.api.xml.SystemJobRunRequest) Parameter(org.finra.herd.model.api.xml.Parameter) SystemJobRunResponse(org.finra.herd.model.api.xml.SystemJobRunResponse) Test(org.junit.Test)

Example 4 with SystemJobRunResponse

use of org.finra.herd.model.api.xml.SystemJobRunResponse in project herd by FINRAOS.

the class SystemJobServiceTest method testRunSystemJobStoragePolicySelectorMissingOptionalParameters.

@Test
public void testRunSystemJobStoragePolicySelectorMissingOptionalParameters() throws Exception {
    // Create the system job run request without parameters.
    SystemJobRunRequest systemJobRunRequest = new SystemJobRunRequest(StoragePolicySelectorJob.JOB_NAME, null);
    // Request to run the system job.
    SystemJobRunResponse resultSystemJobRunResponse = systemJobService.runSystemJob(systemJobRunRequest);
    // Validate the returned object.
    assertEquals(new SystemJobRunResponse(StoragePolicySelectorJob.JOB_NAME, null), resultSystemJobRunResponse);
}
Also used : SystemJobRunRequest(org.finra.herd.model.api.xml.SystemJobRunRequest) SystemJobRunResponse(org.finra.herd.model.api.xml.SystemJobRunResponse) Test(org.junit.Test)

Example 5 with SystemJobRunResponse

use of org.finra.herd.model.api.xml.SystemJobRunResponse in project herd by FINRAOS.

the class SystemJobServiceTest method testRunSystemJobStoragePolicySelectorLowerCaseParameters.

@Test
public void testRunSystemJobStoragePolicySelectorLowerCaseParameters() throws Exception {
    // Create a system job run request using lower case input parameters (except for case-sensitive job name).
    SystemJobRunRequest systemJobRunRequest = new SystemJobRunRequest(StoragePolicySelectorJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.STORAGE_POLICY_SELECTOR_JOB_MAX_BDATA_INSTANCES.getKey().toLowerCase(), String.valueOf(INTEGER_VALUE))));
    // Request to run the system job.
    SystemJobRunResponse resultSystemJobRunResponse = systemJobService.runSystemJob(systemJobRunRequest);
    // Validate the returned object.
    assertEquals(new SystemJobRunResponse(StoragePolicySelectorJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.STORAGE_POLICY_SELECTOR_JOB_MAX_BDATA_INSTANCES.getKey().toLowerCase(), String.valueOf(INTEGER_VALUE)))), resultSystemJobRunResponse);
}
Also used : SystemJobRunRequest(org.finra.herd.model.api.xml.SystemJobRunRequest) Parameter(org.finra.herd.model.api.xml.Parameter) SystemJobRunResponse(org.finra.herd.model.api.xml.SystemJobRunResponse) Test(org.junit.Test)

Aggregations

SystemJobRunResponse (org.finra.herd.model.api.xml.SystemJobRunResponse)20 SystemJobRunRequest (org.finra.herd.model.api.xml.SystemJobRunRequest)19 Test (org.junit.Test)19 Parameter (org.finra.herd.model.api.xml.Parameter)14