avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkol...@apache.org
Subject [avro] branch master updated: AVRO-1939: Add missing Apache license header (#399)
Date Tue, 04 Dec 2018 13:05:35 GMT
This is an automated email from the ASF dual-hosted git repository.

nkollar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new c5aa1d6  AVRO-1939: Add missing Apache license header (#399)
c5aa1d6 is described below

commit c5aa1d6962ee16812d8d8c19b167b1b256e8002f
Author: Ismaël Mejía <iemejia@gmail.com>
AuthorDate: Tue Dec 4 14:05:30 2018 +0100

    AVRO-1939: Add missing Apache license header (#399)
    
    Add missing Apache license header and fix failing test case for schema normalization tool
---
 .../main/java/org/apache/avro/tool/CatTool.java    |  2 +-
 .../apache/avro/tool/SchemaNormalizationTool.java  | 22 +++++++++++++++++++++-
 .../test/java/org/apache/avro/tool/TestMain.java   | 20 +++++++++++++++++++-
 3 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/CatTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/CatTool.java
index 642b563..2574b11 100644
--- a/lang/java/tools/src/main/java/org/apache/avro/tool/CatTool.java
+++ b/lang/java/tools/src/main/java/org/apache/avro/tool/CatTool.java
@@ -210,7 +210,7 @@ public class CatTool implements Tool {
 
   @Override
   public String getShortDescription() {
-    return "extracts samples from files";
+    return "Extracts samples from files";
   }
 
 }
diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/SchemaNormalizationTool.java
b/lang/java/tools/src/main/java/org/apache/avro/tool/SchemaNormalizationTool.java
index 1cd63c7..28fb74b 100644
--- a/lang/java/tools/src/main/java/org/apache/avro/tool/SchemaNormalizationTool.java
+++ b/lang/java/tools/src/main/java/org/apache/avro/tool/SchemaNormalizationTool.java
@@ -1,3 +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.
+ */
 package org.apache.avro.tool;
 
 import java.io.BufferedInputStream;
@@ -12,9 +29,12 @@ import joptsimple.OptionSet;
 import org.apache.avro.Schema;
 import org.apache.avro.SchemaNormalization;
 
+/**
+ * Utility to convert an Avro @{Schema} to its canonical form.
+ */
 public class SchemaNormalizationTool implements Tool {
   @Override
-  public String getName() { return "schemacanonical"; }
+  public String getName() { return "canonical"; }
 
   @Override
   public String getShortDescription() { return "Converts an Avro Schema to its canonical
form"; }
diff --git a/lang/java/tools/src/test/java/org/apache/avro/tool/TestMain.java b/lang/java/tools/src/test/java/org/apache/avro/tool/TestMain.java
index 5a2acc0..f4ee46d 100644
--- a/lang/java/tools/src/test/java/org/apache/avro/tool/TestMain.java
+++ b/lang/java/tools/src/test/java/org/apache/avro/tool/TestMain.java
@@ -22,8 +22,8 @@ import static org.junit.Assert.fail;
 import org.junit.Test;
 
 public class TestMain {
-  @Test
   /** Make sure that tool descriptions fit in 80 characters. */
+  @Test
   public void testToolDescriptionLength() {
     Main m = new Main();
     for (Tool t : m.tools.values()) {
@@ -32,4 +32,22 @@ public class TestMain {
       }
     }
   }
+
+  /**
+   * Make sure that the tool name is not too long, otherwise space for
+   * description is too short because they are rebalanced in the CLI.
+   */
+  @Test
+  public void testToolNameLength() {
+    // 13 chosen for backwards compatibility
+    final int MAX_NAME_LENGTH = 13;
+
+    Main m = new Main();
+    for (Tool t : m.tools.values()) {
+      if (t.getName().length() > MAX_NAME_LENGTH) {
+        fail("Tool name too long (" + t.getName().length() + "): " +
+          t.getName() + ". Max length is: " + MAX_NAME_LENGTH);
+      }
+    }
+  }
 }


Mime
View raw message