Skip to content

Commit 410d252

Browse files
committed
Merge branch 'development' into feature/deploy-others-semver
2 parents e548734 + 72c234c commit 410d252

File tree

6 files changed

+178
-122
lines changed

6 files changed

+178
-122
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ You can then connect a remote debugger and step through the plugin code.
400400
## Building with IntelliJ IDEA notes
401401
### To Debug Test Code:
402402
Configure the Maven commandline to include
403-
`-DforkMode=never` You will likely get warnings when you run maven with this argument.
403+
`-DforkMode=never` You will likely get warnings when you run maven without this argument.
404404

405405
### To inspect code-coverage results from Integration Tests:
406406
* Select the **Analyze** -> **Show Coverage Data** menu.

src/test/java/com/e_gineering/maven/gitflowhelper/DevelopBranchIT.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ public void nonSnapshotDeployFails() throws Exception {
3232
public void snapshotDeploySuccess() throws Exception {
3333
Verifier verifier = createVerifier("/project-stub", "origin/develop", "1.0.0-SNAPSHOT");
3434

35-
verifier.executeGoal("deploy");
36-
37-
verifier.verifyErrorFreeLog();
35+
try {
36+
verifier.executeGoal("deploy");
3837

39-
verifier.resetStreams();
38+
verifier.verifyErrorFreeLog();
39+
} finally {
40+
verifier.resetStreams();
41+
}
4042
}
4143

4244
/**
@@ -48,18 +50,24 @@ public void snapshotDeploySuccess() throws Exception {
4850
public void attachExistingArtifacts() throws Exception {
4951
Verifier verifier = createVerifier("/project-stub", "origin/develop", "1.0.0-SNAPSHOT");
5052

51-
verifier.executeGoal("deploy");
52-
53-
verifier.verifyErrorFreeLog();
53+
try {
54+
verifier.executeGoal("deploy");
5455

55-
verifier.resetStreams();
56+
verifier.verifyErrorFreeLog();
57+
} finally {
58+
verifier.resetStreams();
59+
}
5660

5761

5862
// New verifier to attach existing artifacts
5963
verifier = createVerifier("/project-stub", "origin/develop", "1.0.0-SNAPSHOT");
6064

61-
verifier.executeGoal("gitflow-helper:attach-deployed");
65+
try {
66+
verifier.executeGoal("gitflow-helper:attach-deployed");
6267

63-
verifier.verifyErrorFreeLog();
68+
verifier.verifyErrorFreeLog();
69+
} finally {
70+
verifier.resetStreams();
71+
}
6472
}
6573
}

src/test/java/com/e_gineering/maven/gitflowhelper/EnforceVersionsIT.java

Lines changed: 55 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -97,39 +97,53 @@ public void dependencySuccesses() throws Exception {
9797
// Create a release version and get it deployed.
9898
Verifier verifier = createVerifier("/project-stub", "origin/release/1.0.0", "1.0.0");
9999

100-
verifier.executeGoal("deploy");
100+
try {
101+
verifier.executeGoal("deploy");
101102

102-
verifier.verifyErrorFreeLog();
103-
verifier.resetStreams();
103+
verifier.verifyErrorFreeLog();
104+
} finally {
105+
verifier.resetStreams();
106+
}
104107

105108
// Promote (deploy) from /origin/master
106109
verifier = createVerifier("/project-stub", "origin/master", "1.0.0");
107-
verifier.executeGoal("deploy");
110+
try {
111+
verifier.executeGoal("deploy");
108112

109-
verifier.verifyErrorFreeLog();
110-
verifier.resetStreams();
113+
verifier.verifyErrorFreeLog();
114+
} finally {
115+
verifier.resetStreams();
116+
}
111117

112118
// Build a project that depends upon the upstream project.
113119
verifier = createVerifier("/project-alt1-stub", "origin/release/1.0.0", "1.0.0");
114120
verifier.getCliOptions().add("-Ddependency.stub.version=1.0.0");
115121
verifier.getCliOptions().add("-Dplugin.stub.version=1.0.0");
116122

117-
verifier.executeGoal("deploy");
123+
try {
124+
verifier.executeGoal("deploy");
118125

119-
verifier.verifyErrorFreeLog();
120-
verifier.resetStreams();
126+
verifier.verifyErrorFreeLog();
127+
} finally {
128+
verifier.resetStreams();
129+
}
121130

122131
verifier = createVerifier("/project-alt1-stub", "origin/master", "1.0.0");
123-
verifier.getCliOptions().add("-Ddependency.stub.version=1.0.0");
124-
verifier.getCliOptions().add("-Dplugin.stub.version=1.0.0");
132+
try {
133+
verifier.getCliOptions().add("-Ddependency.stub.version=1.0.0");
134+
verifier.getCliOptions().add("-Dplugin.stub.version=1.0.0");
125135

126-
verifier.executeGoal("deploy");
136+
verifier.executeGoal("deploy");
127137

128-
verifier.verifyTextInLog("gitflow-helper-maven-plugin: Enabling MasterPromoteExtension. GIT_BRANCH: [origin/master] matches masterBranchPattern");
129-
verifier.verifyTextInLog("[INFO] Setting release artifact repository to: [releases]");
130-
verifier.verifyTextInLog("[INFO] Resolving & Reattaching existing artifacts from stageDeploymentRepository [test-releases]");
131-
verifier.verifyErrorFreeLog();
132-
verifier.resetStreams();
138+
verifier.verifyTextInLog(
139+
"gitflow-helper-maven-plugin: Enabling MasterPromoteExtension. GIT_BRANCH: [origin/master] matches masterBranchPattern");
140+
verifier.verifyTextInLog("[INFO] Setting release artifact repository to: [releases]");
141+
verifier.verifyTextInLog(
142+
"[INFO] Resolving & Reattaching existing artifacts from stageDeploymentRepository [test-releases]");
143+
verifier.verifyErrorFreeLog();
144+
} finally {
145+
verifier.resetStreams();
146+
}
133147
}
134148

135149
@Test(expected= VerificationException.class)
@@ -138,18 +152,23 @@ public void dependencySnapshotFail() throws Exception {
138152

139153
// Create a release version and get it deployed.
140154
Verifier verifier = createVerifier("/project-stub", "origin/release/1.0.0", "1.0.0");
155+
try {
156+
verifier.executeGoal("deploy");
141157

142-
verifier.executeGoal("deploy");
143-
144-
verifier.verifyErrorFreeLog();
145-
verifier.resetStreams();
158+
verifier.verifyErrorFreeLog();
159+
} finally {
160+
verifier.resetStreams();
161+
}
146162

147163
// Promote (deploy) from /origin/master
148164
verifier = createVerifier("/project-stub", "origin/master", "1.0.0");
149-
verifier.executeGoal("deploy");
165+
try {
166+
verifier.executeGoal("deploy");
150167

151-
verifier.verifyErrorFreeLog();
152-
verifier.resetStreams();
168+
verifier.verifyErrorFreeLog();
169+
} finally {
170+
verifier.resetStreams();
171+
}
153172

154173
// Build a project that depends upon the upstream project.
155174
verifier = createVerifier("/project-alt1-stub", "origin/release/1.0.0", "1.0.0");
@@ -169,18 +188,23 @@ public void pluginSnapshotFail() throws Exception {
169188

170189
// Create a release version and get it deployed.
171190
Verifier verifier = createVerifier("/project-stub", "origin/release/1.0.0", "1.0.0");
191+
try {
192+
verifier.executeGoal("deploy");
172193

173-
verifier.executeGoal("deploy");
174-
175-
verifier.verifyErrorFreeLog();
176-
verifier.resetStreams();
194+
verifier.verifyErrorFreeLog();
195+
} finally {
196+
verifier.resetStreams();
197+
}
177198

178199
// Promote (deploy) from /origin/master
179200
verifier = createVerifier("/project-stub", "origin/master", "1.0.0");
180-
verifier.executeGoal("deploy");
201+
try {
202+
verifier.executeGoal("deploy");
181203

182-
verifier.verifyErrorFreeLog();
183-
verifier.resetStreams();
204+
verifier.verifyErrorFreeLog();
205+
} finally {
206+
verifier.resetStreams();
207+
}
184208

185209
// Build a project that depends upon the upstream project.
186210
verifier = createVerifier("/project-alt1-stub", "origin/release/1.0.0", "1.0.0");

src/test/java/com/e_gineering/maven/gitflowhelper/MasterSupportBranchIT.java

Lines changed: 60 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ public class MasterSupportBranchIT extends AbstractIntegrationTest {
1616
public void releaseVersionSuccess() throws Exception {
1717
Verifier verifier = createVerifier("/project-stub", "origin/master", "1.0.0");
1818

19-
verifier.executeGoal("gitflow-helper:enforce-versions");
20-
21-
verifier.verifyErrorFreeLog();
22-
verifier.verifyTextInLog("GitBranchInfo:");
19+
try {
20+
verifier.executeGoal("gitflow-helper:enforce-versions");
2321

24-
verifier.resetStreams();
22+
verifier.verifyErrorFreeLog();
23+
verifier.verifyTextInLog("GitBranchInfo:");
24+
} finally {
25+
verifier.resetStreams();
26+
}
2527
}
2628

2729
@Test(expected = VerificationException.class)
@@ -31,24 +33,10 @@ public void snapshotVersionFailure() throws Exception {
3133
try {
3234
verifier.executeGoal("gitflow-helper:enforce-versions");
3335
} finally {
34-
verifier.verifyTextInLog("GitBranchInfo:");
35-
verifier.verifyTextInLog("The maven project or one of its parents is currently a snapshot version.");
36-
37-
verifier.resetStreams();
38-
}
39-
}
40-
41-
@Test(expected = VerificationException.class)
42-
public void snapshotPluginFailure() throws Exception {
43-
if (System.getProperty("project.version", "").endsWith("-SNAPSHOT")) {
44-
Verifier verifier = createVerifier("/project-stub", "origin/master", "1.0.0");
45-
46-
try {
47-
verifier.executeGoal("gitflow-helper:enforce-versions");
48-
} finally {
36+
try {
4937
verifier.verifyTextInLog("GitBranchInfo:");
50-
verifier.verifyTextInLog("The maven project has the following SNAPSHOT plugin dependencies:");
51-
38+
verifier.verifyTextInLog("The maven project or one of its parents is currently a snapshot version.");
39+
} finally {
5240
verifier.resetStreams();
5341
}
5442
}
@@ -59,62 +47,78 @@ public void promotionOfRelease() throws Exception {
5947
// Create a release version and get it deployed.
6048
Verifier verifier = createVerifier("/project-stub", "origin/release/1.0.0", "1.0.0");
6149

62-
verifier.executeGoal("deploy");
50+
try {
51+
verifier.executeGoal("deploy");
6352

64-
verifier.verifyErrorFreeLog();
65-
verifier.resetStreams();
53+
verifier.verifyErrorFreeLog();
54+
} finally {
55+
verifier.resetStreams();
56+
}
6657

6758
// Promote (deploy) from /origin/master
6859
verifier = createVerifier("/project-stub", "origin/master", "1.0.0");
6960

70-
verifier.executeGoal("deploy");
71-
7261
try {
73-
verifier.verifyTextInLog("Compiling");
74-
throw new VerificationException(PROMOTION_FAILED_MESSAGE);
75-
} catch (VerificationException ve) {
76-
if (ve.getMessage().equals(PROMOTION_FAILED_MESSAGE)) {
77-
throw ve;
62+
verifier.executeGoal("deploy");
63+
64+
try {
65+
verifier.verifyTextInLog("Compiling");
66+
throw new VerificationException(PROMOTION_FAILED_MESSAGE);
67+
} catch (VerificationException ve) {
68+
if (ve.getMessage().equals(PROMOTION_FAILED_MESSAGE)) {
69+
throw ve;
70+
}
71+
// Otherwise, it's the VerificationException from looking for "Compiling", and that's expected to fail.
7872
}
79-
// Otherwise, it's the VerificationException from looking for "Compiling", and that's expected to fail.
80-
}
8173

82-
verifier.verifyTextInLog("gitflow-helper-maven-plugin: Enabling MasterPromoteExtension. GIT_BRANCH: [origin/master] matches masterBranchPattern");
83-
verifier.verifyTextInLog("[INFO] Setting release artifact repository to: [releases]");
84-
verifier.verifyTextInLog("[INFO] Resolving & Reattaching existing artifacts from stageDeploymentRepository [test-releases");
85-
verifier.verifyErrorFreeLog();
86-
verifier.resetStreams();
74+
verifier.verifyTextInLog(
75+
"gitflow-helper-maven-plugin: Enabling MasterPromoteExtension. GIT_BRANCH: [origin/master] matches masterBranchPattern");
76+
verifier.verifyTextInLog("[INFO] Setting release artifact repository to: [releases]");
77+
verifier.verifyTextInLog(
78+
"[INFO] Resolving & Reattaching existing artifacts from stageDeploymentRepository [test-releases");
79+
verifier.verifyErrorFreeLog();
80+
} finally {
81+
verifier.resetStreams();
82+
}
8783
}
8884

8985
@Test
9086
public void dontPruneExplicitlyInvokedPlugins() throws Exception {
9187
// Create a release version and get it deployed.
9288
Verifier verifier = createVerifier("/project-stub", "origin/release/1.1.0", "1.1.0");
9389

94-
verifier.executeGoal("deploy");
90+
try {
91+
verifier.executeGoal("deploy");
9592

96-
verifier.verifyErrorFreeLog();
97-
verifier.resetStreams();
93+
verifier.verifyErrorFreeLog();
94+
} finally {
95+
verifier.resetStreams();
96+
}
9897

9998
// Promote (deploy) from /origin/master
10099
verifier = createVerifier("/project-stub", "origin/master", "1.1.0");
101100

102-
verifier.executeGoals(Arrays.asList("jar:jar", "deploy"));
103101
try {
104-
verifier.verifyTextInLog("Compiling");
105-
throw new VerificationException(PROMOTION_FAILED_MESSAGE);
106-
} catch (VerificationException ve) {
107-
if (ve.getMessage().equals(PROMOTION_FAILED_MESSAGE)) {
108-
throw ve;
102+
verifier.executeGoals(Arrays.asList("jar:jar", "deploy"));
103+
try {
104+
verifier.verifyTextInLog("Compiling");
105+
throw new VerificationException(PROMOTION_FAILED_MESSAGE);
106+
} catch (VerificationException ve) {
107+
if (ve.getMessage().equals(PROMOTION_FAILED_MESSAGE)) {
108+
throw ve;
109+
}
110+
// Otherwise, it's the VerificationException from looking for "Compiling", and that's expected to fail.
109111
}
110-
// Otherwise, it's the VerificationException from looking for "Compiling", and that's expected to fail.
111-
}
112112

113-
verifier.verifyTextInLog("Building jar:"); // This should still be there.
114-
verifier.verifyTextInLog("gitflow-helper-maven-plugin: Enabling MasterPromoteExtension. GIT_BRANCH: [origin/master] matches masterBranchPattern");
115-
verifier.verifyTextInLog("[INFO] Setting release artifact repository to: [releases]");
116-
verifier.verifyTextInLog("[INFO] Resolving & Reattaching existing artifacts from stageDeploymentRepository [test-releases");
117-
verifier.verifyErrorFreeLog();
118-
verifier.resetStreams();
113+
verifier.verifyTextInLog("Building jar:"); // This should still be there.
114+
verifier.verifyTextInLog(
115+
"gitflow-helper-maven-plugin: Enabling MasterPromoteExtension. GIT_BRANCH: [origin/master] matches masterBranchPattern");
116+
verifier.verifyTextInLog("[INFO] Setting release artifact repository to: [releases]");
117+
verifier.verifyTextInLog(
118+
"[INFO] Resolving & Reattaching existing artifacts from stageDeploymentRepository [test-releases");
119+
verifier.verifyErrorFreeLog();
120+
} finally {
121+
verifier.resetStreams();
122+
}
119123
}
120124
}

src/test/java/com/e_gineering/maven/gitflowhelper/ReleaseBranchIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ public class ReleaseBranchIT extends AbstractIntegrationTest {
1414
/**
1515
* Non-snapshot versions on the develop branch should fail.
1616
*/
17-
@Test(expected = VerificationException.class)
17+
@Test
1818
public void snapshotDeployFails() throws Exception {
1919
Verifier verifier = createVerifier("/project-stub", "origin/release/1.0.0", "1.0.0-SNAPSHOT");
2020

2121
try {
2222
verifier.executeGoal("deploy");
2323
} catch (Exception ex) {
2424
verifier.verifyTextInLog("The current git branch: [origin/release/1.0.0] is defined as a release branch. The maven project or one of its parents is currently a snapshot version.");
25-
throw ex;
2625
} finally {
2726
verifier.resetStreams();
2827
}

0 commit comments

Comments
 (0)