Repository: asterixdb Updated Branches: refs/heads/master 016603909 -> aa37321a7
[NO ISSUE] Refactor LicensingIT for extensibility Change-Id: Idc82843905dbe3c3d26edcbbbebdde35fdefc775 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1980 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Till Westmann <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/aa37321a Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/aa37321a Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/aa37321a Branch: refs/heads/master Commit: aa37321a7e6a6cf756c75f15c9c1847fda55bbe8 Parents: 0166039 Author: Michael Blow <[email protected]> Authored: Mon Aug 28 10:39:52 2017 -0400 Committer: Michael Blow <[email protected]> Committed: Mon Aug 28 15:59:08 2017 -0700 ---------------------------------------------------------------------- .../apache/asterix/server/test/LicensingIT.java | 27 ++++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/aa37321a/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/LicensingIT.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/LicensingIT.java b/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/LicensingIT.java index e5a3d3e..3ea5b23 100644 --- a/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/LicensingIT.java +++ b/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/LicensingIT.java @@ -61,21 +61,32 @@ public class LicensingIT { @Test public void testLicenseNoticeFilesPresent() throws IOException { - for (String name : Arrays.asList("LICENSE", "NOTICE")) { + for (String name : getRequiredArtifactNames()) { final String fileName = FileUtil.joinPath(installerDir, pathToLicensingFiles(), name); Assert.assertTrue(fileName + " missing", new File(fileName).exists()); } } + protected String[] getRequiredArtifactNames() { + return org.apache.commons.lang3.ArrayUtils.add(getLicenseArtifactNames(), "NOTICE"); + } + @Test - public void testNoMissingLicenses() throws IOException { - final File licenseFile = new File(FileUtil.joinPath(installerDir, pathToLicensingFiles(), "LICENSE")); - List<String> badLines = new ArrayList<>(); - for (String line : FileUtils.readLines(licenseFile, StandardCharsets.UTF_8)) { - if (line.matches("^\\s*MISSING:.*")) { - badLines.add(line.trim()); + public void ensureNoMissingLicenses() throws IOException { + for (String licenseArtifactName : getLicenseArtifactNames()) { + final File licenseFile = new File( + FileUtil.joinPath(installerDir, pathToLicensingFiles(), licenseArtifactName)); + List<String> badLines = new ArrayList<>(); + for (String line : FileUtils.readLines(licenseFile, StandardCharsets.UTF_8)) { + if (line.matches("^\\s*MISSING:.*")) { + badLines.add(line.trim()); + } } + Assert.assertEquals("Missing licenses in " + licenseFile + ": " + badLines, 0, badLines.size()); } - Assert.assertEquals("Missing licenses in " + licenseFile + ": " + badLines, 0, badLines.size()); + } + + protected String[] getLicenseArtifactNames() { + return new String[] { "LICENSE" }; } }
