tpalfy commented on a change in pull request #3748: NIFI-6680: Nifi PutKudu 
processor - Convert record field names to low…
URL: https://github.com/apache/nifi/pull/3748#discussion_r326256769
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-kudu-bundle/nifi-kudu-processors/src/test/java/org/apache/nifi/processors/kudu/TestPutKudu.java
 ##########
 @@ -103,6 +103,7 @@ private void setUpTestRunner(TestRunner testRunner) throws 
InitializationExcepti
         testRunner.setProperty(PutKudu.KUDU_MASTERS, DEFAULT_MASTERS);
         testRunner.setProperty(PutKudu.SKIP_HEAD_LINE, SKIP_HEAD_LINE);
         testRunner.setProperty(PutKudu.IGNORE_NULL, "true");
+        testRunner.setProperty(PutKudu.LOWERCASE_FIELD_NAMES, "true");
 
 Review comment:
   Unfortunately the current tests are not capable of verifying the correct 
behaviour regarding this change.
   Wether these settings are omitted or or changed to `"false"` makes no 
difference.
   
   This `setProperty` could be removed (a bit misleading as it doesn't really 
do anything in the current state) and a couple targeted tests could be added, 
something like these:
   ```java
       @Test
       public void testBuildPartialRowWithLowercaseKuduColumn() {
           String kuduColumn = "name";
           final String recordField = "NAME";
   
           boolean lowercaseFields = true;
   
           testBuildPartialRow(kuduColumn, recordField, lowercaseFields);
       }
   
       @Test
       public void testBuildPartialRowWithUppercaseKuduColumn() {
           String kuduColumn = "NAME";
           final String recordField = "NAME";
   
           boolean lowercaseFields = false;
   
           testBuildPartialRow(kuduColumn, recordField, lowercaseFields);
       }
   
       private void testBuildPartialRow(String kuduColumn, String recordField, 
boolean lowercaseFields) {
           // GIVEN
           final Schema kuduSchema = new Schema(Arrays.asList(
                   new ColumnSchema.ColumnSchemaBuilder(kuduColumn, 
Type.STRING).nullable(true).build()
           ));
   
           final RecordSchema schema = new SimpleRecordSchema(Arrays.asList(
                   new RecordField(recordField, 
RecordFieldType.STRING.getDataType())
           ));
   
           Map<String, Object> values = new HashMap<>() {{
               put(recordField, "foo");
           }};
   
           PartialRow row = kuduSchema.newPartialRow();
           
           // WHEN
           processor.buildPartialRow(
                   kuduSchema,
                   row,
                   new MapRecord(schema, values),
                   schema.getFieldNames(),
                   true,
                   lowercaseFields
           );
   
           // THEN
           assertEquals("foo", row.getString(kuduColumn));
       }
   ```

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


With regards,
Apache Git Services

Reply via email to