This is an automated email from the ASF dual-hosted git repository. granthenke pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 0a555961c6dfa672bfc2d90d4fb26d0bff21c299 Author: Grant Henke <[email protected]> AuthorDate: Mon Nov 25 11:59:31 2019 -0600 [java] Fix remaining checkstyle warnings This patch fixes all of the checkstlyle warnings reported by: ./gradlew :checkstyle I also included some trivial style changes and suppression annotations. A follow on patch will enforce confoming to checkstyle rules in the pre-commit build. Change-Id: I90d317b24c45b2cba069be0c7289751203194f98 Reviewed-on: http://gerrit.cloudera.org:8080/14795 Tested-by: Kudu Jenkins Reviewed-by: Alexey Serbin <[email protected]> --- .../scala/org/apache/kudu/backup/BackupGraph.scala | 1 + .../scala/org/apache/kudu/backup/BackupIO.scala | 2 +- .../org/apache/kudu/backup/TableMetadata.scala | 1 + .../org/apache/kudu/backup/TestBackupGraph.scala | 1 + .../org/apache/kudu/backup/KuduBackupCLI.scala | 1 + .../org/apache/kudu/backup/KuduBackupCleaner.scala | 1 + .../org/apache/kudu/backup/KuduBackupLister.scala | 1 + .../apache/kudu/backup/TestKuduBackupCleaner.scala | 1 + .../apache/kudu/backup/TestKuduBackupLister.scala | 1 + .../scala/org/apache/kudu/backup/TestUtils.scala | 1 + .../scala/org/apache/kudu/backup/BackupUtils.scala | 1 + .../scala/org/apache/kudu/backup/KuduBackup.scala | 1 + .../org/apache/kudu/backup/KuduBackupRDD.scala | 1 + .../scala/org/apache/kudu/backup/KuduRestore.scala | 1 + .../scala/org/apache/kudu/backup/Options.scala | 1 + .../scala/org/apache/kudu/backup/RowAction.java | 5 +- .../kudu/mapreduce/tools/BigLinkedListCommon.java | 5 +- .../org/apache/kudu/mapreduce/tools/CsvParser.java | 2 +- .../org/apache/kudu/mapreduce/tools/ImportCsv.java | 2 +- .../apache/kudu/mapreduce/tools/ImportParquet.java | 6 +- .../tools/IntegrationTestBigLinkedList.java | 57 ++++++++------- .../apache/kudu/mapreduce/tools/RowCounter.java | 2 +- .../apache/kudu/mapreduce/tools/ITExportCsv.java | 6 +- .../apache/kudu/mapreduce/tools/ITImportCsv.java | 8 +-- .../kudu/mapreduce/tools/ITImportParquet.java | 79 +++++++++++++-------- .../mapreduce/tools/ITImportParquetPreCheck.java | 67 +++++++++++------- .../tools/ITIntegrationTestBigLinkedList.java | 2 +- .../apache/kudu/mapreduce/tools/ITRowCounter.java | 5 +- .../hive/metastore/TestKuduMetastorePlugin.java | 15 ++-- .../java/org/apache/kudu/mapreduce/JarFinder.java | 4 +- .../kudu/mapreduce/KuduTableInputFormat.java | 3 +- .../kudu/mapreduce/KuduTableMapReduceUtil.java | 5 +- .../kudu/mapreduce/HadoopTestingUtility.java | 35 +++++----- .../apache/kudu/mapreduce/ITInputFormatJob.java | 7 +- .../kudu/mapreduce/ITKuduTableInputFormat.java | 11 +-- .../kudu/mapreduce/ITKuduTableOutputFormat.java | 6 +- .../apache/kudu/mapreduce/ITOutputFormatJob.java | 6 +- .../org/apache/kudu/mapreduce/TestJarFinder.java | 13 ++-- .../spark/tools/DistributedDataGenerator.scala | 1 + .../spark/tools/DistributedDataGeneratorTest.scala | 1 + .../org/apache/kudu/spark/kudu/DefaultSource.scala | 32 ++++----- .../kudu/spark/kudu/HdrHistogramAccumulator.scala | 32 ++++----- .../org/apache/kudu/spark/kudu/KuduContext.scala | 32 ++++----- .../scala/org/apache/kudu/spark/kudu/KuduRDD.scala | 33 ++++----- .../apache/kudu/spark/kudu/KuduReadOptions.scala | 32 ++++----- .../apache/kudu/spark/kudu/KuduWriteOptions.scala | 32 ++++----- .../org/apache/kudu/spark/kudu/OperationType.scala | 32 ++++----- .../org/apache/kudu/spark/kudu/RowConverter.scala | 33 ++++----- .../scala/org/apache/kudu/spark/kudu/package.scala | 33 ++++----- .../apache/kudu/spark/kudu/DefaultSourceTest.scala | 33 ++++----- .../apache/kudu/spark/kudu/KuduContextTest.scala | 33 ++++----- .../org/apache/kudu/spark/kudu/KuduRDDTest.scala | 32 ++++----- .../org/apache/kudu/spark/kudu/KuduTestSuite.scala | 33 ++++----- .../apache/kudu/spark/kudu/SparkListenerUtil.scala | 33 ++++----- .../org/apache/kudu/spark/kudu/SparkSQLTest.scala | 33 ++++----- .../org/apache/kudu/spark/kudu/StreamingTest.scala | 33 ++++----- .../org/apache/kudu/test/CapturingLogAppender.java | 1 + .../kudu/test/CapturingToFileLogAppender.java | 5 +- .../java/org/apache/kudu/test/ClientTestUtil.java | 80 ++++++++++++---------- .../java/org/apache/kudu/test/KuduTestHarness.java | 38 +++++----- .../java/org/apache/kudu/test/ProtobufUtils.java | 1 + .../java/org/apache/kudu/test/RandomUtils.java | 8 ++- .../java/org/apache/kudu/test/TempDirUtils.java | 16 +++-- .../java/org/apache/kudu/test/cluster/FakeDNS.java | 10 ++- .../apache/kudu/test/cluster/KuduBinaryInfo.java | 9 ++- .../kudu/test/cluster/KuduBinaryJarExtractor.java | 18 ++--- .../kudu/test/cluster/KuduBinaryLocator.java | 25 ++++--- .../apache/kudu/test/cluster/MiniKuduCluster.java | 11 +-- .../org/apache/kudu/test/junit/AssertHelpers.java | 9 ++- .../org/apache/kudu/test/junit/ResultReporter.java | 19 +++-- .../java/org/apache/kudu/test/junit/RetryRule.java | 24 ++++--- .../kudu/test/TestCapturingToFileLogAppender.java | 59 ++++++++-------- .../org/apache/kudu/test/TestMiniKuduCluster.java | 37 +++++----- .../apache/kudu/test/junit/TestResultReporter.java | 38 +++++----- .../org/apache/kudu/test/junit/TestRetryRule.java | 5 +- 75 files changed, 713 insertions(+), 590 deletions(-) diff --git a/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/BackupGraph.scala b/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/BackupGraph.scala index 6e0ecaf..5758d1c 100644 --- a/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/BackupGraph.scala +++ b/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/BackupGraph.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import org.apache.hadoop.fs.Path diff --git a/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/BackupIO.scala b/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/BackupIO.scala index 7807132..f5c2dfd 100644 --- a/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/BackupIO.scala +++ b/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/BackupIO.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import java.io.InputStreamReader @@ -28,7 +29,6 @@ import org.apache.hadoop.fs.LocatedFileStatus import org.apache.hadoop.fs.Path import org.apache.kudu.backup.Backup.TableMetadataPB import org.apache.kudu.backup.BackupIO._ -import org.apache.kudu.client.KuduTable import org.apache.yetus.audience.InterfaceAudience import org.apache.yetus.audience.InterfaceStability import org.slf4j.Logger diff --git a/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/TableMetadata.scala b/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/TableMetadata.scala index 8bff6a1..1d1f6d7 100644 --- a/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/TableMetadata.scala +++ b/java/kudu-backup-common/src/main/scala/org/apache/kudu/backup/TableMetadata.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import java.math.BigDecimal diff --git a/java/kudu-backup-common/src/test/scala/org/apache/kudu/backup/TestBackupGraph.scala b/java/kudu-backup-common/src/test/scala/org/apache/kudu/backup/TestBackupGraph.scala index 314a063..ff4bd93 100644 --- a/java/kudu-backup-common/src/test/scala/org/apache/kudu/backup/TestBackupGraph.scala +++ b/java/kudu-backup-common/src/test/scala/org/apache/kudu/backup/TestBackupGraph.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import com.google.common.collect.ImmutableList diff --git a/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupCLI.scala b/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupCLI.scala index 4ac95ea..a29fb90 100644 --- a/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupCLI.scala +++ b/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupCLI.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import java.time.Duration diff --git a/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupCleaner.scala b/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupCleaner.scala index 7d7d3ff..1c0f43a 100644 --- a/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupCleaner.scala +++ b/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupCleaner.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import java.time.Instant diff --git a/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupLister.scala b/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupLister.scala index 94ac3f7..8303da9 100644 --- a/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupLister.scala +++ b/java/kudu-backup-tools/src/main/scala/org/apache/kudu/backup/KuduBackupLister.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import java.text.SimpleDateFormat diff --git a/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestKuduBackupCleaner.scala b/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestKuduBackupCleaner.scala index 1362532..9585147 100644 --- a/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestKuduBackupCleaner.scala +++ b/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestKuduBackupCleaner.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import java.io.File diff --git a/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestKuduBackupLister.scala b/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestKuduBackupLister.scala index 9740434..4802e66 100644 --- a/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestKuduBackupLister.scala +++ b/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestKuduBackupLister.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import java.io.ByteArrayOutputStream diff --git a/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestUtils.scala b/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestUtils.scala index 8bc754a..f681791 100644 --- a/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestUtils.scala +++ b/java/kudu-backup-tools/src/test/scala/org/apache/kudu/backup/TestUtils.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import org.apache.hadoop.fs.Path diff --git a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/BackupUtils.scala b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/BackupUtils.scala index 4b1def6..3224fa9 100644 --- a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/BackupUtils.scala +++ b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/BackupUtils.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import org.apache.kudu.Schema diff --git a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduBackup.scala b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduBackup.scala index 91092a0..f881c38 100644 --- a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduBackup.scala +++ b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduBackup.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import scala.concurrent.forkjoin.ForkJoinPool diff --git a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduBackupRDD.scala b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduBackupRDD.scala index e15ee42..459faed 100644 --- a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduBackupRDD.scala +++ b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduBackupRDD.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import java.util.concurrent.TimeUnit diff --git a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduRestore.scala b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduRestore.scala index 2d3f1a0..684ad3e 100644 --- a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduRestore.scala +++ b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/KuduRestore.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import org.apache.kudu.backup.Backup.TableMetadataPB diff --git a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/Options.scala b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/Options.scala index 1a8b3b9..8edab5d 100644 --- a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/Options.scala +++ b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/Options.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup import java.net.InetAddress diff --git a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/RowAction.java b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/RowAction.java index 54bf7ae..1d66dfc 100644 --- a/java/kudu-backup/src/main/scala/org/apache/kudu/backup/RowAction.java +++ b/java/kudu-backup/src/main/scala/org/apache/kudu/backup/RowAction.java @@ -14,14 +14,15 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.backup; +import java.util.Map; + import com.google.common.collect.ImmutableMap; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; -import java.util.Map; - /** * A RowAction is used to represent the action associated with a backed up row. * diff --git a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/BigLinkedListCommon.java b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/BigLinkedListCommon.java index d748b5c..9929594 100644 --- a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/BigLinkedListCommon.java +++ b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/BigLinkedListCommon.java @@ -128,7 +128,7 @@ public class BigLinkedListCommon { options.addSplitRow(splitRow); } } else { - options.setRangePartitionColumns(Collections.<String>emptyList()); + options.setRangePartitionColumns(Collections.emptyList()); } if (hashPartitions > 1) { @@ -188,5 +188,6 @@ public class BigLinkedListCommon { } /** Uninstantiable helper class. */ - private BigLinkedListCommon() {} + private BigLinkedListCommon() { + } } \ No newline at end of file diff --git a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/CsvParser.java b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/CsvParser.java index 6b1682b..1fadfdc 100644 --- a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/CsvParser.java +++ b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/CsvParser.java @@ -68,7 +68,7 @@ public class CsvParser { */ public ParsedLine parse(byte[] lineBytes, int length) throws BadCsvLineException { // Enumerate separator offsets - List<Integer> tabOffsets = new ArrayList<Integer>(maxColumnCount); + List<Integer> tabOffsets = new ArrayList<>(maxColumnCount); for (int i = 0; i < length; i++) { if (lineBytes[i] == separatorByte) { tabOffsets.add(i); diff --git a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/ImportCsv.java b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/ImportCsv.java index e4a445f..63c6340 100644 --- a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/ImportCsv.java +++ b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/ImportCsv.java @@ -40,7 +40,7 @@ import org.apache.kudu.mapreduce.KuduTableMapReduceUtil; @InterfaceStability.Unstable public class ImportCsv extends Configured implements Tool { - public static enum Counters { BAD_LINES } + public enum Counters { BAD_LINES } static final String NAME = "importcsv"; static final String DEFAULT_SEPARATOR = "\t"; diff --git a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/ImportParquet.java b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/ImportParquet.java index 386a5a1..485fbda 100644 --- a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/ImportParquet.java +++ b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/ImportParquet.java @@ -73,8 +73,7 @@ public class ImportParquet extends Configured implements Tool { final String tableName = args[0]; Path inputDir = new Path(args[1]); - List<Footer> footers = new ArrayList<Footer>(); - footers.addAll(ParquetFileReader.readFooters(conf, inputDir)); + List<Footer> footers = new ArrayList<>(ParquetFileReader.readFooters(conf, inputDir)); MessageType schema = footers.get(0).getParquetMetadata().getFileMetaData().getSchema(); GroupWriteSupport.setSchema(schema, conf); @@ -112,8 +111,7 @@ public class ImportParquet extends Configured implements Tool { while (fields.hasNext()) { ColumnDescriptor colDesc = fields.next(); if (colDesc.getType().equals(PrimitiveTypeName.INT96)) { - throw new IllegalArgumentException("Column type not supported in Kudu: " - + colDesc); + throw new IllegalArgumentException("Column type not supported in Kudu: " + colDesc); } } diff --git a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/IntegrationTestBigLinkedList.java b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/IntegrationTestBigLinkedList.java index 07c20d6..164f97d 100644 --- a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/IntegrationTestBigLinkedList.java +++ b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/IntegrationTestBigLinkedList.java @@ -406,7 +406,7 @@ public class IntegrationTestBigLinkedList extends Configured implements Tool { private byte[][] current = null; private String id; private long rowId = 0; - private int i; + private int position; private KuduClient client; private KuduTable table; private KuduSession session; @@ -447,11 +447,11 @@ public class IntegrationTestBigLinkedList extends Configured implements Tool { @Override protected void map(BytesWritable key, NullWritable value, Context output) throws IOException { - current[i] = new byte[key.getLength()]; - System.arraycopy(key.getBytes(), 0, current[i], 0, key.getLength()); - if (++i == current.length) { + current[position] = new byte[key.getLength()]; + System.arraycopy(key.getBytes(), 0, current[position], 0, key.getLength()); + if (++position == current.length) { persist(output, current, false); - i = 0; + position = 0; // Keep track of the first row so that we can point to it at the end. if (first == null) { @@ -1327,9 +1327,8 @@ public class IntegrationTestBigLinkedList extends Configured implements Tool { } } - /** - * A stand alone program that deletes a single node. - * TODO + /* + * TODO: A stand alone program that deletes a single node. */ /*private static class Delete extends Configured implements Tool { @Override @@ -1525,24 +1524,30 @@ public class IntegrationTestBigLinkedList extends Configured implements Tool { public int run(String[] args) throws Exception { Tool tool; processOptions(args); - if (toRun.equals("Generator")) { - tool = new Generator(); - } else if (toRun.equals("Verify")) { - tool = new Verify(); - } else if (toRun.equals("Loop")) { - Loop loop = new Loop(); - loop.it = this; - tool = loop; - - } else if (toRun.equals("Print")) { - tool = new Print(); - } else if (toRun.equals("Update")) { - tool = new Updater(); - } else if (toRun.equals("Walker")) { - tool = new Walker(); - } else { - usage(); - throw new RuntimeException("Unknown arg"); + switch (toRun) { + case "Generator": + tool = new Generator(); + break; + case "Verify": + tool = new Verify(); + break; + case "Loop": + Loop loop = new Loop(); + loop.it = this; + tool = loop; + break; + case "Print": + tool = new Print(); + break; + case "Update": + tool = new Updater(); + break; + case "Walker": + tool = new Walker(); + break; + default: + usage(); + throw new RuntimeException("Unknown arg"); } return ToolRunner.run(getConf(), tool, otherArgs); diff --git a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/RowCounter.java b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/RowCounter.java index 84bcb9a..0db188b 100644 --- a/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/RowCounter.java +++ b/java/kudu-client-tools/src/main/java/org/apache/kudu/mapreduce/tools/RowCounter.java @@ -45,7 +45,7 @@ public class RowCounter extends Configured implements Tool { static final String COLUMN_PROJECTION_KEY = "rowcounter.column.projection"; /** Counter enumeration to count the actual rows. */ - public static enum Counters { ROWS } + public enum Counters { ROWS } /** * Simple row counter diff --git a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITExportCsv.java b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITExportCsv.java index 3bdda0d..cb4fd97 100644 --- a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITExportCsv.java +++ b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITExportCsv.java @@ -30,18 +30,18 @@ import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.util.GenericOptionsParser; -import org.apache.kudu.test.KuduTestHarness; import org.junit.After; import org.junit.Rule; import org.junit.Test; import org.apache.kudu.mapreduce.CommandLineParser; import org.apache.kudu.mapreduce.HadoopTestingUtility; +import org.apache.kudu.test.KuduTestHarness; public class ITExportCsv { private static final String TABLE_NAME = - ITExportCsv.class.getName() + "-" + System.currentTimeMillis(); + ITExportCsv.class.getName() + "-" + System.currentTimeMillis(); private static final HadoopTestingUtility HADOOP_UTIL = new HadoopTestingUtility(); @@ -57,7 +57,7 @@ public class ITExportCsv { public void test() throws Exception { Configuration conf = new Configuration(); String testHome = - HADOOP_UTIL.setupAndGetTestDir(ITExportCsv.class.getName(), conf).getAbsolutePath(); + HADOOP_UTIL.setupAndGetTestDir(ITExportCsv.class.getName(), conf).getAbsolutePath(); // create a table with on empty tablet and 3 tablets of 3 rows each. createFourTabletsTableWithNineRows(harness.getAsyncClient(), TABLE_NAME, DEFAULT_SLEEP); diff --git a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportCsv.java b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportCsv.java index b39f799..e5da77e 100644 --- a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportCsv.java +++ b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportCsv.java @@ -17,9 +17,9 @@ package org.apache.kudu.mapreduce.tools; +import static java.nio.charset.StandardCharsets.UTF_8; import static org.apache.kudu.test.ClientTestUtil.countRowsInScan; import static org.apache.kudu.test.ClientTestUtil.scanTableToStrings; -import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -32,7 +32,6 @@ import com.google.common.collect.ImmutableList; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.util.GenericOptionsParser; -import org.apache.kudu.test.KuduTestHarness; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -41,10 +40,11 @@ import org.junit.Test; import org.apache.kudu.ColumnSchema; import org.apache.kudu.Schema; import org.apache.kudu.Type; -import org.apache.kudu.client.KuduTable; import org.apache.kudu.client.CreateTableOptions; +import org.apache.kudu.client.KuduTable; import org.apache.kudu.mapreduce.CommandLineParser; import org.apache.kudu.mapreduce.HadoopTestingUtility; +import org.apache.kudu.test.KuduTestHarness; public class ITImportCsv { @@ -114,7 +114,7 @@ public class ITImportCsv { assertEquals(1, job.getCounters().findCounter(ImportCsv.Counters.BAD_LINES).getValue()); assertEquals(3, countRowsInScan(harness.getAsyncClient().newScannerBuilder(openTable).build())); assertEquals("INT32 key=1, INT32 column1_i=3, DOUBLE column2_d=2.3, STRING column3_s=some " + - "string, BOOL column4_b=true", scanTableToStrings(openTable).get(0)); + "string, BOOL column4_b=true", scanTableToStrings(openTable).get(0)); } private void writeCsvFile(File data) throws IOException { diff --git a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportParquet.java b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportParquet.java index a5752f9..01ddab1 100644 --- a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportParquet.java +++ b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportParquet.java @@ -32,8 +32,6 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.util.GenericOptionsParser; -import org.apache.kudu.client.KuduTable; -import org.apache.kudu.test.KuduTestHarness; import org.apache.parquet.column.ParquetProperties; import org.apache.parquet.example.data.Group; import org.apache.parquet.example.data.simple.SimpleGroupFactory; @@ -49,20 +47,22 @@ import org.apache.kudu.ColumnSchema; import org.apache.kudu.Schema; import org.apache.kudu.Type; import org.apache.kudu.client.CreateTableOptions; +import org.apache.kudu.client.KuduTable; import org.apache.kudu.mapreduce.CommandLineParser; import org.apache.kudu.mapreduce.HadoopTestingUtility; +import org.apache.kudu.test.KuduTestHarness; public class ITImportParquet { private static final String TABLE_NAME = - ITImportParquet.class.getName() + "-" + System.currentTimeMillis(); + ITImportParquet.class.getName() + "-" + System.currentTimeMillis(); private static final HadoopTestingUtility HADOOP_UTIL = new HadoopTestingUtility(); private static Schema schema; static { - ArrayList<ColumnSchema> columns = new ArrayList<ColumnSchema>(4); + ArrayList<ColumnSchema> columns = new ArrayList<>(4); columns.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.INT32) .key(true) .build()); @@ -84,7 +84,7 @@ public class ITImportParquet { @Before public void setUp() throws Exception { harness.getClient().createTable(TABLE_NAME, schema, - new CreateTableOptions().setRangePartitionColumns(ImmutableList.of("key"))); + new CreateTableOptions().setRangePartitionColumns(ImmutableList.of("key"))); } @After @@ -96,48 +96,67 @@ public class ITImportParquet { public void test() throws Exception { Configuration conf = new Configuration(); String testHome = - HADOOP_UTIL.setupAndGetTestDir(ITImportCsv.class.getName(), conf).getAbsolutePath(); + HADOOP_UTIL.setupAndGetTestDir(ITImportCsv.class.getName(), conf).getAbsolutePath(); // Create a 4 records parquet input file. Path data = new Path(testHome, "data.parquet"); writeParquetFile(data,conf); - String[] args = new String[] { "-D" + CommandLineParser.MASTER_ADDRESSES_KEY + "=" - + harness.getMasterAddressesAsString(), TABLE_NAME, data.toString()}; + String[] args = new String[] { "-D" + CommandLineParser.MASTER_ADDRESSES_KEY + "=" + + harness.getMasterAddressesAsString(), TABLE_NAME, data.toString()}; GenericOptionsParser parser = new GenericOptionsParser(conf, args); - Job job = ImportParquet.createSubmittableJob(parser.getConfiguration(), parser.getRemainingArgs()); + Job job = + ImportParquet.createSubmittableJob(parser.getConfiguration(), parser.getRemainingArgs()); assertTrue("Test job did not end properly", job.waitForCompletion(true)); KuduTable openTable = harness.getClient().openTable(TABLE_NAME); assertEquals(4, countRowsInScan( - harness.getAsyncClient().newScannerBuilder(openTable).build())); - assertEquals("INT32 key=1, INT32 column1_i=3, DOUBLE column2_d=2.3, STRING column3_s=some string, " + - "BOOL column4_b=true",scanTableToStrings(openTable).get(0)); + harness.getAsyncClient().newScannerBuilder(openTable).build())); + assertEquals("INT32 key=1, INT32 column1_i=3, DOUBLE column2_d=2.3, " + + "STRING column3_s=some string, BOOL column4_b=true", scanTableToStrings(openTable).get(0)); } + @SuppressWarnings("deprecation") private void writeParquetFile(Path data,Configuration conf) throws IOException { MessageType schema = parseMessageType( - "message test { " - + "required int32 key; " - + "required int32 column1_i; " - + "required double column2_d; " - + "required binary column3_s; " - + "required boolean column4_b; " - + "} "); + "message test { " + + "required int32 key; " + + "required int32 column1_i; " + + "required double column2_d; " + + "required binary column3_s; " + + "required boolean column4_b; " + + "} "); GroupWriteSupport.setSchema(schema, conf); SimpleGroupFactory f = new SimpleGroupFactory(schema); - ParquetWriter<Group> writer = new ParquetWriter<Group>(data, new GroupWriteSupport(), - UNCOMPRESSED, 1024, 1024, 512, true, false, ParquetProperties.WriterVersion.PARQUET_1_0, conf); - - writer.write(f.newGroup().append("key", 1).append("column1_i", 3).append("column2_d", 2.3) - .append("column3_s", "some string").append("column4_b", true)); - writer.write(f.newGroup().append("key", 2).append("column1_i", 5).append("column2_d", 4.5) - .append("column3_s", "some more").append("column4_b", false)); - writer.write(f.newGroup().append("key", 3).append("column1_i", 7).append("column2_d", 5.6) - .append("column3_s", "some more and more").append("column4_b", true)); - writer.write(f.newGroup().append("key", 4).append("column1_i", 9).append("column2_d",10.9) - .append("column3_s", "some more and alst").append("column4_b", false)); + ParquetWriter<Group> writer = new ParquetWriter<>(data, new GroupWriteSupport(), + UNCOMPRESSED, 1024, 1024, 512, true, false, + ParquetProperties.WriterVersion.PARQUET_1_0, conf); + + writer.write(f.newGroup() + .append("key", 1) + .append("column1_i", 3) + .append("column2_d", 2.3) + .append("column3_s", "some string") + .append("column4_b", true)); + writer.write(f.newGroup() + .append("key", 2) + .append("column1_i", 5) + .append("column2_d", 4.5) + .append("column3_s", "some more") + .append("column4_b", false)); + writer.write(f.newGroup() + .append("key", 3) + .append("column1_i", 7) + .append("column2_d", 5.6) + .append("column3_s", "some more and more") + .append("column4_b", true)); + writer.write(f.newGroup() + .append("key", 4) + .append("column1_i", 9) + .append("column2_d",10.9) + .append("column3_s", "some more and alst") + .append("column4_b", false)); writer.close(); } } \ No newline at end of file diff --git a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportParquetPreCheck.java b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportParquetPreCheck.java index 8120f8a..e617f8c 100644 --- a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportParquetPreCheck.java +++ b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITImportParquetPreCheck.java @@ -30,8 +30,6 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.util.GenericOptionsParser; -import org.apache.kudu.client.KuduTable; -import org.apache.kudu.test.KuduTestHarness; import org.apache.parquet.column.ParquetProperties; import org.apache.parquet.example.data.Group; import org.apache.parquet.example.data.simple.SimpleGroupFactory; @@ -49,20 +47,22 @@ import org.apache.kudu.ColumnSchema; import org.apache.kudu.Schema; import org.apache.kudu.Type; import org.apache.kudu.client.CreateTableOptions; +import org.apache.kudu.client.KuduTable; import org.apache.kudu.mapreduce.CommandLineParser; import org.apache.kudu.mapreduce.HadoopTestingUtility; +import org.apache.kudu.test.KuduTestHarness; public class ITImportParquetPreCheck { private static final String TABLE_NAME = - ITImportParquet.class.getName() + "-" + System.currentTimeMillis(); + ITImportParquet.class.getName() + "-" + System.currentTimeMillis(); private static final HadoopTestingUtility HADOOP_UTIL = new HadoopTestingUtility(); private static Schema schema; static { - ArrayList<ColumnSchema> columns = new ArrayList<ColumnSchema>(4); + ArrayList<ColumnSchema> columns = new ArrayList<>(4); columns.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.INT32) .key(true) .build()); @@ -91,7 +91,7 @@ public class ITImportParquetPreCheck { @Before public void setUp() throws Exception { harness.getClient().createTable(TABLE_NAME, schema, - new CreateTableOptions().setRangePartitionColumns(ImmutableList.of("key"))); + new CreateTableOptions().setRangePartitionColumns(ImmutableList.of("key"))); } @After @@ -103,7 +103,7 @@ public class ITImportParquetPreCheck { public void test() throws Exception { Configuration conf = new Configuration(); String testHome = - HADOOP_UTIL.setupAndGetTestDir(ITImportCsv.class.getName(), conf).getAbsolutePath(); + HADOOP_UTIL.setupAndGetTestDir(ITImportCsv.class.getName(), conf).getAbsolutePath(); // Create a 4 records parquet input file. Path data = new Path(testHome, "data.parquet"); @@ -116,35 +116,52 @@ public class ITImportParquetPreCheck { thrown.expectMessage("The column column1_i does not exist in Parquet schema"); GenericOptionsParser parser = new GenericOptionsParser(conf, args); - Job job = ImportParquet.createSubmittableJob(parser.getConfiguration(), parser.getRemainingArgs()); + Job job = + ImportParquet.createSubmittableJob(parser.getConfiguration(), parser.getRemainingArgs()); job.waitForCompletion(true); KuduTable openTable = harness.getClient().openTable(TABLE_NAME); assertEquals(0, countRowsInScan(harness.getAsyncClient().newScannerBuilder(openTable).build())); } + @SuppressWarnings("deprecation") private void writeParquetFile(Path data,Configuration conf) throws IOException { MessageType schema = parseMessageType( - "message test { " - + "required int32 key; " - + "required int32 column1_i_s; " - + "required binary column2_d; " - + "required binary column3_s; " - + "required boolean column4_b; " - + "} "); + "message test { " + + "required int32 key; " + + "required int32 column1_i_s; " + + "required binary column2_d; " + + "required binary column3_s; " + + "required boolean column4_b; " + + "} "); GroupWriteSupport.setSchema(schema, conf); SimpleGroupFactory f = new SimpleGroupFactory(schema); - ParquetWriter<Group> writer = new ParquetWriter<Group>(data, new GroupWriteSupport(), - UNCOMPRESSED, 1024, 1024, 512, true, false, ParquetProperties.WriterVersion.PARQUET_1_0, conf); - - writer.write(f.newGroup().append("key", 1).append("column1_i_s", 292).append("column2_d", "no type") - .append("column3_s", "some string").append("column4_b", true)); - writer.write(f.newGroup().append("key", 2).append("column1_i_s", 23).append("column2_d", "no type") - .append("column3_s", "some more").append("column4_b", false)); - writer.write(f.newGroup().append("key", 3).append("column1_i_s", 32).append("column2_d", "no type") - .append("column3_s", "some more and more").append("column4_b", true)); - writer.write(f.newGroup().append("key", 4).append("column1_i_s", 22).append("column2_d", "no type") - .append("column3_s", "some more and alst").append("column4_b", false)); + ParquetWriter<Group> writer = new ParquetWriter<>(data, new GroupWriteSupport(), + UNCOMPRESSED, 1024, 1024, 512, true, false, + ParquetProperties.WriterVersion.PARQUET_1_0, conf); + + writer.write(f.newGroup().append("key", 1) + .append("column1_i_s", 292) + .append("column2_d", "no type") + .append("column3_s", "some string") + .append("column4_b", true)); + writer.write(f.newGroup().append("key", 2) + .append("column1_i_s", 23) + .append("column2_d", "no type") + .append("column3_s", "some more") + .append("column4_b", false)); + writer.write(f.newGroup() + .append("key", 3) + .append("column1_i_s", 32) + .append("column2_d", "no type") + .append("column3_s", "some more and more") + .append("column4_b", true)); + writer.write(f.newGroup() + .append("key", 4) + .append("column1_i_s", 22) + .append("column2_d", "no type") + .append("column3_s", "some more and alst") + .append("column4_b", false)); writer.close(); } } diff --git a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITIntegrationTestBigLinkedList.java b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITIntegrationTestBigLinkedList.java index 1e72403..19a9e32 100644 --- a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITIntegrationTestBigLinkedList.java +++ b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITIntegrationTestBigLinkedList.java @@ -19,7 +19,6 @@ package org.apache.kudu.mapreduce.tools; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.ToolRunner; -import org.apache.kudu.test.KuduTestHarness; import org.junit.After; import org.junit.Assert; import org.junit.Rule; @@ -27,6 +26,7 @@ import org.junit.Test; import org.apache.kudu.mapreduce.CommandLineParser; import org.apache.kudu.mapreduce.HadoopTestingUtility; +import org.apache.kudu.test.KuduTestHarness; public class ITIntegrationTestBigLinkedList { diff --git a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITRowCounter.java b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITRowCounter.java index 789c47d..e148c20 100644 --- a/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITRowCounter.java +++ b/java/kudu-client-tools/src/test/java/org/apache/kudu/mapreduce/tools/ITRowCounter.java @@ -25,13 +25,13 @@ import static org.junit.Assert.assertTrue; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.util.GenericOptionsParser; -import org.apache.kudu.test.KuduTestHarness; import org.junit.After; import org.junit.Rule; import org.junit.Test; import org.apache.kudu.mapreduce.CommandLineParser; import org.apache.kudu.mapreduce.HadoopTestingUtility; +import org.apache.kudu.test.KuduTestHarness; public class ITRowCounter { @@ -56,7 +56,8 @@ public class ITRowCounter { createFourTabletsTableWithNineRows(harness.getAsyncClient(), TABLE_NAME, DEFAULT_SLEEP); String[] args = new String[] { - "-D" + CommandLineParser.MASTER_ADDRESSES_KEY + "=" + harness.getMasterAddressesAsString(), TABLE_NAME}; + "-D" + CommandLineParser.MASTER_ADDRESSES_KEY + "=" + harness.getMasterAddressesAsString(), + TABLE_NAME}; GenericOptionsParser parser = new GenericOptionsParser(conf, args); Job job = RowCounter.createSubmittableJob(parser.getConfiguration(), parser.getRemainingArgs()); assertTrue("Job did not end properly", job.waitForCompletion(true)); diff --git a/java/kudu-hive/src/test/java/org/apache/kudu/hive/metastore/TestKuduMetastorePlugin.java b/java/kudu-hive/src/test/java/org/apache/kudu/hive/metastore/TestKuduMetastorePlugin.java index 07553b8..2dc358a 100644 --- a/java/kudu-hive/src/test/java/org/apache/kudu/hive/metastore/TestKuduMetastorePlugin.java +++ b/java/kudu-hive/src/test/java/org/apache/kudu/hive/metastore/TestKuduMetastorePlugin.java @@ -39,7 +39,6 @@ import org.apache.hadoop.hive.metastore.api.SerDeInfo; import org.apache.hadoop.hive.metastore.api.StorageDescriptor; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; -import org.apache.kudu.test.junit.RetryRule; import org.apache.thrift.TException; import org.junit.After; import org.junit.Before; @@ -48,6 +47,8 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.kudu.test.junit.RetryRule; + public class TestKuduMetastorePlugin { private static final Logger LOG = LoggerFactory.getLogger(TestKuduMetastorePlugin.class); @@ -288,8 +289,7 @@ public class TestKuduMetastorePlugin { client.alter_table(table.getDbName(), table.getTableName(), alteredTable); fail(); } catch (TException e) { - assertTrue(e.getMessage().contains( - "Kudu table type may not be altered")); + assertTrue(e.getMessage().contains("Kudu table type may not be altered")); } // Alter the Kudu table to a different type by setting the external property fails. @@ -299,8 +299,7 @@ public class TestKuduMetastorePlugin { client.alter_table(table.getDbName(), table.getTableName(), alteredTable); fail(); } catch (TException e) { - assertTrue(e.getMessage().contains( - "Kudu table type may not be altered")); + assertTrue(e.getMessage().contains("Kudu table type may not be altered")); } // Alter the Kudu table to the same type by setting the table property works. @@ -332,8 +331,7 @@ public class TestKuduMetastorePlugin { client.alter_table(table.getDbName(), table.getTableName(), alteredTable); fail(); } catch (TException e) { - assertTrue(e.getMessage().contains( - "Kudu table type may not be altered")); + assertTrue(e.getMessage().contains("Kudu table type may not be altered")); } // Alter the Kudu table to an external type with the master context succeeds. @@ -352,8 +350,7 @@ public class TestKuduMetastorePlugin { client.alter_table(table.getDbName(), table.getTableName(), table); fail(); } catch (TException e) { - assertTrue(e.getMessage().contains( - "Kudu table columns may not be altered through Hive")); + assertTrue(e.getMessage().contains("Kudu table columns may not be altered through Hive")); } // Check that adding a column succeeds with the master event property set. diff --git a/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/JarFinder.java b/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/JarFinder.java index 89ea0a7..f71011c 100644 --- a/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/JarFinder.java +++ b/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/JarFinder.java @@ -100,8 +100,8 @@ public class JarFinder { if (dirList == null) { throw new RuntimeException("Could not list directory: " + dir); } - for (String aDirList : dirList) { - File f = new File(dir, aDirList); + for (String childDir : dirList) { + File f = new File(dir, childDir); if (!f.isHidden()) { if (f.isDirectory()) { if (!start) { diff --git a/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableInputFormat.java b/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableInputFormat.java index de0ca8c..a79f1a6 100644 --- a/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableInputFormat.java +++ b/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableInputFormat.java @@ -307,7 +307,8 @@ public class KuduTableInputFormat extends InputFormat<NullWritable, RowResult> /** Tablet server locations which host the tablet to be scanned. */ private String[] locations; - public TableSplit() { } // Writable + public TableSplit() { + } // Writable public TableSplit(KuduScanToken token, String[] locations) throws IOException { this.scanToken = token.serialize(); diff --git a/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableMapReduceUtil.java b/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableMapReduceUtil.java index da4cb11..2f6a55e 100644 --- a/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableMapReduceUtil.java +++ b/java/kudu-mapreduce/src/main/java/org/apache/kudu/mapreduce/KuduTableMapReduceUtil.java @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.mapreduce; import java.io.IOException; @@ -61,7 +62,6 @@ import org.apache.kudu.client.Operation; */ @InterfaceAudience.Public @InterfaceStability.Evolving -@SuppressWarnings("deprecation") public class KuduTableMapReduceUtil { // Mostly lifted from HBase's TableMapReduceUtil @@ -78,7 +78,8 @@ public class KuduTableMapReduceUtil { /** * Doesn't need instantiation */ - private KuduTableMapReduceUtil() { } + private KuduTableMapReduceUtil() { + } /** diff --git a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/HadoopTestingUtility.java b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/HadoopTestingUtility.java index e550325..a5fe77a 100644 --- a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/HadoopTestingUtility.java +++ b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/HadoopTestingUtility.java @@ -1,21 +1,20 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.mapreduce; import java.io.File; diff --git a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITInputFormatJob.java b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITInputFormatJob.java index 608c678..747573a 100644 --- a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITInputFormatJob.java +++ b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITInputFormatJob.java @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.mapreduce; import static org.apache.kudu.test.ClientTestUtil.createFourTabletsTableWithNineRows; @@ -30,17 +31,17 @@ import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.lib.output.NullOutputFormat; -import org.apache.kudu.Schema; -import org.apache.kudu.test.ClientTestUtil; -import org.apache.kudu.test.KuduTestHarness; import org.junit.After; import org.junit.Rule; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.kudu.Schema; import org.apache.kudu.client.KuduPredicate; import org.apache.kudu.client.RowResult; +import org.apache.kudu.test.ClientTestUtil; +import org.apache.kudu.test.KuduTestHarness; public class ITInputFormatJob { private static final Logger LOG = LoggerFactory.getLogger(ITInputFormatJob.class); diff --git a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITKuduTableInputFormat.java b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITKuduTableInputFormat.java index 7aa4c6d..c213c5e 100644 --- a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITKuduTableInputFormat.java +++ b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITKuduTableInputFormat.java @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.mapreduce; import static org.apache.kudu.test.ClientTestUtil.getBasicCreateTableOptions; @@ -33,7 +34,6 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.mapreduce.InputSplit; import org.apache.hadoop.mapreduce.RecordReader; -import org.apache.kudu.test.KuduTestHarness; import org.junit.Rule; import org.junit.Test; @@ -44,6 +44,7 @@ import org.apache.kudu.client.KuduPredicate; import org.apache.kudu.client.KuduTable; import org.apache.kudu.client.PartialRow; import org.apache.kudu.client.RowResult; +import org.apache.kudu.test.KuduTestHarness; public class ITKuduTableInputFormat { @@ -57,9 +58,9 @@ public class ITKuduTableInputFormat { public void test() throws Exception { harness.getClient().createTable(TABLE_NAME, getBasicSchema(), getBasicCreateTableOptions()); - KuduTable table = harness.getClient().openTable(TABLE_NAME); - Schema schema = getBasicSchema(); - Insert insert = table.newInsert(); + final KuduTable table = harness.getClient().openTable(TABLE_NAME); + final Schema schema = getBasicSchema(); + final Insert insert = table.newInsert(); PartialRow row = insert.getRow(); row.addInt(0, 1); row.addInt(1, 2); @@ -125,7 +126,6 @@ public class ITKuduTableInputFormat { private RecordReader<NullWritable, RowResult> createRecordReader(String columnProjection, List<KuduPredicate> predicates) throws IOException, InterruptedException { - KuduTableInputFormat input = new KuduTableInputFormat(); Configuration conf = new Configuration(); conf.set(KuduTableInputFormat.MASTER_ADDRESSES_KEY, harness.getMasterAddressesAsString()); conf.set(KuduTableInputFormat.INPUT_TABLE_KEY, TABLE_NAME); @@ -136,6 +136,7 @@ public class ITKuduTableInputFormat { String encodedPredicates = KuduTableMapReduceUtil.base64EncodePredicates(predicates); conf.set(KuduTableInputFormat.ENCODED_PREDICATES_KEY, encodedPredicates); } + KuduTableInputFormat input = new KuduTableInputFormat(); input.setConf(conf); List<InputSplit> splits = input.getSplits(null); diff --git a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITKuduTableOutputFormat.java b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITKuduTableOutputFormat.java index 2719ebf..b581a60 100644 --- a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITKuduTableOutputFormat.java +++ b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITKuduTableOutputFormat.java @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.mapreduce; import static org.apache.kudu.test.ClientTestUtil.countRowsInScan; @@ -25,7 +26,6 @@ import static org.junit.Assert.assertNotNull; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.mapreduce.RecordWriter; -import org.apache.kudu.test.KuduTestHarness; import org.junit.Rule; import org.junit.Test; @@ -34,6 +34,7 @@ import org.apache.kudu.client.Insert; import org.apache.kudu.client.KuduTable; import org.apache.kudu.client.Operation; import org.apache.kudu.client.PartialRow; +import org.apache.kudu.test.KuduTestHarness; public class ITKuduTableOutputFormat { @@ -68,7 +69,8 @@ public class ITKuduTableOutputFormat { RecordWriter<NullWritable, Operation> rw = output.getRecordWriter(null); rw.write(NullWritable.get(), insert); rw.close(null); - AsyncKuduScanner.AsyncKuduScannerBuilder builder = harness.getAsyncClient().newScannerBuilder(table); + AsyncKuduScanner.AsyncKuduScannerBuilder builder = + harness.getAsyncClient().newScannerBuilder(table); assertEquals(1, countRowsInScan(builder.build())); } } diff --git a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITOutputFormatJob.java b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITOutputFormatJob.java index 742ae57..d18ae7d 100644 --- a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITOutputFormatJob.java +++ b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/ITOutputFormatJob.java @@ -14,13 +14,14 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.mapreduce; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.apache.kudu.test.KuduTestHarness.DEFAULT_SLEEP; import static org.apache.kudu.test.ClientTestUtil.countRowsInScan; import static org.apache.kudu.test.ClientTestUtil.getBasicCreateTableOptions; import static org.apache.kudu.test.ClientTestUtil.getBasicSchema; +import static org.apache.kudu.test.KuduTestHarness.DEFAULT_SLEEP; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -36,7 +37,6 @@ import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; -import org.apache.kudu.test.KuduTestHarness; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -47,6 +47,7 @@ import org.apache.kudu.client.Insert; import org.apache.kudu.client.KuduTable; import org.apache.kudu.client.Operation; import org.apache.kudu.client.PartialRow; +import org.apache.kudu.test.KuduTestHarness; public class ITOutputFormatJob { @@ -114,6 +115,7 @@ public class ITOutputFormatJob { Mapper<LongWritable, Text, NullWritable, Operation> { private KuduTable table; + @Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { diff --git a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/TestJarFinder.java b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/TestJarFinder.java index 50c7443..b63f61b 100644 --- a/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/TestJarFinder.java +++ b/java/kudu-mapreduce/src/test/java/org/apache/kudu/mapreduce/TestJarFinder.java @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.mapreduce; import static java.nio.charset.StandardCharsets.UTF_8; @@ -80,8 +81,7 @@ public class TestJarFinder { @Test public void testExistingManifest() throws Exception { - File dir = new File(testDir, - TestJarFinder.class.getName() + "-testExistingManifest"); + File dir = new File(testDir, TestJarFinder.class.getName() + "-testExistingManifest"); File metaInfDir = new File(dir, "META-INF"); Assert.assertTrue(metaInfDir.mkdirs()); File manifestFile = new File(metaInfDir, "MANIFEST.MF"); @@ -98,16 +98,14 @@ public class TestJarFinder { ByteArrayOutputStream baos = new ByteArrayOutputStream(); JarOutputStream zos = new JarOutputStream(baos); JarFinder.jarDir(dir, "", zos); - JarInputStream jis = - new JarInputStream(new ByteArrayInputStream(baos.toByteArray())); + JarInputStream jis = new JarInputStream(new ByteArrayInputStream(baos.toByteArray())); Assert.assertNotNull(jis.getManifest()); jis.close(); } @Test public void testNoManifest() throws Exception { - File dir = new File(testDir, - TestJarFinder.class.getName() + "-testNoManifest"); + File dir = new File(testDir, TestJarFinder.class.getName() + "-testNoManifest"); Assert.assertTrue(dir.mkdirs()); File propsFile = new File(dir, "props.properties"); Writer writer = Files.newBufferedWriter(propsFile.toPath(), UTF_8); @@ -116,8 +114,7 @@ public class TestJarFinder { ByteArrayOutputStream baos = new ByteArrayOutputStream(); JarOutputStream zos = new JarOutputStream(baos); JarFinder.jarDir(dir, "", zos); - JarInputStream jis = - new JarInputStream(new ByteArrayInputStream(baos.toByteArray())); + JarInputStream jis = new JarInputStream(new ByteArrayInputStream(baos.toByteArray())); Assert.assertNotNull(jis.getManifest()); jis.close(); } diff --git a/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/DistributedDataGenerator.scala b/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/DistributedDataGenerator.scala index d5a0938..6f8a664 100644 --- a/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/DistributedDataGenerator.scala +++ b/java/kudu-spark-tools/src/main/scala/org/apache/kudu/spark/tools/DistributedDataGenerator.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.spark.tools import java.math.BigDecimal diff --git a/java/kudu-spark-tools/src/test/scala/org/apache/kudu/spark/tools/DistributedDataGeneratorTest.scala b/java/kudu-spark-tools/src/test/scala/org/apache/kudu/spark/tools/DistributedDataGeneratorTest.scala index f794e4a..4c7bd46 100644 --- a/java/kudu-spark-tools/src/test/scala/org/apache/kudu/spark/tools/DistributedDataGeneratorTest.scala +++ b/java/kudu-spark-tools/src/test/scala/org/apache/kudu/spark/tools/DistributedDataGeneratorTest.scala @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.spark.tools import org.apache.kudu.Type diff --git a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/DefaultSource.scala b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/DefaultSource.scala index 907a4d5..b7f5634 100644 --- a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/DefaultSource.scala +++ b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/DefaultSource.scala @@ -1,19 +1,19 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. package org.apache.kudu.spark.kudu diff --git a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/HdrHistogramAccumulator.scala b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/HdrHistogramAccumulator.scala index c68b30d..e42db5f 100644 --- a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/HdrHistogramAccumulator.scala +++ b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/HdrHistogramAccumulator.scala @@ -1,19 +1,19 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. package org.apache.kudu.spark.kudu diff --git a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduContext.scala b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduContext.scala index c3d426d..5a23862 100644 --- a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduContext.scala +++ b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduContext.scala @@ -1,19 +1,19 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. package org.apache.kudu.spark.kudu diff --git a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduRDD.scala b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduRDD.scala index ca57f13..798f80c 100644 --- a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduRDD.scala +++ b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduRDD.scala @@ -1,19 +1,20 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.spark.kudu import scala.collection.JavaConverters._ diff --git a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduReadOptions.scala b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduReadOptions.scala index afe2084..8796131 100644 --- a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduReadOptions.scala +++ b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduReadOptions.scala @@ -1,19 +1,19 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. package org.apache.kudu.spark.kudu diff --git a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduWriteOptions.scala b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduWriteOptions.scala index 24d4fad..abe491c 100644 --- a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduWriteOptions.scala +++ b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/KuduWriteOptions.scala @@ -1,19 +1,19 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. package org.apache.kudu.spark.kudu diff --git a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/OperationType.scala b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/OperationType.scala index 5312305..63d7807 100644 --- a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/OperationType.scala +++ b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/OperationType.scala @@ -1,19 +1,19 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. package org.apache.kudu.spark.kudu diff --git a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/RowConverter.scala b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/RowConverter.scala index 0863bae..03a5f74 100644 --- a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/RowConverter.scala +++ b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/RowConverter.scala @@ -1,19 +1,20 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.spark.kudu import org.apache.kudu.Schema diff --git a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/package.scala b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/package.scala index b949062..5b4546b 100755 --- a/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/package.scala +++ b/java/kudu-spark/src/main/scala/org/apache/kudu/spark/kudu/package.scala @@ -1,19 +1,20 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.spark import org.apache.spark.sql.DataFrame diff --git a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/DefaultSourceTest.scala b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/DefaultSourceTest.scala index b2226e5..43cb10b 100644 --- a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/DefaultSourceTest.scala +++ b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/DefaultSourceTest.scala @@ -1,19 +1,20 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.spark.kudu import scala.collection.JavaConverters._ diff --git a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduContextTest.scala b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduContextTest.scala index 80cbbb2..aa5c5e8 100644 --- a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduContextTest.scala +++ b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduContextTest.scala @@ -1,19 +1,20 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.spark.kudu import java.io.ByteArrayInputStream diff --git a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduRDDTest.scala b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduRDDTest.scala index 1904f95..88404eb 100644 --- a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduRDDTest.scala +++ b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduRDDTest.scala @@ -1,19 +1,19 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. package org.apache.kudu.spark.kudu diff --git a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduTestSuite.scala b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduTestSuite.scala index 46293db..b45ef0b 100644 --- a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduTestSuite.scala +++ b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/KuduTestSuite.scala @@ -1,19 +1,20 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.spark.kudu import java.math.BigDecimal diff --git a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/SparkListenerUtil.scala b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/SparkListenerUtil.scala index b6b4209..7221efe 100644 --- a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/SparkListenerUtil.scala +++ b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/SparkListenerUtil.scala @@ -1,19 +1,20 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.spark.kudu import org.apache.kudu.test.junit.AssertHelpers diff --git a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/SparkSQLTest.scala b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/SparkSQLTest.scala index e4982e3..92ad869 100644 --- a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/SparkSQLTest.scala +++ b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/SparkSQLTest.scala @@ -1,19 +1,20 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.spark.kudu import scala.collection.JavaConverters._ diff --git a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/StreamingTest.scala b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/StreamingTest.scala index feb3579..e6b5c55 100644 --- a/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/StreamingTest.scala +++ b/java/kudu-spark/src/test/scala/org/apache/kudu/spark/kudu/StreamingTest.scala @@ -1,19 +1,20 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.spark.kudu import org.apache.spark.sql.SQLContext diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/CapturingLogAppender.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/CapturingLogAppender.java index 87224b0..541ffdd 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/CapturingLogAppender.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/CapturingLogAppender.java @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test; import java.io.Closeable; diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/CapturingToFileLogAppender.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/CapturingToFileLogAppender.java index f71497a..6f3da24 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/CapturingToFileLogAppender.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/CapturingToFileLogAppender.java @@ -14,8 +14,11 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test; +import static java.nio.charset.StandardCharsets.UTF_8; + import java.io.BufferedWriter; import java.io.Closeable; import java.io.File; @@ -36,8 +39,6 @@ import org.apache.logging.log4j.core.layout.PatternLayout; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; -import static java.nio.charset.StandardCharsets.UTF_8; - /** * Test utility which wraps Log4j and captures all messages logged while * attached, storing them in an (optionally gzipped) temporary file. diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/ClientTestUtil.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/ClientTestUtil.java index 363e9eb..e57dbf8 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/ClientTestUtil.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/ClientTestUtil.java @@ -17,11 +17,27 @@ package org.apache.kudu.test; +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.math.BigDecimal; +import java.nio.ByteBuffer; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.stumbleupon.async.Callback; import com.stumbleupon.async.Deferred; +import org.apache.yetus.audience.InterfaceAudience; +import org.apache.yetus.audience.InterfaceStability; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.apache.kudu.ColumnSchema; import org.apache.kudu.ColumnTypeAttributes; import org.apache.kudu.Schema; @@ -44,21 +60,6 @@ import org.apache.kudu.client.RowResultIterator; import org.apache.kudu.client.Upsert; import org.apache.kudu.util.CharUtil; import org.apache.kudu.util.DecimalUtil; -import org.apache.yetus.audience.InterfaceAudience; -import org.apache.yetus.audience.InterfaceStability; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.math.BigDecimal; -import java.nio.ByteBuffer; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.junit.Assert.assertEquals; /** * Utilities useful for cluster testing. @@ -94,7 +95,9 @@ public abstract class ClientTestUtil { Callback<Object, RowResultIterator> cb = new Callback<Object, RowResultIterator>() { @Override public Object call(RowResultIterator arg) throws Exception { - if (arg == null) return null; + if (arg == null) { + return null; + } counter.addAndGet(arg.getNumRows()); return null; } @@ -130,13 +133,14 @@ public abstract class ClientTestUtil { * @param predicates optional predicates to apply to the scan * @return the number of rows in the table matching the predicates */ - public static long countRowsInTable(KuduTable table, KuduPredicate... predicates) throws KuduException { + public static long countRowsInTable(KuduTable table, KuduPredicate... predicates) + throws KuduException { KuduScanner.KuduScannerBuilder scanBuilder = table.getAsyncClient().syncClient().newScannerBuilder(table); for (KuduPredicate predicate : predicates) { scanBuilder.addPredicate(predicate); } - scanBuilder.setProjectedColumnIndexes(ImmutableList.<Integer>of()); + scanBuilder.setProjectedColumnIndexes(ImmutableList.of()); return countRowsInScan(scanBuilder.build()); } @@ -156,7 +160,8 @@ public abstract class ClientTestUtil { try (KuduClient contextClient = new KuduClient.KuduClientBuilder(masterAddresses) .defaultAdminOperationTimeoutMs(operationTimeoutMs) .build()) { - KuduScanner scanner = KuduScanToken.deserializeIntoScanner(serializedToken, contextClient); + KuduScanner scanner = + KuduScanToken.deserializeIntoScanner(serializedToken, contextClient); try { int localCount = 0; while (scanner.hasMoreRows()) { @@ -280,17 +285,17 @@ public abstract class ClientTestUtil { CreateTableOptions option = new CreateTableOptions(); option.setRangePartitionColumns(ImmutableList.of("key")); - PartialRow aLowerBound = schema.newPartialRow(); - aLowerBound.addInt("key", 0); - PartialRow aUpperBound = schema.newPartialRow(); - aUpperBound.addInt("key", 100); - option.addRangePartition(aLowerBound, aUpperBound); + PartialRow lowerBoundA = schema.newPartialRow(); + lowerBoundA.addInt("key", 0); + PartialRow upperBoundA = schema.newPartialRow(); + upperBoundA.addInt("key", 100); + option.addRangePartition(lowerBoundA, upperBoundA); - PartialRow bLowerBound = schema.newPartialRow(); - bLowerBound.addInt("key", 200); - PartialRow bUpperBound = schema.newPartialRow(); - bUpperBound.addInt("key", 300); - option.addRangePartition(bLowerBound, bUpperBound); + PartialRow lowerBoundB = schema.newPartialRow(); + lowerBoundB.addInt("key", 200); + PartialRow upperBoundB = schema.newPartialRow(); + upperBoundB.addInt("key", 300); + option.addRangePartition(lowerBoundB, upperBoundB); PartialRow split = schema.newPartialRow(); split.addInt("key", 50); @@ -301,7 +306,8 @@ public abstract class ClientTestUtil { /** * A generic helper function to create a table with default test options. */ - public static KuduTable createDefaultTable(KuduClient client, String tableName) throws KuduException { + public static KuduTable createDefaultTable(KuduClient client, String tableName) + throws KuduException { return client.createTable(tableName, getBasicSchema(), getBasicCreateTableOptions()); } @@ -432,7 +438,7 @@ public abstract class ClientTestUtil { } public static Schema createManyStringsSchema() { - ArrayList<ColumnSchema> columns = new ArrayList<ColumnSchema>(4); + ArrayList<ColumnSchema> columns = new ArrayList<>(4); columns.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.STRING).key(true).build()); columns.add(new ColumnSchema.ColumnSchemaBuilder("c1", Type.STRING).build()); columns.add(new ColumnSchema.ColumnSchemaBuilder("c2", Type.STRING).build()); @@ -442,7 +448,7 @@ public abstract class ClientTestUtil { } public static Schema createSchemaWithBinaryColumns() { - ArrayList<ColumnSchema> columns = new ArrayList<ColumnSchema>(); + ArrayList<ColumnSchema> columns = new ArrayList<>(); columns.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.BINARY).key(true).build()); columns.add(new ColumnSchema.ColumnSchemaBuilder("c1", Type.STRING).build()); columns.add(new ColumnSchema.ColumnSchemaBuilder("c2", Type.DOUBLE).build()); @@ -451,14 +457,16 @@ public abstract class ClientTestUtil { } public static Schema createSchemaWithTimestampColumns() { - ArrayList<ColumnSchema> columns = new ArrayList<ColumnSchema>(); - columns.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.UNIXTIME_MICROS).key(true).build()); - columns.add(new ColumnSchema.ColumnSchemaBuilder("c1", Type.UNIXTIME_MICROS).nullable(true).build()); + ArrayList<ColumnSchema> columns = new ArrayList<>(); + columns.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.UNIXTIME_MICROS) + .key(true).build()); + columns.add(new ColumnSchema.ColumnSchemaBuilder("c1", Type.UNIXTIME_MICROS) + .nullable(true).build()); return new Schema(columns); } public static Schema createSchemaWithDecimalColumns() { - ArrayList<ColumnSchema> columns = new ArrayList<ColumnSchema>(); + ArrayList<ColumnSchema> columns = new ArrayList<>(); columns.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.DECIMAL).key(true) .typeAttributes( new ColumnTypeAttributes.ColumnTypeAttributesBuilder() diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java index dba80aa..beb377f 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java @@ -14,8 +14,27 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.List; +import java.util.Random; + +import org.apache.yetus.audience.InterfaceAudience; +import org.apache.yetus.audience.InterfaceStability; +import org.junit.rules.ExternalResource; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.apache.kudu.client.AsyncKuduClient; import org.apache.kudu.client.AsyncKuduClient.AsyncKuduClientBuilder; import org.apache.kudu.client.HostAndPort; @@ -25,27 +44,10 @@ import org.apache.kudu.client.KuduTable; import org.apache.kudu.client.LocatedTablet; import org.apache.kudu.client.RemoteTablet; import org.apache.kudu.client.TimeoutTracker; +import org.apache.kudu.test.cluster.FakeDNS; import org.apache.kudu.test.cluster.MiniKuduCluster; import org.apache.kudu.test.cluster.MiniKuduCluster.MiniKuduClusterBuilder; -import org.apache.kudu.test.cluster.FakeDNS; import org.apache.kudu.test.junit.RetryRule; -import org.apache.yetus.audience.InterfaceAudience; -import org.apache.yetus.audience.InterfaceStability; -import org.junit.rules.ExternalResource; -import org.junit.runner.Description; -import org.junit.runners.model.Statement; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.util.List; -import java.util.Random; - -import static org.junit.Assert.fail; /** * A Junit Rule that manages a Kudu cluster and clients for testing. diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/ProtobufUtils.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/ProtobufUtils.java index ee3cb0d..862439a 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/ProtobufUtils.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/ProtobufUtils.java @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test; import com.google.protobuf.ByteString; diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/RandomUtils.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/RandomUtils.java index a6490df..4888539 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/RandomUtils.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/RandomUtils.java @@ -14,16 +14,17 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test; +import java.util.Random; + import com.google.common.base.Preconditions; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Random; - @InterfaceAudience.Private @InterfaceStability.Unstable public class RandomUtils { @@ -42,7 +43,8 @@ public class RandomUtils { long seed = System.currentTimeMillis(); if (System.getProperty(TEST_RANDOM_SEED_PROP) != null) { seed = Long.parseLong(System.getProperty(TEST_RANDOM_SEED_PROP)); - LOG.info("System property {} is defined. Overriding random seed.", TEST_RANDOM_SEED_PROP, seed); + LOG.info("System property {} is defined. Overriding random seed: {}", + TEST_RANDOM_SEED_PROP, seed); } LOG.info("Using random seed: {}", seed); return new Random(seed); diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/TempDirUtils.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/TempDirUtils.java index 75d5add..9524dea 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/TempDirUtils.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/TempDirUtils.java @@ -17,18 +17,18 @@ package org.apache.kudu.test; -import org.apache.commons.io.FileUtils; -import org.apache.yetus.audience.InterfaceAudience; -import org.apache.yetus.audience.InterfaceStability; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import org.apache.commons.io.FileUtils; +import org.apache.yetus.audience.InterfaceAudience; +import org.apache.yetus.audience.InterfaceStability; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * Utilities for retrieving and creating temp directories. */ @@ -89,7 +89,9 @@ public class TempDirUtils { @Override public void run() { File dir = absPath.toFile(); - if (!dir.exists()) return; + if (!dir.exists()) { + return; + } try { FileUtils.deleteDirectory(dir); } catch (IOException exc) { diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/FakeDNS.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/FakeDNS.java index ca0fcbd..0c37f7d 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/FakeDNS.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/FakeDNS.java @@ -62,7 +62,9 @@ public class FakeDNS { @GuardedBy("this") private boolean installed = false; - private FakeDNS() {} + private FakeDNS() { + } + public static FakeDNS getInstance() { return instance; } @@ -79,7 +81,9 @@ public class FakeDNS { * Install the fake DNS resolver into the Java runtime. */ public synchronized void install() { - if (installed) return; + if (installed) { + return; + } try { try { // Override the NameService in Java 9 or later. @@ -135,7 +139,7 @@ public class FakeDNS { private InetAddress[] lookupAllHostAddr(String host) throws UnknownHostException { InetAddress inetAddress; - synchronized(FakeDNS.this) { + synchronized (FakeDNS.this) { inetAddress = forwardResolutions.get(host); } if (inetAddress != null) { diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryInfo.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryInfo.java index a8f3d9a..8294e33 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryInfo.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryInfo.java @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test.cluster; import org.apache.yetus.audience.InterfaceAudience; @@ -40,11 +41,15 @@ public class KuduBinaryInfo { /** * Return the binary directory of an extracted artifact. */ - public String getBinDir() { return binDir; } + public String getBinDir() { + return binDir; + } /** * Return the SASL module directory of an extracted artifact. * May be {@code null} if unknown. */ - public String getSaslDir() { return saslDir; } + public String getSaslDir() { + return saslDir; + } } diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryJarExtractor.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryJarExtractor.java index e062724..e34ea66 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryJarExtractor.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryJarExtractor.java @@ -17,13 +17,6 @@ package org.apache.kudu.test.cluster; -import com.google.common.base.Preconditions; -import com.google.gradle.osdetector.OsDetector; -import org.apache.yetus.audience.InterfaceAudience; -import org.apache.yetus.audience.InterfaceStability; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.FileNotFoundException; import java.io.IOException; import java.net.URI; @@ -45,6 +38,13 @@ import java.util.Map; import java.util.Properties; import java.util.Set; +import com.google.common.base.Preconditions; +import com.google.gradle.osdetector.OsDetector; +import org.apache.yetus.audience.InterfaceAudience; +import org.apache.yetus.audience.InterfaceStability; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * Class to find and extract Kudu binary jars from the classpath */ @@ -60,7 +60,9 @@ public class KuduBinaryJarExtractor { /** Return the thread context classloader or the parent classloader for this class. */ private static ClassLoader getCurrentClassLoader() { ClassLoader loader = Thread.currentThread().getContextClassLoader(); - if (loader != null) return loader; + if (loader != null) { + return loader; + } return KuduBinaryJarExtractor.class.getClassLoader(); } diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryLocator.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryLocator.java index b88798a..9627e6e 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryLocator.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/KuduBinaryLocator.java @@ -17,13 +17,7 @@ package org.apache.kudu.test.cluster; -import com.google.common.base.Preconditions; -import com.google.common.io.CharStreams; -import org.apache.kudu.test.TempDirUtils; -import org.apache.yetus.audience.InterfaceAudience; -import org.apache.yetus.audience.InterfaceStability; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static java.nio.charset.StandardCharsets.UTF_8; import java.io.File; import java.io.FileNotFoundException; @@ -33,7 +27,14 @@ import java.io.Reader; import java.util.HashMap; import java.util.Map; -import static java.nio.charset.StandardCharsets.UTF_8; +import com.google.common.base.Preconditions; +import com.google.common.io.CharStreams; +import org.apache.yetus.audience.InterfaceAudience; +import org.apache.yetus.audience.InterfaceStability; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.kudu.test.TempDirUtils; @InterfaceAudience.Private @InterfaceStability.Unstable @@ -57,10 +58,14 @@ public class KuduBinaryLocator { } /** Path to the executable. */ - public String exePath() { return exePath; } + public String exePath() { + return exePath; + } /** Any environment variables that should be set when running the executable. */ - public Map<String, String> environment() { return env; } + public Map<String, String> environment() { + return env; + } } /** diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/MiniKuduCluster.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/MiniKuduCluster.java index a61a78c..a1e1d8a 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/MiniKuduCluster.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/cluster/MiniKuduCluster.java @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test.cluster; import static java.nio.charset.StandardCharsets.UTF_8; @@ -35,6 +36,10 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import org.apache.yetus.audience.InterfaceAudience; +import org.apache.yetus.audience.InterfaceStability; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.apache.kudu.Common; import org.apache.kudu.client.HostAndPort; @@ -43,8 +48,8 @@ import org.apache.kudu.test.KuduTestHarness; import org.apache.kudu.test.TempDirUtils; import org.apache.kudu.tools.Tool.ControlShellRequestPB; import org.apache.kudu.tools.Tool.ControlShellResponsePB; -import org.apache.kudu.tools.Tool.CreateClusterRequestPB.MiniKdcOptionsPB; import org.apache.kudu.tools.Tool.CreateClusterRequestPB; +import org.apache.kudu.tools.Tool.CreateClusterRequestPB.MiniKdcOptionsPB; import org.apache.kudu.tools.Tool.DaemonIdentifierPB; import org.apache.kudu.tools.Tool.DaemonInfoPB; import org.apache.kudu.tools.Tool.GetKDCEnvVarsRequestPB; @@ -57,10 +62,6 @@ import org.apache.kudu.tools.Tool.StartClusterRequestPB; import org.apache.kudu.tools.Tool.StartDaemonRequestPB; import org.apache.kudu.tools.Tool.StopDaemonRequestPB; import org.apache.kudu.util.SecurityUtil; -import org.apache.yetus.audience.InterfaceAudience; -import org.apache.yetus.audience.InterfaceStability; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Utility class to start and manipulate Kudu clusters. Depends on precompiled diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/AssertHelpers.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/AssertHelpers.java index 9fc2c0c..b4250da 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/AssertHelpers.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/AssertHelpers.java @@ -14,13 +14,14 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test.junit; +import static org.junit.Assert.assertTrue; + import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; -import static org.junit.Assert.assertTrue; - @InterfaceAudience.Private @InterfaceStability.Unstable public class AssertHelpers { @@ -37,7 +38,9 @@ public class AssertHelpers { do { success = expression.get(); - if (success) break; + if (success) { + break; + } Thread.sleep(50); // Sleep for 50ms } while (System.nanoTime() < deadlineNanos); diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/ResultReporter.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/ResultReporter.java index 483b6ca..c16a07a 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/ResultReporter.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/ResultReporter.java @@ -14,12 +14,14 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test.junit; +import static java.nio.charset.StandardCharsets.UTF_8; + import java.io.BufferedReader; import java.io.File; import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; @@ -27,20 +29,18 @@ import java.util.List; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import org.apache.http.StatusLine; -import org.apache.http.util.EntityUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static java.nio.charset.StandardCharsets.UTF_8; - /** Class to report test results to the flaky test server. */ @InterfaceAudience.Private @InterfaceStability.Unstable @@ -62,22 +62,27 @@ public class ResultReporter { this.reportResults = reportResults; return this; } + public Options httpEndpoint(String httpEndpoint) { this.httpEndpoint = httpEndpoint; return this; } + public Options buildTag(String buildTag) { this.buildTag = buildTag; return this; } + public Options revision(String revision) { this.revision = revision; return this; } + public Options hostname(String hostname) { this.hostname = hostname; return this; } + public Options buildConfig(String buildConfig) { this.buildConfig = buildConfig; return this; @@ -195,10 +200,12 @@ public class ResultReporter { */ public void reportResult(String testName, Result result, File logFile) throws IOException { - if (!options.reportResults) return; + if (!options.reportResults) { + return; + } try (CloseableHttpClient client = HttpClients.createDefault()) { - HttpPost post = new HttpPost("http://" + options.httpEndpoint + "/add_result"); + final HttpPost post = new HttpPost("http://" + options.httpEndpoint + "/add_result"); // Set up the request with all form parts. MultipartEntityBuilder meb = MultipartEntityBuilder.create(); diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/RetryRule.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/RetryRule.java index d420150..17a9413 100644 --- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/RetryRule.java +++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/junit/RetryRule.java @@ -14,19 +14,11 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test.junit; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; +import static java.nio.charset.StandardCharsets.UTF_8; -import org.apache.kudu.test.CapturingToFileLogAppender; -import org.apache.yetus.audience.InterfaceAudience; -import org.apache.yetus.audience.InterfaceStability; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.Statement; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.Closeable; import java.io.File; @@ -36,7 +28,17 @@ import java.nio.file.Paths; import java.util.HashSet; import java.util.Set; -import static java.nio.charset.StandardCharsets.UTF_8; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import org.apache.yetus.audience.InterfaceAudience; +import org.apache.yetus.audience.InterfaceStability; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.kudu.test.CapturingToFileLogAppender; /** * JUnit rule to retry failed tests. diff --git a/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestCapturingToFileLogAppender.java b/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestCapturingToFileLogAppender.java index b511bfd..2c76c5b 100644 --- a/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestCapturingToFileLogAppender.java +++ b/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestCapturingToFileLogAppender.java @@ -1,44 +1,47 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. See accompanying LICENSE file. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.test; import static java.nio.charset.StandardCharsets.UTF_8; - import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import com.google.common.base.Joiner; - -import org.apache.kudu.test.junit.RetryRule; -import org.junit.Rule; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.BufferedReader; import java.io.Closeable; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.IOException; import java.io.Reader; import java.util.ArrayList; import java.util.List; import java.util.zip.GZIPInputStream; +import com.google.common.base.Joiner; +import org.junit.Rule; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.kudu.test.junit.RetryRule; + public class TestCapturingToFileLogAppender { private static final Logger LOG = LoggerFactory.getLogger(TestCapturingToFileLogAppender.class); @@ -49,11 +52,11 @@ public class TestCapturingToFileLogAppender { public RetryRule retryRule = new RetryRule(); private String readAllFromBufferedReader(BufferedReader br) throws IOException { - List<String> output = new ArrayList<>(); - for (String line = br.readLine(); line != null; line = br.readLine()) { - output.add(line); - } - return Joiner.on("\n").join(output); + List<String> output = new ArrayList<>(); + for (String line = br.readLine(); line != null; line = br.readLine()) { + output.add(line); + } + return Joiner.on("\n").join(output); } private String readAllFromFile(File fileName) throws IOException { diff --git a/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestMiniKuduCluster.java b/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestMiniKuduCluster.java index 63cf68b..d86c1a3 100644 --- a/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestMiniKuduCluster.java +++ b/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestMiniKuduCluster.java @@ -1,16 +1,20 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. See accompanying LICENSE file. - */ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package org.apache.kudu.test; import static org.junit.Assert.assertEquals; @@ -22,16 +26,17 @@ import static org.junit.Assert.fail; import java.io.IOException; import java.net.Socket; +import org.junit.Rule; +import org.junit.Test; + import org.apache.kudu.client.HostAndPort; import org.apache.kudu.client.KuduClient; import org.apache.kudu.client.KuduClient.KuduClientBuilder; import org.apache.kudu.client.ListTablesResponse; import org.apache.kudu.client.TimeoutTracker; +import org.apache.kudu.test.cluster.FakeDNS; import org.apache.kudu.test.cluster.MiniKuduCluster; import org.apache.kudu.test.junit.RetryRule; -import org.apache.kudu.test.cluster.FakeDNS; -import org.junit.Rule; -import org.junit.Test; public class TestMiniKuduCluster { diff --git a/java/kudu-test-utils/src/test/java/org/apache/kudu/test/junit/TestResultReporter.java b/java/kudu-test-utils/src/test/java/org/apache/kudu/test/junit/TestResultReporter.java index 7028d40..3d96c8b 100644 --- a/java/kudu-test-utils/src/test/java/org/apache/kudu/test/junit/TestResultReporter.java +++ b/java/kudu-test-utils/src/test/java/org/apache/kudu/test/junit/TestResultReporter.java @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test.junit; import static java.nio.charset.StandardCharsets.UTF_8; @@ -21,23 +22,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import org.apache.commons.io.IOUtils; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.MultipartConfigElement; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.Part; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -47,9 +31,25 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import javax.servlet.MultipartConfigElement; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.Part; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; +import org.apache.commons.io.IOUtils; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** Unit test for ResultReporter. */ public class TestResultReporter { @@ -101,7 +101,7 @@ public class TestResultReporter { private static class MockFlakyTestServlet extends HttpServlet { private static final Logger LOG = LoggerFactory.getLogger(MockFlakyTestServlet.class); private static final long serialVersionUID = 1L; - private transient final List<TestRecord> records = new ArrayList<>(); + private final transient List<TestRecord> records = new ArrayList<>(); List<TestRecord> getRecords() { return records; @@ -155,7 +155,7 @@ public class TestResultReporter { @Test public void testRoundTrip() throws IOException { - ResultReporter.Options options = new ResultReporter.Options(); + final ResultReporter.Options options = new ResultReporter.Options(); assertNotNull(server); assertTrue(server.isStarted()); assertNotNull(server.getURI()); diff --git a/java/kudu-test-utils/src/test/java/org/apache/kudu/test/junit/TestRetryRule.java b/java/kudu-test-utils/src/test/java/org/apache/kudu/test/junit/TestRetryRule.java index b5a3d29..734107a 100644 --- a/java/kudu-test-utils/src/test/java/org/apache/kudu/test/junit/TestRetryRule.java +++ b/java/kudu-test-utils/src/test/java/org/apache/kudu/test/junit/TestRetryRule.java @@ -14,13 +14,14 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + package org.apache.kudu.test.junit; +import static org.junit.Assert.fail; + import org.junit.Rule; import org.junit.Test; -import static org.junit.Assert.fail; - public class TestRetryRule { private static final int MAX_FAILURES = 2;
