コード例 #1
0
  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));
  }
コード例 #2
0
  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) {
    }
  }
コード例 #3
0
  @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) {
    }
  }
コード例 #4
0
 public void testResetNetworkAndInjectNetworkInfo() {
   skipOnAdminExtensionAbsent();
   ServerAdminApi api = apiOption.get();
   assertTrue(api.resetNetwork(testServerId));
   assertTrue(api.injectNetworkInfo(testServerId));
 }