Skip to content

Commit 766dee1

Browse files
committed
add integration test
1 parent 45547b5 commit 766dee1

File tree

7 files changed

+115
-1
lines changed

7 files changed

+115
-1
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<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">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>com.amashchenko.maven.plugin</groupId>
4+
<artifactId>gitflow-maven-test</artifactId>
5+
<packaging>pom</packaging>
6+
<version>0.0.4</version>
7+
8+
<build>
9+
<plugins>
10+
<plugin>
11+
<groupId>com.amashchenko.maven.plugin</groupId>
12+
<artifactId>gitflow-maven-plugin</artifactId>
13+
<configuration>
14+
<projectVersionPolicyId>OddEvenVersionPolicy</projectVersionPolicyId>
15+
</configuration>
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.apache.maven.release</groupId>
19+
<artifactId>maven-release-oddeven-policy</artifactId>
20+
<version>2.5.3</version>
21+
</dependency>
22+
</dependencies>
23+
</plugin>
24+
</plugins>
25+
</build>
26+
27+
</project>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build.log
2+
expected-pom.xml
3+
invoker.properties
4+
init.bsh
5+
verify.bsh
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
try {
2+
new File(basedir, "gitignorefile").renameTo(new File(basedir, ".gitignore"));
3+
4+
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " init");
5+
p.waitFor();
6+
7+
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.email '[email protected]'");
8+
p.waitFor();
9+
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.name 'a'");
10+
p.waitFor();
11+
12+
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " add .");
13+
p.waitFor();
14+
15+
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " commit -m init");
16+
p.waitFor();
17+
18+
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " checkout -b develop");
19+
p.waitFor();
20+
21+
} catch (Exception e) {
22+
e.printStackTrace();
23+
return false;
24+
}
25+
return true;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:release-start -B
2+
3+
invoker.description=Non-interactive simple release-start.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<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">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>com.amashchenko.maven.plugin</groupId>
4+
<artifactId>gitflow-maven-test</artifactId>
5+
<packaging>pom</packaging>
6+
<version>0.0.3-SNAPSHOT</version>
7+
8+
<build>
9+
<plugins>
10+
<plugin>
11+
<groupId>com.amashchenko.maven.plugin</groupId>
12+
<artifactId>gitflow-maven-plugin</artifactId>
13+
<configuration>
14+
<projectVersionPolicyId>OddEvenVersionPolicy</projectVersionPolicyId>
15+
</configuration>
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.apache.maven.release</groupId>
19+
<artifactId>maven-release-oddeven-policy</artifactId>
20+
<version>2.5.3</version>
21+
</dependency>
22+
</dependencies>
23+
</plugin>
24+
</plugins>
25+
</build>
26+
27+
</project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import org.codehaus.plexus.util.FileUtils;
2+
3+
try {
4+
File gitRef = new File(basedir, ".git/refs/heads/release/0.0.4");
5+
if (!gitRef.exists()) {
6+
System.out.println("release-start .git/refs/heads/release/0.0.4 doesn't exist");
7+
return false;
8+
}
9+
10+
File file = new File(basedir, "pom.xml");
11+
File expectedFile = new File(basedir, "expected-pom.xml");
12+
13+
String actual = FileUtils.fileRead(file, "UTF-8");
14+
String expected = FileUtils.fileRead(expectedFile, "UTF-8");
15+
16+
actual = actual.replaceAll("\\r?\\n", "");
17+
expected = expected.replaceAll("\\r?\\n", "");
18+
19+
if (!expected.equals(actual)) {
20+
System.out.println("release-start expected: " + expected + " actual was:" + actual);
21+
return false;
22+
}
23+
} catch (Exception e) {
24+
e.printStackTrace();
25+
return false;
26+
}
27+
return true;

src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
202202
* If a policy is set other parameters controlling the generation of version are ignored
203203
* (digitsOnlyDevVersion, versionDigitToIncrement).
204204
*
205-
* @since 1.15.0
205+
* @since 1.18.0
206206
*/
207207
@Parameter(property="projectVersionPolicyId")
208208
private String projectVersionPolicyId;

0 commit comments

Comments
 (0)