public void testGetServer() { if (apiOption.isPresent()) { for (Resource server : serverApi.list().concat()) { ServerWithSecurityGroups serverWithGroups = apiOption.get().get(server.getId()); assertEquals(serverWithGroups.getId(), server.getId()); assertEquals(serverWithGroups.getName(), server.getName()); assertNotNull(serverWithGroups.getSecurityGroupNames()); } // Create a new server to verify the groups work as expected Server testServer = null; try { testServer = createServerInZone(zone); ServerWithSecurityGroups results = apiOption.get().get(testServer.getId()); assertEquals(results.getId(), testServer.getId()); assertEquals(results.getSecurityGroupNames(), ImmutableSet.of("default")); } finally { if (testServer != null) { serverApi.delete(testServer.getId()); } } } }
public void testGetServer() { if (apiOption.isPresent()) { for (Resource server : serverApi.list().concat()) { ServerWithSecurityGroups serverWithGroups = apiOption.get().get(server.getId()); assertEquals(serverWithGroups.getId(), server.getId()); assertEquals(serverWithGroups.getName(), server.getName()); assertNotNull(serverWithGroups.getSecurityGroupNames()); } // Create a new server to verify the groups work as expected Server testServer = null; try { testServer = createServerInRegion(region); ServerWithSecurityGroups results = apiOption.get().get(testServer.getId()); assertEquals(results.getId(), testServer.getId()); assertEquals(results.getSecurityGroupNames(), ImmutableSet.of("default")); } finally { if (testServer != null) { serverApi.delete(testServer.getId()); } } } }