Skip to content

Commit

Permalink
Fix #267 gnu.org unreliable - replace it with something else in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed Feb 20, 2019
1 parent e491dcc commit b50a2aa
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 37 deletions.
4 changes: 2 additions & 2 deletions src/it/PR-32/child1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<artifactId>PR-32-child1</artifactId>
<licenses>
<license>
<name>LGPL 3.0</name>
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
<name>Apache License 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

Expand Down
10 changes: 5 additions & 5 deletions src/it/PR-32/postbuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
* #L%
*/

def lgpl3 = new File(basedir, 'child2/target/generated-resources/licenses/lgpl 3.0 - lgpl-3.0.txt')
assert lgpl3.exists()
assert lgpl3.text.contains('GNU LESSER GENERAL PUBLIC LICENSE');
def asl2 = new File(basedir, 'child2/target/generated-resources/licenses/apache license 2.0 - license-2.0.txt')
assert asl2.exists()
assert asl2.text.contains('Version 2.0, January 2004');

def licensesXml = new File(basedir, 'child2/target/generated-resources/licenses.xml');
assert licensesXml.exists()
assert licensesXml.text.contains('<file>lgpl 3.0 - lgpl-3.0.txt</file>')
assert licensesXml.text.contains('<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>')
assert licensesXml.text.contains('<file>apache license 2.0 - license-2.0.txt</file>')
assert licensesXml.text.contains('<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>')
4 changes: 2 additions & 2 deletions src/it/PR-33/child1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<artifactId>PR-33-child1</artifactId>
<licenses>
<license>
<name>LGPL 2.1</name>
<url>https://www.gnu.org/licenses/lgpl-2.1.txt</url>
<name>Apache License 1.0</name>
<url>https://www.apache.org/licenses/LICENSE-1.0</url>
</license>
</licenses>

Expand Down
4 changes: 2 additions & 2 deletions src/it/PR-33/child2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<artifactId>PR-33-child2</artifactId>
<licenses>
<license>
<name>LGPL 3.0</name>
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
<name>Apache License 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
</project>
36 changes: 10 additions & 26 deletions src/it/PR-33/postbuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,18 @@
* #L%
*/

def assertExistsFile(file) {
if (!file.exists() || file.isDirectory()) {
println(file.getAbsolutePath() + " file is missing or a directory.")
assert false
}
assert true
}

def assertContains(file, content, expected) {
if (!content.contains(expected)) {
println(expected + " was not found in file [" + file + "]\n :" + content)
return false
}
return true
}
def asl2 = new File(basedir, 'child3/target/generated-resources/licenses/org.codehaus.mojo.license.test.pr-33-child2_apache_license_2.0.txt')
assert asl2.exists()
assert asl2.text.contains('Version 2.0, January 2004');


def lgpl3 = new File(basedir, 'child3/target/generated-resources/licenses/org.codehaus.mojo.license.test.pr-33-child1_lgpl_2.1.txt')
assert lgpl3.exists()
assert lgpl3.text.contains('Version 2.1, February 1999');

def lgpl21 = new File(basedir, 'child3/target/generated-resources/licenses/org.codehaus.mojo.license.test.pr-33-child2_lgpl_3.0.txt')
assert lgpl21.exists()
assert lgpl21.text.contains('Version 3, 29 June 2007');
def asl1 = new File(basedir, 'child3/target/generated-resources/licenses/org.codehaus.mojo.license.test.pr-33-child1_apache_license_1.0.txt')
assert asl1.exists()
assert asl1.text.contains('Copyright (c) 1995-1999 The Apache Group.');

def licensesXml = new File(basedir, 'child3/target/generated-resources/licenses.xml');
assert licensesXml.exists()
assert licensesXml.text.contains('<file>org.codehaus.mojo.license.test.pr-33-child1_lgpl_2.1.txt</file>')
assert licensesXml.text.contains('<url>https://www.gnu.org/licenses/lgpl-2.1.txt</url>')
assert licensesXml.text.contains('<file>org.codehaus.mojo.license.test.pr-33-child2_lgpl_3.0.txt</file>')
assert licensesXml.text.contains('<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>')
assert licensesXml.text.contains('<file>org.codehaus.mojo.license.test.pr-33-child2_apache_license_2.0.txt</file>')
assert licensesXml.text.contains('<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>')
assert licensesXml.text.contains('<file>org.codehaus.mojo.license.test.pr-33-child1_apache_license_1.0.txt</file>')
assert licensesXml.text.contains('<url>https://www.apache.org/licenses/LICENSE-1.0</url>')

0 comments on commit b50a2aa

Please sign in to comment.