use of org.apache.pulsar.io.core.SinkContext in project pulsar by yahoo.
the class ContextImplTest method testGetSinkConfig.
@Test
public void testGetSinkConfig() {
SinkContext sinkContext = context;
SinkConfig sinkConfig = sinkContext.getSinkConfig();
Assert.assertNotNull(sinkConfig);
}
use of org.apache.pulsar.io.core.SinkContext in project incubator-pulsar by apache.
the class ContextImplTest method testGetSubscriptionType.
@Test
public void testGetSubscriptionType() {
SinkContext ctx = context;
// make sure SinkContext can get SubscriptionType.
Assert.assertEquals(ctx.getSubscriptionType(), SubscriptionType.Shared);
}
use of org.apache.pulsar.io.core.SinkContext in project incubator-pulsar by apache.
the class KinesisSinkConfigTests method loadFromMapCredentialFromSecretTest.
@Test
public final void loadFromMapCredentialFromSecretTest() throws IOException {
Map<String, Object> map = new HashMap<String, Object>();
map.put("awsEndpoint", "https://some.endpoint.aws");
map.put("awsRegion", "us-east-1");
map.put("awsKinesisStreamName", "my-stream");
SinkContext sinkContext = Mockito.mock(SinkContext.class);
Mockito.when(sinkContext.getSecret("awsCredentialPluginParam")).thenReturn("{\"accessKey\":\"myKey\",\"secretKey\":\"my-Secret\"}");
KinesisSinkConfig config = IOConfigUtils.loadWithSecrets(map, KinesisSinkConfig.class, sinkContext);
assertNotNull(config);
assertEquals(config.getAwsEndpoint(), "https://some.endpoint.aws");
assertEquals(config.getAwsRegion(), "us-east-1");
assertEquals(config.getAwsKinesisStreamName(), "my-stream");
assertEquals(config.getAwsCredentialPluginParam(), "{\"accessKey\":\"myKey\",\"secretKey\":\"my-Secret\"}");
}
use of org.apache.pulsar.io.core.SinkContext in project incubator-pulsar by apache.
the class KinesisSinkConfigTests method loadFromMapTest.
@Test
public final void loadFromMapTest() throws IOException {
Map<String, Object> map = new HashMap<String, Object>();
map.put("awsEndpoint", "https://some.endpoint.aws");
map.put("awsRegion", "us-east-1");
map.put("awsKinesisStreamName", "my-stream");
map.put("awsCredentialPluginParam", "{\"accessKey\":\"myKey\",\"secretKey\":\"my-Secret\"}");
SinkContext sinkContext = Mockito.mock(SinkContext.class);
KinesisSinkConfig config = IOConfigUtils.loadWithSecrets(map, KinesisSinkConfig.class, sinkContext);
assertNotNull(config);
assertEquals(config.getAwsEndpoint(), "https://some.endpoint.aws");
assertEquals(config.getAwsRegion(), "us-east-1");
assertEquals(config.getAwsKinesisStreamName(), "my-stream");
assertEquals(config.getAwsCredentialPluginParam(), "{\"accessKey\":\"myKey\",\"secretKey\":\"my-Secret\"}");
}
use of org.apache.pulsar.io.core.SinkContext in project incubator-pulsar by apache.
the class ContextImplTest method testGetSinkConfig.
@Test
public void testGetSinkConfig() {
SinkContext sinkContext = context;
SinkConfig sinkConfig = sinkContext.getSinkConfig();
Assert.assertNotNull(sinkConfig);
}
Aggregations