diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java index 0d08541e6d..ea9455026c 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java @@ -83,7 +83,7 @@ public class RunningInstanceToNodeMetadataTest { DateService dateService = new SimpleDateFormatDateService(); - @SuppressWarnings( { "unchecked", "rawtypes" }) + @SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testApplyWithEBSWhenBootIsInstanceStoreAndAvailabilityZoneNotFound() throws UnknownHostException { EC2Client client = createMock(EC2Client.class); @@ -92,7 +92,7 @@ public class RunningInstanceToNodeMetadataTest { Map credentialsMap = createMock(Map.class); ConcurrentMap imageMap = createMock(ConcurrentMap.class); Supplier> hardwares = Suppliers.> ofInstance(ImmutableSet - . of(EC2Hardware.M1_SMALL)); + . of(EC2Hardware.M1_SMALL)); PopulateDefaultLoginCredentialsForImageStrategy credentialProvider = createMock(PopulateDefaultLoginCredentialsForImageStrategy.class); RunningInstance instance = createMock(RunningInstance.class); Image image = createMock(Image.class); @@ -104,7 +104,7 @@ public class RunningInstanceToNodeMetadataTest { Location location = new LocationImpl(LocationScope.ZONE, "us-east-1d", "description", null); Supplier> locations = Suppliers.> ofInstance(ImmutableSet - . of(location)); + . of(location)); org.jclouds.compute.domain.Image jcImage = createMock(org.jclouds.compute.domain.Image.class); expect(instance.getIpAddress()).andReturn("174.129.1.50"); @@ -118,21 +118,24 @@ public class RunningInstanceToNodeMetadataTest { expect(imageMap.get(new RegionAndName(Region.US_EAST_1, "ami-1515f07c"))).andReturn(jcImage); expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("ami-1515f07c"))).andReturn( - (Set) ImmutableSet. of(image)); + (Set) ImmutableSet. of(image)); expect(credentialProvider.execute(image)).andReturn(new Credentials("user", "pass")); expect(credentialsMap.get(new RegionAndName(Region.US_EAST_1, "jclouds#tag#us-east-1#50"))).andReturn( - new KeyPair(Region.US_EAST_1, "jclouds#tag#us-east-1#50", "keyFingerprint", "pass")); + new KeyPair(Region.US_EAST_1, "jclouds#tag#us-east-1#50", "keyFingerprint", "pass")); expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce(); expect(instance.getInstanceType()).andReturn(InstanceType.M1_SMALL).atLeastOnce(); expect(instance.getEbsBlockDevices()).andReturn( - ImmutableMap. of("/dev/sdg", new EbsBlockDevice("vol-1f20d376", - Attachment.Status.ATTACHED, dateService.iso8601DateParse("2009-12-11T16:32:46.000Z"), false), - "/dev/sdj", new EbsBlockDevice("vol-c0eb78aa", Attachment.Status.ATTACHED, dateService - .iso8601DateParse("2010-06-17T10:43:28.000Z"), false))); + ImmutableMap. of( + "/dev/sdg", + new EbsBlockDevice("vol-1f20d376", Attachment.Status.ATTACHED, dateService + .iso8601DateParse("2009-12-11T16:32:46.000Z"), false), + "/dev/sdj", + new EbsBlockDevice("vol-c0eb78aa", Attachment.Status.ATTACHED, dateService + .iso8601DateParse("2010-06-17T10:43:28.000Z"), false))); expect(instance.getRootDeviceType()).andReturn(RootDeviceType.INSTANCE_STORE); expect(instance.getRootDeviceName()).andReturn(null).atLeastOnce(); @@ -145,7 +148,7 @@ public class RunningInstanceToNodeMetadataTest { replay(jcImage); RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(client, credentialsMap, - credentialProvider, imageMap, locations, hardwares); + credentialProvider, imageMap, locations, hardwares); NodeMetadata metadata = parser.apply(instance); @@ -157,11 +160,11 @@ public class RunningInstanceToNodeMetadataTest { assertEquals(metadata.getHardware().getProviderId(), "m1.small"); assertEquals(metadata.getHardware().getProcessors(), ImmutableList. of(new Processor(1.0, 1.0))); assertEquals(metadata.getHardware().getRam(), 1740); - assertEquals(metadata.getHardware().getVolumes(), ImmutableList. of(new VolumeImpl(null, - Volume.Type.LOCAL, 10.0f, "/dev/sda1", true, false),// - new VolumeImpl(null, Volume.Type.LOCAL, 150.0f, "/dev/sda2", false, false),// - new VolumeImpl("vol-1f20d376", Volume.Type.SAN, null, "/dev/sdg", false, true),// - new VolumeImpl("vol-c0eb78aa", Volume.Type.SAN, null, "/dev/sdj", false, true))); + assertEquals(metadata.getHardware().getVolumes(), + ImmutableList. of(new VolumeImpl(null, Volume.Type.LOCAL, 10.0f, "/dev/sda1", true, false),// + new VolumeImpl(null, Volume.Type.LOCAL, 150.0f, "/dev/sda2", false, false),// + new VolumeImpl("vol-1f20d376", Volume.Type.SAN, null, "/dev/sdg", false, true),// + new VolumeImpl("vol-c0eb78aa", Volume.Type.SAN, null, "/dev/sdj", false, true))); assertEquals(metadata.getCredentials(), new Credentials("user", "pass")); @@ -175,16 +178,16 @@ public class RunningInstanceToNodeMetadataTest { } - @SuppressWarnings( { "unchecked", "rawtypes" }) + @SuppressWarnings({ "unchecked", "rawtypes" }) @Test - public void testApplyForEucalyptusWhereNullAvailabilityZoneIpAddressNoGroups() throws UnknownHostException { + public void testApplyForNovaWhereNullAvailabilityZoneIpAddressNoGroups() throws UnknownHostException { EC2Client client = createMock(EC2Client.class); AMIClient amiClient = createMock(AMIClient.class); expect(client.getAMIServices()).andReturn(amiClient).atLeastOnce(); Map credentialsMap = createMock(Map.class); ConcurrentMap imageMap = createMock(ConcurrentMap.class); Supplier> hardwares = Suppliers.> ofInstance(ImmutableSet - . of(EC2Hardware.M1_SMALL)); + . of(EC2Hardware.M1_SMALL)); PopulateDefaultLoginCredentialsForImageStrategy credentialProvider = createMock(PopulateDefaultLoginCredentialsForImageStrategy.class); RunningInstance instance = createMock(RunningInstance.class); Image image = createMock(Image.class); @@ -196,7 +199,7 @@ public class RunningInstanceToNodeMetadataTest { Location region = new LocationImpl(LocationScope.REGION, "us-east-1", "description", null); Supplier> locations = Suppliers.> ofInstance(ImmutableSet - . of(region)); + . of(region)); org.jclouds.compute.domain.Image jcImage = createMock(org.jclouds.compute.domain.Image.class); expect(instance.getIpAddress()).andReturn(null); @@ -210,7 +213,7 @@ public class RunningInstanceToNodeMetadataTest { expect(imageMap.get(new RegionAndName(Region.US_EAST_1, "ami-1515f07c"))).andReturn(jcImage); expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("ami-1515f07c"))).andReturn( - (Set) ImmutableSet. of(image)); + (Set) ImmutableSet. of(image)); expect(credentialProvider.execute(image)).andReturn(new Credentials("user", "pass")); @@ -231,7 +234,7 @@ public class RunningInstanceToNodeMetadataTest { replay(jcImage); RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(client, credentialsMap, - credentialProvider, imageMap, locations, hardwares); + credentialProvider, imageMap, locations, hardwares); NodeMetadata metadata = parser.apply(instance); @@ -243,9 +246,9 @@ public class RunningInstanceToNodeMetadataTest { assertEquals(metadata.getHardware().getProviderId(), "m1.small"); assertEquals(metadata.getHardware().getProcessors(), ImmutableList. of(new Processor(1.0, 1.0))); assertEquals(metadata.getHardware().getRam(), 1740); - assertEquals(metadata.getHardware().getVolumes(), ImmutableList. of(new VolumeImpl(null, - Volume.Type.LOCAL, 10.0f, "/dev/sda1", true, false),// - new VolumeImpl(null, Volume.Type.LOCAL, 150.0f, "/dev/sda2", false, false))); + assertEquals(metadata.getHardware().getVolumes(), + ImmutableList. of(new VolumeImpl(null, Volume.Type.LOCAL, 10.0f, "/dev/sda1", true, false),// + new VolumeImpl(null, Volume.Type.LOCAL, 150.0f, "/dev/sda2", false, false))); assertEquals(metadata.getCredentials(), new Credentials("user", null)); @@ -259,19 +262,19 @@ public class RunningInstanceToNodeMetadataTest { } - - @SuppressWarnings( { "unchecked", "rawtypes" }) + @SuppressWarnings({ "unchecked", "rawtypes" }) @Test - public void testApplyForEucalyptusWhereImageNotFound() throws UnknownHostException { + public void testApplyWhereUnknownInstanceType() throws UnknownHostException { EC2Client client = createMock(EC2Client.class); AMIClient amiClient = createMock(AMIClient.class); expect(client.getAMIServices()).andReturn(amiClient).atLeastOnce(); Map credentialsMap = createMock(Map.class); ConcurrentMap imageMap = createMock(ConcurrentMap.class); Supplier> hardwares = Suppliers.> ofInstance(ImmutableSet - . of(EC2Hardware.M1_SMALL)); + . of(EC2Hardware.M1_SMALL)); PopulateDefaultLoginCredentialsForImageStrategy credentialProvider = createMock(PopulateDefaultLoginCredentialsForImageStrategy.class); RunningInstance instance = createMock(RunningInstance.class); + Image image = createMock(Image.class); expect(instance.getId()).andReturn("i-3d640055").atLeastOnce(); expect(instance.getGroupIds()).andReturn(ImmutableSet. of()).atLeastOnce(); @@ -280,7 +283,7 @@ public class RunningInstanceToNodeMetadataTest { Location region = new LocationImpl(LocationScope.REGION, "us-east-1", "description", null); Supplier> locations = Suppliers.> ofInstance(ImmutableSet - . of(region)); + . of(region)); org.jclouds.compute.domain.Image jcImage = createMock(org.jclouds.compute.domain.Image.class); expect(instance.getIpAddress()).andReturn(null); @@ -294,10 +297,83 @@ public class RunningInstanceToNodeMetadataTest { expect(imageMap.get(new RegionAndName(Region.US_EAST_1, "ami-1515f07c"))).andReturn(jcImage); expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("ami-1515f07c"))).andReturn( - (Set) ImmutableSet. of()); - - expect(credentialProvider.execute(null)).andReturn(new Credentials("root", null)); + (Set) ImmutableSet. of(image)); + expect(credentialProvider.execute(image)).andReturn(new Credentials("user", "pass")); + + expect(credentialsMap.get(new RegionAndName(Region.US_EAST_1, "nebulatanimislam"))).andReturn(null); + + expect(instance.getAvailabilityZone()).andReturn(null).atLeastOnce(); + + expect(instance.getInstanceType()).andReturn("hhttpp").atLeastOnce(); + + replay(imageMap); + replay(client); + replay(amiClient); + replay(credentialsMap); + replay(credentialProvider); + replay(instance); + replay(jcImage); + + RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(client, credentialsMap, + credentialProvider, imageMap, locations, hardwares); + + NodeMetadata metadata = parser.apply(instance); + + assertEquals(metadata.getTag(), "NOTAG-i-3d640055"); + assertEquals(metadata.getLocation(), region); + assertEquals(metadata.getImageId(), "us-east-1/ami-1515f07c"); + assertEquals(metadata.getHardware(), null); + + assertEquals(metadata.getCredentials(), new Credentials("user", null)); + + verify(imageMap); + verify(jcImage); + verify(client); + verify(amiClient); + verify(credentialsMap); + verify(credentialProvider); + verify(instance); + + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Test + public void testApplyForNovaWhereImageNotFound() throws UnknownHostException { + EC2Client client = createMock(EC2Client.class); + AMIClient amiClient = createMock(AMIClient.class); + expect(client.getAMIServices()).andReturn(amiClient).atLeastOnce(); + Map credentialsMap = createMock(Map.class); + ConcurrentMap imageMap = createMock(ConcurrentMap.class); + Supplier> hardwares = Suppliers.> ofInstance(ImmutableSet + . of(EC2Hardware.M1_SMALL)); + PopulateDefaultLoginCredentialsForImageStrategy credentialProvider = createMock(PopulateDefaultLoginCredentialsForImageStrategy.class); + RunningInstance instance = createMock(RunningInstance.class); + + expect(instance.getId()).andReturn("i-3d640055").atLeastOnce(); + expect(instance.getGroupIds()).andReturn(ImmutableSet. of()).atLeastOnce(); + expect(instance.getKeyName()).andReturn("nebulatanimislam").atLeastOnce(); + expect(instance.getInstanceState()).andReturn(InstanceState.RUNNING); + + Location region = new LocationImpl(LocationScope.REGION, "us-east-1", "description", null); + Supplier> locations = Suppliers.> ofInstance(ImmutableSet + . of(region)); + org.jclouds.compute.domain.Image jcImage = createMock(org.jclouds.compute.domain.Image.class); + + expect(instance.getIpAddress()).andReturn(null); + expect(instance.getPrivateIpAddress()).andReturn("10.202.117.241"); + + expect(instance.getRegion()).andReturn(Region.US_EAST_1).atLeastOnce(); + + expect(jcImage.getOperatingSystem()).andReturn(createMock(OperatingSystem.class)).atLeastOnce(); + + expect(instance.getImageId()).andReturn("ami-1515f07c").atLeastOnce(); + expect(imageMap.get(new RegionAndName(Region.US_EAST_1, "ami-1515f07c"))).andReturn(jcImage); + + expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("ami-1515f07c"))).andReturn( + (Set) ImmutableSet. of()); + + expect(credentialProvider.execute(null)).andReturn(new Credentials("root", null)); expect(credentialsMap.get(new RegionAndName(Region.US_EAST_1, "nebulatanimislam"))).andReturn(null); @@ -316,7 +392,7 @@ public class RunningInstanceToNodeMetadataTest { replay(jcImage); RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(client, credentialsMap, - credentialProvider, imageMap, locations, hardwares); + credentialProvider, imageMap, locations, hardwares); NodeMetadata metadata = parser.apply(instance); @@ -328,9 +404,9 @@ public class RunningInstanceToNodeMetadataTest { assertEquals(metadata.getHardware().getProviderId(), "m1.small"); assertEquals(metadata.getHardware().getProcessors(), ImmutableList. of(new Processor(1.0, 1.0))); assertEquals(metadata.getHardware().getRam(), 1740); - assertEquals(metadata.getHardware().getVolumes(), ImmutableList. of(new VolumeImpl(null, - Volume.Type.LOCAL, 10.0f, "/dev/sda1", true, false),// - new VolumeImpl(null, Volume.Type.LOCAL, 150.0f, "/dev/sda2", false, false))); + assertEquals(metadata.getHardware().getVolumes(), + ImmutableList. of(new VolumeImpl(null, Volume.Type.LOCAL, 10.0f, "/dev/sda1", true, false),// + new VolumeImpl(null, Volume.Type.LOCAL, 150.0f, "/dev/sda2", false, false))); assertEquals(metadata.getCredentials(), new Credentials("root", null)); @@ -357,9 +433,9 @@ public class RunningInstanceToNodeMetadataTest { Location location = new LocationImpl(LocationScope.ZONE, "us-east-1a", "description", null); Supplier> locations = Suppliers.> ofInstance(ImmutableSet - . of(location)); + . of(location)); Supplier> hardwares = Suppliers.> ofInstance(ImmutableSet - . of(EC2Hardware.M2_4XLARGE)); + . of(EC2Hardware.M2_4XLARGE)); PopulateDefaultLoginCredentialsForImageStrategy credentialProvider = createMock(PopulateDefaultLoginCredentialsForImageStrategy.class); RunningInstance instance = createMock(RunningInstance.class); @@ -389,7 +465,7 @@ public class RunningInstanceToNodeMetadataTest { replay(instance); RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(client, credentialsMap, - credentialProvider, imageMap, locations, hardwares); + credentialProvider, imageMap, locations, hardwares); NodeMetadata metadata = parser.apply(instance); assertEquals(metadata.getLocation(), locations.get().iterator().next()); @@ -418,9 +494,9 @@ public class RunningInstanceToNodeMetadataTest { Location location = new LocationImpl(LocationScope.ZONE, "us-east-1a", "description", null); Supplier> locations = Suppliers.> ofInstance(ImmutableSet - . of(location)); + . of(location)); Supplier> hardwares = Suppliers.> ofInstance(ImmutableSet - . of(EC2Hardware.M2_4XLARGE)); + . of(EC2Hardware.M2_4XLARGE)); PopulateDefaultLoginCredentialsForImageStrategy credentialProvider = createMock(PopulateDefaultLoginCredentialsForImageStrategy.class); RunningInstance instance = createMock(RunningInstance.class); @@ -438,7 +514,7 @@ public class RunningInstanceToNodeMetadataTest { expect(instance.getRegion()).andReturn("us-east-1").atLeastOnce(); expect(imageMap.get(new RegionAndName("us-east-1", "imageId"))).andThrow(new NullPointerException()) - .atLeastOnce(); + .atLeastOnce(); expect(instance.getInstanceType()).andReturn(InstanceType.C1_XLARGE).atLeastOnce(); @@ -451,7 +527,7 @@ public class RunningInstanceToNodeMetadataTest { replay(instance); RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(client, credentialsMap, - credentialProvider, imageMap, locations, hardwares); + credentialProvider, imageMap, locations, hardwares); NodeMetadata metadata = parser.apply(instance); assertEquals(metadata.getLocation(), locations.get().iterator().next()); @@ -480,9 +556,9 @@ public class RunningInstanceToNodeMetadataTest { Location location = new LocationImpl(LocationScope.ZONE, "us-east-1a", "description", null); Supplier> locations = Suppliers.> ofInstance(ImmutableSet - . of(location)); + . of(location)); Supplier> hardwares = Suppliers.> ofInstance(ImmutableSet - . of(EC2Hardware.M2_4XLARGE)); + . of(EC2Hardware.M2_4XLARGE)); PopulateDefaultLoginCredentialsForImageStrategy credentialProvider = createMock(PopulateDefaultLoginCredentialsForImageStrategy.class); RunningInstance instance = createMock(RunningInstance.class); @@ -517,7 +593,7 @@ public class RunningInstanceToNodeMetadataTest { replay(instance); RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(client, credentialsMap, - credentialProvider, imageMap, locations, hardwares); + credentialProvider, imageMap, locations, hardwares); NodeMetadata metadata = parser.apply(instance); assertEquals(metadata.getLocation(), locations.get().iterator().next()); @@ -547,9 +623,9 @@ public class RunningInstanceToNodeMetadataTest { Location location = new LocationImpl(LocationScope.ZONE, "us-east-1a", "description", null); Supplier> locations = Suppliers.> ofInstance(ImmutableSet - . of(location)); + . of(location)); Supplier> hardwares = Suppliers.> ofInstance(ImmutableSet - . of(EC2Hardware.M2_4XLARGE)); + . of(EC2Hardware.M2_4XLARGE)); PopulateDefaultLoginCredentialsForImageStrategy credentialProvider = createMock(PopulateDefaultLoginCredentialsForImageStrategy.class); RunningInstance instance = createMock(RunningInstance.class); @@ -580,7 +656,7 @@ public class RunningInstanceToNodeMetadataTest { replay(instance); RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(client, credentialsMap, - credentialProvider, imageMap, locations, hardwares); + credentialProvider, imageMap, locations, hardwares); NodeMetadata metadata = parser.apply(instance); assertEquals(metadata.getLocation(), locations.get().iterator().next()); @@ -608,9 +684,9 @@ public class RunningInstanceToNodeMetadataTest { Location location = new LocationImpl(LocationScope.ZONE, "us-east-1a", "description", null); Supplier> locations = Suppliers.> ofInstance(ImmutableSet - . of(location)); + . of(location)); Supplier> hardwares = Suppliers.> ofInstance(ImmutableSet - . of(EC2Hardware.M2_4XLARGE)); + . of(EC2Hardware.M2_4XLARGE)); PopulateDefaultLoginCredentialsForImageStrategy credentialProvider = createMock(PopulateDefaultLoginCredentialsForImageStrategy.class); RunningInstance instance = createMock(RunningInstance.class); @@ -641,7 +717,7 @@ public class RunningInstanceToNodeMetadataTest { replay(instance); RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(client, credentialsMap, - credentialProvider, imageMap, locations, hardwares); + credentialProvider, imageMap, locations, hardwares); NodeMetadata metadata = parser.apply(instance); assertEquals(metadata.getLocation(), locations.get().iterator().next()); @@ -658,7 +734,7 @@ public class RunningInstanceToNodeMetadataTest { verify(instance); } - @SuppressWarnings( { "unchecked", "rawtypes" }) + @SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testApplyWithKeyPairCreatesTagOfParsedSecurityGroupAndCredentialsBasedOnIt() throws UnknownHostException { EC2Client client = createMock(EC2Client.class); @@ -667,7 +743,7 @@ public class RunningInstanceToNodeMetadataTest { Map credentialsMap = createMock(Map.class); ConcurrentMap imageMap = createMock(ConcurrentMap.class); Supplier> hardwares = Suppliers.> ofInstance(ImmutableSet - . of(EC2Hardware.M2_4XLARGE)); + . of(EC2Hardware.M2_4XLARGE)); PopulateDefaultLoginCredentialsForImageStrategy credentialProvider = createMock(PopulateDefaultLoginCredentialsForImageStrategy.class); RunningInstance instance = createMock(RunningInstance.class); Image image = createMock(Image.class); @@ -679,7 +755,7 @@ public class RunningInstanceToNodeMetadataTest { Location location = new LocationImpl(LocationScope.ZONE, "us-east-1a", "description", null); Supplier> locations = Suppliers.> ofInstance(ImmutableSet - . of(location)); + . of(location)); org.jclouds.compute.domain.Image jcImage = createMock(org.jclouds.compute.domain.Image.class); expect(instance.getIpAddress()).andReturn("127.0.0.1"); @@ -693,12 +769,12 @@ public class RunningInstanceToNodeMetadataTest { expect(imageMap.get(new RegionAndName(Region.US_EAST_1, "imageId"))).andReturn(jcImage); expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("imageId"))).andReturn( - (Set) ImmutableSet. of(image)); + (Set) ImmutableSet. of(image)); expect(credentialProvider.execute(image)).andReturn(new Credentials("user", "pass")); expect(credentialsMap.get(new RegionAndName(Region.US_EAST_1, "jclouds#tag#us-east-1#50"))).andReturn( - new KeyPair(Region.US_EAST_1, "jclouds#tag#us-east-1#50", "keyFingerprint", "pass")); + new KeyPair(Region.US_EAST_1, "jclouds#tag#us-east-1#50", "keyFingerprint", "pass")); expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce(); @@ -713,7 +789,7 @@ public class RunningInstanceToNodeMetadataTest { replay(jcImage); RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(client, credentialsMap, - credentialProvider, imageMap, locations, hardwares); + credentialProvider, imageMap, locations, hardwares); NodeMetadata metadata = parser.apply(instance); assertEquals(metadata.getTag(), "tag"); @@ -732,7 +808,7 @@ public class RunningInstanceToNodeMetadataTest { } - @SuppressWarnings( { "unchecked", "rawtypes" }) + @SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testApplyWithTwoSecurityGroups() throws UnknownHostException { EC2Client client = createMock(EC2Client.class); @@ -741,7 +817,7 @@ public class RunningInstanceToNodeMetadataTest { Map credentialsMap = createMock(Map.class); ConcurrentMap imageMap = createMock(ConcurrentMap.class); Supplier> hardwares = Suppliers.> ofInstance(ImmutableSet - . of(EC2Hardware.M2_4XLARGE)); + . of(EC2Hardware.M2_4XLARGE)); PopulateDefaultLoginCredentialsForImageStrategy credentialProvider = createMock(PopulateDefaultLoginCredentialsForImageStrategy.class); RunningInstance instance = createMock(RunningInstance.class); Image image = createMock(Image.class); @@ -753,7 +829,7 @@ public class RunningInstanceToNodeMetadataTest { Location location = new LocationImpl(LocationScope.ZONE, "us-east-1a", "description", null); Supplier> locations = Suppliers.> ofInstance(ImmutableSet - . of(location)); + . of(location)); org.jclouds.compute.domain.Image jcImage = createMock(org.jclouds.compute.domain.Image.class); expect(instance.getIpAddress()).andReturn("127.0.0.1"); @@ -767,12 +843,12 @@ public class RunningInstanceToNodeMetadataTest { expect(imageMap.get(new RegionAndName(Region.US_EAST_1, "imageId"))).andReturn(jcImage); expect(amiClient.describeImagesInRegion(Region.US_EAST_1, imageIds("imageId"))).andReturn( - (Set) ImmutableSet. of(image)); + (Set) ImmutableSet. of(image)); expect(credentialProvider.execute(image)).andReturn(new Credentials("user", "pass")); expect(credentialsMap.get(new RegionAndName(Region.US_EAST_1, "jclouds#tag#us-east-1#50"))).andReturn( - new KeyPair(Region.US_EAST_1, "jclouds#tag#us-east-1#50", "keyFingerprint", "pass")); + new KeyPair(Region.US_EAST_1, "jclouds#tag#us-east-1#50", "keyFingerprint", "pass")); expect(instance.getAvailabilityZone()).andReturn(AvailabilityZone.US_EAST_1A).atLeastOnce(); @@ -787,7 +863,7 @@ public class RunningInstanceToNodeMetadataTest { replay(jcImage); RunningInstanceToNodeMetadata parser = new RunningInstanceToNodeMetadata(client, credentialsMap, - credentialProvider, imageMap, locations, hardwares); + credentialProvider, imageMap, locations, hardwares); NodeMetadata metadata = parser.apply(instance);