Michael Blow has submitted this change and it was merged. Change subject: Fix Missing License, Add Tests ......................................................................
Fix Missing License, Add Tests - Fix missing license for updated appassembler components - Add tests to prevent missing licenses Change-Id: Ic6f4afc3dd9edd311709bf14ac4cbc7438a3716d Reviewed-on: https://asterix-gerrit.ics.uci.edu/1583 Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> BAD: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Till Westmann <ti...@apache.org> --- M asterixdb/asterix-client-helper/pom.xml M asterixdb/asterix-installer/pom.xml A asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/InstallerLicensingIT.java M asterixdb/asterix-server/pom.xml A asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/LicensingIT.java M asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/SampleLocalClusterIT.java 6 files changed, 149 insertions(+), 6 deletions(-) Approvals: Till Westmann: Looks good to me, approved Jenkins: Verified; No violations found; No violations found; Verified diff --git a/asterixdb/asterix-client-helper/pom.xml b/asterixdb/asterix-client-helper/pom.xml index d3ad745..1769003 100644 --- a/asterixdb/asterix-client-helper/pom.xml +++ b/asterixdb/asterix-client-helper/pom.xml @@ -80,10 +80,20 @@ <models> <model>${basedir}/../src/main/appended-resources/supplemental-models.xml</model> </models> + <overrides> + <override> + <gav>org.codehaus.mojo.appassembler:appassembler-booter:2.0.0</gav> + <url>https://raw.githubusercontent.com/mojohaus/appassembler/appassembler-2.0.0/LICENSE.txt</url> + </override> + <override> + <gav>org.codehaus.mojo.appassembler:appassembler-model:2.0.0</gav> + <url>https://raw.githubusercontent.com/mojohaus/appassembler/appassembler-2.0.0/LICENSE.txt</url> + </override> + </overrides> <licenses> <license> <url>https://raw.githubusercontent.com/mojohaus/appassembler/master/LICENSE.txt</url> - <aliasUrls>http://svn.codehaus.org/mojo/trunk/mojo/appassembler/LICENSE.txt</aliasUrls> + <aliasUrls>https://raw.githubusercontent.com/mojohaus/appassembler/appassembler-2.0.0/LICENSE.txt</aliasUrls> </license> <license> <url>https://java.net/projects/stax-utils/sources/svn/content/trunk/LICENSE</url> diff --git a/asterixdb/asterix-installer/pom.xml b/asterixdb/asterix-installer/pom.xml index a6e7541..8041b99 100644 --- a/asterixdb/asterix-installer/pom.xml +++ b/asterixdb/asterix-installer/pom.xml @@ -482,5 +482,12 @@ <artifactId>hyracks-util</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.asterix</groupId> + <artifactId>asterix-server</artifactId> + <type>test-jar</type> + <version>${project.version}</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/InstallerLicensingIT.java b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/InstallerLicensingIT.java new file mode 100644 index 0000000..0fc06b8 --- /dev/null +++ b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/InstallerLicensingIT.java @@ -0,0 +1,29 @@ +/* + * 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.asterix.installer.test; + +import org.apache.asterix.server.test.LicensingIT; + +public class InstallerLicensingIT extends LicensingIT { + + @Override + protected String getInstallerDirPattern() { + return "asterix-installer.*-binary-assembly"; + } +} diff --git a/asterixdb/asterix-server/pom.xml b/asterixdb/asterix-server/pom.xml index 5bfe30f..1b971af 100644 --- a/asterixdb/asterix-server/pom.xml +++ b/asterixdb/asterix-server/pom.xml @@ -42,6 +42,17 @@ <build> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> <groupId>org.apache.hyracks</groupId> <artifactId>license-automation-plugin</artifactId> <version>${hyracks.version}</version> @@ -124,6 +135,14 @@ <gav>xmlenc:xmlenc:0.52</gav> <url>https://cytranet.dl.sourceforge.net/project/xmlenc/xmlenc/0.52/xmlenc-0.52.tgz?xmlenc-0.52/COPYRIGHT</url> </override> + <override> + <gav>org.codehaus.mojo.appassembler:appassembler-booter:2.0.0</gav> + <url>https://raw.githubusercontent.com/mojohaus/appassembler/appassembler-2.0.0/LICENSE.txt</url> + </override> + <override> + <gav>org.codehaus.mojo.appassembler:appassembler-model:2.0.0</gav> + <url>https://raw.githubusercontent.com/mojohaus/appassembler/appassembler-2.0.0/LICENSE.txt</url> + </override> </overrides> <licenses> <license> @@ -166,10 +185,6 @@ <license> <url>http://www.json.org/license.html</url> <displayName>The JSON License</displayName> - </license> - <license> - <url>https://raw.githubusercontent.com/mojohaus/appassembler/master/LICENSE.txt</url> - <aliasUrls>http://svn.codehaus.org/mojo/trunk/mojo/appassembler/LICENSE.txt</aliasUrls> </license> <license> <url>https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html</url> 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 new file mode 100644 index 0000000..e5a3d3e --- /dev/null +++ b/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/LicensingIT.java @@ -0,0 +1,81 @@ +/* + * 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.asterix.server.test; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.apache.hyracks.util.file.FileUtil; +import org.junit.Assert; +import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; + +@FixMethodOrder(MethodSorters.JVM) +public class LicensingIT { + + // The "target" subdirectory of asterix-server. All outputs go here. + private static final String TARGET_DIR = FileUtil.joinPath("target"); + + protected String installerDir; + + @Before + public void setup() { + final String pattern = getInstallerDirPattern(); + final String[] list = new File(TARGET_DIR).list((dir, name) -> name.matches(pattern)); + Assert.assertNotNull("installerDir", list); + Assert.assertFalse("Ambiguous install dir (" + pattern + "): " + Arrays.toString(list), list.length > 1); + Assert.assertEquals("Can't find install dir (" + pattern + ")", 1, list.length); + installerDir = FileUtil.joinPath(TARGET_DIR, list[0]); + } + + protected String getInstallerDirPattern() { + return "asterix-server.*-binary-assembly"; + } + + protected String pathToLicensingFiles() { + return ""; + } + + @Test + public void testLicenseNoticeFilesPresent() throws IOException { + for (String name : Arrays.asList("LICENSE", "NOTICE")) { + final String fileName = FileUtil.joinPath(installerDir, pathToLicensingFiles(), name); + Assert.assertTrue(fileName + " missing", new File(fileName).exists()); + } + } + + @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()); + } + } + Assert.assertEquals("Missing licenses in " + licenseFile + ": " + badLines, 0, badLines.size()); + } +} diff --git a/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/SampleLocalClusterIT.java b/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/SampleLocalClusterIT.java index 566ebb8..61128c5 100644 --- a/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/SampleLocalClusterIT.java +++ b/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/SampleLocalClusterIT.java @@ -70,7 +70,8 @@ } outDir.mkdirs(); - String[] pathElements = new String[]{TARGET_DIR, new File(TARGET_DIR).list((dir, name) -> name.matches("asterix-server.*-binary-assembly.zip"))[0]}; + String[] pathElements = new String[] { TARGET_DIR, + new File(TARGET_DIR).list((dir, name) -> name.matches("asterix-server.*-binary-assembly.zip"))[0] }; String installerZip = FileUtil.joinPath(pathElements); TestHelper.unzip(installerZip, OUTPUT_DIR); -- To view, visit https://asterix-gerrit.ics.uci.edu/1583 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic6f4afc3dd9edd311709bf14ac4cbc7438a3716d Gerrit-PatchSet: 2 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael Blow <mb...@apache.org> Gerrit-Reviewer: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Gerrit-Reviewer: Michael Blow <mb...@apache.org> Gerrit-Reviewer: Till Westmann <ti...@apache.org>