use of com.yahoo.athenz.zms.SignedDomain 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.zms.SignedDomain 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.zms.SignedDomain in project athenz by yahoo.
the class ChangeLogStoreTest method testChangeLogStore.
@Test
public void testChangeLogStore() {
ChangeLogStore store = new ChangeLogStore() {
@Override
public SignedDomain getLocalSignedDomain(String domainName) {
return null;
}
@Override
public SignedDomain getServerSignedDomain(String domainName) {
return null;
}
@Override
public void removeLocalDomain(String domainName) {
}
@Override
public void saveLocalDomain(String domainName, SignedDomain signedDomain) {
}
@Override
public List<String> getLocalDomainList() {
return null;
}
@Override
public Set<String> getServerDomainList() {
return null;
}
@Override
public SignedDomains getServerDomainModifiedList() {
return null;
}
@Override
public SignedDomains getUpdatedSignedDomains(StringBuilder lastModTimeBuffer) {
return null;
}
@Override
public void setLastModificationTimestamp(String lastModTime) {
}
@Override
public boolean supportsFullRefresh() {
return false;
}
};
assertNull(store.getLocalJWSDomain("domain"));
assertNull(store.getServerJWSDomain("domain"));
assertNull(store.getUpdatedJWSDomains(null));
store.saveLocalDomain("domain", new JWSDomain());
store.setRequestConditions(true);
store.setRequestConditions(false);
store.setJWSDomainSupport(true);
store.setJWSDomainSupport(false);
}
use of com.yahoo.athenz.zms.SignedDomain in project athenz by yahoo.
the class S3ChangeLogStoreTest method testGetSignedDomainInternal.
@Test
public void testGetSignedDomainInternal() throws IOException {
MockS3ChangeLogStore store = new MockS3ChangeLogStore();
InputStream is = new FileInputStream("src/test/resources/iaas.json");
MockS3ObjectInputStream s3Is = new MockS3ObjectInputStream(is, null);
S3Object object = mock(S3Object.class);
when(object.getObjectContent()).thenReturn(s3Is);
when(store.awsS3Client.getObject("s3-unit-test-bucket-name", "iaas")).thenReturn(object);
SignedDomain signedDomain = store.getSignedDomain(store.awsS3Client, "iaas");
assertNotNull(signedDomain);
DomainData domainData = signedDomain.getDomain();
assertNotNull(domainData);
assertEquals(domainData.getName(), "iaas");
is.close();
}
use of com.yahoo.athenz.zms.SignedDomain in project athenz by yahoo.
the class S3ChangeLogStoreTest method testGetSignedDomainException.
@Test
public void testGetSignedDomainException() throws IOException {
MockS3ChangeLogStore store = new MockS3ChangeLogStore();
InputStream is = new FileInputStream("src/test/resources/iaas.json");
MockS3ObjectInputStream s3Is = new MockS3ObjectInputStream(is, null);
S3Object object = mock(S3Object.class);
when(object.getObjectContent()).thenReturn(s3Is);
// first call we return null, second call we return success
when(store.awsS3Client.getObject("s3-unit-test-bucket-name", "iaas")).thenThrow(new AmazonServiceException("test")).thenReturn(object);
SignedDomain signedDomain = store.getLocalSignedDomain("iaas");
assertNotNull(signedDomain);
DomainData domainData = signedDomain.getDomain();
assertNotNull(domainData);
assertEquals(domainData.getName(), "iaas");
is.close();
}
Aggregations