/** * 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); }
/** * 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; } }