1
1
package org .scm4j .releaser ;
2
2
3
+ import static org .junit .Assert .assertEquals ;
4
+ import static org .junit .Assert .assertFalse ;
3
5
import static org .junit .Assert .assertNotNull ;
6
+ import static org .junit .Assert .assertNull ;
4
7
import static org .junit .Assert .assertTrue ;
5
8
6
9
import java .util .List ;
@@ -43,19 +46,19 @@ public void testDelayedTagOnPatch() throws Exception {
43
46
44
47
// build all patches, delayed tag
45
48
Component compUnTillVersioned = compUnTill .clone (env .getUnTillVer ().toReleaseZeroPatch ());
46
- action = getActionTreeDelayedTag (compUnTillVersioned ); //actionBuilder.getActionTreeDelayedTag(compUnTillVersioned);
49
+ action = getActionDelayedTag (compUnTillVersioned ); //actionBuilder.getActionTreeDelayedTag(compUnTillVersioned);
47
50
assertIsGoingToBuildAll (action );
48
51
execAction (action );
49
52
50
53
// check no new tags
51
- assertTrue ( env .getUblVCS ().getTags ().size () == 1 );
52
- assertTrue ( env .getUnTillDbVCS ().getTags ().size () == 1 );
53
- assertTrue ( env .getUnTillVCS ().getTags ().size () == 1 );
54
+ assertEquals ( 2 , env .getUblVCS ().getTags ().size ());
55
+ assertEquals ( 2 , env .getUnTillDbVCS ().getTags ().size ());
56
+ assertEquals ( 1 , env .getUnTillVCS ().getTags ().size ());
54
57
55
58
// check Delayed Tags file
56
- assertNotNull (dtf .getRevisitonByUrl (compUnTillDb .getVcsRepository ().getUrl ()));
59
+ assertNull (dtf .getRevisitonByUrl (compUnTillDb .getVcsRepository ().getUrl ()));
57
60
assertNotNull (dtf .getRevisitonByUrl (compUnTill .getVcsRepository ().getUrl ()));
58
- assertNotNull (dtf .getRevisitonByUrl (compUBL .getVcsRepository ().getUrl ()));
61
+ assertNull (dtf .getRevisitonByUrl (compUBL .getVcsRepository ().getUrl ()));
59
62
60
63
// check Delayed Tags are used
61
64
action = getActionTreeBuild (compUnTillVersioned );
@@ -64,22 +67,27 @@ public void testDelayedTagOnPatch() throws Exception {
64
67
65
68
@ Test
66
69
public void testDelayedTag () throws Exception {
67
- IAction action = getActionTreeDelayedTag (compUnTill );
70
+ IAction action = getActionDelayedTag (compUnTill );
68
71
execAction (action );
69
72
70
- // check no tags
73
+ // check root component tag is delayed
71
74
assertTrue (env .getUnTillVCS ().getTags ().isEmpty ());
72
- assertTrue (env .getUnTillDbVCS ().getTags ().isEmpty ());
73
- assertTrue (env .getUblVCS ().getTags ().isEmpty ());
75
+ assertTrue (env .getUnTillDbVCS ().getTags ().size () == 1 );
76
+ assertTrue (env .getUblVCS ().getTags ().size () == 1 );
77
+
78
+ // check component with delayed tag is considered as tagged (DONE) on build
79
+ action = getActionTreeBuild (compUnTill );
80
+ assertIsGoingToDoNothing (action );
74
81
75
82
// check Delayed Tags file
76
- assertNotNull (dtf .getRevisitonByUrl (compUnTillDb .getVcsRepository ().getUrl ()));
83
+ assertNull (dtf .getRevisitonByUrl (compUnTillDb .getVcsRepository ().getUrl ()));
77
84
assertNotNull (dtf .getRevisitonByUrl (compUnTill .getVcsRepository ().getUrl ()));
78
- assertNotNull (dtf .getRevisitonByUrl (compUBL .getVcsRepository ().getUrl ()));
85
+ assertNull (dtf .getRevisitonByUrl (compUBL .getVcsRepository ().getUrl ()));
79
86
80
- // tag all
87
+ // create tag which was delayed
81
88
action = getActionTreeTag (compUnTill );
82
- assertIsGoingToTagAll (action );
89
+ assertIsGoingToTag (action , compUnTill );
90
+
83
91
execAction (action );
84
92
85
93
// check tags
@@ -93,30 +101,31 @@ public void testDelayedTag() throws Exception {
93
101
94
102
@ Test
95
103
public void testTagFileDeleted () throws Exception {
96
- IAction action = getActionTreeDelayedTag (compUnTill );
104
+ // build all, root tag delayed
105
+ IAction action = getActionDelayedTag (compUnTill );
97
106
execAction (action );
98
107
99
108
// simulate delayed tags file is deleted right after action create
100
109
action = getActionTreeTag (compUnTill );
101
- assertIsGoingToTagAll (action );
110
+ assertIsGoingToTag (action , compUnTill );
102
111
dtf .delete ();
103
112
execAction (action );
104
113
105
114
// check no tags
106
115
assertTrue (env .getUnTillVCS ().getTags ().isEmpty ());
107
- assertTrue (env .getUnTillDbVCS ().getTags ().isEmpty ());
108
- assertTrue (env .getUblVCS ().getTags ().isEmpty ());
116
+ assertFalse (env .getUnTillDbVCS ().getTags ().isEmpty ());
117
+ assertFalse (env .getUblVCS ().getTags ().isEmpty ());
109
118
}
110
119
111
120
@ Test
112
121
public void testTagExistsOnExecute () throws Exception {
113
122
// build all
114
- IAction action = getActionTreeDelayedTag (compUnTill );
123
+ IAction action = getActionDelayedTag (compUnTill );
115
124
execAction (action );
116
125
117
126
// all is going to tag
118
127
action = getActionTreeTag (compUnTill );
119
- assertIsGoingToTagAll (action );
128
+ assertIsGoingToTag (action , compUnTill );
120
129
121
130
// simulate tag exists already
122
131
ReleaseBranch rb = ReleaseBranchFactory .getCRB (compUnTill );
@@ -158,7 +167,7 @@ public void testDoNothingIfNoDelayedTags() {
158
167
@ Test
159
168
public void testTagExistsOnGetActionTree () throws Exception {
160
169
// build all
161
- IAction action = getActionTreeDelayedTag (compUnTillDb );
170
+ IAction action = getActionDelayedTag (compUnTillDb );
162
171
assertIsGoingToForkAndBuild (action , compUnTillDb );
163
172
execAction (action );
164
173
0 commit comments