コード例 #1
0
  private void checkPermission(
      List<ClientPermission> permissions, String permission, int expectedValue) {
    for (ClientPermission clientPermission : permissions) {

      if (clientPermission.getId().equals(permission)) {
        Assert.assertEquals(expectedValue, clientPermission.getValue());
        return;
      }
    }
    Assert.fail("Did not find permission: " + permissions);
  }
コード例 #2
0
  @Test
  public void testAdminPrivileges() throws Exception {
    TestContainer.getInstance().getTestContext().useAdminForRequests();

    List<ClientPermission> permissions = this.getPermissions();

    Assert.assertEquals(this.getExpectedPrivilegeCount(), permissions.size());

    for (ClientPermission clientPermission : permissions) {
      Assert.assertEquals(15, clientPermission.getValue());
    }
  }
コード例 #3
0
  @Test
  public void testSecurityDisabledStatus() throws Exception {

    NexusStatusUtil statusUtil = getNexusStatusUtil();
    StatusResource statusResource = statusUtil.getNexusStatus(true).getData();

    List<ClientPermission> permisisons = statusResource.getClientPermissions().getPermissions();

    Assert.assertTrue(
        "Permissions are empty, expected a whole bunch, not zero.", permisisons.size() > 0);
    for (ClientPermission clientPermission : permisisons) {
      Assert.assertEquals(
          "Permission '"
              + clientPermission.getId()
              + "' should have had a value of '15', the value was"
              + clientPermission.getValue(),
          clientPermission.getValue(),
          15);
    }
    // that is it, just checking the values, when security is disabled, access is WIDE open.
  }