use of com.hazelcast.jet.kinesis.impl.AwsConfig in project hazelcast by hazelcast.
the class KinesisIntegrationTest method beforeClass.
@BeforeClass
public static void beforeClass() {
assumeTrue(DockerClientFactory.instance().isDockerAvailable());
localStack = new LocalStackContainer(parse("localstack/localstack").withTag("0.12.3")).withServices(Service.KINESIS);
localStack.start();
// To run with real kinesis AWS credentials need be available
// to be loaded by DefaultAWSCredentialsProviderChain.
// Keep in mind the real Kinesis is paid service and once you
// run it you should ensure that cleanup happened correctly.
useRealKinesis = Boolean.parseBoolean(System.getProperty("run.with.real.kinesis", "false"));
System.setProperty(SDKGlobalConfiguration.AWS_CBOR_DISABLE_SYSTEM_PROPERTY, "true");
if (useRealKinesis) {
AWS_CONFIG = new AwsConfig().withEndpoint("https://kinesis.us-east-1.amazonaws.com").withRegion("us-east-1");
} else {
AWS_CONFIG = new AwsConfig().withEndpoint("http://" + localStack.getHost() + ":" + localStack.getMappedPort(4566)).withRegion(localStack.getRegion()).withCredentials(localStack.getAccessKey(), localStack.getSecretKey());
}
KINESIS = AWS_CONFIG.buildClient();
HELPER = new KinesisTestHelper(KINESIS, STREAM, Logger.getLogger(KinesisIntegrationTest.class));
}
use of com.hazelcast.jet.kinesis.impl.AwsConfig in project hazelcast by hazelcast.
the class KinesisFailureTest method beforeClass.
@BeforeClass
public static void beforeClass() {
assumeTrue(DockerClientFactory.instance().isDockerAvailable());
localStack = new LocalStackContainer(parse("localstack/localstack").withTag("0.12.3")).withNetwork(NETWORK).withServices(Service.KINESIS);
localStack.start();
toxiProxy = new ToxiproxyContainer(parse("shopify/toxiproxy").withTag("2.1.0")).withNetwork(NETWORK).withNetworkAliases("toxiproxy");
toxiProxy.start();
System.setProperty(SDKGlobalConfiguration.AWS_CBOR_DISABLE_SYSTEM_PROPERTY, "true");
// with the jackson versions we use (2.11.x) Localstack doesn't without disabling CBOR
// https://github.com/localstack/localstack/issues/3208
PROXY = toxiProxy.getProxy(localStack, 4566);
AWS_CONFIG = new AwsConfig().withEndpoint("http://" + PROXY.getContainerIpAddress() + ":" + PROXY.getProxyPort()).withRegion(localStack.getRegion()).withCredentials(localStack.getAccessKey(), localStack.getSecretKey());
KINESIS = AWS_CONFIG.buildClient();
HELPER = new KinesisTestHelper(KINESIS, STREAM, Logger.getLogger(KinesisIntegrationTest.class));
}
use of com.hazelcast.jet.kinesis.impl.AwsConfig in project hazelcast by hazelcast.
the class KinesisFailureTest method sourceWithIncorrectCredentials.
@Test
@Category(SerialTest.class)
// AWS mock completely ignores the credentials passed to it, accepts anything (test passes on real backend)
@Ignore
public void sourceWithIncorrectCredentials() {
HELPER.createStream(1);
AwsConfig awsConfig = new AwsConfig().withCredentials("wrong_key", "wrong_key");
Pipeline p = Pipeline.create();
p.readFrom(KinesisSources.kinesis(STREAM).withEndpoint(awsConfig.getEndpoint()).withRegion(awsConfig.getRegion()).withCredentials(awsConfig.getAccessKey(), awsConfig.getSecretKey()).withRetryStrategy(KinesisTestHelper.RETRY_STRATEGY).build()).withoutTimestamps().writeTo(Sinks.noop());
Job job = hz().getJet().newJob(p);
assertThrowsJetException(job, "The security token included in the request is invalid");
}
use of com.hazelcast.jet.kinesis.impl.AwsConfig in project hazelcast by hazelcast.
the class KinesisFailureTest method sinkWithIncorrectCredentials.
@Test
@Category(SerialTest.class)
// AWS mock completely ignores the credentials passed to it, accepts anything (test passes on real backend)
@Ignore
public void sinkWithIncorrectCredentials() {
HELPER.createStream(1);
AwsConfig awsConfig = new AwsConfig().withCredentials("wrong_key", "wrong_key");
Pipeline p = Pipeline.create();
p.readFrom(TestSources.items(entry("k", new byte[0]))).writeTo(KinesisSinks.kinesis(STREAM).withEndpoint(awsConfig.getEndpoint()).withRegion(awsConfig.getRegion()).withCredentials(awsConfig.getAccessKey(), awsConfig.getSecretKey()).withRetryStrategy(KinesisTestHelper.RETRY_STRATEGY).build());
Job job = hz().getJet().newJob(p);
assertThrowsJetException(job, "The security token included in the request is invalid");
}
Aggregations