/** Testing entity listing for patterns that match and validating the output for the same. */ @Test(dataProvider = "getPattern") public void listEntitiesWithPattern(AbstractEntityHelper helper, String patternParam) throws AuthenticationException, IOException, URISyntaxException, InterruptedException { EntityElement[] entities = helper.listAllEntities("nameseq=" + patternParam, null).getEntityList().getElements(); LOGGER.info(helper.getEntityType() + " entities: " + Arrays.toString(entities)); validateOutputPatternList( helper.listAllEntities().getEntityList().getElements(), entities, patternParam); }
/** * Test feed acl modification. * * @throws Exception */ @Test(dataProvider = "generateAclOwnerAndGroup") public void feedAclUpdate(final String newOwner, final String newGroup) throws Exception { bundles[0].submitClusters(prism); final String oldFeed = bundles[0].getInputFeedFromBundle(); AssertUtil.assertSucceeded(feedHelper.submitAndSchedule(oldFeed)); final FeedMerlin feedMerlin = new FeedMerlin(oldFeed); feedMerlin.setACL(newOwner, newGroup, "*"); final String newFeed = feedMerlin.toString(); AssertUtil.assertFailed( feedHelper.update(oldFeed, newFeed), "AuthorizationException: Permission denied"); }
/** * Testing entity listing for patterns that do not match and validating the output for the same. */ @Test(dataProvider = "getMismatchPattern") public void listEntitiesWithPatternMismatch( AbstractEntityHelper helper, String mismatchPatternParam) throws AuthenticationException, IOException, URISyntaxException, InterruptedException { mismatchPatternParam = mismatchPatternParam.replaceAll(" ", "%20"); EntityElement[] entities = helper .listAllEntities("nameseq=" + mismatchPatternParam, null) .getEntityList() .getElements(); LOGGER.info(helper.getEntityType() + " entities: " + Arrays.toString(entities)); Assert.assertNull(entities, "No pattern matches"); }
/** * Test edit operation on scheduled feed by different users. * * @param user the user that would attempt operation * @param op the edit operation that would be performed * @param isAllowed is operation expected to go through * @throws Exception */ @Test(dataProvider = "generateUserScheduledEditOpsPermission") public void othersEditScheduledFeed(final String user, final EntityOp op, boolean isAllowed) throws Exception { bundles[0].submitClusters(prism); bundles[0].submitAndScheduleAllFeeds(); if (op == EntityOp.resume) { feedHelper.suspend(feedString); } else if (op == EntityOp.update) { FeedMerlin feedMerlin = new FeedMerlin(feedString); feedMerlin.addProperty("abc", "xyz"); feedString = feedMerlin.toString(); } final boolean executeRes = op.executeAs(user, feedHelper, feedString); Assert.assertEquals( executeRes, isAllowed, "Unexpected result user " + user + " performing: " + op); }