use of org.finra.herd.model.api.xml.EmrClusterDefinitionCreateRequest in project herd by FINRAOS.
the class EmrClusterDefinitionServiceTest method createEmrClusterDefinitionCreateRequest.
/**
* Creates a new EMR cluster definition create request.
*
* @param namespace the namespace
* @param emrClusterDefinitionName the EMR cluster definition name
* @param emrClusterDefinitionConfiguration the EMR cluster definition configuration
*
* @return the newly created EMR cluster definition create request
*/
private EmrClusterDefinitionCreateRequest createEmrClusterDefinitionCreateRequest(String namespace, String emrClusterDefinitionName, EmrClusterDefinition emrClusterDefinitionConfiguration) {
// Create a new ENR cluster definition create request.
EmrClusterDefinitionCreateRequest request = new EmrClusterDefinitionCreateRequest();
// Fill in the parameters.
request.setEmrClusterDefinitionKey(new EmrClusterDefinitionKey(namespace, emrClusterDefinitionName));
request.setEmrClusterDefinition(emrClusterDefinitionConfiguration);
return request;
}
use of org.finra.herd.model.api.xml.EmrClusterDefinitionCreateRequest in project herd by FINRAOS.
the class EmrClusterDefinitionServiceTest method testCreateEmrClusterDefinitionCoreInstanceCount0AssertResponseCoreInstanceDefinitionIsNull.
/**
* Asserts that when 0 is specified for core instance count, no validation exception is thrown.
*/
@Test
public void testCreateEmrClusterDefinitionCoreInstanceCount0AssertResponseCoreInstanceDefinitionIsNull() throws Exception {
// Create and persist the namespace entity.
namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
// Create an EMR cluster definition create request.
EmrClusterDefinitionCreateRequest request = createEmrClusterDefinitionCreateRequest(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH));
InstanceDefinition coreInstanceDefinition = new InstanceDefinition(0, "m1.medium", NO_EMR_CLUSTER_DEFINITION_EBS_CONFIGURATION, NO_INSTANCE_SPOT_PRICE, NO_INSTANCE_MAX_SEARCH_PRICE, NO_INSTANCE_ON_DEMAND_THRESHOLD);
request.getEmrClusterDefinition().getInstanceDefinitions().setCoreInstances(coreInstanceDefinition);
// Create an EMR cluster definition.
EmrClusterDefinitionInformation emrClusterDefinitionInformation = emrClusterDefinitionService.createEmrClusterDefinition(request);
assertNull(emrClusterDefinitionInformation.getEmrClusterDefinition().getInstanceDefinitions().getCoreInstances());
}
use of org.finra.herd.model.api.xml.EmrClusterDefinitionCreateRequest 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.EmrClusterDefinitionCreateRequest 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