S3ChangeLogStore implements ChangeLogStore { @Override public SignedDomain getLocalSignedDomain(String domainName) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("getSignedDomain: {}", domainName); } SignedDomain signedDomain = tempSignedDomainMap.remove(domainName); if (signedDomain == null) { if (LOGGER.isInfoEnabled()) { LOGGER.info("getSignedDomain: not present in cache, fetching from S3..."); } if (awsS3Client == null) { awsS3Client = getS3Client(); } signedDomain = getSignedDomain(awsS3Client, domainName); if (signedDomain == null) { awsS3Client = getS3Client(); signedDomain = getSignedDomain(awsS3Client, domainName); } } return signedDomain; } S3ChangeLogStore();  S3ChangeLogStore(String awsRegion); @Override boolean supportsFullRefresh(); @Override SignedDomain getLocalSignedDomain(String domainName); @SuppressWarnings("EmptyMethod") @Override void removeLocalDomain(String domainName); @SuppressWarnings("EmptyMethod") @Override void saveLocalDomain(String domainName, SignedDomain signedDomain); @Override List<String> getLocalDomainList(); boolean getAllSignedDomains(List<String> domains); @Override Set<String> getServerDomainList(); @Override SignedDomains getServerDomainModifiedList(); @Override SignedDomain getServerSignedDomain(String domainName); @Override SignedDomains getUpdatedSignedDomains(StringBuilder lastModTimeBuffer); @Override void setLastModificationTimestamp(String newLastModTime); ExecutorService getExecutorService();  }
@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); 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(); }