Search in sources :

Example 6 with EmrClusterDefinitionInstanceFleet

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

the class EmrServiceTest method testCreateEmrClusterOverrideInstanceDefinitionsWithInstanceFleets.

@Test
public void testCreateEmrClusterOverrideInstanceDefinitionsWithInstanceFleets() throws Exception {
    // Create the namespace entity.
    NamespaceEntity namespaceEntity = namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
    String definitionXml = IOUtils.toString(resourceLoader.getResource(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH).getInputStream());
    EmrClusterDefinition expectedEmrClusterDefinition = xmlHelper.unmarshallXmlToObject(EmrClusterDefinition.class, definitionXml);
    emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceEntity, EMR_CLUSTER_DEFINITION_NAME, definitionXml);
    // Create a new EMR cluster create request that replaces instance definitions with instance fleets.
    EmrClusterCreateRequest request = getNewEmrClusterCreateRequest();
    EmrClusterDefinition emrClusterDefinitionOverride = new EmrClusterDefinition();
    emrClusterDefinitionOverride.setInstanceDefinitions(new InstanceDefinitions());
    emrClusterDefinitionOverride.setInstanceFleets(Arrays.asList(new EmrClusterDefinitionInstanceFleet()));
    request.setEmrClusterDefinitionOverride(emrClusterDefinitionOverride);
    // Update the expected EMR cluster definition.
    expectedEmrClusterDefinition.setInstanceDefinitions(new InstanceDefinitions());
    expectedEmrClusterDefinition.setInstanceFleets(Arrays.asList(new EmrClusterDefinitionInstanceFleet()));
    // Create the cluster.
    EmrCluster emrCluster = emrService.createCluster(request);
    // Validate the returned object against the input.
    assertNotNull(emrCluster);
    assertTrue(emrCluster.getNamespace().equals(request.getNamespace()));
    assertTrue(emrCluster.getEmrClusterDefinitionName().equals(request.getEmrClusterDefinitionName()));
    assertTrue(emrCluster.getEmrClusterName().equals(request.getEmrClusterName()));
    assertNotNull(emrCluster.getId());
    assertNull(emrCluster.isDryRun());
    assertTrue(emrCluster.isEmrClusterCreated());
    assertNotNull(emrCluster.getEmrClusterDefinition());
    assertEquals(expectedEmrClusterDefinition, emrCluster.getEmrClusterDefinition());
    validateEmrClusterCreationLogUnique(emrCluster, expectedEmrClusterDefinition);
}
Also used : NamespaceEntity(org.finra.herd.model.jpa.NamespaceEntity) EmrClusterDefinition(org.finra.herd.model.api.xml.EmrClusterDefinition) EmrClusterCreateRequest(org.finra.herd.model.api.xml.EmrClusterCreateRequest) EmrCluster(org.finra.herd.model.api.xml.EmrCluster) EmrClusterDefinitionInstanceFleet(org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceFleet) InstanceDefinitions(org.finra.herd.model.api.xml.InstanceDefinitions) Test(org.junit.Test)

Aggregations

EmrClusterDefinitionInstanceFleet (org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceFleet)6 Test (org.junit.Test)5 EmrClusterDefinition (org.finra.herd.model.api.xml.EmrClusterDefinition)4 InstanceFleetConfig (com.amazonaws.services.elasticmapreduce.model.InstanceFleetConfig)3 EmrCluster (org.finra.herd.model.api.xml.EmrCluster)3 EmrClusterCreateRequest (org.finra.herd.model.api.xml.EmrClusterCreateRequest)3 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)3 EmrClusterDefinitionInstanceTypeConfig (org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceTypeConfig)2 EmrClusterDefinitionLaunchSpecifications (org.finra.herd.model.api.xml.EmrClusterDefinitionLaunchSpecifications)2 InstanceDefinitions (org.finra.herd.model.api.xml.InstanceDefinitions)2 InstanceTypeConfig (com.amazonaws.services.elasticmapreduce.model.InstanceTypeConfig)1 JobFlowInstancesConfig (com.amazonaws.services.elasticmapreduce.model.JobFlowInstancesConfig)1 RunJobFlowRequest (com.amazonaws.services.elasticmapreduce.model.RunJobFlowRequest)1 Tag (com.amazonaws.services.elasticmapreduce.model.Tag)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AbstractDaoTest (org.finra.herd.dao.AbstractDaoTest)1 NodeTag (org.finra.herd.model.api.xml.NodeTag)1 AwsParamsDto (org.finra.herd.model.dto.AwsParamsDto)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1