Java Code Examples for org.apache.flink.streaming.connectors.elasticsearch.testutils.SourceSinkDataTestKit#verifyProducedSinkData()
The following examples show how to use
org.apache.flink.streaming.connectors.elasticsearch.testutils.SourceSinkDataTestKit#verifyProducedSinkData() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ElasticsearchSinkTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Tests that the Elasticsearch sink works properly. */ public void runElasticsearchSinkTest() throws Exception { final String index = "elasticsearch-sink-test-index"; final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStreamSource<Tuple2<Integer, String>> source = env.addSource(new SourceSinkDataTestKit.TestDataSourceFunction()); source.addSink(createElasticsearchSinkForEmbeddedNode( 1, CLUSTER_NAME, new SourceSinkDataTestKit.TestElasticsearchSinkFunction(index))); env.execute("Elasticsearch Sink Test"); // verify the results Client client = embeddedNodeEnv.getClient(); SourceSinkDataTestKit.verifyProducedSinkData(client, index); client.close(); }
Example 2
Source File: ElasticsearchSinkTestBase.java From flink with Apache License 2.0 | 6 votes |
/** * Tests that the Elasticsearch sink works properly. */ public void runElasticsearchSinkTest() throws Exception { final String index = "elasticsearch-sink-test-index"; final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStreamSource<Tuple2<Integer, String>> source = env.addSource(new SourceSinkDataTestKit.TestDataSourceFunction()); source.addSink(createElasticsearchSinkForEmbeddedNode( 1, CLUSTER_NAME, new SourceSinkDataTestKit.TestElasticsearchSinkFunction(index))); env.execute("Elasticsearch Sink Test"); // verify the results Client client = embeddedNodeEnv.getClient(); SourceSinkDataTestKit.verifyProducedSinkData(client, index); client.close(); }
Example 3
Source File: ElasticsearchSinkTestBase.java From flink with Apache License 2.0 | 6 votes |
private void runElasticSearchSinkTest(String index, Function<String, ElasticsearchSinkFunction<Tuple2<Integer, String>>> functionFactory) throws Exception { final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStreamSource<Tuple2<Integer, String>> source = env.addSource(new SourceSinkDataTestKit.TestDataSourceFunction()); source.addSink(createElasticsearchSinkForEmbeddedNode( 1, CLUSTER_NAME, functionFactory.apply(index))); env.execute("Elasticsearch Sink Test"); // verify the results Client client = elasticsearchResource.getClient(); SourceSinkDataTestKit.verifyProducedSinkData(client, index); client.close(); }
Example 4
Source File: ElasticsearchSinkITCase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Tests that behaviour of the deprecated {@link IndexRequestBuilder} constructor works properly. */ @Test public void testDeprecatedIndexRequestBuilderVariant() throws Exception { final String index = "index-req-builder-test-index"; final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStreamSource<Tuple2<Integer, String>> source = env.addSource(new SourceSinkDataTestKit.TestDataSourceFunction()); Map<String, String> userConfig = new HashMap<>(); // This instructs the sink to emit after every element, otherwise they would be buffered userConfig.put(ElasticsearchSinkBase.CONFIG_KEY_BULK_FLUSH_MAX_ACTIONS, "1"); userConfig.put("cluster.name", CLUSTER_NAME); userConfig.put("node.local", "true"); List<TransportAddress> transports = new ArrayList<>(); transports.add(new LocalTransportAddress("1")); source.addSink(new ElasticsearchSink<>( userConfig, transports, new TestIndexRequestBuilder(index)) ); env.execute("Elasticsearch Deprecated IndexRequestBuilder Bridge Test"); // verify the results Client client = embeddedNodeEnv.getClient(); SourceSinkDataTestKit.verifyProducedSinkData(client, index); client.close(); }