예제 #1
0
  public void testIsRootInstanceFalse() {
    URI endpoint =
        URI.create(
            "http://172.16.0.1:8776/v1/3456/instances/44b277eb-39be-4921-be31-3d61b43651d7/root");
    InstanceApi api =
        requestsSendResponses(
                keystoneAuthWithUsernameAndPasswordAndTenantName,
                responseWithKeystoneAccess,
                authenticatedGET().endpoint(endpoint).build(),
                HttpResponse.builder()
                    .statusCode(200)
                    .payload(payloadFromResource("/instance_is_rooted_false.json"))
                    .build())
            .getInstanceApi("RegionOne");

    Boolean rooted = api.isRooted("44b277eb-39be-4921-be31-3d61b43651d7");
    assertEquals(rooted.booleanValue(), false);
  }
예제 #2
0
  @Test(expectedExceptions = ResourceNotFoundException.class)
  public void testIsRootInstanceFail() {
    URI endpoint =
        URI.create(
            "http://172.16.0.1:8776/v1/3456/instances/44b277eb-39be-4921-be31-3d61b43651d7/root");
    InstanceApi api =
        requestsSendResponses(
                keystoneAuthWithUsernameAndPasswordAndTenantName,
                responseWithKeystoneAccess,
                authenticatedGET().endpoint(endpoint).build(),
                HttpResponse.builder()
                    .statusCode(404)
                    .payload(payloadFromResource("/instance_is_rooted.json"))
                    .build())
            .getInstanceApi("RegionOne");

    Boolean rooted = api.isRooted("44b277eb-39be-4921-be31-3d61b43651d7");
    assertNull(rooted);
  }