Search in sources :

Example 11 with Parameter

use of org.finra.herd.model.api.xml.Parameter 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)

Example 12 with Parameter

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

the class SystemJobServiceTest method testRunSystemJobBusinessObjectDataFinalizeRestoreTrimParameters.

@Test
public void testRunSystemJobBusinessObjectDataFinalizeRestoreTrimParameters() 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(BusinessObjectDataFinalizeRestoreJob.JOB_NAME), Arrays.asList(new Parameter(addWhitespace(ConfigurationValue.BDATA_FINALIZE_RESTORE_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(BusinessObjectDataFinalizeRestoreJob.JOB_NAME, Arrays.asList(new Parameter(ConfigurationValue.BDATA_FINALIZE_RESTORE_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 13 with Parameter

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

the class AddBusinessObjectDataStorageUnitTest method testAddBusinessObjectDataStorageUnitUsingJsonRequest.

@Test
public void testAddBusinessObjectDataStorageUnitUsingJsonRequest() throws Exception {
    BusinessObjectDataStorageUnitCreateRequest businessObjectDataStorageUnitCreateRequest = businessObjectDataServiceTestHelper.getBusinessObjectDataStorageUnitCreateRequest();
    List<FieldExtension> fieldExtensionList = new ArrayList<>();
    fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataStorageUnitCreateRequest", "${businessObjectDataStorageUnitCreateRequest}"));
    List<Parameter> parameters = new ArrayList<>();
    parameters.add(buildParameter("contentType", "json"));
    parameters.add(buildParameter("businessObjectDataStorageUnitCreateRequest", jsonHelper.objectToJson(businessObjectDataStorageUnitCreateRequest)));
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, VARIABLE_VALUE_NOT_NULL);
    testActivitiServiceTaskSuccess(AddBusinessObjectDataStorageUnit.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : HashMap(java.util.HashMap) FieldExtension(org.activiti.bpmn.model.FieldExtension) BusinessObjectDataStorageUnitCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitCreateRequest) ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Example 14 with Parameter

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

the class AddEmrStepsTest method testAddShellStepNoStepName.

@Test
public void testAddShellStepNoStepName() throws Exception {
    List<Parameter> parameters = new ArrayList<>();
    Parameter parameter = new Parameter("clusterName", "testCluster1");
    parameters.add(parameter);
    parameter = new Parameter("continueOnError", "");
    parameters.add(parameter);
    parameter = new Parameter("stepName", "");
    parameters.add(parameter);
    executeWithoutLogging(ActivitiRuntimeHelper.class, () -> {
        testActivitiAddEmrStepFailure(AddEmrShellStep.class.getCanonicalName(), new ArrayList<>(), parameters);
    });
}
Also used : ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Example 15 with Parameter

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

the class AddEmrStepsTest method testAddShellStepWrongContinueOnError.

@Test
public void testAddShellStepWrongContinueOnError() throws Exception {
    List<Parameter> parameters = new ArrayList<>();
    Parameter parameter = new Parameter("clusterName", "testCluster1");
    parameters.add(parameter);
    parameter = new Parameter("stepName", "Shell Step");
    parameters.add(parameter);
    parameter = new Parameter("continueOnError", "sfsdfsd");
    parameters.add(parameter);
    parameter = new Parameter("scriptLocation", "A_SCRIPT_LOCATION");
    parameters.add(parameter);
    executeWithoutLogging(ActivitiRuntimeHelper.class, () -> {
        testActivitiAddEmrStepFailure(AddEmrShellStep.class.getCanonicalName(), getScriptStepsFieldExtension(), parameters);
    });
}
Also used : ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Aggregations

Parameter (org.finra.herd.model.api.xml.Parameter)148 Test (org.junit.Test)121 ArrayList (java.util.ArrayList)98 FieldExtension (org.activiti.bpmn.model.FieldExtension)64 HashMap (java.util.HashMap)61 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)30 Job (org.finra.herd.model.api.xml.Job)30 SystemJobRunRequest (org.finra.herd.model.api.xml.SystemJobRunRequest)20 SystemJobRunResponse (org.finra.herd.model.api.xml.SystemJobRunResponse)14 S3PropertiesLocation (org.finra.herd.model.api.xml.S3PropertiesLocation)13 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)13 BusinessObjectDataAttribute (org.finra.herd.model.api.xml.BusinessObjectDataAttribute)12 JobDefinition (org.finra.herd.model.api.xml.JobDefinition)9 BusinessObjectDataAttributeEntity (org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity)9 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)8 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)7 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)6 JobAction (org.finra.herd.model.api.xml.JobAction)6 NotificationRegistrationKey (org.finra.herd.model.api.xml.NotificationRegistrationKey)6 BusinessObjectData (org.finra.herd.model.api.xml.BusinessObjectData)5