use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testProcessStandardMembershipMemberRolesNull.
@Test
public void testProcessStandardMembershipMemberRolesNull() {
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 = "coretech" + ROLE_POSTFIX;
store.processStandardMembership(null, prefix, null, accessibleRoles, false);
assertEquals(accessibleRoles.size(), 0);
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testStoreInitNoLastModTimeDomainUpdateFailure.
@Test
public void testStoreInitNoLastModTimeDomainUpdateFailure() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
addDomainToDataStore(store, "coretech");
((MockZMSFileChangeLogStore) store.changeLogStore).setDomainList(null);
((MockZMSFileChangeLogStore) store.changeLogStore).setTagHeader(null);
/* our mock is going to throw an exception for domain list so failure */
assertFalse(store.init());
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testProcessLocalDomainInvalidFile.
@Test
public void testProcessLocalDomainInvalidFile() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
boolean result = store.processLocalDomain("coretech");
assertFalse(result);
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testGetAccessibleRolesInvalidDomain.
@Test
public void testGetAccessibleRolesInvalidDomain() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
SignedDomain signedDomain = createSignedDomain("coretech", "weather");
store.processDomain(signedDomain, true);
Set<String> accessibleRoles = new HashSet<>();
DataCache data = store.getDataCache("sports");
store.getAccessibleRoles(data, "sports", "user_domain.user", null, accessibleRoles, false);
assertEquals(accessibleRoles.size(), 0);
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testRoleMatchInSetRegex.
@Test
public void testRoleMatchInSetRegex() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
Set<MemberRole> checkSet = new HashSet<>();
checkSet.add(new MemberRole("coretech:role.readers", 0));
checkSet.add(new MemberRole("coretech:role.writers", 0));
checkSet.add(new MemberRole("*:role.update", 0));
checkSet.add(new MemberRole("weather:role.*", 0));
assertTrue(store.roleMatchInSet("coretech:role.readers", checkSet));
assertTrue(store.roleMatchInSet("coretech:role.writers", checkSet));
assertTrue(store.roleMatchInSet("sports:role.update", checkSet));
assertTrue(store.roleMatchInSet("weather:role.update", checkSet));
assertFalse(store.roleMatchInSet("coretech:role.admin", checkSet));
}
Aggregations