Search in sources :

Example 1 with KinesisDatastoreProperties

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;
}
Also used : KinesisDatastoreProperties(org.talend.components.kinesis.KinesisDatastoreProperties)

Example 2 with KinesisDatastoreProperties

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());
        }
    }
}
Also used : SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) KinesisDatastoreProperties(org.talend.components.kinesis.KinesisDatastoreProperties) RuntimeInfo(org.talend.daikon.runtime.RuntimeInfo) DatastoreRuntime(org.talend.components.common.datastore.runtime.DatastoreRuntime) ValidationResult(org.talend.daikon.properties.ValidationResult) Test(org.junit.Test)

Example 3 with KinesisDatastoreProperties

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;
}
Also used : KinesisDatastoreProperties(org.talend.components.kinesis.KinesisDatastoreProperties)

Example 4 with KinesisDatastoreProperties

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());
}
Also used : KinesisDatastoreProperties(org.talend.components.kinesis.KinesisDatastoreProperties) TalendKinesisProvider(org.apache.beam.sdk.io.kinesis.TalendKinesisProvider)

Example 5 with KinesisDatastoreProperties

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;
}
Also used : KinesisDatastoreProperties(org.talend.components.kinesis.KinesisDatastoreProperties)

Aggregations

KinesisDatastoreProperties (org.talend.components.kinesis.KinesisDatastoreProperties)6 TalendKinesisProvider (org.apache.beam.sdk.io.kinesis.TalendKinesisProvider)1 Test (org.junit.Test)1 DatastoreRuntime (org.talend.components.common.datastore.runtime.DatastoreRuntime)1 ValidationResult (org.talend.daikon.properties.ValidationResult)1 RuntimeInfo (org.talend.daikon.runtime.RuntimeInfo)1 SandboxedInstance (org.talend.daikon.sandbox.SandboxedInstance)1