DynamoDBCertRecordStore implements CertRecordStore { @Override public CertRecordStoreConnection getConnection() { try { return new DynamoDBCertRecordStoreConnection(dynamoDB, tableName, indexName); } catch (Exception ex) { LOGGER.error("getConnection: {}", ex.getMessage()); throw new ResourceException(ResourceException.SERVICE_UNAVAILABLE, ex.getMessage()); } } DynamoDBCertRecordStore(AmazonDynamoDB client, final String tableName, final String indexName, ZTSClientNotificationSenderImpl ztsClientNotificationSender); @Override CertRecordStoreConnection getConnection(); @Override void setOperationTimeout(int opTimeout); @Override void clearConnections(); @Override void log(final Principal principal, final String ip, final String provider,
                    final String instanceId, final X509Certificate x509Cert); @Override boolean enableNotifications(NotificationManager notificationManager, RolesProvider rolesProvider, final String serverName);  }
@Test public void testGetConnection() { DynamoDBCertRecordStore store = new DynamoDBCertRecordStore( dbClient, "Athenz-ZTS-Table", "Athenz-ZTS-Current-Time-Index", null); CertRecordStoreConnection dbConn = store.getConnection(); assertNotNull(dbConn); store.setOperationTimeout(10); store.clearConnections(); }
@Test public void testGetConnectionException() { DynamoDBCertRecordStore store = new DynamoDBCertRecordStore(dbClient, null, "Athenz-ZTS-Current-Time-Index", null); try { store.getConnection(); fail(); } catch (Exception ignored) { } store = new DynamoDBCertRecordStore(dbClient, "Athenz-ZTS-Table", null, null); try { store.getConnection(); fail(); } catch (Exception ignored) { } }