@Test public void testGetEmrClusterPricesWithinLowestCoreInstancePriceThresholdSinglePricing() throws Exception { List<EmrClusterPriceDto> pricingList = Arrays.asList(createSimpleEmrClusterPrice(AVAILABILITY_ZONE_1, BigDecimal.ONE)); List<EmrClusterPriceDto> lowestCoreInstancePriceClusters = emrPricingHelper.getEmrClusterPricesWithinLowestCoreInstancePriceThreshold(pricingList, TEN_PERCENT); assertEquals(1, lowestCoreInstancePriceClusters.size()); assertEquals(AVAILABILITY_ZONE_1, lowestCoreInstancePriceClusters.get(0).getAvailabilityZone()); }
/** * Tests when one cluster does not have core instance. In this case this cluster will be picked since the price for the cluster is now zero (the lowest) * * @throws Exception */ @Test public void testGetEmrClusterPricesWithinLowestCoreInstancePriceEmptyCoreInstanceMultiplePricings() throws Exception { List<EmrClusterPriceDto> pricingList = Arrays.asList(createSimpleEmrClusterPrice(AVAILABILITY_ZONE_1, BigDecimal.ONE), createSimpleEmrClusterPrice(AVAILABILITY_ZONE_4, null)); List<EmrClusterPriceDto> lowestCoreInstancePriceClusters = emrPricingHelper.getEmrClusterPricesWithinLowestCoreInstancePriceThreshold(pricingList, TEN_PERCENT); assertEquals(1, lowestCoreInstancePriceClusters.size()); for (EmrClusterPriceDto emrClusterPriceDto : lowestCoreInstancePriceClusters) { assertTrue(Arrays.asList(AVAILABILITY_ZONE_4).contains(emrClusterPriceDto.getAvailabilityZone())); } }
@Test public void testGetEmrClusterPricesWithinLowestCoreInstancePriceThresholdMultiplePricing() throws Exception { List<EmrClusterPriceDto> pricingList = Arrays .asList(createSimpleEmrClusterPrice(AVAILABILITY_ZONE_1, BigDecimal.ONE), createSimpleEmrClusterPrice(AVAILABILITY_ZONE_2, BigDecimal.TEN), createSimpleEmrClusterPrice(AVAILABILITY_ZONE_3, ONE_POINT_ONE), createSimpleEmrClusterPrice(AVAILABILITY_ZONE_4, ONE_POINT_ONE_ONE)); List<EmrClusterPriceDto> lowestCoreInstancePriceClusters = emrPricingHelper.getEmrClusterPricesWithinLowestCoreInstancePriceThreshold(pricingList, TEN_PERCENT); assertEquals(2, lowestCoreInstancePriceClusters.size()); for (EmrClusterPriceDto emrClusterPriceDto : lowestCoreInstancePriceClusters) { assertTrue(Arrays.asList(AVAILABILITY_ZONE_1, AVAILABILITY_ZONE_3).contains(emrClusterPriceDto.getAvailabilityZone())); } }
/** * Tests when the threshold is set to zero. * * @throws Exception */ @Test public void testGetEmrClusterPricesWithinLowestCoreInstancePriceZeroThresholdMultiplePricings() throws Exception { List<EmrClusterPriceDto> pricingList = Arrays .asList(createSimpleEmrClusterPrice(AVAILABILITY_ZONE_1, BigDecimal.ONE), createSimpleEmrClusterPrice(AVAILABILITY_ZONE_2, BigDecimal.TEN), createSimpleEmrClusterPrice(AVAILABILITY_ZONE_3, BigDecimal.ONE.add(FIVE_UNIT)), createSimpleEmrClusterPrice(AVAILABILITY_ZONE_4, BigDecimal.ONE)); List<EmrClusterPriceDto> lowestCoreInstancePriceClusters = emrPricingHelper.getEmrClusterPricesWithinLowestCoreInstancePriceThreshold(pricingList, BigDecimal.ZERO); assertEquals(2, lowestCoreInstancePriceClusters.size()); for (EmrClusterPriceDto emrClusterPriceDto : lowestCoreInstancePriceClusters) { assertTrue(Arrays.asList(AVAILABILITY_ZONE_1, AVAILABILITY_ZONE_4).contains(emrClusterPriceDto.getAvailabilityZone())); } }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theAvailabilityZone; theAvailabilityZone = this.getAvailabilityZone(); strategy.appendField(locator, this, "availabilityZone", buffer, theAvailabilityZone, (this.availabilityZone!= null)); } { Ec2PriceDto theMasterPrice; theMasterPrice = this.getMasterPrice(); strategy.appendField(locator, this, "masterPrice", buffer, theMasterPrice, (this.masterPrice!= null)); } { Ec2PriceDto theCorePrice; theCorePrice = this.getCorePrice(); strategy.appendField(locator, this, "corePrice", buffer, theCorePrice, (this.corePrice!= null)); } { Ec2PriceDto theTaskPrice; theTaskPrice = this.getTaskPrice(); strategy.appendField(locator, this, "taskPrice", buffer, theTaskPrice, (this.taskPrice!= null)); } return buffer; }
Subnet bestEmrClusterSubnet = getBestSubnetForAvailabilityZone(bestEmrClusterPrice.getAvailabilityZone(), subnets);
Subnet bestEmrClusterSubnet = getBestSubnetForAvailabilityZone(bestEmrClusterPrice.getAvailabilityZone(), subnets);
lhsAvailabilityZone = this.getAvailabilityZone(); String rhsAvailabilityZone; rhsAvailabilityZone = that.getAvailabilityZone(); if (!strategy.equals(LocatorUtils.property(thisLocator, "availabilityZone", lhsAvailabilityZone), LocatorUtils.property(thatLocator, "availabilityZone", rhsAvailabilityZone), lhsAvailabilityZone, rhsAvailabilityZone, (this.availabilityZone!= null), (that.availabilityZone!= null))) { return false;
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theAvailabilityZone; theAvailabilityZone = this.getAvailabilityZone(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "availabilityZone", theAvailabilityZone), currentHashCode, theAvailabilityZone, (this.availabilityZone!= null)); } { Ec2PriceDto theMasterPrice; theMasterPrice = this.getMasterPrice(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "masterPrice", theMasterPrice), currentHashCode, theMasterPrice, (this.masterPrice!= null)); } { Ec2PriceDto theCorePrice; theCorePrice = this.getCorePrice(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "corePrice", theCorePrice), currentHashCode, theCorePrice, (this.corePrice!= null)); } { Ec2PriceDto theTaskPrice; theTaskPrice = this.getTaskPrice(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "taskPrice", theTaskPrice), currentHashCode, theTaskPrice, (this.taskPrice!= null)); } return currentHashCode; }
if (availabilityZoneShouldBeCopiedAndSet == Boolean.TRUE) { String sourceAvailabilityZone; sourceAvailabilityZone = this.getAvailabilityZone(); String copyAvailabilityZone = ((String) strategy.copy(LocatorUtils.property(locator, "availabilityZone", sourceAvailabilityZone), sourceAvailabilityZone, (this.availabilityZone!= null))); copy.setAvailabilityZone(copyAvailabilityZone);