use of com.yahoo.athenz.zts.notification.ZTSClientNotificationSenderImpl in project athenz by yahoo.
the class DynamoDBSSHRecordStoreFactory method create.
@Override
public SSHRecordStore create(PrivateKeyStore keyStore) {
final String tableName = System.getProperty(ZTSConsts.ZTS_PROP_SSH_DYNAMODB_TABLE_NAME);
if (tableName == null || tableName.isEmpty()) {
LOGGER.error("SSH Store DynamoDB table name not specified");
throw new ResourceException(ResourceException.SERVICE_UNAVAILABLE, "DynamoDB ssh table name not specified");
}
ZTSClientNotificationSenderImpl ztsClientNotificationSender = new ZTSClientNotificationSenderImpl();
AmazonDynamoDB client = getDynamoDBClient(ztsClientNotificationSender, keyStore);
return new DynamoDBSSHRecordStore(client, tableName, ztsClientNotificationSender);
}
use of com.yahoo.athenz.zts.notification.ZTSClientNotificationSenderImpl in project athenz by yahoo.
the class DynamoDBWorkloadRecordStoreFactoryTest method testGetDynamoDBClient.
@Test
public void testGetDynamoDBClient() {
System.setProperty(ZTS_PROP_DYNAMODB_KEY_PATH, "test.keypath");
System.setProperty(ZTS_PROP_DYNAMODB_CERT_PATH, "test.certpath");
System.setProperty(ZTS_PROP_DYNAMODB_DOMAIN, "test.domain");
System.setProperty(ZTS_PROP_DYNAMODB_REGION, "test.region");
System.setProperty(ZTS_PROP_DYNAMODB_ROLE, "test.role");
System.setProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE, "test.truststore");
System.setProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_PASSWORD, "test.truststore.password");
System.setProperty(ZTS_PROP_DYNAMODB_ZTS_URL, "test.ztsurl");
System.setProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_APPNAME, "test.appname");
PrivateKeyStore keyStore = Mockito.mock(PrivateKeyStore.class);
when(keyStore.getApplicationSecret(Mockito.eq("test.appname"), Mockito.eq("test.truststore.password"))).thenReturn("decryptedPassword");
DynamoDBWorkloadRecordStoreFactory factory = new DynamoDBWorkloadRecordStoreFactory();
ZTSClientNotificationSenderImpl ztsClientNotificationSender = Mockito.mock(ZTSClientNotificationSenderImpl.class);
PrivateKeyStore privateKeyStore = Mockito.mock(PrivateKeyStore.class);
AmazonDynamoDB dynamoDBClient = factory.getDynamoDBClient(ztsClientNotificationSender, privateKeyStore);
Assert.assertNotNull(dynamoDBClient);
System.clearProperty(ZTS_PROP_DYNAMODB_KEY_PATH);
System.clearProperty(ZTS_PROP_DYNAMODB_CERT_PATH);
System.clearProperty(ZTS_PROP_DYNAMODB_DOMAIN);
System.clearProperty(ZTS_PROP_DYNAMODB_REGION);
System.clearProperty(ZTS_PROP_DYNAMODB_ROLE);
System.clearProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE);
System.clearProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_PASSWORD);
System.clearProperty(ZTS_PROP_DYNAMODB_ZTS_URL);
System.clearProperty(ZTS_PROP_DYNAMODB_TRUSTSTORE_APPNAME);
}
Aggregations