use of com.thinkbiganalytics.test.security.WithMockJaasUser 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));
}
use of com.thinkbiganalytics.test.security.WithMockJaasUser in project kylo by Teradata.
the class JpaBatchJobExecutionTest method testJobStatusCountFromNow.
@WithMockJaasUser(username = "dladmin", password = "secret", authorities = { "admin" })
@Test
public void testJobStatusCountFromNow() {
operationalMetadataAccess.read(() -> {
Period period = DateTimeUtil.period("3Y");
List<JobStatusCount> counts = jobExecutionProvider.getJobStatusCountByDateFromNow(period, null);
return counts;
});
}
use of com.thinkbiganalytics.test.security.WithMockJaasUser in project kylo by Teradata.
the class JpaBatchJobExecutionTest method testPaging.
@WithMockJaasUser(username = "dladmin", password = "secret", authorities = { "admin" })
@Test
public void testPaging() {
operationalMetadataAccess.read(() -> {
String filter = "jobInstance.feed.feedType==FEED,jobInstance.feed.name==movies.new_releases";
// String feed = "movies.new_releases";
Page<? extends BatchJobExecution> page = jobExecutionProvider.findAll(filter, new PageRequest(0, 10, Sort.Direction.DESC, "jobExecutionId"));
return page;
});
}
use of com.thinkbiganalytics.test.security.WithMockJaasUser in project kylo by Teradata.
the class FeedHealthRepositoryTest method findAll_NoMatchingGroupAclEntry.
@WithMockJaasUser(username = "dladmin", password = "secret", authorities = { "admin", "user" })
@Test
public void findAll_NoMatchingGroupAclEntry() throws Exception {
UUID uuid = UUID.randomUUID();
JpaOpsManagerFeedHealth health = new JpaOpsManagerFeedHealth();
health.setFeedId(new JpaOpsManagerFeedHealth.OpsManagerFeedHealthFeedId(uuid));
repo.save(health);
BaseFeed.FeedId healthId = new BaseFeed.FeedId(uuid);
JpaFeedOpsAclEntry nonMatching = new JpaFeedOpsAclEntry(healthId, "NON_MATCHING", JpaFeedOpsAclEntry.PrincipalType.GROUP);
aclRepo.save(nonMatching);
Iterable<JpaOpsManagerFeedHealth> all = repo.findAll();
Assert.assertFalse(StreamSupport.stream(all.spliterator(), false).anyMatch(it -> it.getFeedId().getUuid().equals(uuid)));
}
use of com.thinkbiganalytics.test.security.WithMockJaasUser in project kylo by Teradata.
the class FeedHealthRepositoryTest method findAll_WithMatchingUserAclEntry.
@WithMockJaasUser(username = "dladmin", password = "secret", authorities = { "admin", "user" })
@Test
public void findAll_WithMatchingUserAclEntry() throws Exception {
UUID uuid = UUID.randomUUID();
JpaOpsManagerFeedHealth health = new JpaOpsManagerFeedHealth();
health.setFeedId(new JpaOpsManagerFeedHealth.OpsManagerFeedHealthFeedId(uuid));
repo.save(health);
BaseFeed.FeedId healthId = new BaseFeed.FeedId(uuid);
JpaFeedOpsAclEntry nonMatching = new JpaFeedOpsAclEntry(healthId, "dladmin", JpaFeedOpsAclEntry.PrincipalType.USER);
aclRepo.save(nonMatching);
Iterable<JpaOpsManagerFeedHealth> all = repo.findAll();
Assert.assertTrue(StreamSupport.stream(all.spliterator(), false).anyMatch(it -> it.getFeedId().getUuid().equals(uuid)));
}
Aggregations