use of org.talend.components.kinesis.KinesisDatastoreProperties in project components by Talend.
the class KinesisTestConstants method getDatastore.
public static KinesisDatastoreProperties getDatastore() {
KinesisDatastoreProperties datastore = new KinesisDatastoreProperties("kinesisDatastore");
datastore.init();
String awsAccessKey = System.getProperty("aws.accesskey");
String awsSecretKey = System.getProperty("aws.secretkey");
if (StringUtils.isEmpty(awsAccessKey) || StringUtils.isEmpty(awsSecretKey)) {
datastore.specifyCredentials.setValue(false);
} else {
datastore.accessKey.setValue(awsAccessKey);
datastore.secretKey.setValue(awsSecretKey);
}
return datastore;
}
use of org.talend.components.kinesis.KinesisDatastoreProperties in project components by Talend.
the class KinesisDatastoreRuntimeTestIT method doHealthChecks.
@Test
public void doHealthChecks() {
KinesisDatastoreProperties props = getDatastore();
RuntimeInfo ri = def.getRuntimeInfo(props);
try (SandboxedInstance si = RuntimeUtil.createRuntimeClass(ri, getClass().getClassLoader())) {
DatastoreRuntime runtime = (DatastoreRuntime) si.getInstance();
runtime.initialize(null, props);
Iterable<ValidationResult> validationResults = runtime.doHealthChecks(null);
Assert.assertEquals(ValidationResult.OK, validationResults.iterator().next());
// Wrong access key
{
KinesisDatastoreProperties wrongAccess = getDatastore();
wrongAccess.accessKey.setValue("wrong");
runtime.initialize(null, wrongAccess);
validationResults = runtime.doHealthChecks(null);
Assert.assertEquals(ValidationResult.Result.ERROR, validationResults.iterator().next().getStatus());
}
// Wrong screct key
{
KinesisDatastoreProperties wrongSecret = getDatastore();
wrongSecret.secretKey.setValue("wrong");
runtime.initialize(null, wrongSecret);
validationResults = runtime.doHealthChecks(null);
Assert.assertEquals(ValidationResult.Result.ERROR, validationResults.iterator().next().getStatus());
}
}
}
use of org.talend.components.kinesis.KinesisDatastoreProperties in project components by Talend.
the class KinesisTestConstants method getDatastore.
public static KinesisDatastoreProperties getDatastore() {
KinesisDatastoreProperties datastore = new KinesisDatastoreProperties("kinesisDatastore");
datastore.init();
String awsAccessKey = System.getProperty("aws.accesskey");
String awsSecretKey = System.getProperty("aws.secretkey");
if (StringUtils.isEmpty(awsAccessKey) || StringUtils.isEmpty(awsSecretKey)) {
datastore.specifyCredentials.setValue(false);
} else {
datastore.accessKey.setValue(awsAccessKey);
datastore.secretKey.setValue(awsSecretKey);
}
return datastore;
}
use of org.talend.components.kinesis.KinesisDatastoreProperties in project components by Talend.
the class KinesisClient method getProvider.
public static TalendKinesisProvider getProvider(KinesisDatasetProperties dataset) {
KinesisDatastoreProperties datastore = dataset.getDatastoreProperties();
String region = dataset.region.getValue().getValue();
if (KinesisRegion.OTHER.getValue().equals(region)) {
region = dataset.unknownRegion.getValue();
}
return new TalendKinesisProvider(datastore.specifyCredentials.getValue(), datastore.accessKey.getValue(), datastore.secretKey.getValue(), datastore.specifyEndpoint.getValue(), datastore.endpoint.getValue(), Regions.fromName(region), datastore.specifySTS.getValue(), datastore.roleArn.getValue(), datastore.roleSessionName.getValue(), datastore.specifyRoleExternalId.getValue(), datastore.roleExternalId.getValue(), datastore.specifySTSEndpoint.getValue(), datastore.stsEndpoint.getValue());
}
use of org.talend.components.kinesis.KinesisDatastoreProperties in project components by Talend.
the class KinesisTestConstants method getLocalDatastore.
// for localstack test
public static KinesisDatastoreProperties getLocalDatastore() {
KinesisDatastoreProperties datastore = new KinesisDatastoreProperties("kinesisDatastore");
datastore.init();
datastore.specifyCredentials.setValue(true);
datastore.accessKey.setValue("test");
datastore.secretKey.setValue("test");
datastore.specifyEndpoint.setValue(true);
datastore.endpoint.setValue(LOCALSTACK_KINESIS_ENDPOINT);
return datastore;
}
Aggregations