Skip to content

Commit

Permalink
AVRO-1939: Add missing Apache license header (#399)
Browse files Browse the repository at this point in the history
Add missing Apache license header and fix failing test case for schema normalization tool
  • Loading branch information
iemejia authored and nandorKollar committed Dec 4, 2018
1 parent 3299a9f commit c5aa1d6
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public String getName() {

@Override
public String getShortDescription() {
return "extracts samples from files";
return "Extracts samples from files";
}

}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,9 +29,12 @@
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"; }
Expand Down
20 changes: 19 additions & 1 deletion lang/java/tools/src/test/java/org/apache/avro/tool/TestMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
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()) {
Expand All @@ -32,4 +32,22 @@ public void testToolDescriptionLength() {
}
}
}

/**
* 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);
}
}
}
}

0 comments on commit c5aa1d6

Please sign in to comment.