public void testGetSlicesDetail() throws Exception { Set<Slice> response = client.listSlices(); assert null != response; long sliceCount = response.size(); assertTrue(sliceCount >= 0); for (Slice slice : response) { Slice newDetails = client.getSlice(slice.getId()); assertEquals(slice, newDetails); } }
@Test(enabled = true) public void testCreateSlice() throws Exception { int imageId = 14362; int flavorId = 1; Slice slice = null; while (slice == null) { String sliceName = slicePrefix + "createslice" + new SecureRandom().nextInt(); try { slice = client.createSlice(sliceName, imageId, flavorId); } catch (UndeclaredThrowableException e) { HttpResponseException htpe = (HttpResponseException) e.getCause().getCause(); if (htpe.getResponse().getStatusCode() == 400) continue; throw e; } } assertNotNull(slice.getRootPassword()); sliceId = slice.getId(); rootPassword = slice.getRootPassword(); assertEquals(slice.getStatus(), Slice.Status.BUILD); blockUntilSliceActive(sliceId); }