EC2CloudManager extends TimerTask implements InstanceManager { @Override public synchronized InstanceType getInstanceTypeByName(String instanceTypeName) { for (int i = 0; i < this.availableInstanceTypes.length; i++) { if (this.availableInstanceTypes[i].getIdentifier().equals(instanceTypeName)) { return this.availableInstanceTypes[i]; } } return null; } EC2CloudManager(); @Override InstanceType getSuitableInstanceType(final int minNumComputeUnits, final int minNumCPUCores,
			final int minMemorySize, final int minDiskCapacity, final int maxPricePerHour); @Override synchronized void releaseAllocatedResource(final JobID jobID, final Configuration conf,
			final AllocatedResource allocatedResource); @Override synchronized void reportHeartBeat(final InstanceConnectionInfo instanceConnectionInfo,
			final HardwareDescription hardwareDescription); @Override void requestInstance(final JobID jobID, Configuration conf, final InstanceRequestMap instanceRequestMap,
			final List<String> splitAffinityList); @Override void run(); @Override InstanceType getDefaultInstanceType(); @Override synchronized InstanceType getInstanceTypeByName(String instanceTypeName); @Override void shutdown(); @Override NetworkTopology getNetworkTopology(final JobID jobID); @Override void setInstanceListener(final InstanceListener instanceListener); @Override Map<InstanceType, InstanceTypeDescription> getMapOfAvailableInstanceTypes(); @Override AbstractInstance getInstanceByName(final String name); @Override void cancelPendingRequests(final JobID jobID);  }
@Test public void testGetInstanceTypeByName() { GlobalConfiguration.loadConfiguration(System.getProperty("user.dir") + "/correct-conf"); MyInstanceListener myInstanceListener = new MyInstanceListener(); EC2CloudManager cm = new EC2CloudManager(); cm.setInstanceListener(myInstanceListener); InstanceType type = cm.getInstanceTypeByName("m1.small"); assertEquals("m1.small", type.getIdentifier()); assertEquals(1, type.getNumberOfComputeUnits()); assertEquals(1, type.getNumberOfCores()); assertEquals(2048, type.getMemorySize()); assertEquals(40, type.getDiskCapacity()); assertEquals(10, type.getPricePerHour()); }