use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testProcessStandardMembershipRoleSuffixValid.
@Test
public void testProcessStandardMembershipRoleSuffixValid() {
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;
String[] requestedRoleList = { "admin" };
Set<MemberRole> memberRoles = new HashSet<>();
memberRoles.add(new MemberRole("coretech:role.admin", 0));
memberRoles.add(new MemberRole("coretech:role.readers", 0));
store.processStandardMembership(memberRoles, prefix, requestedRoleList, accessibleRoles, false);
assertEquals(accessibleRoles.size(), 1);
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testStoreInitNoLastModTimeLocalDomainDelete.
@Test
public void testStoreInitNoLastModTimeLocalDomainDelete() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
store.changeLogStore.setLastModificationTimestamp(null);
/* this domain will be deleted since our last refresh is 0 */
addDomainToDataStore(store, "coretech");
File file = new File("/tmp/zts_server_unit_tests/zts_root/coretech");
assertTrue(file.exists());
/* initialize our datastore which will call init */
clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
store = new DataStore(clogStore, null);
assertNull(store.getDomainData("coretech"));
assertFalse(file.exists());
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testAddRoleToListNullSuffix.
@Test
public void testAddRoleToListNullSuffix() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
Set<String> accessibleRoles = new HashSet<>();
store.addRoleToList("coretech:role.admin", "coretech:role.", null, 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 testGetDomainListFromZMSError.
@Test
public void testGetDomainListFromZMSError() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
((MockZMSFileChangeLogStore) store.changeLogStore).setDomainList(null);
Set<String> zmsDomainList = store.changeLogStore.getServerDomainList();
assertNull(zmsDomainList);
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testAddRoleToListMultipleRoleSpecified.
@Test
public void testAddRoleToListMultipleRoleSpecified() {
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 = { "admin2", "admin3", "admin" };
store.addRoleToList("coretech:role.admin", "coretech:role.", requestedRoleList, accessibleRoles, false);
assertEquals(accessibleRoles.size(), 1);
assertTrue(accessibleRoles.contains("admin"));
}
Aggregations