use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testAddRoleToListSingleRoleSpecified.
@Test
public void testAddRoleToListSingleRoleSpecified() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
Set<String> accessibleRoles = new HashSet<>();
String[] requestedRoleList = { "admin" };
store.addRoleToList("coretech:role.admin", "coretech:role.", requestedRoleList, accessibleRoles, false);
assertEquals(accessibleRoles.size(), 1);
assertTrue(accessibleRoles.contains("admin"));
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testProcessLocalDomain.
@Test
public void testProcessLocalDomain() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
store.loadZMSPublicKeys();
SignedDomain signedDomain = createSignedDomain("coretech", "weather");
store.processDomain(signedDomain, true);
store = new DataStore(clogStore, null);
boolean result = store.processLocalDomain("coretech");
assertTrue(result);
assertNotNull(store.getDomainData("coretech"));
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testProcessDomainUpdatesFromZMSNoTagHeader.
@Test
public void testProcessDomainUpdatesFromZMSNoTagHeader() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
((MockZMSFileChangeLogStore) store.changeLogStore).setTagHeader(null);
SignedDomain signedDomain = createSignedDomain("coretech", "weather");
List<SignedDomain> domains = new ArrayList<>();
domains.add(signedDomain);
SignedDomains signedDomains = new SignedDomains();
signedDomains.setDomains(domains);
((MockZMSFileChangeLogStore) store.changeLogStore).setSignedDomains(signedDomains);
boolean result = store.processDomainUpdates();
assertFalse(result);
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testRoleCheckValueNoPrefixMatch.
@Test
public void testRoleCheckValueNoPrefixMatch() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
String roleCheck = store.roleCheckValue("readers", "coretech:role.");
assertEquals(roleCheck, "coretech:role.readers");
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testProcessSingleTrustedDomainRoleAddRoleFalse.
@Test
public void testProcessSingleTrustedDomainRoleAddRoleFalse() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
Set<String> accessibleRoles = new HashSet<>();
String prefix = "coretech2" + ROLE_POSTFIX;
String role = "coretech:role.readers";
/* invalid role causing no match */
Set<MemberRole> memberRoles = new HashSet<>();
memberRoles.add(new MemberRole("coretech:role.admin", 0));
memberRoles.add(new MemberRole("coretech:role.readers", 0));
store.processSingleTrustedDomainRole(role, prefix, null, memberRoles, accessibleRoles, false);
assertEquals(accessibleRoles.size(), 0);
}
Aggregations