コード例 #1
0
  /**
   * Tests icat admin on valid Dataset for update keyword
   *
   * <p>MANAGE_USERS - Y
   */
  @Test
  public void testIcatAdminManageUsersOnDataset() throws ICATAPIException {
    log.info(
        "Testing  user: "******" for ManageUsers on Dataset Id: "
            + VALID_INVESTIGATION_ID_FOR_GATEKEEPER_TEST);

    Dataset dataset = getDataset(true);

    GateKeeper.performAuthorisation(ICAT_ADMIN_USER, dataset, AccessType.MANAGE_USERS, em);
    // no exception
    assertTrue("This should be true", true);
  }
コード例 #2
0
  /**
   * Tests icat admin on valid Dataset for delete
   *
   * <p>ACTION_DELETE - Y (But no on SET_FA = 'Y')
   */
  @Test
  public void testIcatAdminDeleteOnDatasetNotFA() throws ICATAPIException {
    log.info(
        "Testing  user: "******" for deleting Dataset not FA Id: "
            + VALID_DATASET_ID_FOR_INVESTIGATION_FOR_NOT_FACILITY_ACQURED);

    Dataset Dataset = getDatasetNotFA_Acquired();

    GateKeeper.performAuthorisation(ICAT_ADMIN_USER, Dataset, AccessType.DELETE, em);

    // no exception
    assertTrue("This should be true", true);
  }
コード例 #3
0
  /**
   * Tests icat admin on valid Dataset for download
   *
   * <p>ACTION_DOWNLOAD - Y
   */
  @Test
  public void testIcatAdminDownloadOnDataset() throws ICATAPIException {
    log.info(
        "Testing  user: "******" for download Dataset Id: "
            + VALID_INVESTIGATION_ID_FOR_GATEKEEPER_TEST);

    Dataset Dataset = getDataset(true);

    GateKeeper.performAuthorisation(ICAT_ADMIN_USER, Dataset, AccessType.DOWNLOAD, em);

    // no exception
    assertTrue("This should be true", true);
  }
コード例 #4
0
  /**
   * Tests icat admin on valid Dataset for update keyword
   *
   * <p>ACTION_UPDATE - Y
   */
  @Test
  public void testIcatAdminUpdateDatasetParameterOnDataset() throws ICATAPIException {
    log.info(
        "Testing  user: "******" for update DatasetParameter on Dataset Id: "
            + VALID_INVESTIGATION_ID_FOR_GATEKEEPER_TEST);

    Dataset dataset = getDataset(true);
    DatasetParameter dsp = new DatasetParameter();
    dsp.setDataset(dataset);

    GateKeeper.performAuthorisation(ICAT_ADMIN_USER, dsp, AccessType.UPDATE, em);

    // no exception
    assertTrue("This should be true", true);
  }
コード例 #5
0
  /**
   * Tests icat admin on valid Dataset for insert (cos Dataset this test insert root)
   *
   * <p>ACTION_ROOT_INSERT - Y (set null in inv_id for ICAT_ICAT_ADMIN_USER)
   */
  @Test
  public void testIcatAdminDatasetInsertOnDataset() throws ICATAPIException {
    log.info(
        "Testing  user: "******" for insert on Dataset Id: "
            + VALID_INVESTIGATION_ID_FOR_GATEKEEPER_TEST);

    Investigation investigation = getInvestigation(true);
    Dataset dataset = getDataset(false);
    dataset.setInvestigation(investigation);

    GateKeeper.performAuthorisation(ICAT_ADMIN_USER, dataset, AccessType.CREATE, em);

    // no exception
    assertTrue("This should be true", true);
  }
コード例 #6
0
  /**
   * Tests icat admin on valid Dataset for delete
   *
   * <p>ACTION_DELETE - N (But no on SET_FA = 'Y')
   */
  @Test(expected = InsufficientPrivilegesException.class)
  public void testIcatAdminDeleteOnDataset() throws ICATAPIException {
    log.info(
        "Testing  user: "******" for deleting Dataset is FA Id: "
            + VALID_INVESTIGATION_ID_FOR_GATEKEEPER_TEST);

    Dataset Dataset = getDataset(true);

    try {
      GateKeeper.performAuthorisation(ICAT_ADMIN_USER, Dataset, AccessType.DELETE, em);
    } catch (InsufficientPrivilegesException ex) {
      log.warn("caught: " + ex.getClass() + " " + ex.getMessage());
      assertTrue(
          "Exception must contain 'does not have permission'",
          ex.getMessage().contains("does not have permission"));
      throw ex;
    }
  }
コード例 #7
0
  /**
   * Tests icat admin on valid Dataset for update keyword
   *
   * <p>ACTION_REMOVE - N
   */
  @Test(expected = InsufficientPrivilegesException.class)
  public void testIcatAdminRemoveDatasetParameterOnDataset() throws ICATAPIException {
    log.info(
        "Testing  user: "******" for remove DatasetParameter on Dataset Id: "
            + VALID_INVESTIGATION_ID_FOR_GATEKEEPER_TEST);

    Dataset dataset = getDataset(true);
    DatasetParameter dsp = new DatasetParameter();
    dsp.setDataset(dataset);

    try {
      GateKeeper.performAuthorisation(ICAT_ADMIN_USER, dsp, AccessType.REMOVE, em);
    } catch (InsufficientPrivilegesException ex) {
      log.warn("caught: " + ex.getClass() + " " + ex.getMessage());
      assertTrue(
          "Exception must contain 'does not have permission'",
          ex.getMessage().contains("does not have permission"));
      throw ex;
    }
  }