public void testEBS() throws UnknownHostException { Set<Reservation<RunningInstance>> contents = ImmutableSet.of(new Reservation<RunningInstance>(defaultRegion, ImmutableSet.of("adriancole.ec2ebsingress"), ImmutableSet.of(RunningInstance.builder().region( defaultRegion).groupName("adriancole.ec2ebsingress").amiLaunchIndex("0").dnsName( "ec2-75-101-203-146.compute-1.amazonaws.com").imageId("ami-849875ed").instanceId("i-e564438d") .instanceState(InstanceState.RUNNING).rawState("running").instanceType(InstanceType.M1_SMALL) .ipAddress("75.101.203.146").kernelId("aki-a71cf9ce") .keyName("adriancole.ec2ebs1") .launchTime(dateService.iso8601DateOrSecondsDateParse("2009-12-30T04:06:23.000Z")) // MonitoringState.DISABLED .availabilityZone("us-east-1b") // "placement" .virtualizationType("hvm").privateDnsName("domU-12-31-39-09-CE-53.compute-1.internal") .privateIpAddress("10.210.209.157").ramdiskId("ari-a51cf9cc") .rootDeviceType(RootDeviceType.EBS).rootDeviceName("/dev/sda1").device( "/dev/sda1", new BlockDevice("vol-dc6ca8b5", Attachment.Status.ATTACHED, dateService .iso8601DateOrSecondsDateParse("2009-12-30T04:06:29.000Z"), true)).build()), "993194456877", null, "r-596dd731")); Set<Reservation<? extends RunningInstance>> result = parseRunningInstances("/describe_instances_ebs.xml"); assertEquals(result.toString(), contents.toString()); assertEquals(get(get(result, 0), 0).getInstanceState(), InstanceState.RUNNING); assertEquals(get(get(result, 0), 0).getRawState(), "running"); }
reservationId = currentOrNull(currentText); } else if (equalsOrSuffix(qName, "amiLaunchIndex")) { builder.amiLaunchIndex(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "dnsName")) { builder.dnsName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "imageId")) { builder.imageId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "instanceId")) { builder.instanceId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "name")) { String rawState = currentOrNull(currentText); if (rawState != null) { builder.rawState(rawState); builder.instanceState(InstanceState.fromValue(rawState)); builder.instanceType(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "ipAddress")) { builder.ipAddress(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "kernelId")) { builder.kernelId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "keyName")) { builder.keyName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "launchTime")) { builder.launchTime(dateService.iso8601DateOrSecondsDateParse(currentOrNull(currentText))); } else if (equalsOrSuffix(qName, "availabilityZone")) { builder.availabilityZone(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "virtualizationType")) { builder.virtualizationType(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "platform")) {
reservationId = currentOrNull(currentText); } else if (equalsOrSuffix(qName, "amiLaunchIndex")) { builder.amiLaunchIndex(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "dnsName")) { builder.dnsName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "imageId")) { builder.imageId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "instanceId")) { builder.instanceId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "name")) { String rawState = currentOrNull(currentText); if (rawState != null) { builder.rawState(rawState); builder.instanceState(InstanceState.fromValue(rawState)); builder.instanceType(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "ipAddress")) { builder.ipAddress(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "kernelId")) { builder.kernelId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "keyName")) { builder.keyName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "launchTime")) { builder.launchTime(dateCodec.toDate(currentOrNull(currentText))); } else if (equalsOrSuffix(qName, "availabilityZone")) { builder.availabilityZone(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "virtualizationType")) { builder.virtualizationType(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "platform")) {
reservationId = currentOrNull(currentText); } else if (equalsOrSuffix(qName, "amiLaunchIndex")) { builder.amiLaunchIndex(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "dnsName")) { builder.dnsName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "imageId")) { builder.imageId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "instanceId")) { builder.instanceId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "name")) { String rawState = currentOrNull(currentText); if (rawState != null) { builder.rawState(rawState); builder.instanceState(InstanceState.fromValue(rawState)); builder.instanceType(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "ipAddress")) { builder.ipAddress(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "kernelId")) { builder.kernelId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "keyName")) { builder.keyName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "launchTime")) { builder.launchTime(dateService.iso8601DateOrSecondsDateParse(currentOrNull(currentText))); } else if (equalsOrSuffix(qName, "availabilityZone")) { builder.availabilityZone(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "virtualizationType")) { builder.virtualizationType(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "platform")) {
reservationId = currentOrNull(currentText); } else if (equalsOrSuffix(qName, "amiLaunchIndex")) { builder.amiLaunchIndex(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "dnsName")) { builder.dnsName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "imageId")) { builder.imageId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "instanceId")) { builder.instanceId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "name")) { String rawState = currentOrNull(currentText); if (rawState != null) { builder.rawState(rawState); builder.instanceState(InstanceState.fromValue(rawState)); builder.instanceType(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "ipAddress")) { builder.ipAddress(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "kernelId")) { builder.kernelId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "keyName")) { builder.keyName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "launchTime")) { builder.launchTime(dateCodec.toDate(currentOrNull(currentText))); } else if (equalsOrSuffix(qName, "availabilityZone")) { builder.availabilityZone(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "virtualizationType")) { builder.virtualizationType(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "platform")) {
reservationId = currentOrNull(currentText); } else if (equalsOrSuffix(qName, "amiLaunchIndex")) { builder.amiLaunchIndex(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "dnsName")) { builder.dnsName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "imageId")) { builder.imageId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "instanceId")) { builder.instanceId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "name")) { String rawState = currentOrNull(currentText); if (rawState != null) { builder.rawState(rawState); builder.instanceState(InstanceState.fromValue(rawState)); builder.instanceType(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "ipAddress")) { builder.ipAddress(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "kernelId")) { builder.kernelId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "keyName")) { builder.keyName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "launchTime")) { builder.launchTime(dateService.iso8601DateOrSecondsDateParse(currentOrNull(currentText))); } else if (equalsOrSuffix(qName, "availabilityZone")) { builder.availabilityZone(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "virtualizationType")) { builder.virtualizationType(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "platform")) {
public void testApplyInputStream() { Set<Reservation<RunningInstance>> contents = ImmutableSet.of(new Reservation<RunningInstance>(defaultRegion, ImmutableSet.of("default"), ImmutableSet.of(RunningInstance.builder().region(defaultRegion).groupName( "default").amiLaunchIndex("23").dnsName("ec2-72-44-33-4.compute-1.amazonaws.com").imageId( "ami-6ea54007").instanceId("i-28a64341").instanceState(InstanceState.RUNNING).rawState( "running").instanceType(InstanceType.M1_LARGE).kernelId("aki-ba3adfd3").keyName( "example-key-name").launchTime(dateService.iso8601DateOrSecondsDateParse("2007-08-07T11:54:42.000Z")) // MonitoringState.DISABLED, .availabilityZone("us-east-1b").virtualizationType("paravirtual").privateDnsName( "10-251-50-132.ec2.internal")// product codes // ImmutableSet.of("774F4FF8") .tags(ImmutableMap.of("Name", "ec2-o", "Empty", "")) .ramdiskId("ari-badbad00").rootDeviceType(RootDeviceType.INSTANCE_STORE).build(), RunningInstance.builder().region(defaultRegion).groupName("default").amiLaunchIndex("23") .dnsName("ec2-72-44-33-6.compute-1.amazonaws.com").imageId("ami-6ea54007").instanceId( "i-28a64435").instanceState(InstanceState.RUNNING).rawState("running") .instanceType(InstanceType.M1_LARGE).kernelId("aki-ba3adfd3").keyName( "example-key-name").launchTime( dateService.iso8601DateOrSecondsDateParse("2007-08-07T11:54:42.000Z")) // MonitoringState.DISABLED, .availabilityZone("us-east-1b").virtualizationType("paravirtual").privateDnsName( "10-251-50-134.ec2.internal")// product codes // ImmutableSet.of("774F4FF8") .ramdiskId("ari-badbad00").rootDeviceType(RootDeviceType.INSTANCE_STORE).build()), "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM", null, "r-44a5402d")); Set<Reservation<? extends RunningInstance>> result = parseRunningInstances("/describe_instances.xml"); assertEquals(result.toString(), contents.toString()); assertEquals(get(get(result, 0), 0).getInstanceState(), InstanceState.RUNNING); assertEquals(get(get(result, 0), 0).getRawState(), "running"); }
public void testEC2() { InputStream is = getClass().getResourceAsStream("/run_instances.xml"); Reservation<? extends RunningInstance> expected = new Reservation<RunningInstance>(defaultRegion, ImmutableSet .of("default"), ImmutableSet.of( RunningInstance.builder().region(defaultRegion).groupName("default").amiLaunchIndex("0") .imageId("ami-60a54009").instanceId("i-2ba64342").instanceState(InstanceState.PENDING).rawState( "pending").instanceType(InstanceType.M1_SMALL).keyName("example-key-name").launchTime( dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))// MonitoringState.ENABLED, .availabilityZone("us-east-1b").build(), RunningInstance.builder().region(defaultRegion).groupName("default").amiLaunchIndex("1") .imageId("ami-60a54009").instanceId("i-2bc64242").instanceState(InstanceState.PENDING).rawState( "pending").instanceType(InstanceType.M1_SMALL).keyName("example-key-name").launchTime( dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))// MonitoringState.ENABLED, .availabilityZone("us-east-1b").build(), RunningInstance.builder().region(defaultRegion).groupName("default").amiLaunchIndex("2") .imageId("ami-60a54009").instanceId("i-2be64332").instanceState(InstanceState.PENDING).rawState( "pending").instanceType(InstanceType.M1_SMALL).keyName("example-key-name").launchTime( dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))// MonitoringState.ENABLED, .availabilityZone("us-east-1b").build()) , "AIDADH4IGTRXXKCD", null, "r-47a5402e"); RunInstancesResponseHandler handler = injector.getInstance(RunInstancesResponseHandler.class); addDefaultRegionToHandler(handler); Reservation<? extends RunningInstance> result = factory.create(handler).parse(is); assertEquals(result.toString(), expected.toString()); }
public void testApplyInputStream() { Set<Reservation<RunningInstance>> contents = ImmutableSet.of(new Reservation<RunningInstance>(defaultRegion, ImmutableSet.of("default"), ImmutableSet.of(RunningInstance.builder().region(defaultRegion).groupName( "default").amiLaunchIndex("23").dnsName("ec2-72-44-33-4.compute-1.amazonaws.com").imageId( "ami-6ea54007").instanceId("i-28a64341").instanceState(InstanceState.RUNNING).rawState( "running").instanceType(InstanceType.M1_LARGE).kernelId("aki-ba3adfd3").keyName( "example-key-name").launchTime(dateService.iso8601DateParse("2007-08-07T11:54:42.000Z")) // MonitoringState.DISABLED, .availabilityZone("us-east-1b").virtualizationType("paravirtual").privateDnsName( "10-251-50-132.ec2.internal")// product codes // ImmutableSet.of("774F4FF8") .tags(ImmutableMap.of("Name","ec2-o", "Empty","")) .ramdiskId("ari-badbad00").rootDeviceType(RootDeviceType.INSTANCE_STORE).build(), RunningInstance.builder().region(defaultRegion).groupName("default").amiLaunchIndex("23") .dnsName("ec2-72-44-33-6.compute-1.amazonaws.com").imageId("ami-6ea54007").instanceId( "i-28a64435").instanceState(InstanceState.RUNNING).rawState("running") .instanceType(InstanceType.M1_LARGE).kernelId("aki-ba3adfd3").keyName( "example-key-name").launchTime( dateService.iso8601DateParse("2007-08-07T11:54:42.000Z")) // MonitoringState.DISABLED, .availabilityZone("us-east-1b").virtualizationType("paravirtual").privateDnsName( "10-251-50-134.ec2.internal")// product codes // ImmutableSet.of("774F4FF8") .ramdiskId("ari-badbad00").rootDeviceType(RootDeviceType.INSTANCE_STORE).build()), "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM", null, "r-44a5402d")); Set<Reservation<? extends RunningInstance>> result = parseRunningInstances("/describe_instances.xml"); assertEquals(result.toString(), contents.toString()); assertEquals(get(get(result, 0), 0).getInstanceState(), InstanceState.RUNNING); assertEquals(get(get(result, 0), 0).getRawState(), "running"); }
public void testEC2() { InputStream is = getClass().getResourceAsStream("/run_instances.xml"); Reservation<? extends RunningInstance> expected = new Reservation<RunningInstance>(defaultRegion, ImmutableSet .of("default"), ImmutableSet.of( RunningInstance.builder().region(defaultRegion).groupName("default").amiLaunchIndex("0") .imageId("ami-60a54009").instanceId("i-2ba64342").instanceState(InstanceState.PENDING).rawState( "pending").instanceType(InstanceType.M1_SMALL).keyName("example-key-name").launchTime( dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))// MonitoringState.ENABLED, .availabilityZone("us-east-1b").build(), RunningInstance.builder().region(defaultRegion).groupName("default").amiLaunchIndex("1") .imageId("ami-60a54009").instanceId("i-2bc64242").instanceState(InstanceState.PENDING).rawState( "pending").instanceType(InstanceType.M1_SMALL).keyName("example-key-name").launchTime( dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))// MonitoringState.ENABLED, .availabilityZone("us-east-1b").build(), RunningInstance.builder().region(defaultRegion).groupName("default").amiLaunchIndex("2") .imageId("ami-60a54009").instanceId("i-2be64332").instanceState(InstanceState.PENDING).rawState( "pending").instanceType(InstanceType.M1_SMALL).keyName("example-key-name").launchTime( dateService.iso8601DateParse("2007-08-07T11:51:50.000Z"))// MonitoringState.ENABLED, .availabilityZone("us-east-1b").build()) , "AIDADH4IGTRXXKCD", null, "r-47a5402e"); RunInstancesResponseHandler handler = injector.getInstance(RunInstancesResponseHandler.class); addDefaultRegionToHandler(handler); Reservation<? extends RunningInstance> result = factory.create(handler).parse(is); assertEquals(result.toString(), expected.toString()); }
public void testEBS() throws UnknownHostException { Set<Reservation<RunningInstance>> contents = ImmutableSet.of(new Reservation<RunningInstance>(defaultRegion, ImmutableSet.of("adriancole.ec2ebsingress"), ImmutableSet.of(RunningInstance.builder().region( defaultRegion).groupName("adriancole.ec2ebsingress").amiLaunchIndex("0").dnsName( "ec2-75-101-203-146.compute-1.amazonaws.com").imageId("ami-849875ed").instanceId("i-e564438d") .instanceState(InstanceState.RUNNING).rawState("running").instanceType(InstanceType.M1_SMALL) .ipAddress("75.101.203.146").kernelId("aki-a71cf9ce") .keyName("adriancole.ec2ebs1") .launchTime(dateService.iso8601DateParse("2009-12-30T04:06:23.000Z")) // MonitoringState.DISABLED .availabilityZone("us-east-1b") // "placement" .virtualizationType("hvm").privateDnsName("domU-12-31-39-09-CE-53.compute-1.internal") .privateIpAddress("10.210.209.157").ramdiskId("ari-a51cf9cc") .rootDeviceType(RootDeviceType.EBS).rootDeviceName("/dev/sda1").device( "/dev/sda1", new BlockDevice("vol-dc6ca8b5", Attachment.Status.ATTACHED, dateService .iso8601DateParse("2009-12-30T04:06:29.000Z"), true)).build()), "993194456877", null, "r-596dd731")); Set<Reservation<? extends RunningInstance>> result = parseRunningInstances("/describe_instances_ebs.xml"); assertEquals(result.toString(), contents.toString()); assertEquals(get(get(result, 0), 0).getInstanceState(), InstanceState.RUNNING); assertEquals(get(get(result, 0), 0).getRawState(), "running"); }
public void testWhenRunning() throws UnknownHostException { Set<Reservation<RunningInstance>> contents = ImmutableSet.of(new Reservation<RunningInstance>(defaultRegion, ImmutableSet.of("adriancole.ec2ingress"), ImmutableSet.of(RunningInstance.builder().region( defaultRegion).groupName("adriancole.ec2ingress").amiLaunchIndex("0").dnsName( "ec2-174-129-81-68.compute-1.amazonaws.com").imageId("ami-82e4b5c7").instanceId("i-0799056f") .instanceState(InstanceState.RUNNING).rawState("running").instanceType(InstanceType.M1_SMALL) .ipAddress("174.129.81.68").kernelId("aki-a71cf9ce").keyName("adriancole.ec21").launchTime( dateService.iso8601DateOrSecondsDateParse("2009-11-09T03:00:34.000Z")) // MonitoringState.DISABLED, .availabilityZone("us-east-1c").virtualizationType("paravirtual").privateDnsName( "ip-10-243-42-70.ec2.internal").privateIpAddress("10.243.42.70").ramdiskId( "ari-a51cf9cc").rootDeviceType(RootDeviceType.INSTANCE_STORE).build()), "993194456877", null, "r-a3c508cb")); Set<Reservation<? extends RunningInstance>> result = parseRunningInstances("/describe_instances_running.xml"); assertEquals(result.toString(), contents.toString()); assertEquals(get(get(result, 0), 0).getInstanceState(), InstanceState.RUNNING); assertEquals(get(get(result, 0), 0).getRawState(), "running"); }
public void testWhenRunningAndSecondsDate() throws UnknownHostException { Set<Reservation<RunningInstance>> contents = ImmutableSet.of(new Reservation<RunningInstance>(defaultRegion, ImmutableSet.of("adriancole.ec2ingress"), ImmutableSet.of(RunningInstance.builder().region( defaultRegion).groupName("adriancole.ec2ingress").amiLaunchIndex("0").dnsName( "ec2-174-129-81-68.compute-1.amazonaws.com").imageId("ami-82e4b5c7").instanceId("i-0799056f") .instanceState(InstanceState.RUNNING).rawState("running").instanceType(InstanceType.M1_SMALL) .ipAddress("174.129.81.68").kernelId("aki-a71cf9ce").keyName("adriancole.ec21").launchTime( dateService.iso8601DateOrSecondsDateParse("2009-11-09T03:00:34+0000")) // MonitoringState.DISABLED, .availabilityZone("us-east-1c").virtualizationType("paravirtual").privateDnsName( "ip-10-243-42-70.ec2.internal").privateIpAddress("10.243.42.70").ramdiskId( "ari-a51cf9cc").rootDeviceType(RootDeviceType.INSTANCE_STORE).build()), "993194456877", null, "r-a3c508cb")); Set<Reservation<? extends RunningInstance>> result = parseRunningInstances("/describe_instances_running.xml"); assertEquals(result.toString(), contents.toString()); assertEquals(get(get(result, 0), 0).getInstanceState(), InstanceState.RUNNING); assertEquals(get(get(result, 0), 0).getRawState(), "running"); }
public void testCloudBridge() { InputStream is = getClass().getResourceAsStream("/run_instances_cloudbridge.xml"); Reservation<? extends RunningInstance> expected = new Reservation<RunningInstance>(defaultRegion, ImmutableSet .of("jclouds#greenqloud-computeblock"), ImmutableSet.of( RunningInstance.builder().region(defaultRegion).groupName("jclouds#greenqloud-computeblock").amiLaunchIndex("0") .imageId("qmi-9ac92558").instanceId("i-01b0dac3").instanceState(InstanceState.PENDING).rawState( "pending").instanceType(InstanceType.M1_SMALL).keyName("jclouds#greenqloud-computeblock#35") .launchTime(dateService.iso8601DateParse("2012-06-15T19:06:35.000+00:00")) .rootDeviceType(RootDeviceType.EBS).availabilityZone("is-1a").build()) , "56eeacd9-c790-45c3-85f3-e4380b55e1d8<", null, "r-f847a6ca"); RunInstancesResponseHandler handler = injector.getInstance(RunInstancesResponseHandler.class); addDefaultRegionToHandler(handler); Reservation<? extends RunningInstance> result = factory.create(handler).parse(is); assertEquals(result.toString(), expected.toString()); }
public void testWhenRunning() throws UnknownHostException { Set<Reservation<RunningInstance>> contents = ImmutableSet.of(new Reservation<RunningInstance>(defaultRegion, ImmutableSet.of("adriancole.ec2ingress"), ImmutableSet.of(RunningInstance.builder().region( defaultRegion).groupName("adriancole.ec2ingress").amiLaunchIndex("0").dnsName( "ec2-174-129-81-68.compute-1.amazonaws.com").imageId("ami-82e4b5c7").instanceId("i-0799056f") .instanceState(InstanceState.RUNNING).rawState("running").instanceType(InstanceType.M1_SMALL) .ipAddress("174.129.81.68").kernelId("aki-a71cf9ce").keyName("adriancole.ec21").launchTime( dateService.iso8601DateParse("2009-11-09T03:00:34.000Z")) // MonitoringState.DISABLED, .availabilityZone("us-east-1c").virtualizationType("paravirtual").privateDnsName( "ip-10-243-42-70.ec2.internal").privateIpAddress("10.243.42.70").ramdiskId( "ari-a51cf9cc").rootDeviceType(RootDeviceType.INSTANCE_STORE).build()), "993194456877", null, "r-a3c508cb")); Set<Reservation<? extends RunningInstance>> result = parseRunningInstances("/describe_instances_running.xml"); assertEquals(result.toString(), contents.toString()); assertEquals(get(get(result, 0), 0).getInstanceState(), InstanceState.RUNNING); assertEquals(get(get(result, 0), 0).getRawState(), "running"); }
protected void inItem() { if (endOfInstanceItem()) { refineBuilderBeforeAddingInstance(); instances.add(builder.build()); builder = newBuilder(); } }
public void testCloudBridge() { InputStream is = getClass().getResourceAsStream("/run_instances_cloudbridge.xml"); Reservation<? extends RunningInstance> expected = new Reservation<RunningInstance>(defaultRegion, ImmutableSet .of("jclouds#greenqloud-computeblock"), ImmutableSet.of( RunningInstance.builder().region(defaultRegion).groupName("jclouds#greenqloud-computeblock").amiLaunchIndex("0") .imageId("qmi-9ac92558").instanceId("i-01b0dac3").instanceState(InstanceState.PENDING).rawState( "pending").instanceType(InstanceType.M1_SMALL).keyName("jclouds#greenqloud-computeblock#35") .launchTime(dateService.iso8601DateParse("2012-06-15T19:06:35.000+00:00")) .rootDeviceType(RootDeviceType.EBS).availabilityZone("is-1a").build()) , "56eeacd9-c790-45c3-85f3-e4380b55e1d8<", null, "r-f847a6ca"); RunInstancesResponseHandler handler = injector.getInstance(RunInstancesResponseHandler.class); addDefaultRegionToHandler(handler); Reservation<? extends RunningInstance> result = factory.create(handler).parse(is); assertEquals(result.toString(), expected.toString()); }
protected void inItem() { if (endOfInstanceItem()) { refineBuilderBeforeAddingInstance(); instances.add(builder.build()); builder = newBuilder(); } }
@Test public void testGroupNameIsSetWhenCustomKeyNameIsSetAndSecurityGroupIsGenerated() { checkGroupName(RunningInstance.builder().instanceId("id").imageId("image").instanceType("m1.small") .instanceState(InstanceState.RUNNING).rawState("running").region("us-east-1").keyName("custom-key") .groupName("jclouds#groupname").build()); }
@Test public void testPublicIpAddressIncorrectlyInPrivateAddressFieldGoesToPublicAddressCollection() { RunningInstance instance = RunningInstance.builder().instanceId("id").imageId("image").instanceType("m1.small") .instanceState(InstanceState.RUNNING).rawState("running").region("us-east-1").privateIpAddress("1.1.1.1").build(); RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of()); assertEquals(parser.apply(instance).toString(), new NodeMetadataBuilder().status(Status.RUNNING).backendStatus("running").privateAddresses( ImmutableSet.<String> of()).publicAddresses(ImmutableSet.of("1.1.1.1")).id("us-east-1/id").imageId( "us-east-1/image").providerId("id").build().toString()); }