use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testProcessDomainServiceIdentities.
@Test
public void testProcessDomainServiceIdentities() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
ServiceIdentity service = new ServiceIdentity();
service.setName("coretech.storage");
List<String> hosts = new ArrayList<>();
hosts.add("host1");
service.setHosts(hosts);
List<ServiceIdentity> services = new ArrayList<>();
services.add(service);
DomainData domainData = new DomainData();
domainData.setName("coretech");
domainData.setServices(services);
DataCache dataCache = new DataCache();
dataCache.setDomainData(domainData);
store.processDomainServiceIdentities(domainData, dataCache);
store.addDomainToCache(domainData.getName(), dataCache);
HostServices hostServices = store.getHostServices("host1");
hosts = hostServices.getNames();
assertEquals(hosts.size(), 1);
assertTrue(hosts.contains("coretech.storage"));
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testProcessSignedDomainsNullList.
@Test
public void testProcessSignedDomainsNullList() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
boolean result = store.processSignedDomains(null);
assertTrue(result);
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testRetrieveTagHeadersValueNotFound.
@Test
public void testRetrieveTagHeadersValueNotFound() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
((MockZMSFileChangeLogStore) store.changeLogStore).setTagHeader(null);
Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
List<String> values = new ArrayList<>();
values.add("Unit-Test");
responseHeaders.put("User-Agent", values);
assertNull(((MockZMSFileChangeLogStore) store.changeLogStore).retrieveTagHeader(responseHeaders));
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testRetrieveTagHeadersEmptyList.
@Test
public void testRetrieveTagHeadersEmptyList() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
((MockZMSFileChangeLogStore) store.changeLogStore).setTagHeader(null);
Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
assertNull(((MockZMSFileChangeLogStore) store.changeLogStore).retrieveTagHeader(responseHeaders));
}
use of com.yahoo.athenz.zts.store.impl.MockZMSFileChangeLogStore in project athenz by yahoo.
the class DataStoreTest method testProcessDomainDeletesZMSSingleDelete.
@Test
public void testProcessDomainDeletesZMSSingleDelete() {
ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0");
DataStore store = new DataStore(clogStore, null);
addDomainToDataStore(store, "coretech");
addDomainToDataStore(store, "sports");
List<String> list = new ArrayList<>();
list.add(userDomain);
list.add("sys.auth");
list.add("coretech");
((MockZMSFileChangeLogStore) store.changeLogStore).setDomainList(list);
assertTrue(store.processDomainDeletes());
assertNull(store.getDomainData("sports"));
assertNotNull(store.getDomainData("coretech"));
}
Aggregations