@AfterClass(groups = { "integration", "live" }) @Override protected void tearDown() { if (testAggregate != null) { assertTrue(apiOption.get().delete(testAggregate.getId())); } super.tearDown(); }
@AfterClass(groups = { "integration", "live" }) @Override protected void tearDown() { if (testAggregate != null) { assertTrue(apiOption.get().delete(testAggregate.getId())); } super.tearDown(); }
@Test(dependsOnMethods = "testCreateAggregate") public void testModifyMetadata() { if (apiOption.isPresent()) { HostAggregateApi api = apiOption.get(); for (Map<String, String> theMetaData : ImmutableSet.of( ImmutableMap.of("somekey", "somevalue"), ImmutableMap.of("somekey", "some other value", "anotherkey", "another val") )) { // Apply changes HostAggregate details = api.setMetadata(testAggregate.getId(), theMetaData); // bug in openstack - metadata values are never removed, so we just checking what we've set for (Map.Entry<String, String> entry : theMetaData.entrySet()) { assertEquals(details.getMetadata().get(entry.getKey()), entry.getValue()); } // Re-fetch to double-check details = api.get(testAggregate.getId()); for (Map.Entry<String, String> entry : theMetaData.entrySet()) { assertEquals(details.getMetadata().get(entry.getKey()), entry.getValue()); } } } }
@Test(dependsOnMethods = "testCreateAggregate") public void testModifyMetadata() { if (apiOption.isPresent()) { HostAggregateApi api = apiOption.get(); for (Map<String, String> theMetaData : ImmutableSet.of( ImmutableMap.of("somekey", "somevalue"), ImmutableMap.of("somekey", "some other value", "anotherkey", "another val") )) { // Apply changes HostAggregate details = api.setMetadata(testAggregate.getId(), theMetaData); // bug in openstack - metadata values are never removed, so we just checking what we've set for (Map.Entry<String, String> entry : theMetaData.entrySet()) { assertEquals(details.getMetadata().get(entry.getKey()), entry.getValue()); } // Re-fetch to double-check details = api.get(testAggregate.getId()); for (Map.Entry<String, String> entry : theMetaData.entrySet()) { assertEquals(details.getMetadata().get(entry.getKey()), entry.getValue()); } } } }
@Test(dependsOnMethods = "testCreateAggregate") public void testListAndGetAggregate() { if (apiOption.isPresent()) { HostAggregateApi api = apiOption.get(); Set<? extends HostAggregate> aggregates = api.list().toSet(); for (HostAggregate aggregate : aggregates) { assertNotNull(aggregate.getId()); assertNotNull(aggregate.getName()); assertNotNull(aggregate.getAvailabilityZone()); HostAggregate details = api.get(aggregate.getId()); assertEquals(details.getId(), aggregate.getId()); assertEquals(details.getName(), aggregate.getName()); assertEquals(details.getAvailabilityZone(), aggregate.getAvailabilityZone()); assertEquals(details.getHosts(), aggregate.getHosts()); } } }
@Test(dependsOnMethods = "testCreateAggregate") public void testListAndGetAggregate() { if (apiOption.isPresent()) { HostAggregateApi api = apiOption.get(); Set<? extends HostAggregate> aggregates = api.list().toSet(); for (HostAggregate aggregate : aggregates) { assertNotNull(aggregate.getId()); assertNotNull(aggregate.getName()); assertNotNull(aggregate.getAvailabilityZone()); HostAggregate details = api.get(aggregate.getId()); assertEquals(details.getId(), aggregate.getId()); assertEquals(details.getName(), aggregate.getName()); assertEquals(details.getAvailabilityZone(), aggregate.getAvailabilityZone()); assertEquals(details.getHosts(), aggregate.getHosts()); } } }
@Test(enabled = false, dependsOnMethods = "testCreateAggregate") public void testModifyHosts() { if (apiOption.isPresent() && hostAdminOption.isPresent()) { HostAggregateApi api = apiOption.get(); Host host = Iterables.getFirst(hostAdminOption.get().list(), null); assertNotNull(host); String host_id = host.getName(); assertNotNull(host_id); HostAggregate details; try { details = api.addHost(testAggregate.getId(), host_id); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // re-fetch to double-check details = api.get(testAggregate.getId()); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // TODO wait until status of aggregate isn't CHANGING (hostAdministration.shutdown?) } finally { details = api.removeHost(testAggregate.getId(), host_id); } assertEquals(details.getHosts(), ImmutableSet.of()); } } }
@Test(enabled = false, dependsOnMethods = "testCreateAggregate") public void testModifyHosts() { if (apiOption.isPresent() && hostAdminOption.isPresent()) { HostAggregateApi api = apiOption.get(); Host host = Iterables.getFirst(hostAdminOption.get().list(), null); assertNotNull(host); String host_id = host.getName(); assertNotNull(host_id); HostAggregate details; try { details = api.addHost(testAggregate.getId(), host_id); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // re-fetch to double-check details = api.get(testAggregate.getId()); assertEquals(details.getHosts(), ImmutableSet.of(host_id)); // TODO wait until status of aggregate isn't CHANGING (hostAdministration.shutdown?) } finally { details = api.removeHost(testAggregate.getId(), host_id); } assertEquals(details.getHosts(), ImmutableSet.of()); } } }
public T fromHostAggregate(HostAggregate in) { return this .id(in.getId()) .name(in.getName()) .availabilityZone(in.getAvailabilityZone()) .hosts(in.getHosts()) .state(in.getState()) .created(in.getCreated()) .updated(in.getUpdated().get()) .metadata(in.getMetadata()); } }
public T fromHostAggregate(HostAggregate in) { return this .id(in.getId()) .name(in.getName()) .availabilityZone(in.getAvailabilityZone()) .hosts(in.getHosts()) .state(in.getState()) .created(in.getCreated()) .updated(in.getUpdated().get()) .metadata(in.getMetadata()); } }
public T fromHostAggregate(HostAggregate in) { return this .id(in.getId()) .name(in.getName()) .availabilityZone(in.getAvailabilityZone()) .hosts(in.getHosts()) .state(in.getState()) .created(in.getCreated()) .updated(in.getUpdated().get()) .metadata(in.getMetadata()); } }
public T fromHostAggregate(HostAggregate in) { return this .id(in.getId()) .name(in.getName()) .availabilityZone(in.getAvailabilityZone()) .hosts(in.getHosts()) .state(in.getState()) .created(in.getCreated()) .updated(in.getUpdated().get()) .metadata(in.getMetadata()); } }
public T fromHostAggregate(HostAggregate in) { return this .id(in.getId()) .name(in.getName()) .availabilityZone(in.getAvailabilityZone()) .hosts(in.getHosts()) .state(in.getState()) .created(in.getCreated()) .updated(in.getUpdated().get()) .metadata(in.getMetadata()); } }
public T fromHostAggregate(HostAggregate in) { return this .id(in.getId()) .name(in.getName()) .availabilityZone(in.getAvailabilityZone()) .hosts(in.getHosts()) .state(in.getState()) .created(in.getCreated()) .updated(in.getUpdated().get()) .metadata(in.getMetadata()); } }