| 7186 |
dpurdie |
1 |
package com.erggroup.buildtool.utf;
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
import com.erggroup.buildtool.ripple.Package;
|
|
|
5 |
import com.erggroup.buildtool.ripple.RippleEngine;
|
|
|
6 |
import org.slf4j.Logger;
|
|
|
7 |
import org.slf4j.LoggerFactory;
|
|
|
8 |
import org.junit.AfterClass;
|
|
|
9 |
import org.junit.BeforeClass;
|
|
|
10 |
import org.junit.After;
|
|
|
11 |
import org.junit.Before;
|
|
|
12 |
import org.junit.Test;
|
|
|
13 |
import static org.junit.Assert.*;
|
|
|
14 |
|
|
|
15 |
/**
|
|
|
16 |
* container of Build Daemon test methods
|
|
|
17 |
*/
|
|
|
18 |
public class RippleVersionsTest
|
|
|
19 |
{
|
|
|
20 |
private static final Logger mLogger = LoggerFactory.getLogger(RippleVersionsTest.class);
|
|
|
21 |
myReleaseManager releaseManager = null;
|
|
|
22 |
RippleEngine rippleEngine = null;
|
|
|
23 |
Package p = null;
|
|
|
24 |
|
|
|
25 |
/** Subclass and override key methods so that the test can control
|
|
|
26 |
* the data being used
|
|
|
27 |
*/
|
|
|
28 |
public class myReleaseManager extends ReleaseManagerUtf
|
|
|
29 |
{
|
|
|
30 |
int mAmyReleaseManager = 1;
|
|
|
31 |
|
|
|
32 |
public myReleaseManager(final String connectionString, final String username, final String password)
|
|
|
33 |
{
|
|
|
34 |
super(connectionString, username, password);
|
|
|
35 |
mLogger.error("Test {}", connectionString);
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
public myReleaseManager()
|
|
|
39 |
{
|
|
|
40 |
super();
|
|
|
41 |
}
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
public RippleVersionsTest()
|
|
|
46 |
{
|
|
|
47 |
mLogger.debug("DaemonBuildTestCase");
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
/**
|
|
|
51 |
* set up performed prior to any test method
|
|
|
52 |
*/
|
|
|
53 |
@BeforeClass
|
|
|
54 |
public static void TestCaseSetUp()
|
|
|
55 |
{
|
|
|
56 |
mLogger.debug("TestCaseSetUp");
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
/**
|
|
|
60 |
* tear down performed after test methods
|
|
|
61 |
*/
|
|
|
62 |
@AfterClass
|
|
|
63 |
public static void TestCaseTearDown()
|
|
|
64 |
{
|
|
|
65 |
mLogger.debug("TestCaseTearDown");
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
/**
|
|
|
69 |
* set up performed prior to each test method
|
|
|
70 |
*/
|
|
|
71 |
@Before
|
|
|
72 |
public void TestSetUp()
|
|
|
73 |
{
|
|
|
74 |
mLogger.debug("TestSetUp");
|
|
|
75 |
System.setProperty("vix.utf.name", "DaemonBuildTestCase");
|
|
|
76 |
Package.mGenericMachtype = "win32";
|
|
|
77 |
Package.mGbeDpkg = ".";
|
|
|
78 |
|
|
|
79 |
releaseManager = new myReleaseManager();
|
|
|
80 |
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
/**
|
|
|
84 |
* tear down performed after each test method
|
|
|
85 |
*/
|
|
|
86 |
@After
|
|
|
87 |
public void TestTearDown()
|
|
|
88 |
{
|
|
|
89 |
mLogger.debug("TestTearDown");
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
/**
|
|
|
93 |
* test method designed to test ripple field limits
|
|
|
94 |
* 1 tests applyPV returns 1 for package with version a.b.1.2.0
|
|
|
95 |
*/
|
|
|
96 |
@Test
|
|
|
97 |
public void TestRippleFieldLimits()
|
|
|
98 |
{
|
|
|
99 |
// for test purposes, p.mId will contain the return value of applyPV
|
|
|
100 |
// test applyPV returns 1 and leaves mVersion alone
|
|
|
101 |
p = new Package(releaseManager, "a.b.1.2.0", ".cr", false, 255, 255, 255, 255);
|
|
|
102 |
assertTrue(p.getId() == 1);
|
|
|
103 |
assertTrue(p.getVersion().compareTo("a.b.1.2.0") == 0);
|
|
|
104 |
|
|
|
105 |
// test applyPV returns 2 and leaves mVersion alone
|
|
|
106 |
p = new Package(releaseManager, "1.0.0000", ".cr", false, 0, 0, 0, 0);
|
|
|
107 |
assertTrue(p.getId() == 2);
|
|
|
108 |
assertTrue(p.getVersion().compareTo("1.0.0000") == 0);
|
|
|
109 |
|
|
|
110 |
// test applyPV returns 2 and leaves mVersion alone
|
|
|
111 |
p = new Package(releaseManager, "1.0.0009", ".cr", false, 0, 0, 0, 9);
|
|
|
112 |
assertTrue(p.getId() == 2);
|
|
|
113 |
assertTrue(p.getVersion().compareTo("1.0.0009") == 0);
|
|
|
114 |
|
|
|
115 |
// test applyPV returns 2 and leaves mVersion alone
|
|
|
116 |
p = new Package(releaseManager, "1.0.9000", ".cr", false, 0, 0, 9, 0);
|
|
|
117 |
assertTrue(p.getId() == 2);
|
|
|
118 |
assertTrue(p.getVersion().compareTo("1.0.9000") == 0);
|
|
|
119 |
|
|
|
120 |
// test applyPV returns 2 and leaves mVersion alone
|
|
|
121 |
p = new Package(releaseManager, "1.9.0000", ".cr", false, 0, 9, 0, 0);
|
|
|
122 |
assertTrue(p.getId() == 2);
|
|
|
123 |
assertTrue(p.getVersion().compareTo("1.9.0000") == 0);
|
|
|
124 |
|
|
|
125 |
// test applyPV returns 2 and leaves mVersion alone
|
|
|
126 |
p = new Package(releaseManager, "1.0.0000", ".cr", false, 1, 0, 0, 0);
|
|
|
127 |
assertTrue(p.getId() == 2);
|
|
|
128 |
assertTrue(p.getVersion().compareTo("1.0.0000") == 0);
|
|
|
129 |
|
|
|
130 |
// test applyPV returns 2 and leaves mVersion alone - wince style limits
|
|
|
131 |
p = new Package(releaseManager, "9.9.9000", ".cr", false, 9, 9, 9, 0);
|
|
|
132 |
assertTrue(p.getId() == 2);
|
|
|
133 |
assertTrue(p.getVersion().compareTo("9.9.9000") == 0);
|
|
|
134 |
|
|
|
135 |
// test applyPV returns 0 and sets mNextVersion from 8.8.8000 to 8.8.9000 and does not change mVersion
|
|
|
136 |
p = new Package(releaseManager, "8.8.8000", ".cr", false, 9, 9, 9, 0);
|
|
|
137 |
assertTrue(p.getId() == 0);
|
|
|
138 |
assertTrue(p.getVersion().compareTo("8.8.8000") == 0);
|
|
|
139 |
assertTrue(p.getNextVersion().compareTo("8.8.9000") == 0);
|
|
|
140 |
|
|
|
141 |
// test applyPV returns 0 and sets mNextVersion from 8.8.9000 to 8.9.0000
|
|
|
142 |
p = new Package(releaseManager, "8.8.9000", ".cr", false, 9, 9, 9, 0);
|
|
|
143 |
assertTrue(p.getId() == 0);
|
|
|
144 |
assertTrue(p.getVersion().compareTo("8.8.9000") == 0);
|
|
|
145 |
assertTrue(p.getNextVersion().compareTo("8.9.0000") == 0);
|
|
|
146 |
|
|
|
147 |
// test applyPV returns 0 and sets mNextVersion from 8.9.9000 to 9.0.0000
|
|
|
148 |
p = new Package(releaseManager, "8.9.9000", ".cr", false, 9, 9, 9, 0);
|
|
|
149 |
assertTrue(p.getId() == 0);
|
|
|
150 |
assertTrue(p.getVersion().compareTo("8.9.9000") == 0);
|
|
|
151 |
assertTrue(p.getNextVersion().compareTo("9.0.0000") == 0);
|
|
|
152 |
|
|
|
153 |
// test applyPV returns 2 and leaves mVersion alone - mos style limits
|
|
|
154 |
p = new Package(releaseManager, "99.99.0000", ".cr", false, 99, 99, 0, 0);
|
|
|
155 |
assertTrue(p.getId() == 2);
|
|
|
156 |
assertTrue(p.getVersion().compareTo("99.99.0000") == 0);
|
|
|
157 |
|
|
|
158 |
// test applyPV returns 0 and sets mNextVersion from 98.98.0000 to 98.99.0000
|
|
|
159 |
p = new Package(releaseManager, "98.98.0000", ".cr", false, 99, 99, 0, 0);
|
|
|
160 |
assertTrue(p.getId() == 0);
|
|
|
161 |
assertTrue(p.getVersion().compareTo("98.98.0000") == 0);
|
|
|
162 |
assertTrue(p.getNextVersion().compareTo("98.99.0000") == 0);
|
|
|
163 |
|
|
|
164 |
// test applyPV returns 0 and sets mNextVersion from 98.99.0000 to 99.0.0000
|
|
|
165 |
p = new Package(releaseManager, "98.99.0000", ".cr", false, 99, 99, 0, 0);
|
|
|
166 |
assertTrue(p.getId() == 0);
|
|
|
167 |
assertTrue(p.getVersion().compareTo("98.99.0000") == 0);
|
|
|
168 |
assertTrue(p.getNextVersion().compareTo("99.0.0000") == 0);
|
|
|
169 |
|
|
|
170 |
}
|
|
|
171 |
|
|
|
172 |
/**
|
|
|
173 |
* test method designed to ripple of COTS packages
|
|
|
174 |
* 1 tests applyPV returns 1 for package with version a.b.1.2.0
|
|
|
175 |
*/
|
|
|
176 |
@Test
|
|
|
177 |
public void TestCotsRipples()
|
|
|
178 |
{
|
|
|
179 |
// for test purposes, p.mId will contain the return value of applyPV
|
|
|
180 |
// test applyPV returns 1 and leaves mVersion alone
|
|
|
181 |
|
|
|
182 |
mLogger.debug("TestCotsRipples: willNotRipple.cots");
|
|
|
183 |
p = new Package(releaseManager, "willNotRipple", ".cots", false, 255, 255, 255, 255);
|
|
|
184 |
assertTrue(p.getId() == 1);
|
|
|
185 |
assertTrue(p.getVersion().compareTo("willNotRipple") == 0);
|
|
|
186 |
|
|
|
187 |
mLogger.debug("TestCotsRipples: willRipple.0000.cots");
|
|
|
188 |
p = new Package(releaseManager, "willRipple.0000", ".cots", false, 255, 255, 255, 255);
|
|
|
189 |
assertTrue(p.getId() == 0);
|
|
|
190 |
assertTrue(p.getVersion().compareTo("willRipple.0000") == 0);
|
|
|
191 |
assertTrue(p.getNextVersion().compareTo("willRipple.1000") == 0);
|
|
|
192 |
|
|
|
193 |
mLogger.debug("TestCotsRipples: willNotRipple.000.cots");
|
|
|
194 |
p = new Package(releaseManager, "willNotRipple.000", ".cots", false, 255, 255, 255, 255);
|
|
|
195 |
assertTrue(p.getId() == 1);
|
|
|
196 |
assertTrue(p.getVersion().compareTo("willNotRipple.000") == 0);
|
|
|
197 |
|
|
|
198 |
}
|
|
|
199 |
|
|
|
200 |
/** Test the generation of version numbers on TEST builds
|
|
|
201 |
*
|
|
|
202 |
*/
|
|
|
203 |
@Test
|
|
|
204 |
public void TestTestRequest()
|
|
|
205 |
{
|
|
|
206 |
|
|
|
207 |
// for test purposes, p.mId will contain the return value of applyPV
|
|
|
208 |
// test applyPV returns 1 and leaves mVersion alone
|
|
|
209 |
|
|
|
210 |
mLogger.debug("TestCoreTestRequest: 12.13.0000.cr");
|
|
|
211 |
p = new Package(releaseManager, "12.13.0000", ".cr", true, 255, 255, 255, 255);
|
|
|
212 |
mLogger.warn("Result:{} {}", p, p.getNextVersion() );
|
|
|
213 |
assertTrue(p.getId() == 0);
|
|
|
214 |
assertTrue(p.getNextVersion().compareTo("99.99.99000") == 0);
|
|
|
215 |
|
|
|
216 |
mLogger.debug("TestCoreRequest: 12.13.0000.cr");
|
|
|
217 |
p = new Package(releaseManager, "12.13.0000", ".cr", false, 255, 255, 255, 255);
|
|
|
218 |
mLogger.warn("Result:{} {}", p, p.getNextVersion() );
|
|
|
219 |
assertTrue(p.getId() == 0);
|
|
|
220 |
assertTrue(p.getNextVersion().compareTo("12.13.0001") == 0);
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
/** Test the generation of version numbers on TEST builds
|
|
|
224 |
*
|
|
|
225 |
*/
|
|
|
226 |
@Test
|
|
|
227 |
public void TestCotsTestRequest()
|
|
|
228 |
{
|
|
|
229 |
|
|
|
230 |
// for test purposes, p.mId will contain the return value of applyPV
|
|
|
231 |
// test applyPV returns 1 and leaves mVersion alone
|
|
|
232 |
|
|
|
233 |
mLogger.debug("TestCotsTestRequest: willNotRipple.cots");
|
|
|
234 |
p = new Package(releaseManager, "willNotTestBuild", ".cots", true, 255, 255, 255, 255);
|
|
|
235 |
mLogger.warn("Result:{} {}", p, p.getNextVersion() );
|
|
|
236 |
assertTrue(p.getId() == 1);
|
|
|
237 |
assertTrue(p.getVersion().compareTo("willNotTestBuild") == 0);
|
|
|
238 |
|
|
|
239 |
mLogger.debug("TestCotsTestRequest: willTestBuild.0000.cots");
|
|
|
240 |
p = new Package(releaseManager, "willTestBuild.0000", ".cots", true, 255, 255, 255, 255);
|
|
|
241 |
mLogger.warn("Result:{} {}", p, p.getNextVersion());
|
|
|
242 |
assertTrue(p.getId() == 0);
|
|
|
243 |
assertTrue(p.getVersion().compareTo("willTestBuild.0000") == 0);
|
|
|
244 |
assertTrue(p.getNextVersion().compareTo("willTestBuild.99000") == 0);
|
|
|
245 |
|
|
|
246 |
mLogger.debug("TestCotsTestRequest: willTestBuild.0000.tools");
|
|
|
247 |
p = new Package(releaseManager, "willTestBuild.0000", ".tools", true, 255, 255, 255, 255);
|
|
|
248 |
mLogger.warn("Result:{} {}", p, p.getNextVersion());
|
|
|
249 |
assertTrue(p.getId() == 0);
|
|
|
250 |
assertTrue(p.getVersion().compareTo("willTestBuild.0000") == 0);
|
|
|
251 |
assertTrue(p.getNextVersion().compareTo("willTestBuild.99000") == 0);
|
|
|
252 |
|
|
|
253 |
mLogger.debug("TestCotsTestRequest: 12.13.0000.cots");
|
|
|
254 |
p = new Package(releaseManager, "12.13.0000", ".cots", true, 255, 255, 255, 255);
|
|
|
255 |
mLogger.warn("Result:{} {}", p, p.getNextVersion());
|
|
|
256 |
assertTrue(p.getId() == 0);
|
|
|
257 |
assertTrue(p.getVersion().compareTo("12.13.0000") == 0);
|
|
|
258 |
assertTrue(p.getNextVersion().compareTo("12.13.99000") == 0);
|
|
|
259 |
|
|
|
260 |
mLogger.debug("TestCotsTestRequest: 12.13.14.0000.cots");
|
|
|
261 |
p = new Package(releaseManager, "12.13.14.0000", ".cots", true, 255, 255, 255, 255);
|
|
|
262 |
mLogger.warn("Result:{} {}", p, p.getNextVersion());
|
|
|
263 |
assertTrue(p.getId() == 0);
|
|
|
264 |
assertTrue(p.getVersion().compareTo("12.13.14.0000") == 0);
|
|
|
265 |
assertTrue(p.getNextVersion().compareTo("12.13.14.99000") == 0);
|
|
|
266 |
|
|
|
267 |
mLogger.debug("TestCotsTestRequest: willNotTestBuild.000.cots");
|
|
|
268 |
p = new Package(releaseManager, "willNotTestBuild.000", ".cots", true, 255, 255, 255, 255);
|
|
|
269 |
mLogger.warn("Result:{} {}", p, p.getNextVersion());
|
|
|
270 |
assertTrue(p.getId() == 1);
|
|
|
271 |
assertTrue(p.getVersion().compareTo("willNotTestBuild.000") == 0);
|
|
|
272 |
|
|
|
273 |
}
|
|
|
274 |
|
|
|
275 |
}
|