@@ -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}
0 commit comments