Permalink
Browse files

Added skip parameter, and ability to handle projects with no CHANGES.txt

  • Loading branch information...
1 parent 0b74cf8 commit ca5f75e9359e30793e1cff242ea82131bdd370d0 @jakewins jakewins committed Jan 25, 2012
Showing with 574 additions and 81 deletions.
  1. +9 −9 src/functionaltest/testprojects/combineProject/build.log
  2. +1 −1 src/functionaltest/testprojects/combineProject/pom.xml
  3. +31 −20 src/functionaltest/testprojects/combineProject/src/test/java/org/neo4j/ChangelogAttachedTest.java
  4. +11 −11 src/functionaltest/testprojects/firstProject/build.log
  5. +1 −1 src/functionaltest/testprojects/firstProject/pom.xml
  6. +2 −3 src/functionaltest/testprojects/firstProject/src/test/java/org/neo4j/ChangelogAttachedTest.java
  7. +98 −0 src/functionaltest/testprojects/noChangelogProject/build.log
  8. +2 −0 src/functionaltest/testprojects/noChangelogProject/invoker.properties
  9. +65 −0 src/functionaltest/testprojects/noChangelogProject/pom.xml
  10. +56 −0 ...functionaltest/testprojects/noChangelogProject/src/test/java/org/neo4j/ChangelogDeployedTest.java
  11. +10 −0 src/functionaltest/testprojects/noChangelogProject/validate.groovy
  12. +11 −11 src/functionaltest/testprojects/secondProject/build.log
  13. +1 −1 src/functionaltest/testprojects/secondProject/pom.xml
  14. +7 −7 src/functionaltest/testprojects/singleChangelogTest/build.log
  15. +1 −1 src/functionaltest/testprojects/singleChangelogTest/pom.xml
  16. +24 −0 src/functionaltest/testprojects/skipProject/CHANGES.txt
  17. +90 −0 src/functionaltest/testprojects/skipProject/build.log
  18. +2 −0 src/functionaltest/testprojects/skipProject/invoker.properties
  19. +67 −0 src/functionaltest/testprojects/skipProject/pom.xml
  20. +33 −0 src/functionaltest/testprojects/skipProject/src/test/java/org/neo4j/PluginSkippedTest.java
  21. +10 −0 src/functionaltest/testprojects/skipProject/validate.groovy
  22. +21 −8 src/main/java/org/neo4j/build/plugins/changes/ChangeLogExtractorMojo.java
  23. +9 −1 src/main/java/org/neo4j/build/plugins/changes/ChangelogAttachingMojo.java
  24. +12 −7 src/main/java/org/neo4j/build/plugins/changes/CombiningChangelogWriter.java
@@ -1,7 +1,7 @@
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
-[INFO] Building Unnamed - it.sandbox:combineProject:jar:1.0-SNAPSHOT
+[INFO] Building Unnamed - it.sandbox:combineProject:jar:1.0
[INFO] task-segment: [clean, compile, test]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
@@ -32,7 +32,7 @@
T E S T S
-------------------------------------------------------
Running org.neo4j.ChangelogAttachedTest
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.023 sec
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.025 sec
Results :
@@ -41,14 +41,14 @@ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 2 seconds
-[INFO] Finished at: Wed Jan 25 13:54:00 CET 2012
-[INFO] Final Memory: 14M/211M
+[INFO] Total time: 1 second
+[INFO] Finished at: Wed Jan 25 16:50:01 CET 2012
+[INFO] Final Memory: 15M/213M
[INFO] ------------------------------------------------------------------------
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
-[INFO] Building Unnamed - it.sandbox:combineProject:jar:1.0-SNAPSHOT
+[INFO] Building Unnamed - it.sandbox:combineProject:jar:1.0
[INFO] task-segment: [compile, test]
[INFO] ------------------------------------------------------------------------
[INFO] [changes:extract-changelog {execution: default}]
@@ -77,7 +77,7 @@ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
T E S T S
-------------------------------------------------------
Running org.neo4j.ChangelogAttachedTest
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.023 sec
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 sec
Results :
@@ -87,8 +87,8 @@ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
-[INFO] Finished at: Wed Jan 25 13:54:02 CET 2012
-[INFO] Final Memory: 10M/211M
+[INFO] Finished at: Wed Jan 25 16:50:02 CET 2012
+[INFO] Final Memory: 9M/149M
[INFO] ------------------------------------------------------------------------
Running post-build script in: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/combineProject/validate.groovy
Finished post-build script in: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/combineProject/validate.groovy
@@ -5,7 +5,7 @@
<groupId>it.sandbox</groupId>
<artifactId>combineProject</artifactId>
<packaging>jar</packaging>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
<properties>
<maven.compiler.source>1.5</maven.compiler.source>
@@ -5,31 +5,13 @@
import java.io.File;
import java.io.IOException;
+import java.util.Date;
import org.apache.commons.io.FileUtils;
-import org.junit.Ignore;
import org.junit.Test;
public class ChangelogAttachedTest {
- private static final String EXPECTED_CHANGELOG_CONTENT =
- "1.0-SNAPSHOT (2012-1-25)\n" +
- "-------------------------\n" +
- "\n" +
- "it.sandbox.combineProject:\n" +
- "o Fixes issues #173, #118, #138, #103\n" +
- "\n" +
- "\n" +
- "it.sandbox.firstProject:\n" +
- "o Fixes issues #173, #118, #138, #103\n" +
- // This line is in the firstProject changelog,
- // but we are expecting it to be excluded here.
- //"o Made some changes [minor]\n" +
- "\n" +
- "\n" +
- "it.sandbox.secondProject:\n" +
- "o Fixes issues #173, #118, #138, #103\n\n\n";
-
private File output = new File("target/CHANGES.txt");
@Test
@@ -41,7 +23,36 @@ public void outputFilesShouldExist() throws Exception
@Test
public void outputFileShouldContainExpectedContent() throws Exception
{
- assertContains(output, EXPECTED_CHANGELOG_CONTENT);
+ assertContains(output, expectedChangelogContent());
+ }
+
+ private String expectedChangelogContent() {
+ Date date = new Date();
+ @SuppressWarnings("deprecation")
+ String dateStr = (date.getYear() + 1900) + "-" + (date.getMonth() + 1) + "-" + date.getDate();
+ String headline = "1.0 (" + dateStr + ")";
+
+ StringBuilder divide = new StringBuilder();
+ for(int i=0;i<headline.length();i++) {
+ divide.append("-");
+ }
+
+ return headline + "\n"+
+ divide.toString() + "\n"+
+ "\n" +
+ "it.sandbox.combineProject:\n" +
+ "o Fixes issues #173, #118, #138, #103\n" +
+ "\n" +
+ "\n" +
+ "it.sandbox.firstProject:\n" +
+ "o Fixes issues #173, #118, #138, #103\n" +
+ // This line is in the firstProject changelog,
+ // but we are expecting it to be excluded here.
+ //"o Made some changes [minor]\n" +
+ "\n" +
+ "\n" +
+ "it.sandbox.secondProject:\n" +
+ "o Fixes issues #173, #118, #138, #103\n\n\n";
}
private static void assertExists(File file) throws Exception
@@ -1,7 +1,7 @@
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
-[INFO] Building Unnamed - it.sandbox:firstProject:jar:1.0-SNAPSHOT
+[INFO] Building Unnamed - it.sandbox:firstProject:jar:1.0
[INFO] task-segment: [clean, compile, test]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
@@ -32,7 +32,7 @@
T E S T S
-------------------------------------------------------
Running org.neo4j.ChangelogAttachedTest
-Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 sec
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.022 sec
Results :
@@ -41,14 +41,14 @@ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 2 seconds
-[INFO] Finished at: Wed Jan 25 13:53:55 CET 2012
-[INFO] Final Memory: 14M/214M
+[INFO] Total time: 1 second
+[INFO] Finished at: Wed Jan 25 16:49:56 CET 2012
+[INFO] Final Memory: 15M/213M
[INFO] ------------------------------------------------------------------------
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
-[INFO] Building Unnamed - it.sandbox:firstProject:jar:1.0-SNAPSHOT
+[INFO] Building Unnamed - it.sandbox:firstProject:jar:1.0
[INFO] task-segment: [compile, install]
[INFO] ------------------------------------------------------------------------
[INFO] [changes:extract-changelog {execution: default}]
@@ -86,14 +86,14 @@ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO] [jar:jar {execution: default-jar}]
[INFO] Building jar: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/firstProject/target/singleChangelogTest.jar
[INFO] [install:install {execution: default-install}]
-[INFO] Installing /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/firstProject/target/singleChangelogTest.jar to /home/jake/.m2/repository/it/sandbox/firstProject/1.0-SNAPSHOT/firstProject-1.0-SNAPSHOT.jar
-[INFO] Installing /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/firstProject/target/classes/CHANGES.txt to /home/jake/.m2/repository/it/sandbox/firstProject/1.0-SNAPSHOT/firstProject-1.0-SNAPSHOT-changelog.txt
-[INFO] Installing /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/firstProject/target/classes/CHANGES.txt to /home/jake/.m2/repository/it/sandbox/firstProject/1.0-SNAPSHOT/firstProject-1.0-SNAPSHOT-changelog.txt
+[INFO] Installing /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/firstProject/target/singleChangelogTest.jar to /home/jake/.m2/repository/it/sandbox/firstProject/1.0/firstProject-1.0.jar
+[INFO] Installing /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/firstProject/target/classes/CHANGES.txt to /home/jake/.m2/repository/it/sandbox/firstProject/1.0/firstProject-1.0-changelog.txt
+[INFO] Installing /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/firstProject/target/classes/CHANGES.txt to /home/jake/.m2/repository/it/sandbox/firstProject/1.0/firstProject-1.0-changelog.txt
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 2 seconds
-[INFO] Finished at: Wed Jan 25 13:53:57 CET 2012
+[INFO] Total time: 1 second
+[INFO] Finished at: Wed Jan 25 16:49:58 CET 2012
[INFO] Final Memory: 14M/215M
[INFO] ------------------------------------------------------------------------
Running post-build script in: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/firstProject/validate.groovy
@@ -5,7 +5,7 @@
<groupId>it.sandbox</groupId>
<artifactId>firstProject</artifactId>
<packaging>jar</packaging>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
<properties>
<maven.compiler.source>1.5</maven.compiler.source>
@@ -7,14 +7,13 @@
import java.io.IOException;
import org.apache.commons.io.FileUtils;
-import org.junit.Ignore;
import org.junit.Test;
public class ChangelogAttachedTest {
private static final String EXPECTED_CHANGELOG_CONTENT =
- "1.0-SNAPSHOT (2012-1-25)\n" +
- "-------------------------\n" +
+ "1.0 (2012-1-25)\n" +
+ "---------------\n" +
"\n" +
"it.sandbox.firstProject:\n" +
"o Fixes issues #173, #118, #138, #103\n" +
@@ -0,0 +1,98 @@
++ Error stacktraces are turned on.
+[INFO] Scanning for projects...
+[INFO] ------------------------------------------------------------------------
+[INFO] Building Unnamed - it.sandbox:singleChangelogTest:jar:1.0
+[INFO] task-segment: [clean, compile, test]
+[INFO] ------------------------------------------------------------------------
+[INFO] [clean:clean {execution: default-clean}]
+[INFO] Deleting file set: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/target (included: [**], excluded: [])
+[INFO] [changes:extract-changelog {execution: default}]
+[WARNING] No changelog found at: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/CHANGES.txt. Ignoring.
+[INFO] [resources:resources {execution: default-resources}]
+[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+[INFO] skip non existing resourceDirectory /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/src/main/resources
+[INFO] [changes:attach-changelog {execution: default}]
+[INFO] [compiler:compile {execution: default-compile}]
+[INFO] No sources to compile
+[INFO] [changes:extract-changelog {execution: default}]
+[WARNING] No changelog found at: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/CHANGES.txt. Ignoring.
+[INFO] [resources:resources {execution: default-resources}]
+[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+[INFO] skip non existing resourceDirectory /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/src/main/resources
+[INFO] [changes:attach-changelog {execution: default}]
+[INFO] [compiler:compile {execution: default-compile}]
+[INFO] No sources to compile
+[INFO] [resources:testResources {execution: default-testResources}]
+[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+[INFO] skip non existing resourceDirectory /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/src/test/resources
+[INFO] [compiler:testCompile {execution: default-testCompile}]
+[INFO] Compiling 1 source file to /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/target/test-classes
+[INFO] [surefire:test {execution: default-test}]
+[INFO] Surefire report directory: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/target/surefire-reports
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.neo4j.ChangelogDeployedTest
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.026 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+[INFO] ------------------------------------------------------------------------
+[INFO] BUILD SUCCESSFUL
+[INFO] ------------------------------------------------------------------------
+[INFO] Total time: 1 second
+[INFO] Finished at: Wed Jan 25 16:49:49 CET 2012
+[INFO] Final Memory: 14M/213M
+[INFO] ------------------------------------------------------------------------
++ Error stacktraces are turned on.
+[INFO] Scanning for projects...
+[INFO] ------------------------------------------------------------------------
+[INFO] Building Unnamed - it.sandbox:singleChangelogTest:jar:1.0
+[INFO] task-segment: [compile, test]
+[INFO] ------------------------------------------------------------------------
+[INFO] [changes:extract-changelog {execution: default}]
+[WARNING] No changelog found at: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/CHANGES.txt. Ignoring.
+[INFO] [resources:resources {execution: default-resources}]
+[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+[INFO] skip non existing resourceDirectory /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/src/main/resources
+[INFO] [changes:attach-changelog {execution: default}]
+[INFO] [compiler:compile {execution: default-compile}]
+[INFO] No sources to compile
+[INFO] [changes:extract-changelog {execution: default}]
+[WARNING] No changelog found at: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/CHANGES.txt. Ignoring.
+[INFO] [resources:resources {execution: default-resources}]
+[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+[INFO] skip non existing resourceDirectory /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/src/main/resources
+[INFO] [changes:attach-changelog {execution: default}]
+[INFO] [compiler:compile {execution: default-compile}]
+[INFO] No sources to compile
+[INFO] [resources:testResources {execution: default-testResources}]
+[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+[INFO] skip non existing resourceDirectory /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/src/test/resources
+[INFO] [compiler:testCompile {execution: default-testCompile}]
+[INFO] Nothing to compile - all classes are up to date
+[INFO] [surefire:test {execution: default-test}]
+[INFO] Surefire report directory: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/target/surefire-reports
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.neo4j.ChangelogDeployedTest
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.025 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+[INFO] ------------------------------------------------------------------------
+[INFO] BUILD SUCCESSFUL
+[INFO] ------------------------------------------------------------------------
+[INFO] Total time: 1 second
+[INFO] Finished at: Wed Jan 25 16:49:50 CET 2012
+[INFO] Final Memory: 9M/149M
+[INFO] ------------------------------------------------------------------------
+Running post-build script in: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/validate.groovy
+Finished post-build script in: /home/jake/Workspaces/Neo4j/changes-maven-plugin/src/functionaltest/testprojects/noChangelogProject/validate.groovy
@@ -0,0 +1,2 @@
+invoker.goals=clean compile test
+invoker.goals.2=compile test
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>it.sandbox</groupId>
+ <artifactId>singleChangelogTest</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0</version>
+
+ <properties>
+ <maven.compiler.source>1.5</maven.compiler.source>
+ <maven.compiler.target>1.5</maven.compiler.target>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3.2</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <!-- Test dependencies -->
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit-dep</artifactId>
+ <version>4.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-all</artifactId>
+ <version>1.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>singleChangelogTest</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.neo4j.build.plugins</groupId>
+ <artifactId>changes-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>extract-changelog</goal>
+ <goal>attach-changelog</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Oops, something went wrong.

0 comments on commit ca5f75e

Please sign in to comment.