You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2017/03/15 18:55:45 UTC

asterixdb git commit: Fix Missing License, Add Tests

Repository: asterixdb
Updated Branches:
  refs/heads/master 050f509e0 -> 51ef51ca6


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 <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
BAD: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/51ef51ca
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/51ef51ca
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/51ef51ca

Branch: refs/heads/master
Commit: 51ef51ca61c5542732415c65b556b34a4ec490ac
Parents: 050f509
Author: Michael Blow <mb...@apache.org>
Authored: Tue Mar 14 22:22:24 2017 -0400
Committer: Michael Blow <mb...@apache.org>
Committed: Wed Mar 15 11:55:21 2017 -0700

----------------------------------------------------------------------
 asterixdb/asterix-client-helper/pom.xml         | 12 ++-
 asterixdb/asterix-installer/pom.xml             |  7 ++
 .../installer/test/InstallerLicensingIT.java    | 29 +++++++
 asterixdb/asterix-server/pom.xml                | 23 +++++-
 .../apache/asterix/server/test/LicensingIT.java | 81 ++++++++++++++++++++
 .../server/test/SampleLocalClusterIT.java       |  3 +-
 6 files changed, 149 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/51ef51ca/asterixdb/asterix-client-helper/pom.xml
----------------------------------------------------------------------
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>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/51ef51ca/asterixdb/asterix-installer/pom.xml
----------------------------------------------------------------------
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>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/51ef51ca/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/InstallerLicensingIT.java
----------------------------------------------------------------------
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";
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/51ef51ca/asterixdb/asterix-server/pom.xml
----------------------------------------------------------------------
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>
@@ -168,10 +187,6 @@
               <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>
               <!--<displayName>CDDL 1.1</displayName>-->
               <metric>10</metric>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/51ef51ca/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
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());
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/51ef51ca/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/SampleLocalClusterIT.java
----------------------------------------------------------------------
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 @@ public class SampleLocalClusterIT {
         }
         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);