Search in sources :

Example 1 with InstanceGroupConfig

use of com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig in project herd by FINRAOS.

the class EmrDaoImplTest method testGetInstanceGroupConfigWhenBidPriceIsNull.

@Test
public void testGetInstanceGroupConfigWhenBidPriceIsNull() {
    // Call the method under test.
    InstanceGroupConfig result = emrDaoImpl.getInstanceGroupConfig(InstanceRoleType.MASTER, EC2_INSTANCE_TYPE, INSTANCE_COUNT, NO_BID_PRICE, NO_EMR_CLUSTER_DEFINITION_EBS_CONFIGURATION);
    // Verify the external calls.
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(new InstanceGroupConfig(InstanceRoleType.MASTER, EC2_INSTANCE_TYPE, INSTANCE_COUNT), result);
}
Also used : InstanceGroupConfig(com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig) Test(org.junit.Test) AbstractDaoTest(org.finra.herd.dao.AbstractDaoTest)

Example 2 with InstanceGroupConfig

use of com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig in project herd by FINRAOS.

the class EmrDaoImplTest method testGetInstanceGroupConfigsMissingOptionalInstanceDefinitions.

@Test
public void testGetInstanceGroupConfigsMissingOptionalInstanceDefinitions() {
    // Create objects required for testing.
    final Integer instanceCount = 0;
    final InstanceDefinitions instanceDefinitions = new InstanceDefinitions(new MasterInstanceDefinition(), null, null);
    // Mock the external calls.
    when(emrHelper.isInstanceDefinitionsEmpty(instanceDefinitions)).thenReturn(false);
    // Call the method under test.
    List<InstanceGroupConfig> result = emrDaoImpl.getInstanceGroupConfigs(instanceDefinitions);
    // Verify the external calls.
    verify(emrHelper).isInstanceDefinitionsEmpty(instanceDefinitions);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(Arrays.asList(new InstanceGroupConfig(InstanceRoleType.MASTER, null, instanceCount)), result);
}
Also used : MasterInstanceDefinition(org.finra.herd.model.api.xml.MasterInstanceDefinition) InstanceDefinitions(org.finra.herd.model.api.xml.InstanceDefinitions) InstanceGroupConfig(com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig) Test(org.junit.Test) AbstractDaoTest(org.finra.herd.dao.AbstractDaoTest)

Example 3 with InstanceGroupConfig

use of com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig in project herd by FINRAOS.

the class EmrDaoImplTest method testGetInstanceGroupConfigsWhenInstanceDefinitionsObjectIsEmpty.

@Test
public void testGetInstanceGroupConfigsWhenInstanceDefinitionsObjectIsEmpty() {
    // Create objects required for testing.
    final InstanceDefinitions instanceDefinitions = new InstanceDefinitions();
    // Mock the external calls.
    when(emrHelper.isInstanceDefinitionsEmpty(instanceDefinitions)).thenReturn(true);
    // Call the method under test.
    List<InstanceGroupConfig> result = emrDaoImpl.getInstanceGroupConfigs(instanceDefinitions);
    // Verify the external calls.
    verify(emrHelper).isInstanceDefinitionsEmpty(instanceDefinitions);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertNull(result);
}
Also used : InstanceDefinitions(org.finra.herd.model.api.xml.InstanceDefinitions) InstanceGroupConfig(com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig) Test(org.junit.Test) AbstractDaoTest(org.finra.herd.dao.AbstractDaoTest)

Example 4 with InstanceGroupConfig

use of com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig in project herd by FINRAOS.

the class EmrDaoImplTest method testGetInstanceGroupConfigs.

@Test
public void testGetInstanceGroupConfigs() {
    // Create objects required for testing.
    final Integer instanceCount = 0;
    final InstanceDefinitions instanceDefinitions = new InstanceDefinitions(new MasterInstanceDefinition(), new InstanceDefinition(), new InstanceDefinition());
    // Mock the external calls.
    when(emrHelper.isInstanceDefinitionsEmpty(instanceDefinitions)).thenReturn(false);
    // Call the method under test.
    List<InstanceGroupConfig> result = emrDaoImpl.getInstanceGroupConfigs(instanceDefinitions);
    // Verify the external calls.
    verify(emrHelper).isInstanceDefinitionsEmpty(instanceDefinitions);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(3, CollectionUtils.size(result));
    assertTrue(result.contains(new InstanceGroupConfig(InstanceRoleType.MASTER, null, instanceCount)));
    assertTrue(result.contains(new InstanceGroupConfig(InstanceRoleType.CORE, null, instanceCount)));
    assertTrue(result.contains(new InstanceGroupConfig(InstanceRoleType.TASK, null, instanceCount)));
}
Also used : MasterInstanceDefinition(org.finra.herd.model.api.xml.MasterInstanceDefinition) InstanceDefinition(org.finra.herd.model.api.xml.InstanceDefinition) MasterInstanceDefinition(org.finra.herd.model.api.xml.MasterInstanceDefinition) InstanceDefinitions(org.finra.herd.model.api.xml.InstanceDefinitions) InstanceGroupConfig(com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig) Test(org.junit.Test) AbstractDaoTest(org.finra.herd.dao.AbstractDaoTest)

Example 5 with InstanceGroupConfig

use of com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig in project herd by FINRAOS.

the class EmrDaoImplTest method testGetInstanceGroupConfig.

@Test
public void testGetInstanceGroupConfig() throws Exception {
    // Call the method under test.
    InstanceGroupConfig result = emrDaoImpl.getInstanceGroupConfig(InstanceRoleType.MASTER, EC2_INSTANCE_TYPE, INSTANCE_COUNT, BID_PRICE, new EmrClusterDefinitionEbsConfiguration(Collections.singletonList(new EmrClusterDefinitionEbsBlockDeviceConfig(new EmrClusterDefinitionVolumeSpecification(VOLUME_TYPE, IOPS, SIZE_IN_GB), VOLUMES_PER_INSTANCE)), EBS_OPTIMIZED));
    // Verify the external calls.
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(new InstanceGroupConfig(InstanceRoleType.MASTER, EC2_INSTANCE_TYPE, INSTANCE_COUNT).withMarket(MarketType.SPOT).withBidPrice(BID_PRICE.toPlainString()).withEbsConfiguration(new EbsConfiguration().withEbsBlockDeviceConfigs(new EbsBlockDeviceConfig().withVolumeSpecification(new VolumeSpecification().withVolumeType(VOLUME_TYPE).withIops(IOPS).withSizeInGB(SIZE_IN_GB)).withVolumesPerInstance(VOLUMES_PER_INSTANCE)).withEbsOptimized(EBS_OPTIMIZED)), result);
}
Also used : VolumeSpecification(com.amazonaws.services.elasticmapreduce.model.VolumeSpecification) EmrClusterDefinitionVolumeSpecification(org.finra.herd.model.api.xml.EmrClusterDefinitionVolumeSpecification) EmrClusterDefinitionEbsConfiguration(org.finra.herd.model.api.xml.EmrClusterDefinitionEbsConfiguration) EbsConfiguration(com.amazonaws.services.elasticmapreduce.model.EbsConfiguration) EmrClusterDefinitionEbsBlockDeviceConfig(org.finra.herd.model.api.xml.EmrClusterDefinitionEbsBlockDeviceConfig) EbsBlockDeviceConfig(com.amazonaws.services.elasticmapreduce.model.EbsBlockDeviceConfig) EmrClusterDefinitionEbsBlockDeviceConfig(org.finra.herd.model.api.xml.EmrClusterDefinitionEbsBlockDeviceConfig) EmrClusterDefinitionEbsConfiguration(org.finra.herd.model.api.xml.EmrClusterDefinitionEbsConfiguration) EmrClusterDefinitionVolumeSpecification(org.finra.herd.model.api.xml.EmrClusterDefinitionVolumeSpecification) InstanceGroupConfig(com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig) Test(org.junit.Test) AbstractDaoTest(org.finra.herd.dao.AbstractDaoTest)

Aggregations

InstanceGroupConfig (com.amazonaws.services.elasticmapreduce.model.InstanceGroupConfig)8 Test (org.junit.Test)7 AbstractDaoTest (org.finra.herd.dao.AbstractDaoTest)5 InstanceDefinitions (org.finra.herd.model.api.xml.InstanceDefinitions)5 MasterInstanceDefinition (org.finra.herd.model.api.xml.MasterInstanceDefinition)4 InstanceDefinition (org.finra.herd.model.api.xml.InstanceDefinition)3 RunJobFlowRequest (com.amazonaws.services.elasticmapreduce.model.RunJobFlowRequest)2 EmrClusterDefinition (org.finra.herd.model.api.xml.EmrClusterDefinition)2 NodeTag (org.finra.herd.model.api.xml.NodeTag)2 AwsParamsDto (org.finra.herd.model.dto.AwsParamsDto)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 ClientConfiguration (com.amazonaws.ClientConfiguration)1 Application (com.amazonaws.services.elasticmapreduce.model.Application)1 BootstrapActionConfig (com.amazonaws.services.elasticmapreduce.model.BootstrapActionConfig)1 Configuration (com.amazonaws.services.elasticmapreduce.model.Configuration)1 EbsBlockDeviceConfig (com.amazonaws.services.elasticmapreduce.model.EbsBlockDeviceConfig)1 EbsConfiguration (com.amazonaws.services.elasticmapreduce.model.EbsConfiguration)1 JobFlowInstancesConfig (com.amazonaws.services.elasticmapreduce.model.JobFlowInstancesConfig)1 ScriptBootstrapActionConfig (com.amazonaws.services.elasticmapreduce.model.ScriptBootstrapActionConfig)1 Tag (com.amazonaws.services.elasticmapreduce.model.Tag)1