use of com.thinkbiganalytics.metadata.jpa.feed.security.JpaFeedOpsAclEntry in project kylo by Teradata.
the class OpsManagerFeedRepositoryTest method findAllFilter_MatchingGroupButNoMatchingFilter.
@WithMockJaasUser(username = "dladmin", password = "secret", authorities = { "admin", "user" })
@Test
public void findAllFilter_MatchingGroupButNoMatchingFilter() throws Exception {
JpaOpsManagerFeed feed = new JpaOpsManagerFeed(OpsManagerFeedId.create(), "feed-name");
repo.save(feed);
BaseFeed.FeedId feedId = new BaseFeed.FeedId(feed.getId().getUuid());
JpaFeedOpsAclEntry dladminUserAcl = new JpaFeedOpsAclEntry(feedId, "dladmin", JpaFeedOpsAclEntry.PrincipalType.USER);
aclRepo.save(dladminUserAcl);
JpaFeedOpsAclEntry nonMatching = new JpaFeedOpsAclEntry(feedId, "admin", JpaFeedOpsAclEntry.PrincipalType.GROUP);
aclRepo.save(nonMatching);
QJpaOpsManagerFeed qFeed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
Iterable<JpaOpsManagerFeed> all = repo.findAll(GenericQueryDslFilter.buildFilter(qFeed, "name==non-matching-feed-name"));
Assert.assertFalse(StreamSupport.stream(all.spliterator(), false).anyMatch(it -> it.getName().equals("feed-name")));
Assert.assertFalse(StreamSupport.stream(all.spliterator(), false).anyMatch(it -> it.getName().equals("non-matching-feed-name")));
}
use of com.thinkbiganalytics.metadata.jpa.feed.security.JpaFeedOpsAclEntry in project kylo by Teradata.
the class OpsManagerFeedRepositoryTest method findAllFilter_MatchingGroupAndMatchingFilter.
@WithMockJaasUser(username = "dladmin", password = "secret", authorities = { "admin", "user" })
@Test
public void findAllFilter_MatchingGroupAndMatchingFilter() throws Exception {
JpaOpsManagerFeed feed = new JpaOpsManagerFeed(OpsManagerFeedId.create(), "feed-name");
repo.save(feed);
BaseFeed.FeedId feedId = new BaseFeed.FeedId(feed.getId().getUuid());
JpaFeedOpsAclEntry dladminUserAcl = new JpaFeedOpsAclEntry(feedId, "dladmin", JpaFeedOpsAclEntry.PrincipalType.USER);
aclRepo.save(dladminUserAcl);
JpaFeedOpsAclEntry matchingGroup = new JpaFeedOpsAclEntry(feedId, "admin", JpaFeedOpsAclEntry.PrincipalType.GROUP);
aclRepo.save(matchingGroup);
JpaOpsManagerFeed nonMatchingFeed = new JpaOpsManagerFeed(OpsManagerFeedId.create(), "non-matching-feed-name");
repo.save(nonMatchingFeed);
BaseFeed.FeedId nonMatchingFeedId = new BaseFeed.FeedId(nonMatchingFeed.getId().getUuid());
JpaFeedOpsAclEntry dladminUserAcl1 = new JpaFeedOpsAclEntry(nonMatchingFeedId, "dladmin", JpaFeedOpsAclEntry.PrincipalType.USER);
aclRepo.save(dladminUserAcl1);
JpaFeedOpsAclEntry matchingGroup1 = new JpaFeedOpsAclEntry(nonMatchingFeedId, "admin", JpaFeedOpsAclEntry.PrincipalType.GROUP);
aclRepo.save(matchingGroup1);
QJpaOpsManagerFeed qFeed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
Iterable<JpaOpsManagerFeed> all = repo.findAll(GenericQueryDslFilter.buildFilter(qFeed, "name==feed-name"));
Assert.assertTrue(StreamSupport.stream(all.spliterator(), false).anyMatch(it -> it.getName().equals("feed-name")));
Assert.assertFalse(StreamSupport.stream(all.spliterator(), false).anyMatch(it -> it.getName().equals("non-matching-feed-name")));
}
use of com.thinkbiganalytics.metadata.jpa.feed.security.JpaFeedOpsAclEntry in project kylo by Teradata.
the class OpsManagerFeedRepositoryTest method findFeedNames_NoMatchingGroupMatchingUserAclEntry.
@WithMockJaasUser(username = "dladmin", password = "secret", authorities = { "admin", "user" })
@Test
public void findFeedNames_NoMatchingGroupMatchingUserAclEntry() throws Exception {
JpaOpsManagerFeed feed = new JpaOpsManagerFeed(OpsManagerFeedId.create(), "feed-name");
repo.save(feed);
BaseFeed.FeedId feedId = new BaseFeed.FeedId(feed.getId().getUuid());
JpaFeedOpsAclEntry dladminUserAcl = new JpaFeedOpsAclEntry(feedId, "dladmin", JpaFeedOpsAclEntry.PrincipalType.USER);
aclRepo.save(dladminUserAcl);
JpaFeedOpsAclEntry nonMatching = new JpaFeedOpsAclEntry(feedId, "NON_MATCHING", JpaFeedOpsAclEntry.PrincipalType.GROUP);
aclRepo.save(nonMatching);
List<String> feedNames = repo.getFeedNames();
Assert.assertEquals(1, feedNames.size());
}
use of com.thinkbiganalytics.metadata.jpa.feed.security.JpaFeedOpsAclEntry in project kylo by Teradata.
the class OpsManagerFeedRepositoryTest method findFeedNames_MultipleMatchingFeedsAndGroups.
@WithMockJaasUser(username = "dladmin", password = "secret", authorities = { "admin", "user" })
@Test
public void findFeedNames_MultipleMatchingFeedsAndGroups() throws Exception {
JpaOpsManagerFeed feed1 = new JpaOpsManagerFeed(OpsManagerFeedId.create(), "feed1-name");
repo.save(feed1);
BaseFeed.FeedId feedId = new BaseFeed.FeedId(feed1.getId().getUuid());
JpaFeedOpsAclEntry dladminUserAcl = new JpaFeedOpsAclEntry(feedId, "dladmin", JpaFeedOpsAclEntry.PrincipalType.USER);
aclRepo.save(dladminUserAcl);
JpaFeedOpsAclEntry nonMatching = new JpaFeedOpsAclEntry(feedId, "NON_MATCHING", JpaFeedOpsAclEntry.PrincipalType.GROUP);
aclRepo.save(nonMatching);
JpaFeedOpsAclEntry adminGroupAcl = new JpaFeedOpsAclEntry(feedId, "admin", JpaFeedOpsAclEntry.PrincipalType.GROUP);
aclRepo.save(adminGroupAcl);
JpaOpsManagerFeed feed2 = new JpaOpsManagerFeed(OpsManagerFeedId.create(), "feed2-name");
repo.save(feed2);
BaseFeed.FeedId feedId2 = new BaseFeed.FeedId(feed2.getId().getUuid());
JpaFeedOpsAclEntry userGroupAcl = new JpaFeedOpsAclEntry(feedId2, "user", JpaFeedOpsAclEntry.PrincipalType.GROUP);
aclRepo.save(userGroupAcl);
List<String> feedNames = repo.getFeedNames();
Assert.assertEquals(2, feedNames.size());
Assert.assertTrue(feedNames.contains("feed1-name"));
Assert.assertTrue(feedNames.contains("feed2-name"));
}
use of com.thinkbiganalytics.metadata.jpa.feed.security.JpaFeedOpsAclEntry in project kylo by Teradata.
the class OpsManagerFeedRepositoryTest method findFeedNames_BothMatchingAndNonMatchingGroupsAreSetInAclEntry.
@WithMockJaasUser(username = "dladmin", password = "secret", authorities = { "admin", "user" })
@Test
public void findFeedNames_BothMatchingAndNonMatchingGroupsAreSetInAclEntry() throws Exception {
JpaOpsManagerFeed feed = new JpaOpsManagerFeed(OpsManagerFeedId.create(), "feed-name");
repo.save(feed);
BaseFeed.FeedId feedId = new BaseFeed.FeedId(feed.getId().getUuid());
JpaFeedOpsAclEntry dladminUserAcl = new JpaFeedOpsAclEntry(feedId, "dladmin", JpaFeedOpsAclEntry.PrincipalType.USER);
aclRepo.save(dladminUserAcl);
JpaFeedOpsAclEntry nonMatching = new JpaFeedOpsAclEntry(feedId, "NON_MATCHING", JpaFeedOpsAclEntry.PrincipalType.GROUP);
aclRepo.save(nonMatching);
JpaFeedOpsAclEntry adminGroupAcl = new JpaFeedOpsAclEntry(feedId, "admin", JpaFeedOpsAclEntry.PrincipalType.GROUP);
aclRepo.save(adminGroupAcl);
List<String> feedNames = repo.getFeedNames();
Assert.assertEquals(1, feedNames.size());
Assert.assertEquals("feed-name", feedNames.get(0));
}
Aggregations