azagrebin commented on a change in pull request #6735: [FLINK-9126] New 
CassandraPojoInputFormat to output data as a custom annotated Cassandra Pojo
URL: https://github.com/apache/flink/pull/6735#discussion_r219940842
 
 

 ##########
 File path: 
flink-connectors/flink-connector-cassandra/src/test/java/org/apache/flink/streaming/connectors/cassandra/CassandraConnectorITCase.java
 ##########
 @@ -470,6 +472,34 @@ public void testCassandraTableSink() throws Exception {
                Assert.assertTrue("The input data was not completely written to 
Cassandra", input.isEmpty());
        }
 
+       @Test
+       public void testCassandraBatchPojoFormat() throws Exception {
+
+               OutputFormat<Tuple3<String, Integer, Integer>> sink = new 
CassandraTupleOutputFormat<>(injectTableName(INSERT_DATA_QUERY), builder);
+               sink.configure(new Configuration());
+               sink.open(0, 1);
+
+               for (Tuple3<String, Integer, Integer> value : collection) {
+                       sink.writeRecord(value);
+               }
+
+               sink.close();
+
+               InputFormat<CustomCassandraAnnotatedPojo, InputSplit> source = 
new CassandraPojoInputFormat<>(injectTableName(SELECT_DATA_QUERY), builder, 
CustomCassandraAnnotatedPojo.class);
+               source.configure(new Configuration());
+               source.open(null);
+
+               List<CustomCassandraAnnotatedPojo> result = new ArrayList<>();
+
+               while (!source.reachedEnd()) {
+                       CustomCassandraAnnotatedPojo temp = 
source.nextRecord(new CustomCassandraAnnotatedPojo());
+                       result.add(temp);
+               }
+
+               source.close();
+               Assert.assertEquals(20, result.size());
 
 Review comment:
   Can we also convert `collection` of tuples into list of 
`CustomCassandraAnnotatedPojo` and check the contents as well, additionally to 
size?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to