use of org.finra.herd.model.api.xml.Parameter in project herd by FINRAOS.
the class EmrDaoImplTest method testGetMap.
@Test
public void testGetMap() {
// Create objects required for testing.
final String name = STRING_VALUE;
final String value = STRING_VALUE_2;
final Parameter parameter = new Parameter(name, value);
// Call the method under test.
Map<String, String> result = emrDaoImpl.getMap(Arrays.asList(parameter));
// Verify the external calls.
verifyNoMoreInteractionsHelper();
// Validate the results.
assertEquals(1, CollectionUtils.size(result));
assertTrue(result.containsKey(name));
assertEquals(value, result.get(name));
}
use of org.finra.herd.model.api.xml.Parameter in project herd by FINRAOS.
the class EmrDaoImplTest method testGetConfigurations.
@Test
public void testGetConfigurations() {
// Create objects required for testing.
final String classification = STRING_VALUE;
final List<EmrClusterDefinitionConfiguration> emrClusterDefinitionConfigurations = null;
final List<Parameter> properties = null;
final EmrClusterDefinitionConfiguration emrClusterDefinitionConfiguration = new EmrClusterDefinitionConfiguration(classification, emrClusterDefinitionConfigurations, properties);
// Call the method under test.
List<Configuration> result = emrDaoImpl.getConfigurations(Arrays.asList(emrClusterDefinitionConfiguration));
// Verify the external calls.
verifyNoMoreInteractionsHelper();
// Validate the results.
final List<Configuration> expectedConfigurations = null;
assertEquals(Arrays.asList(new Configuration().withClassification(classification).withConfigurations(expectedConfigurations).withProperties(null)), result);
}
use of org.finra.herd.model.api.xml.Parameter in project herd by FINRAOS.
the class JobDefinitionServiceImpl method createJobDefinitionFromEntity.
/**
* Creates the job definition from the persisted entity.
*
* @param jobDefinitionEntity the newly persisted job definition entity.
*
* @return the job definition.
*/
private JobDefinition createJobDefinitionFromEntity(JobDefinitionEntity jobDefinitionEntity) throws IOException {
// Create the business object definition information.
JobDefinition jobDefinition = new JobDefinition();
jobDefinition.setId(jobDefinitionEntity.getId());
jobDefinition.setNamespace(jobDefinitionEntity.getNamespace().getCode());
jobDefinition.setJobName(jobDefinitionEntity.getName());
jobDefinition.setDescription(jobDefinitionEntity.getDescription());
String s3BucketName = jobDefinitionEntity.getS3BucketName();
String s3ObjectKey = jobDefinitionEntity.getS3ObjectKey();
if (s3BucketName != null && s3ObjectKey != null) {
S3PropertiesLocation s3PropertiesLocation = new S3PropertiesLocation();
s3PropertiesLocation.setBucketName(s3BucketName);
s3PropertiesLocation.setKey(s3ObjectKey);
jobDefinition.setS3PropertiesLocation(s3PropertiesLocation);
}
// Retrieve Activiti XML from activiti.
ProcessDefinition processDefinition = activitiRepositoryService.createProcessDefinitionQuery().processDefinitionId(jobDefinitionEntity.getActivitiId()).singleResult();
InputStream xmlStream = activitiRepositoryService.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName());
jobDefinition.setActivitiJobXml(IOUtils.toString(xmlStream));
// Add in the parameters.
List<Parameter> parameters = new ArrayList<>();
jobDefinition.setParameters(parameters);
for (JobDefinitionParameterEntity parameterEntity : jobDefinitionEntity.getParameters()) {
Parameter parameter = new Parameter(parameterEntity.getName(), parameterEntity.getValue());
jobDefinitionHelper.maskPassword(parameter);
parameters.add(parameter);
}
// Populate the "last updated by" user ID.
jobDefinition.setLastUpdatedByUserId(jobDefinitionEntity.getUpdatedBy());
return jobDefinition;
}
use of org.finra.herd.model.api.xml.Parameter in project herd by FINRAOS.
the class StorageUnitStatusChangeNotificationJobActionServiceImpl method buildJobParameters.
private List<Parameter> buildJobParameters(StorageUnitNotificationEventParamsDto storageUnitNotificationEventParams) throws IOException {
List<Parameter> parameters = new ArrayList<>();
BusinessObjectData businessObjectData = storageUnitNotificationEventParams.getBusinessObjectData();
NotificationJobActionEntity notificationJobActionEntity = storageUnitNotificationEventParams.getNotificationJobAction();
parameters.add(new Parameter(PARAM_NAMESPACE, storageUnitNotificationEventParams.getStorageUnitNotificationRegistration().getNamespace().getCode()));
parameters.add(new Parameter(PARAM_NOTIFICATION_NAME, storageUnitNotificationEventParams.getStorageUnitNotificationRegistration().getName()));
parameters.add(new Parameter(PARAM_STORAGE_UNIT_EVENT_TYPE, storageUnitNotificationEventParams.getEventType()));
parameters.add(new Parameter(PARAM_CORRELATION_DATA, notificationJobActionEntity.getCorrelationData()));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA, jsonHelper.objectToJson(businessObjectData)));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DEFINITION_NAMESPACE, businessObjectData.getNamespace()));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DEFINITION_NAME, businessObjectData.getBusinessObjectDefinitionName()));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_USAGE, businessObjectData.getBusinessObjectFormatUsage()));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_FILE_TYPE, businessObjectData.getBusinessObjectFormatFileType()));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_VERSION, Integer.toString(businessObjectData.getBusinessObjectFormatVersion())));
parameters.add(new Parameter(PARAM_PARTITION_COLUMN_NAMES, herdStringHelper.buildStringWithDefaultDelimiter(storageUnitNotificationEventParams.getPartitionColumnNames())));
parameters.add(new Parameter(PARAM_PARTITION_VALUES, herdStringHelper.buildStringWithDefaultDelimiter(storageUnitNotificationEventParams.getPartitionValues())));
parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA_VERSION, Integer.toString(businessObjectData.getVersion())));
parameters.add(new Parameter(PARAM_STORAGE_NAME, storageUnitNotificationEventParams.getStorageName()));
parameters.add(new Parameter(PARAM_NEW_STORAGE_UNIT_STATUS, storageUnitNotificationEventParams.getNewStorageUnitStatus()));
parameters.add(new Parameter(PARAM_OLD_STORAGE_UNIT_STATUS, storageUnitNotificationEventParams.getOldStorageUnitStatus()));
return parameters;
}
use of org.finra.herd.model.api.xml.Parameter in project herd by FINRAOS.
the class JobServiceImpl method createJobFromRequest.
/**
* Creates a new job object from request.
*
* @param namespaceCd, the namespace Code
* @param jobName, the job name
* @param mergedParameters parameters that were submitted with the job
* @param processInstanceId process instance ID of the submitted job
*
* @return the created job object
*/
private Job createJobFromRequest(String namespaceCd, String jobName, Map<String, Object> mergedParameters, String processInstanceId) {
// Create the job.
Job job = new Job();
job.setId(processInstanceId);
job.setNamespace(namespaceCd);
job.setJobName(jobName);
// Populate parameters from process instance.
if (!mergedParameters.isEmpty()) {
List<Parameter> jobParameters = new ArrayList<>();
job.setParameters(jobParameters);
for (Map.Entry<String, Object> entry : mergedParameters.entrySet()) {
Parameter parameter = new Parameter(entry.getKey(), entry.getValue() != null ? entry.getValue().toString() : null);
jobDefinitionHelper.maskPassword(parameter);
jobParameters.add(parameter);
}
}
return job;
}
Aggregations