public void testLockAndUnlock() { skipOnAdminExtensionAbsent(); ServerAdminApi api = apiOption.get(); // TODO should we be able to double-lock (as it were) assertTrue(api.unlock(testServerId)); assertTrue(api.unlock(testServerId)); assertTrue(api.lock(testServerId)); assertTrue(api.lock(testServerId)); assertTrue(api.unlock(testServerId)); assertTrue(api.unlock(testServerId)); }
public void testSuspendAndResume() { skipOnAdminExtensionAbsent(); ServerAdminApi api = apiOption.get(); // Suspend-resume try { api.resume(testServerId); fail("Resumed an active server!"); } catch (HttpResponseException e) { } assertTrue(api.suspend(testServerId)); blockUntilServerInState(testServerId, serverApi, Status.SUSPENDED); try { api.suspend(testServerId); fail("Suspended an already suspended server!"); } catch (HttpResponseException e) { } assertTrue(api.resume(testServerId)); blockUntilServerInState(testServerId, serverApi, Status.ACTIVE); try { api.resume(testServerId); fail("Resumed an already resumed server!"); } catch (HttpResponseException e) { } }
@Test public void testPauseAndUnpause() { skipOnAdminExtensionAbsent(); ServerAdminApi api = apiOption.get(); // Unlock and lock (double-checking error contitions too) try { api.unpause(testServerId); fail("Unpaused active server!"); } catch (HttpResponseException e) { } assertTrue(api.pause(testServerId)); blockUntilServerInState(testServerId, serverApi, Status.PAUSED); try { api.pause(testServerId); fail("paused a paused server!"); } catch (HttpResponseException e) { } assertTrue(api.unpause(testServerId)); blockUntilServerInState(testServerId, serverApi, Status.ACTIVE); try { api.unpause(testServerId); fail("Unpaused a server we just unpaused!"); } catch (HttpResponseException e) { } }
public void testResetNetworkAndInjectNetworkInfo() { skipOnAdminExtensionAbsent(); ServerAdminApi api = apiOption.get(); assertTrue(api.resetNetwork(testServerId)); assertTrue(api.injectNetworkInfo(testServerId)); }