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