use of org.finra.herd.model.api.xml.EmrClusterDefinitionInformation in project herd by FINRAOS.
the class EmrClusterDefinitionServiceTest method testCreateEmrClusterDefinitionMaxInstancesSetToZero.
@Test
public void testCreateEmrClusterDefinitionMaxInstancesSetToZero() throws Exception {
// Create and persist the namespace entity.
namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
// Override configuration to set the maximum allowed number of EMR instances to zero.
Map<String, Object> overrideMap = new HashMap<>();
overrideMap.put(ConfigurationValue.MAX_EMR_INSTANCES_COUNT.getKey(), "0");
modifyPropertySourceInEnvironment(overrideMap);
try {
// Create an EMR cluster definition create request.
EmrClusterDefinitionCreateRequest request = createEmrClusterDefinitionCreateRequest(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH));
// Create an EMR cluster definition.
EmrClusterDefinitionInformation resultEmrClusterDefinition = emrClusterDefinitionService.createEmrClusterDefinition(request);
// Validate the returned object.
validateEmrClusterDefinition(null, NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH), resultEmrClusterDefinition);
} finally {
// Restore the property sources so we don't affect other tests.
restorePropertySourceInEnvironment();
}
}
use of org.finra.herd.model.api.xml.EmrClusterDefinitionInformation in project herd by FINRAOS.
the class EmrClusterDefinitionServiceTest method testDeleteEmrClusterDefinitionUpperCaseParameters.
@Test
public void testDeleteEmrClusterDefinitionUpperCaseParameters() throws Exception {
// Create and persist the namespace entity with a lowercase name.
NamespaceEntity namespaceEntity = namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE.toLowerCase());
// Create and persist the EMR cluster definition entity with a lowercase name.
EmrClusterDefinitionEntity emrClusterDefinitionEntity = emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceEntity, EMR_CLUSTER_DEFINITION_NAME.toLowerCase(), getTestEmrClusterDefinitionConfigurationXml(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH));
// Validate that this EMR cluster definition exists.
assertNotNull(emrClusterDefinitionDao.getEmrClusterDefinitionByAltKey(NAMESPACE.toLowerCase(), EMR_CLUSTER_DEFINITION_NAME.toLowerCase()));
executeWithoutLogging(EmrClusterDefinitionServiceImpl.class, () -> {
// Delete this EMR cluster definition by passing the EMR cluster definition name key parameters in upper case.
EmrClusterDefinitionInformation deletedEmrClusterDefinition = emrClusterDefinitionService.deleteEmrClusterDefinition(new EmrClusterDefinitionKey(NAMESPACE.toUpperCase(), EMR_CLUSTER_DEFINITION_NAME.toUpperCase()));
// Validate the returned object.
validateEmrClusterDefinition(emrClusterDefinitionEntity.getId(), NAMESPACE.toLowerCase(), EMR_CLUSTER_DEFINITION_NAME.toLowerCase(), getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH), deletedEmrClusterDefinition);
// Ensure that this EMR cluster definition is no longer there.
assertNull(emrClusterDefinitionDao.getEmrClusterDefinitionByAltKey(NAMESPACE.toLowerCase(), EMR_CLUSTER_DEFINITION_NAME.toLowerCase()));
});
}
use of org.finra.herd.model.api.xml.EmrClusterDefinitionInformation in project herd by FINRAOS.
the class EmrClusterDefinitionServiceTest method testCreateEmrClusterDefinitionTrimParameters.
@Test
public void testCreateEmrClusterDefinitionTrimParameters() throws Exception {
// Create and persist the namespace entity.
namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
// Create an EMR cluster definition create request by passing namespace and EMR cluster definition name with leading and trailing whitespace characters.
EmrClusterDefinitionCreateRequest request = createEmrClusterDefinitionCreateRequest(addWhitespace(NAMESPACE), addWhitespace(EMR_CLUSTER_DEFINITION_NAME), getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH));
// Create an EMR cluster definition.
EmrClusterDefinitionInformation resultEmrClusterDefinition = emrClusterDefinitionService.createEmrClusterDefinition(request);
// Validate the returned object.
validateEmrClusterDefinition(null, NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH), resultEmrClusterDefinition);
}
Aggregations