use of com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore in project athenz by yahoo.
the class ZMSFileChangeLogStoreTest method getExistent.
@Test
public void getExistent() {
ZMSFileChangeLogStore fstore = new ZMSFileChangeLogStore(FSTORE_PATH, null, null);
Struct data = new Struct();
data.put("key", "val1");
fstore.put("test1", JSON.bytes(data));
Struct st = fstore.get("test1", Struct.class);
assertNotNull(st);
assertEquals(st.get("key"), "val1");
}
use of com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore in project athenz by yahoo.
the class ZMSFileChangeLogStoreTest method scanDelete.
@Test
public void scanDelete() {
ZMSFileChangeLogStore fstore = new ZMSFileChangeLogStore(FSTORE_PATH, null, null);
Struct data = new Struct();
data.put("key", "val1");
fstore.put("test1", JSON.bytes(data));
data = new Struct();
data.put("key", "val1");
fstore.put("test2", JSON.bytes(data));
data = new Struct();
data.put("key", "val1");
fstore.put("test3", JSON.bytes(data));
fstore.delete("test2");
List<String> ls = fstore.scan();
assertEquals(ls.size(), 2);
assertTrue(ls.contains("test1"));
assertTrue(ls.contains("test3"));
}
use of com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore in project athenz by yahoo.
the class ZMSFileChangeLogStoreTest method scanMultiple.
@Test
public void scanMultiple() {
ZMSFileChangeLogStore fstore = new ZMSFileChangeLogStore(FSTORE_PATH, null, null);
Struct data = new Struct();
data.put("key", "val1");
fstore.put("test1", JSON.bytes(data));
data = new Struct();
data.put("key", "val1");
fstore.put("test2", JSON.bytes(data));
data = new Struct();
data.put("key", "val1");
fstore.put("test3", JSON.bytes(data));
List<String> ls = fstore.scan();
assertEquals(ls.size(), 3);
assertTrue(ls.contains("test1"));
assertTrue(ls.contains("test2"));
assertTrue(ls.contains("test3"));
}
use of com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore in project athenz by yahoo.
the class ZMSFileChangeLogStoreTest method getNonExistent.
@Test
public void getNonExistent() {
ZMSFileChangeLogStore fstore = new ZMSFileChangeLogStore(FSTORE_PATH, null, null);
Struct st = fstore.get("NotExistent", Struct.class);
assertNull(st);
}
use of com.yahoo.athenz.zts.store.impl.ZMSFileChangeLogStore in project athenz by yahoo.
the class ZMSFileChangeLogStoreTest method getSignedDomainListOneBadDomain.
@Test
public void getSignedDomainListOneBadDomain() {
ZMSFileChangeLogStore fstore = new ZMSFileChangeLogStore(FSTORE_PATH, null, null);
ZMSClient zmsClient = Mockito.mock(ZMSClient.class);
DomainData domData1 = new DomainData().setName("athenz");
SignedDomain domain1 = new SignedDomain().setDomain(domData1);
DomainData domData2 = new DomainData().setName("sports");
SignedDomain domain2 = new SignedDomain().setDomain(domData2);
List<SignedDomain> domains = new ArrayList<>();
domains.add(domain1);
domains.add(domain2);
SignedDomains domainList = new SignedDomains().setDomains(domains);
List<SignedDomain> mockDomains = new ArrayList<>();
mockDomains.add(domain1);
SignedDomains mockDomainList = new SignedDomains().setDomains(mockDomains);
Mockito.when(zmsClient.getSignedDomains("athenz", null, null, null)).thenReturn(mockDomainList);
Mockito.when(zmsClient.getSignedDomains("sports", null, null, null)).thenReturn(null);
List<SignedDomain> returnList = fstore.getSignedDomainList(zmsClient, domainList);
assertEquals(returnList.size(), 1);
assertEquals(returnList.get(0).getDomain().getName(), "athenz");
}
Aggregations