Search in sources :

Example 26 with SystemJobRunRequest

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

the class SystemJobServiceTest method testRunSystemJobStoragePolicySelectorTrimParameters.

@Test
public void testRunSystemJobStoragePolicySelectorTrimParameters() throws Exception {
    // Create a system job run request using input parameters with leading
    // and trailing empty spaces (except for  parameter values that do not get trimmed).
    SystemJobRunRequest systemJobRunRequest = new SystemJobRunRequest(addWhitespace(StoragePolicySelectorJob.JOB_NAME), Arrays.asList(new Parameter(addWhitespace(ConfigurationValue.STORAGE_POLICY_SELECTOR_JOB_MAX_BDATA_INSTANCES.getKey()), 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(), 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 27 with SystemJobRunRequest

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

the class SystemJobServiceTest method testRunSystemJobMissingRequiredParameters.

// Non job-specific system job tests
@Test
public void testRunSystemJobMissingRequiredParameters() throws Exception {
    // Try to run a system job when job name is not specified.
    try {
        systemJobService.runSystemJob(new SystemJobRunRequest(BLANK_TEXT, Arrays.asList(new Parameter(ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1))));
        fail("Should throw an IllegalArgumentException when job name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A job name must be specified.", e.getMessage());
    }
    // Try to run a system job when parameter name is not specified.
    try {
        systemJobService.runSystemJob(new SystemJobRunRequest(JOB_NAME, Arrays.asList(new Parameter(BLANK_TEXT, ATTRIBUTE_VALUE_1))));
        fail("Should throw an IllegalArgumentException when parameter name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A parameter name must be specified.", e.getMessage());
    }
}
Also used : SystemJobRunRequest(org.finra.herd.model.api.xml.SystemJobRunRequest) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Aggregations

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