SQOOP-3380: parquet-configurator-implementation is not recognized as an option

(Szabolcs Vasas)
diff --git a/src/java/org/apache/sqoop/tool/BaseSqoopTool.java b/src/java/org/apache/sqoop/tool/BaseSqoopTool.java
index b47be72..955d3a6 100644
--- a/src/java/org/apache/sqoop/tool/BaseSqoopTool.java
+++ b/src/java/org/apache/sqoop/tool/BaseSqoopTool.java
@@ -547,6 +547,11 @@
         .hasArg()
         .withArgName("boolean")
         .create());
+    commonOpts.addOption(OptionBuilder
+        .hasArg()
+        .withDescription("The implementation used during Parquet reading/writing")
+        .withLongOpt(PARQUET_CONFIGURATOR_IMPLEMENTATION)
+        .create());
 
     return commonOpts;
   }
diff --git a/src/test/org/apache/sqoop/tool/TestBaseSqoopTool.java b/src/test/org/apache/sqoop/tool/TestBaseSqoopTool.java
index 5571b25..aecfa8b 100644
--- a/src/test/org/apache/sqoop/tool/TestBaseSqoopTool.java
+++ b/src/test/org/apache/sqoop/tool/TestBaseSqoopTool.java
@@ -19,7 +19,9 @@
 package org.apache.sqoop.tool;
 
 import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
 import org.apache.sqoop.SqoopOptions;
+import org.apache.sqoop.cli.RelatedOptions;
 import org.apache.sqoop.mapreduce.parquet.ParquetJobConfiguratorImplementation;
 import org.junit.Before;
 import org.junit.Rule;
@@ -30,11 +32,14 @@
 import static org.apache.sqoop.mapreduce.parquet.ParquetJobConfiguratorImplementation.HADOOP;
 import static org.hamcrest.CoreMatchers.sameInstance;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 public class TestBaseSqoopTool {
 
+  private static final String PARQUET_CONFIGURATOR_IMPLEMENTATION = "parquet-configurator-implementation";
+
   @Rule
   public ExpectedException exception = ExpectedException.none();
 
@@ -80,7 +85,7 @@
   public void testApplyCommonOptionsSetsParquetJobConfigurationImplementationFromCommandLine() throws Exception {
     ParquetJobConfiguratorImplementation expectedValue = HADOOP;
 
-    when(mockCommandLine.getOptionValue("parquet-configurator-implementation")).thenReturn(expectedValue.toString());
+    when(mockCommandLine.getOptionValue(PARQUET_CONFIGURATOR_IMPLEMENTATION)).thenReturn(expectedValue.toString());
 
     testBaseSqoopTool.applyCommonOptions(mockCommandLine, testSqoopOptions);
 
@@ -91,7 +96,7 @@
   public void testApplyCommonOptionsSetsParquetJobConfigurationImplementationFromCommandLineCaseInsensitively() throws Exception {
     String hadoopImplementationLowercase = "haDooP";
 
-    when(mockCommandLine.getOptionValue("parquet-configurator-implementation")).thenReturn(hadoopImplementationLowercase);
+    when(mockCommandLine.getOptionValue(PARQUET_CONFIGURATOR_IMPLEMENTATION)).thenReturn(hadoopImplementationLowercase);
 
     testBaseSqoopTool.applyCommonOptions(mockCommandLine, testSqoopOptions);
 
@@ -112,7 +117,7 @@
   public void testApplyCommonOptionsPrefersParquetJobConfigurationImplementationFromCommandLine() throws Exception {
     ParquetJobConfiguratorImplementation expectedValue = HADOOP;
     testSqoopOptions.getConf().set("parquetjob.configurator.implementation", "kite");
-    when(mockCommandLine.getOptionValue("parquet-configurator-implementation")).thenReturn(expectedValue.toString());
+    when(mockCommandLine.getOptionValue(PARQUET_CONFIGURATOR_IMPLEMENTATION)).thenReturn(expectedValue.toString());
 
     testBaseSqoopTool.applyCommonOptions(mockCommandLine, testSqoopOptions);
 
@@ -121,7 +126,7 @@
 
   @Test
   public void testApplyCommonOptionsThrowsWhenInvalidParquetJobConfigurationImplementationIsSet() throws Exception {
-    when(mockCommandLine.getOptionValue("parquet-configurator-implementation")).thenReturn("this_is_definitely_not_valid");
+    when(mockCommandLine.getOptionValue(PARQUET_CONFIGURATOR_IMPLEMENTATION)).thenReturn("this_is_definitely_not_valid");
 
     exception.expectMessage("Invalid Parquet job configurator implementation is set: this_is_definitely_not_valid. Supported values are: [HADOOP]");
     testBaseSqoopTool.applyCommonOptions(mockCommandLine, testSqoopOptions);
@@ -133,4 +138,19 @@
 
     assertEquals(HADOOP, testSqoopOptions.getParquetConfiguratorImplementation());
   }
+
+  @Test
+  public void testGetCommonOptionsAddsParquetJobConfigurationImplementation() {
+    RelatedOptions commonOptions = testBaseSqoopTool.getCommonOptions();
+
+    assertTrue(commonOptions.hasOption(PARQUET_CONFIGURATOR_IMPLEMENTATION));
+  }
+
+  @Test
+  public void testParquetJobConfigurationImplementationOptionHasAnArg() {
+    RelatedOptions commonOptions = testBaseSqoopTool.getCommonOptions();
+
+    Option implementationOption = commonOptions.getOption(PARQUET_CONFIGURATOR_IMPLEMENTATION);
+    assertTrue(implementationOption.hasArg());
+  }
 }