Ec2Service { public void launchCluster(String groupName, int numOfSlaves) throws IOException { Ec2Instance master = launchMaster(groupName); Ec2Instance[] nodes = launchNodes(groupName, numOfSlaves); postLaunch(master, nodes); } Ec2Service(String awsAccountId, String accessKeyId, String secretAccessKey, String aim, String keyName,
          String keyPath); Set<String> list(); void launchCluster(String groupName, int numOfSlaves); void terminiateCluster(String cluster);  }
@Test public void testLaunchCluster() throws Exception { if (Ec2ServiceTest.class.getResource("/katta.ec2.properties") == null) { System.err.println("Ec2ServiceTest did not run since property file is missing"); return; } Ec2Configuration ec2Config = new Ec2Configuration(); String awsAccountId = ec2Config.getAccountId(); String aWSAccessKeyId = ec2Config.getAccessKey(); String secretAccessKey = ec2Config.getSecretAccessKey(); String keyName = ec2Config.getKeyName(); String keyPath = ec2Config.getKeyPath(); String aim = ec2Config.getAim(); DummyEc2Service hadoop = new DummyEc2Service(awsAccountId, aWSAccessKeyId, secretAccessKey, aim, keyName, keyPath); String cluster = "kattaTestCluster" + System.currentTimeMillis(); int numOfSlaves = 1; hadoop.launchCluster(cluster, numOfSlaves); Set<String> clusters = hadoop.list(); Assert.assertTrue(clusters.contains(cluster)); for (String clusterName : clusters) { hadoop.terminiateCluster(clusterName); } }