Search in sources :

Example 1 with InstanceTypeConfig

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

the class EmrDaoImplTest method testGetInstanceTypeConfigs.

@Test
public void testGetInstanceTypeConfigs() {
    // Create objects required for testing.
    final String instanceType = STRING_VALUE;
    final Integer weightedCapacity = INTEGER_VALUE;
    final String bidPrice = STRING_VALUE_2;
    final Double bidPriceAsPercentageOfOnDemandPrice = DOUBLE_VALUE;
    final EmrClusterDefinitionEbsConfiguration emrClusterDefinitionEbsConfiguration = null;
    final List<EmrClusterDefinitionConfiguration> emrClusterDefinitionConfigurations = null;
    final EmrClusterDefinitionInstanceTypeConfig emrClusterDefinitionInstanceTypeConfig = new EmrClusterDefinitionInstanceTypeConfig(instanceType, weightedCapacity, bidPrice, bidPriceAsPercentageOfOnDemandPrice, emrClusterDefinitionEbsConfiguration, emrClusterDefinitionConfigurations);
    // Call the method under test.
    List<InstanceTypeConfig> result = emrDaoImpl.getInstanceTypeConfigs(Arrays.asList(emrClusterDefinitionInstanceTypeConfig));
    // Verify the external calls.
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    final List<Configuration> expectedConfigurations = null;
    assertEquals(Arrays.asList(new InstanceTypeConfig().withInstanceType(instanceType).withWeightedCapacity(weightedCapacity).withBidPrice(bidPrice).withBidPriceAsPercentageOfOnDemandPrice(bidPriceAsPercentageOfOnDemandPrice).withEbsConfiguration(null).withConfigurations(expectedConfigurations)), result);
}
Also used : EmrClusterDefinitionInstanceTypeConfig(org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceTypeConfig) EmrClusterDefinitionConfiguration(org.finra.herd.model.api.xml.EmrClusterDefinitionConfiguration) Configuration(com.amazonaws.services.elasticmapreduce.model.Configuration) EmrClusterDefinitionEbsConfiguration(org.finra.herd.model.api.xml.EmrClusterDefinitionEbsConfiguration) EbsConfiguration(com.amazonaws.services.elasticmapreduce.model.EbsConfiguration) EmrClusterDefinitionConfiguration(org.finra.herd.model.api.xml.EmrClusterDefinitionConfiguration) EmrClusterDefinitionEbsConfiguration(org.finra.herd.model.api.xml.EmrClusterDefinitionEbsConfiguration) InstanceTypeConfig(com.amazonaws.services.elasticmapreduce.model.InstanceTypeConfig) EmrClusterDefinitionInstanceTypeConfig(org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceTypeConfig) Test(org.junit.Test) AbstractDaoTest(org.finra.herd.dao.AbstractDaoTest)

Example 2 with InstanceTypeConfig

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

the class EmrDaoImplTest method testGetInstanceFleets.

@Test
public void testGetInstanceFleets() {
    // Create objects required for testing.
    final String name = STRING_VALUE;
    final String instanceFleetType = STRING_VALUE_2;
    final Integer targetOnDemandCapacity = INTEGER_VALUE;
    final Integer targetSpotCapacity = INTEGER_VALUE_2;
    final List<EmrClusterDefinitionInstanceTypeConfig> emrClusterDefinitionInstanceTypeConfigs = null;
    final EmrClusterDefinitionLaunchSpecifications emrClusterDefinitionLaunchSpecifications = null;
    final EmrClusterDefinitionInstanceFleet emrClusterDefinitionInstanceFleet = new EmrClusterDefinitionInstanceFleet(name, instanceFleetType, targetOnDemandCapacity, targetSpotCapacity, emrClusterDefinitionInstanceTypeConfigs, emrClusterDefinitionLaunchSpecifications);
    // Call the method under test.
    List<InstanceFleetConfig> result = emrDaoImpl.getInstanceFleets(Arrays.asList(emrClusterDefinitionInstanceFleet));
    // Verify the external calls.
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    final List<InstanceTypeConfig> expectedInstanceTypeConfigs = null;
    assertEquals(Arrays.asList(new InstanceFleetConfig().withName(name).withInstanceFleetType(instanceFleetType).withTargetOnDemandCapacity(targetOnDemandCapacity).withTargetSpotCapacity(targetSpotCapacity).withInstanceTypeConfigs(expectedInstanceTypeConfigs).withLaunchSpecifications(null)), result);
}
Also used : EmrClusterDefinitionInstanceTypeConfig(org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceTypeConfig) InstanceFleetConfig(com.amazonaws.services.elasticmapreduce.model.InstanceFleetConfig) EmrClusterDefinitionInstanceFleet(org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceFleet) InstanceTypeConfig(com.amazonaws.services.elasticmapreduce.model.InstanceTypeConfig) EmrClusterDefinitionInstanceTypeConfig(org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceTypeConfig) EmrClusterDefinitionLaunchSpecifications(org.finra.herd.model.api.xml.EmrClusterDefinitionLaunchSpecifications) Test(org.junit.Test) AbstractDaoTest(org.finra.herd.dao.AbstractDaoTest)

Example 3 with InstanceTypeConfig

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

the class EmrDaoImpl method getInstanceTypeConfigs.

/**
 * Creates a list of {@link InstanceTypeConfig} from a given list of {@link EmrClusterDefinitionInstanceTypeConfig}.
 *
 * @param emrClusterDefinitionInstanceTypeConfigs the list of {@link EmrClusterDefinitionInstanceTypeConfig}
 *
 * @return the list of {@link InstanceTypeConfig}
 */
protected List<InstanceTypeConfig> getInstanceTypeConfigs(List<EmrClusterDefinitionInstanceTypeConfig> emrClusterDefinitionInstanceTypeConfigs) {
    List<InstanceTypeConfig> instanceTypeConfigs = null;
    if (!CollectionUtils.isEmpty(emrClusterDefinitionInstanceTypeConfigs)) {
        instanceTypeConfigs = new ArrayList<>();
        for (EmrClusterDefinitionInstanceTypeConfig emrClusterDefinitionInstanceTypeConfig : emrClusterDefinitionInstanceTypeConfigs) {
            if (emrClusterDefinitionInstanceTypeConfig != null) {
                InstanceTypeConfig instanceTypeConfig = new InstanceTypeConfig();
                instanceTypeConfig.setInstanceType(emrClusterDefinitionInstanceTypeConfig.getInstanceType());
                instanceTypeConfig.setWeightedCapacity(emrClusterDefinitionInstanceTypeConfig.getWeightedCapacity());
                instanceTypeConfig.setBidPrice(emrClusterDefinitionInstanceTypeConfig.getBidPrice());
                instanceTypeConfig.setBidPriceAsPercentageOfOnDemandPrice(emrClusterDefinitionInstanceTypeConfig.getBidPriceAsPercentageOfOnDemandPrice());
                instanceTypeConfig.setEbsConfiguration(getEbsConfiguration(emrClusterDefinitionInstanceTypeConfig.getEbsConfiguration()));
                instanceTypeConfig.setConfigurations(getConfigurations(emrClusterDefinitionInstanceTypeConfig.getConfigurations()));
                instanceTypeConfigs.add(instanceTypeConfig);
            }
        }
    }
    return instanceTypeConfigs;
}
Also used : EmrClusterDefinitionInstanceTypeConfig(org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceTypeConfig) InstanceTypeConfig(com.amazonaws.services.elasticmapreduce.model.InstanceTypeConfig) EmrClusterDefinitionInstanceTypeConfig(org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceTypeConfig)

Aggregations

InstanceTypeConfig (com.amazonaws.services.elasticmapreduce.model.InstanceTypeConfig)3 EmrClusterDefinitionInstanceTypeConfig (org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceTypeConfig)3 AbstractDaoTest (org.finra.herd.dao.AbstractDaoTest)2 Test (org.junit.Test)2 Configuration (com.amazonaws.services.elasticmapreduce.model.Configuration)1 EbsConfiguration (com.amazonaws.services.elasticmapreduce.model.EbsConfiguration)1 InstanceFleetConfig (com.amazonaws.services.elasticmapreduce.model.InstanceFleetConfig)1 EmrClusterDefinitionConfiguration (org.finra.herd.model.api.xml.EmrClusterDefinitionConfiguration)1 EmrClusterDefinitionEbsConfiguration (org.finra.herd.model.api.xml.EmrClusterDefinitionEbsConfiguration)1 EmrClusterDefinitionInstanceFleet (org.finra.herd.model.api.xml.EmrClusterDefinitionInstanceFleet)1 EmrClusterDefinitionLaunchSpecifications (org.finra.herd.model.api.xml.EmrClusterDefinitionLaunchSpecifications)1