Search in sources :

Example 6 with SystemJobRunRequest

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

the class SystemJobServiceTest method testRunSystemJobBusinessObjectDataFinalizeRestoreInvalidParameters.

@Test
public void testRunSystemJobBusinessObjectDataFinalizeRestoreInvalidParameters() throws Exception {
    // Try to run a system job when too many parameters are specified.
    try {
        systemJobService.runSystemJob(new SystemJobRunRequest(BusinessObjectDataFinalizeRestoreJob.JOB_NAME, Arrays.asList(new Parameter(ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1), new Parameter(ATTRIBUTE_NAME_2_MIXED_CASE, ATTRIBUTE_VALUE_2))));
        fail("Should throw an IllegalArgumentException when too many parameters are specified.");
    } catch (IllegalArgumentException e) {
        assertEquals(String.format("Too many parameters are specified for \"%s\" system job.", BusinessObjectDataFinalizeRestoreJob.JOB_NAME), e.getMessage());
    }
    // Try to run a system job when invalid parameter name is specified.
    try {
        systemJobService.runSystemJob(new SystemJobRunRequest(BusinessObjectDataFinalizeRestoreJob.JOB_NAME, Arrays.asList(new Parameter(ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1))));
        fail("Should throw an IllegalArgumentException when invalid parameter name is specified.");
    } catch (IllegalArgumentException e) {
        assertEquals(String.format("Parameter \"%s\" is not supported by \"%s\" system job.", ATTRIBUTE_NAME_1_MIXED_CASE, BusinessObjectDataFinalizeRestoreJob.JOB_NAME), e.getMessage());
    }
    // Try to run a system job when invalid parameter value is specified.
    try {
        systemJobService.runSystemJob(new SystemJobRunRequest(BusinessObjectDataFinalizeRestoreJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.BDATA_FINALIZE_RESTORE_JOB_MAX_BDATA_INSTANCES.getKey(), "NOT_AN_INTEGER"))));
        fail("Should throw an IllegalArgumentException when invalid parameter value is specified.");
    } catch (IllegalArgumentException e) {
        assertEquals(String.format("Parameter \"%s\" specifies a non-integer value \"NOT_AN_INTEGER\".", ConfigurationValue.BDATA_FINALIZE_RESTORE_JOB_MAX_BDATA_INSTANCES.getKey()), e.getMessage());
    }
}
Also used : SystemJobRunRequest(org.finra.herd.model.api.xml.SystemJobRunRequest) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Example 7 with SystemJobRunRequest

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

the class SystemJobServiceTest method testRunSystemJobFileUploadCleanup.

// File upload cleanup system job
@Test
public void testRunSystemJobFileUploadCleanup() throws Exception {
    // Create the system job run request.
    SystemJobRunRequest systemJobRunRequest = new SystemJobRunRequest(FileUploadCleanupJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.FILE_UPLOAD_CLEANUP_JOB_THRESHOLD_MINUTES.getKey(), String.valueOf(INTEGER_VALUE))));
    // Request to run the system job.
    SystemJobRunResponse resultSystemJobRunResponse = systemJobService.runSystemJob(systemJobRunRequest);
    // Validate the returned object.
    assertEquals(new SystemJobRunResponse(FileUploadCleanupJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.FILE_UPLOAD_CLEANUP_JOB_THRESHOLD_MINUTES.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 8 with SystemJobRunRequest

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

the class SystemJobServiceTest method testRunSystemJobFileUploadCleanupMissingOptionalParameters.

@Test
public void testRunSystemJobFileUploadCleanupMissingOptionalParameters() throws Exception {
    // Create the system job run request without parameters.
    SystemJobRunRequest systemJobRunRequest = new SystemJobRunRequest(FileUploadCleanupJob.JOB_NAME, null);
    // Request to run the system job.
    SystemJobRunResponse resultSystemJobRunResponse = systemJobService.runSystemJob(systemJobRunRequest);
    // Validate the returned object.
    assertEquals(new SystemJobRunResponse(FileUploadCleanupJob.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 9 with SystemJobRunRequest

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

the class SystemJobServiceTest method testRunSystemJobStoragePolicySelectorUpperCaseParameters.

@Test
public void testRunSystemJobStoragePolicySelectorUpperCaseParameters() throws Exception {
    // Create a system job run request using upper 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().toUpperCase(), 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().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 10 with SystemJobRunRequest

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

the class SystemJobServiceTest method testRunSystemJobBusinessObjectDataFinalizeRestoreLowerCaseParameters.

@Test
public void testRunSystemJobBusinessObjectDataFinalizeRestoreLowerCaseParameters() throws Exception {
    // Create a system job run request using lower 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().toLowerCase(), 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().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

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