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);
}
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());
}
}
Aggregations