Subversion Repositories DevTools

Rev

Rev 6914 | Rev 7082 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6914 dpurdie 1
package com.erggroup.buildtool.utf;
2
 
3
 
4
import java.sql.SQLException;
5
import java.util.ArrayList;
6
import java.util.Date;
7
 
8
import com.erggroup.buildtool.daemon.BuildDaemon;
9
import com.erggroup.buildtool.daemon.BuildThread;
10
import com.erggroup.buildtool.daemon.MasterThread;
11
import com.erggroup.buildtool.daemon.SlaveThread;
12
import com.erggroup.buildtool.ripple.BuildFile;
13
import com.erggroup.buildtool.ripple.BuildFile.BuildFileState;
14
import com.erggroup.buildtool.ripple.BuildStandard;
15
import com.erggroup.buildtool.ripple.ReleaseConfig;
16
import com.erggroup.buildtool.ripple.ReleaseManager;
17
import com.erggroup.buildtool.ripple.Package;
18
import com.erggroup.buildtool.ripple.RippleEngine;
19
import com.erggroup.buildtool.ripple.RunLevelData;
20
import com.erggroup.buildtool.ripple.RunLevel.BuildState;
21
 
7033 dpurdie 22
import org.slf4j.Logger;
23
import org.slf4j.LoggerFactory;
6914 dpurdie 24
import org.junit.AfterClass;
25
import org.junit.BeforeClass;
26
import org.junit.After;
27
import org.junit.Before;
28
import org.junit.Test;
29
import org.junit.runner.JUnitCore;
30
 
31
import static org.junit.Assert.*;
32
 
33
/**
34
 * container of Build Daemon test methods
35
 */
36
public class DaemonBuildTestCase
37
{
7033 dpurdie 38
    private static final Logger mLogger = LoggerFactory.getLogger(DaemonBuildTestCase.class);
6914 dpurdie 39
    ReleaseManager              releaseManager = null;
40
    RippleEngine                rippleEngine   = null;
41
 
42
    /** Subclass and override key methods so that the test can control
43
     *  the data being used
44
     */
45
    public class myReleaseManager extends ReleaseManagerUtf
46
	{
47
        int mAmyReleaseManager = 1;
48
 
49
		public myReleaseManager(final String connectionString, final String username, final String password)
50
		{
51
			super(connectionString, username, password);
52
		}
53
 
54
		public myReleaseManager()
55
		{
56
			super();
57
		}
58
 
59
		@Override
60
		public void queryPackageVersions(RippleEngine rippleEngine, ArrayList<Package> packageCollection,
61
				int baseline) throws SQLException, Exception
62
		{
63
 
64
	        /* a highly unlikely set of packages
65
	         * planned info
66
	         * pv_id pkg_id pkg_name                     v_ext pkg_vcs_tag                            change_type
67
	         * 0     76     UncommonDependency           .tim  0.TIM.WIP \vob\UncommonDependency           P
68
	         * 1     1011   DependencyMissingFromRelease .tim  1.TIM.WIP \vob\DependencyMissingFromRelease M
69
	         * 2     34     CommonDependency             .tim  2.TIM.WIP \vob\CommonDependency             M
70
	         * 3     908    SolarisCentricProduct        .tim  3.TIM.WIP \vob\SolarisCentricProduct        N
71
	         * 4     6      GenericProduct               .tim  4.TIM.WIP \vob\GenericProduct               P
72
	         * 5     11     Product                      .tim  5.TIM.WIP \vob\Product                      M
73
	         * 6     113    UnfinishedProduct            .tim  6.TIM.WIP \vob\UnfinishedProduct            M
74
	         * 25    45     Banana                       .tim  B.TIM.WIP \vob\Banana                       M
75
	         */
76
	         if ( mConnectionString.compareTo("iteration1") == 0 )
77
	         {
78
	           Package p = new Package(76, 0, "UncommonDependency", "1.0.0000", ".tim", "UncommonDependency.tim", "CC::/vob/UncommonDependency::0.TIM.WIP", 'b', 'P');
79
	           p.mDirectlyPlanned = true;
80
	           packageCollection.add(p);
81
	         }
82
 
83
	         Package p = new Package(1011, 1, "DependencyMissingFromRelease", "1.0.0000", ".tim", "DependencyMissingFromRelease.tim", "CC::/vob/DependencyMissingFromRelease::1.TIM.WIP", 'b', 'M');
84
	         p.mDirectlyPlanned = true;
85
	         packageCollection.add(p);
86
 
87
	         if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
88
	         {
89
	           p = new Package(34, 2, "CommonDependency", "1.0.0000", ".tim", "CommonDependency.tim", "CC::/vob/CommonDependency::2.TIM.WIP", 'b', 'M');
90
	           p.mDirectlyPlanned = true;
91
	           packageCollection.add(p);
92
	         }
93
 
94
	         if ( mConnectionString.compareTo("iteration1") == 0 
95
	           || mConnectionString.compareTo("iteration2") == 0
96
	           || mConnectionString.compareTo("iteration3") == 0 )
97
	         {
98
	           p = new Package(908, 3, "SolarisCentricProduct", "1.0.0000", ".tim", "SolarisCentricProduct.tim", "CC::/vob/SolarisCentricProduct::3.TIM.WIP", 'b', 'N');
99
	           p.mDirectlyPlanned = true;
100
	           packageCollection.add(p);
101
	         }
102
 
103
	         if ( mConnectionString.compareTo("iteration1") == 0 
104
	           || mConnectionString.compareTo("iteration2") == 0
105
	           || mConnectionString.compareTo("iteration3") == 0
106
	           || mConnectionString.compareTo("iteration4") == 0 )
107
	         {
108
	           p = new Package(6, 4, "GenericProduct", "1.0.0000", ".tim", "GenericProduct.tim", "CC::/vob/GenericProduct::4.TIM.WIP", 'b', 'P');
109
	           p.mDirectlyPlanned = true;
110
	           packageCollection.add(p);
111
	         }
112
 
113
	         if ( mConnectionString.compareTo("iteration1") == 0 
114
	           || mConnectionString.compareTo("iteration2") == 0
115
	           || mConnectionString.compareTo("iteration3") == 0
116
	           || mConnectionString.compareTo("iteration4") == 0
117
	           || mConnectionString.compareTo("iteration5") == 0 )
118
	         {
119
	           p = new Package(11, 5, "Product", "1.0.0000", ".tim", "Product.tim", "CC::/vob/Product::5.TIM.WIP", 'b', 'M');
120
	           p.mDirectlyPlanned = true;
121
	           packageCollection.add(p);
122
	         }
123
 
124
	         p = new Package(113, 6, "UnfinishedProduct", "1.0.0000", ".tim", "UnfinishedProduct.tim", "CC::/vob/UnfinishedProduct::6.TIM.WIP", 'b', 'M');
125
	         p.mDirectlyPlanned = true;
126
	         packageCollection.add(p);
127
 
128
	         if ( mConnectionString.compareTo("iteration1") == 0 )
129
	         {
130
	           p = new Package(45, 25, "Banana", "1.0.0000", ".tim", "Banana.tim", "CC::B.TIM.WIP/vob/Banana", 'b', 'M');
131
	           p.mDirectlyPlanned = true;
132
	           packageCollection.add(p);
133
	         }
134
 
135
	        /* planned dependencies
136
	         * pv_id pkg_name                     v_ext
137
	         * 1     NotInTheRelease              .cots
138
	         * 2     CotsWithFunnyVersion         .cots
139
	         * 2     UncommonDependency           .tim
140
	         * 3     CommonDependency             .tim
141
	         * 4     CommonDependency             .tim
142
	         * 5     UncommonDependency           .tim
143
	         * 25    Car                          .tim
144
	         */
145
	         p = findPackage(1, packageCollection);
146
	         p.mDependencyCollection.add("NotInTheRelease.cots");
147
	         p.mDependencyIDCollection.add(-1);
148
 
149
	         if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
150
	         {
151
	           p = findPackage(2, packageCollection);
152
	           p.mDependencyCollection.add("CotsWithFunnyVersion.cots");
153
	           p.mDependencyIDCollection.add(-1);
154
	           p.mDependencyCollection.add("UncommonDependency.tim");
155
	           p.mDependencyIDCollection.add(-1);
156
	         }
157
 
158
	         if ( mConnectionString.compareTo("iteration1") == 0 
159
	           || mConnectionString.compareTo("iteration2") == 0
160
	           || mConnectionString.compareTo("iteration3") == 0 )
161
	         {
162
	           p = findPackage(3, packageCollection);
163
	           p.mDependencyCollection.add("CommonDependency.tim");
164
	           p.mDependencyIDCollection.add(-1);
165
	         }
166
 
167
	         if ( mConnectionString.compareTo("iteration1") == 0 
168
	           || mConnectionString.compareTo("iteration2") == 0
169
	           || mConnectionString.compareTo("iteration3") == 0
170
	           || mConnectionString.compareTo("iteration4") == 0 )
171
	         {
172
	           p = findPackage(4, packageCollection);
173
	           p.mDependencyCollection.add("CommonDependency.tim");
174
	           p.mDependencyIDCollection.add(-1);
175
	         }
176
 
177
	         if ( mConnectionString.compareTo("iteration1") == 0 
178
	           || mConnectionString.compareTo("iteration2") == 0
179
	           || mConnectionString.compareTo("iteration3") == 0
180
	           || mConnectionString.compareTo("iteration4") == 0
181
	           || mConnectionString.compareTo("iteration5") == 0 )
182
	         {
183
	           p = findPackage(5, packageCollection);
184
	           p.mDependencyCollection.add("UncommonDependency.tim");
185
	           p.mDependencyIDCollection.add(-1);
186
	         }
187
 
188
	         if ( mConnectionString.compareTo("iteration1") == 0 )
189
	         {
190
	           p = findPackage(25, packageCollection);
191
 
192
	           p.mDependencyCollection.add("Car.tim");
193
	           p.mDependencyIDCollection.add(-1);
194
	         }
195
 
196
 
197
 
198
	        /* planned build info
199
	         * pv_id bm_name bsa_name
200
	         * 0     Linux   Java 1.6
201
	         * 1     Linux   Debug
202
	         * 2     Linux   Debug
203
	         * 2     Solaris Production
204
	         * 2     Win32   Production and Debug
205
	         * 3     Solaris Java 1.4
206
	         * 4     Generic Java 1.5
207
	         * 5     Linux   Java 1.6
208
	         * 5     Win32   Java 1.6
209
	         * 25    Linux   Java 1.6
210
	         */
211
	         if ( mConnectionString.compareTo("iteration1") == 0 )
212
	         {
213
	           p = findPackage(0, packageCollection);
214
	           BuildStandard bs = new BuildStandard(rippleEngine, "Linux", "Java 1.6");
215
	           p.mBuildStandardCollection.add(bs);
216
	         }
217
 
218
	         p = findPackage(1, packageCollection);
219
	         BuildStandard bs = new BuildStandard(rippleEngine, "Linux", "Debug");
220
	         p.mBuildStandardCollection.add(bs);
221
 
222
	         if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
223
	         {
224
	           p = findPackage(2, packageCollection);
225
	           bs = new BuildStandard(rippleEngine, "Linux", "Debug");
226
	           p.mBuildStandardCollection.add(bs);
227
	           bs = new BuildStandard(rippleEngine, "Solaris","Production");
228
	           p.mBuildStandardCollection.add(bs);
229
	           bs = new BuildStandard(rippleEngine, "Win32", "Production and Debug");
230
	           p.mBuildStandardCollection.add(bs);
231
	         }
232
 
233
	         if ( mConnectionString.compareTo("iteration1") == 0 
234
	           || mConnectionString.compareTo("iteration2") == 0
235
	           || mConnectionString.compareTo("iteration3") == 0 )
236
	         {
237
	           p = findPackage(3, packageCollection);
238
	           bs = new BuildStandard(rippleEngine, "Solaris", "Java 1.4");
239
	           p.mBuildStandardCollection.add(bs);
240
	         }
241
 
242
	         if ( mConnectionString.compareTo("iteration1") == 0 
243
	           || mConnectionString.compareTo("iteration2") == 0
244
	           || mConnectionString.compareTo("iteration3") == 0
245
	           || mConnectionString.compareTo("iteration4") == 0 )
246
	         {
247
	           p = findPackage(4, packageCollection);
248
	           bs = new BuildStandard(rippleEngine, "Generic", "Java 1.5");
249
	           p.mBuildStandardCollection.add(bs);
250
	         }
251
 
252
	         if ( mConnectionString.compareTo("iteration1") == 0 
253
	           || mConnectionString.compareTo("iteration2") == 0
254
	           || mConnectionString.compareTo("iteration3") == 0
255
	           || mConnectionString.compareTo("iteration4") == 0
256
	           || mConnectionString.compareTo("iteration5") == 0 )
257
	         {
258
	           p = findPackage(5, packageCollection);
259
	           bs = new BuildStandard(rippleEngine, "Linux", "Java 1.6");
260
	           p.mBuildStandardCollection.add(bs);
261
	           bs = new BuildStandard(rippleEngine, "Win32", "Java 1.6");
262
	           p.mBuildStandardCollection.add(bs);
263
	         }
264
 
265
	         if ( mConnectionString.compareTo("iteration1") == 0 )
266
	         {
267
	           p = findPackage(25, packageCollection);
268
	           bs = new BuildStandard(rippleEngine, "Linux", "Java 1.6");
269
	           p.mBuildStandardCollection.add(bs);
270
	         }
271
 
272
	         /* planned unit test info
273
	         * pv_id test_type_name
274
	         * 2     Manual Test
275
	         * 2     Interactive Test
276
	         * 2     Integration Test
277
	         * 5     Autobuild UTF
278
	         */
279
	         if ( mConnectionString.compareTo("iteration1") == 0 
280
	           || mConnectionString.compareTo("iteration2") == 0
281
	           || mConnectionString.compareTo("iteration3") == 0
282
	           || mConnectionString.compareTo("iteration4") == 0
283
	           || mConnectionString.compareTo("iteration5") == 0 )
284
	         {
285
	           p = findPackage(5, packageCollection);
286
	           p.mHasAutomatedUnitTests = true;
287
	         }
288
 
289
	        /* planned build failure info
290
	         * pv_id user_email
291
	         * 3     jimmyfishcake@vixtechnology.com
292
	         * 3     rayhaddock@vixtechnology.com
293
	         * 5     timbutdim@vixtechnology.com
294
	         */
295
	         if ( mConnectionString.compareTo("iteration1") == 0 
296
	           || mConnectionString.compareTo("iteration2") == 0
297
	           || mConnectionString.compareTo("iteration3") == 0 )
298
	         {
299
	           p = findPackage(3, packageCollection);
300
	           p.addEmail("jimmyfishcake@vixtechnology.com");
301
	           p.addEmail("rayhaddock@vixtechnology.com");
302
	         }
303
 
304
	         if ( mConnectionString.compareTo("iteration1") == 0 
305
	           || mConnectionString.compareTo("iteration2") == 0
306
	           || mConnectionString.compareTo("iteration3") == 0
307
	           || mConnectionString.compareTo("iteration4") == 0
308
	           || mConnectionString.compareTo("iteration5") == 0 )
309
	         {
310
	           p = findPackage(5, packageCollection);
311
	           p.addEmail("timbutdim@vixtechnology.com");
312
	         }
313
 
314
	        /* planned advisory ripple info
315
	         * pv_id
316
	         * 0
317
	         */
318
	         if ( mConnectionString.compareTo("iteration1") == 0 )
319
	         {
320
	           p = findPackage(0, packageCollection);
321
	           p.mAdvisoryRipple = true;
322
	         }
323
 
324
	        /* released info
325
	         * pv_id pkg_id pkg_name                     pkg_version      v_ext pkg_vcs_tag                                                    ripple_field
326
	         * 7     8      CotsWithFunnyVersion         hoopla2_x.cots   .cots CotsWithFunnyVersion_hoopla2_x.cots \vob\CotsWithFunnyVersion
327
	         * 8     17     NotInAnyWayReproducible      1.0.0.tim        .tim  NA                                  NA
328
	         * 9     34     CommonDependency             1.0.0000.tim     .tim  CommonDependency_1.0.0000.tim       \vob\CommonDependency
329
	         * 10    908    SolarisCentricProduct        1.0.0000.tim     .tim  SolarisCentricProduct_1.0.0000.tim  \vob\SolarisCentricProduct m
330
	         * 11    16     LinuxCentricProduct          1.0.0000.tim     .tim  LinuxCentricProduct_1.0.0000.tim    \vob\LinuxCentricProduct
331
	         * 12    312    Win32CentricProduct          1.0.0000.tim     .tim  Win32CentricProduct_1.0.0000.tim    \vob\Win32CentricProduct
332
	         * 13    6      GenericProduct               1.0.0000.tim     .tim  GenericProduct_1.0.0000.tim         \vob\ToBeMovedFromHere     M
333
	         * 14    81     AdvisoryDependency           1.0.0000.tim     .tim  AdvisoryDependency_1.0.0000.tim     \vob\AdvisoryDependency
334
	         * 15    1      MergedProduct                1.0.0000.tim     .tim  MergedProduct_1.0.0000.tim          \vob\MergedProduct         m
335
	         * 22    45     Banana                       1.1.0000.tim     .tim  Banana_1.1.0000.tim                 \vob\Banana
336
	         * 23    18     Aardvark                     1.1.1000.tim     .tim  Aardvark_1.1.1000.tim               \vob\Aardvark
337
	         * 24    227    Car                          1.0.10000.tim    .tim  Car_1.0.10000.tim                   \vob\Car
338
	         */
339
	         if ( mConnectionString.compareTo("iteration1") != 0 )
340
	         {
341
	           p = new Package(76, 0, "UncommonDependency", "0.0.1000.tim", ".tim", "UncommonDependency.tim", "CC::/vob/UncommonDependency::UncommonDependency_0.0.1000.tim", 'x');
342
	           Integer pv_id = new Integer(0);
343
	           rippleEngine.mReleasedPvIDCollection.add(pv_id);
344
	           Package plannedPackage = findPackage(p.mAlias, packageCollection);
345
 
346
	           if ( plannedPackage == NULL_PACKAGE )
347
	           {
348
	             packageCollection.add(p);
349
	           }
350
	           else
351
	           {
352
	             plannedPackage.mVersion = "0.0.1000";
353
	           }
354
	         }
355
 
356
	         if ( mConnectionString.compareTo("iteration1") != 0 
357
	           && mConnectionString.compareTo("iteration2") != 0
358
	           && mConnectionString.compareTo("iteration3") != 0 )
359
	         {
360
	           p = new Package(908, 3, "SolarisCentricProduct", "1.1.0000.tim", ".tim", "SolarisCentricProduct.tim", "CC::/vob/SolarisCentricProduct::SolarisCentricProduct_1.1.0000.tim", 'm');
361
	           Integer pv_id = new Integer(3);
362
	           rippleEngine.mReleasedPvIDCollection.add(pv_id);
363
	           Package plannedPackage = findPackage(p.mAlias, packageCollection);
364
 
365
	           if ( plannedPackage == NULL_PACKAGE )
366
	           {
367
	             packageCollection.add(p);
368
	           }
369
	           else
370
	           {
371
	             plannedPackage.mVersion = "1.1.0000";
372
	           }
373
	         }
374
 
375
	         if ( mConnectionString.compareTo("iteration1") != 0 
376
	           && mConnectionString.compareTo("iteration2") != 0
377
	           && mConnectionString.compareTo("iteration3") != 0
378
	           && mConnectionString.compareTo("iteration4") != 0 )
379
	         {
380
	           p = new Package(6, 4, "GenericProduct", "1.0.1000.tim", ".tim", "GenericProduct.tim", "CC::/vob/GenericProduct::GenericProduct_1.0.1000.tim", 'M');
381
	           Integer pv_id = new Integer(4);
382
	           rippleEngine.mReleasedPvIDCollection.add(pv_id);
383
	           Package plannedPackage = findPackage(p.mAlias, packageCollection);
384
 
385
	           if ( plannedPackage == NULL_PACKAGE )
386
	           {
387
	             packageCollection.add(p);
388
	           }
389
	           else
390
	           {
391
	             plannedPackage.mVersion = "1.0.1000";
392
	           }
393
	         }
394
 
395
	         if ( mConnectionString.compareTo("iteration1") != 0 
396
	           && mConnectionString.compareTo("iteration2") != 0
397
	           && mConnectionString.compareTo("iteration3") != 0
398
	           && mConnectionString.compareTo("iteration4") != 0
399
	           && mConnectionString.compareTo("iteration5") != 0 )
400
	         {
401
	           p = new Package(11, 5, "Product", "1.0.0000.tim", ".tim", "Product.tim", "CC::/vob/Product::Product_1.0.0000.tim", 'M');
402
	           Integer pv_id = new Integer(5);
403
	           rippleEngine.mReleasedPvIDCollection.add(pv_id);
404
	           Package plannedPackage = findPackage(p.mAlias, packageCollection);
405
 
406
	           if ( plannedPackage == NULL_PACKAGE )
407
	           {
408
	             packageCollection.add(p);
409
	           }
410
	           else
411
	           {
412
	             plannedPackage.mVersion = "1.0.0000";
413
	           }
414
	         }
415
 
416
	         p = new Package(8, 7, "CotsWithFunnyVersion", "hoopla2_x.cots", ".cots", "CotsWithFunnyVersion.cots", "CC::/vob/CotsWithFunnyVersion::CotsWithFunnyVersion_hoopla2_x", 'x');
417
	         Integer pv_id = new Integer(7);
418
	         rippleEngine.mReleasedPvIDCollection.add(pv_id);
419
	         Package plannedPackage = findPackage(p.mAlias, packageCollection);
420
 
421
	         if ( plannedPackage == NULL_PACKAGE )
422
	         {
423
	           packageCollection.add(p);
424
	         }
425
	         else
426
	         {
427
	           plannedPackage.mVersion = "hoopla2_x";
428
	         }
429
 
430
	         p = new Package(17, 8, "NotInAnyWayReproducible", "1.0.0.tim", ".tim", "NotInAnyWayReproducible.tim", "CC::NA::NA", 'x');
431
	         pv_id = new Integer(8);
432
	         rippleEngine.mReleasedPvIDCollection.add(pv_id);
433
	         plannedPackage = findPackage(p.mAlias, packageCollection);
434
 
435
	         if ( plannedPackage == NULL_PACKAGE )
436
	         {
437
	           packageCollection.add(p);
438
	         }
439
	         else
440
	         {
441
	           plannedPackage.mVersion = "1.0.0";
442
	         }
443
 
444
	         if ( mConnectionString.compareTo("iteration1") == 0 
445
	           || mConnectionString.compareTo("iteration2") == 0
446
	           || mConnectionString.compareTo("iteration3") == 0 )
447
	         {
448
	           p = new Package(908, 10, "SolarisCentricProduct", "1.0.0000.tim", ".tim", "SolarisCentricProduct.tim", "CC::/vob/SolarisCentricProduct::SolarisCentricProduct_1.0.0000.tim", 'm');
449
	           pv_id = new Integer(10);
450
	           rippleEngine.mReleasedPvIDCollection.add(pv_id);
451
	           plannedPackage = findPackage(p.mAlias, packageCollection);
452
 
453
	           if ( plannedPackage == NULL_PACKAGE )
454
	           {
455
	             packageCollection.add(p);
456
	           }
457
	           else
458
	           {
459
	             plannedPackage.mVersion = "1.0.0000";
460
	           }
461
	         }
462
 
463
	         p = new Package(16, 11, "LinuxCentricProduct", "1.0.0000.tim", ".tim", "LinuxCentricProduct.tim", "CC::/vob/LinuxCentricProduct::LinuxCentricProduct_1.0.0000.tim", 'x');
464
	         pv_id = new Integer(11);
465
	         rippleEngine.mReleasedPvIDCollection.add(pv_id);
466
	         plannedPackage = findPackage(p.mAlias, packageCollection);
467
 
468
	         if ( plannedPackage == NULL_PACKAGE )
469
	         {
470
	           packageCollection.add(p);
471
	         }
472
	         else
473
	         {
474
	           plannedPackage.mVersion = "1.0.0000";
475
	         }
476
 
477
	         p = new Package(312, 12, "Win32CentricProduct", "1.0.0000.tim", ".tim", "Win32CentricProduct.tim", "CC::/vob/Win32CentricProduct::Win32CentricProduct_1.0.0000.tim", 'x');
478
	         pv_id = new Integer(12);
479
	         rippleEngine.mReleasedPvIDCollection.add(pv_id);
480
	         plannedPackage = findPackage(p.mAlias, packageCollection);
481
 
482
	         if ( plannedPackage == NULL_PACKAGE )
483
	         {
484
	           packageCollection.add(p);
485
	         }
486
	         else
487
	         {
488
	           plannedPackage.mVersion = "1.0.0000";
489
	         }
490
 
491
	         if ( mConnectionString.compareTo("iteration1") == 0 
492
	           || mConnectionString.compareTo("iteration2") == 0
493
	           || mConnectionString.compareTo("iteration3") == 0
494
	           || mConnectionString.compareTo("iteration4") == 0 )
495
	         {
496
	           p = new Package(6, 13, "GenericProduct", "1.0.0000.tim", ".tim", "GenericProduct.tim", "CC::/vob/ToBeMovedFromHere::GenericProduct_1.0.0000.tim", 'M');
497
	           pv_id = new Integer(13);
498
	           rippleEngine.mReleasedPvIDCollection.add(pv_id);
499
	           plannedPackage = findPackage(p.mAlias, packageCollection);
500
	         }
501
 
502
	         if ( plannedPackage == NULL_PACKAGE )
503
	         {
504
	           packageCollection.add(p);
505
	         }
506
	         else
507
	         {
508
	           plannedPackage.mVersion = "1.0.0000";
509
	         }
510
 
511
	         p = new Package(81, 14, "AdvisoryDependency", "1.0.0000.tim", ".tim", "AdvisoryDependency.tim", "CC::/vob/AdvisoryDependency::AdvisoryDependency_1.0.0000.tim", 'x');
512
	         pv_id = new Integer(14);
513
	         rippleEngine.mReleasedPvIDCollection.add(pv_id);
514
	         plannedPackage = findPackage(p.mAlias, packageCollection);
515
 
516
	         if ( plannedPackage == NULL_PACKAGE )
517
	         {
518
	           packageCollection.add(p);
519
	         }
520
	         else
521
	         {
522
	           plannedPackage.mVersion = "1.0.0000";
523
	         }
524
 
525
	         if ( mConnectionString.compareTo("iteration1") == 0 
526
	           || mConnectionString.compareTo("iteration2") == 0
527
	           || mConnectionString.compareTo("iteration3") == 0
528
	           || mConnectionString.compareTo("iteration4") == 0
529
	           || mConnectionString.compareTo("iteration5") == 0
530
	           || mConnectionString.compareTo("iteration6") == 0 )
531
	         {
532
	           p = new Package(1, 15, "MergedProduct", "1.0.0000.tim", ".tim", "MergedProduct.tim", "CC::/vob/MergedProduct::MergedProduct_1.0.0000.tim", 'm');
533
	           pv_id = new Integer(15);
534
	           rippleEngine.mReleasedPvIDCollection.add(pv_id);
535
	           plannedPackage = findPackage(p.mAlias, packageCollection);
536
	         }
537
	         else
538
	         {
539
	           p = new Package(1, 16, "MergedProduct", "1.0.0000.tim", ".tim", "MergedProduct.tim", "CC::/vob/MergedProduct::MergedProduct_1.0.0000.tim", 'm');
540
	           pv_id = new Integer(16);
541
	           rippleEngine.mReleasedPvIDCollection.add(pv_id);
542
	           plannedPackage = findPackage(p.mAlias, packageCollection);
543
	         }
544
 
545
	         if ( plannedPackage == NULL_PACKAGE )
546
	         {
547
	           packageCollection.add(p);
548
	         }
549
	         else
550
	         {
551
	           plannedPackage.mVersion = "1.0.0000";
552
	         }
553
 
554
	         if ( mConnectionString.compareTo("iteration1") == 0 )
555
	         {
556
	           p = new Package(45, 22, "Banana", "1.1.0000.tim", ".tim", "Banana.tim", "CC::/vob/Banana::Banana_1.1.0000.tim", 'x');
557
	           pv_id = new Integer(22);
558
	           rippleEngine.mReleasedPvIDCollection.add(pv_id);
559
	           plannedPackage = findPackage(p.mAlias, packageCollection);
560
 
561
	           if ( plannedPackage == NULL_PACKAGE )
562
	           {
563
	             packageCollection.add(p);
564
	           }
565
	           else
566
	           {
567
	             plannedPackage.mVersion = "1.1.0000";
568
	           }
569
 
570
	           p = new Package(18, 23, "Aardvark", "1.1.1000.tim", ".tim", "Aardvark.tim", "CC::/vob/Aardvark::Aardvark_1.1.1000.tim", 'x');
571
	           pv_id = new Integer(18);
572
	           rippleEngine.mReleasedPvIDCollection.add(pv_id);
573
	           plannedPackage = findPackage(p.mAlias, packageCollection);
574
 
575
	           if ( plannedPackage == NULL_PACKAGE )
576
	           {
577
	             packageCollection.add(p);
578
	           }
579
	           else
580
	           {
581
	             plannedPackage.mVersion = "1.1.1000";
582
	           }
583
 
584
	           p = new Package(227, 24, "Car", "1.0.10000.tim", ".tim", "Car.tim", "CC::/vob/Car::Car_1.0.10000.tim", 'x');
585
	           pv_id = new Integer(24);
586
	           rippleEngine.mReleasedPvIDCollection.add(pv_id);
587
	           plannedPackage = findPackage(p.mAlias, packageCollection);
588
 
589
	           if ( plannedPackage == NULL_PACKAGE )
590
	           {
591
	             packageCollection.add(p);
592
	           }
593
	           else
594
	           {
595
	             plannedPackage.mVersion = "1.0.10000";
596
	           }
597
	         }
598
 
599
             if ( mConnectionString.compareTo("iteration1") != 0 && mConnectionString.compareTo("iteration2") != 0 )
600
             {
601
               p = new Package(34, 2, "CommonDependency", "2.0.0000.tim", ".tim", "CommonDependency.tim", "CC::/vob/CommonDependency::CommonDependency_2.0.0000.tim", 'x');
602
               pv_id = new Integer(2);
603
               rippleEngine.mReleasedPvIDCollection.add(pv_id);
604
               plannedPackage = findPackage(p.mAlias, packageCollection);
605
 
606
               if ( plannedPackage == NULL_PACKAGE )
607
               {
608
                 packageCollection.add(p);
609
               }
610
               else
611
               {
612
                 plannedPackage.mVersion = "2.0.0000";
613
               }
614
             }	         
615
 
616
	           if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
617
	             {
618
	               p = new Package(34, 9, "CommonDependency", "1.0.0000.tim", ".tim", "CommonDependency.tim", "CC::/vob/CommonDependency::CommonDependency_1.0.0000.tim", 'x');
619
	               pv_id = new Integer(9);
620
	               rippleEngine.mReleasedPvIDCollection.add(pv_id);
621
	               plannedPackage = findPackage(p.mAlias, packageCollection);
622
 
623
	               if ( plannedPackage == NULL_PACKAGE )
624
	               {
625
	                 packageCollection.add(p);
626
	               }
627
	               else
628
	               {
629
	                 plannedPackage.mVersion = "1.0.0000";
630
	               }
631
	             }
632
 
633
	         /* released dependencies
634
	         * pv_id dpv_id pkg_name                     v_ext
635
	         * 8     9      CommonDependency             .tim
636
	         * 9     7      CotsWithFunnyVersion         .cots
637
	         * 10    9      CommonDependency             .tim
638
	         * 11    44     AdvisoryDependency           .tim
639
	         * 13    9      CommonDependency             .tim
640
	         * 15    99     CommonDependency             .tim
641
	         * 23    22     Banana                       .tim
642
	         * 24    23     Aardvark                     .tim
643
	         */
644
	         if ( mConnectionString.compareTo("iteration1") != 0 && mConnectionString.compareTo("iteration2") != 0 )
645
	         {
646
	           p = findPackage(2, packageCollection);
647
	           p.mDependencyCollection.add("CotsWithFunnyVersion.cots");
648
	           p.mDependencyIDCollection.add(7);
649
	           p.mDependencyCollection.add("UncommonDependency.tim");
650
	           p.mDependencyIDCollection.add(0);
651
	         }
652
 
653
	         if ( mConnectionString.compareTo("iteration1") != 0 
654
	           && mConnectionString.compareTo("iteration2") != 0
655
	           && mConnectionString.compareTo("iteration3") != 0 )
656
	         {
657
	           p = findPackage(3, packageCollection);
658
	           p.mDependencyCollection.add("CommonDependency.tim");
659
	           p.mDependencyIDCollection.add(2);
660
	         }
661
 
662
	         if ( mConnectionString.compareTo("iteration1") != 0 
663
	           && mConnectionString.compareTo("iteration2") != 0
664
	           && mConnectionString.compareTo("iteration3") != 0
665
	           && mConnectionString.compareTo("iteration4") != 0 )
666
	         {
667
	           p = findPackage(4, packageCollection);
668
	           p.mDependencyCollection.add("CommonDependency.tim");
669
	           p.mDependencyIDCollection.add(2);
670
	         }
671
 
672
	         if ( mConnectionString.compareTo("iteration1") != 0 
673
	           && mConnectionString.compareTo("iteration2") != 0
674
	           && mConnectionString.compareTo("iteration3") != 0
675
	           && mConnectionString.compareTo("iteration4") != 0
676
	           && mConnectionString.compareTo("iteration5") != 0 )
677
	         {
678
	           p = findPackage(5, packageCollection);
679
	           p.mDependencyCollection.add("UncommonDependency.tim");
680
	           p.mDependencyIDCollection.add(0);
681
	         }
682
 
683
	         p = findPackage(8, packageCollection);
684
	         p.mDependencyCollection.add("CommonDependency.tim");
685
	         p.mDependencyIDCollection.add(9);
686
 
687
	         if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
688
	         {
689
	           p = findPackage(9, packageCollection);
690
	           p.mDependencyCollection.add("CotsWithFunnyVersion.cots");
691
	           p.mDependencyIDCollection.add(7);
692
	         }
693
 
694
	         if ( mConnectionString.compareTo("iteration1") == 0 
695
	           || mConnectionString.compareTo("iteration2") == 0
696
	           || mConnectionString.compareTo("iteration3") == 0 )
697
	         {
698
	           p = findPackage(10, packageCollection);
699
	           p.mDependencyCollection.add("CommonDependency.tim");
700
	           p.mDependencyIDCollection.add(9);
701
	         }
702
 
703
	         p = findPackage(11, packageCollection);
704
	         p.mDependencyCollection.add("AdvisoryDependency.tim");
705
	         p.mDependencyIDCollection.add(44);
706
 
707
	         if ( mConnectionString.compareTo("iteration1") == 0 
708
	           || mConnectionString.compareTo("iteration2") == 0
709
	           || mConnectionString.compareTo("iteration3") == 0
710
	           || mConnectionString.compareTo("iteration4") == 0 )
711
	         {
712
	           p = findPackage(13, packageCollection);
713
	           p.mDependencyCollection.add("CommonDependency.tim");
714
	           p.mDependencyIDCollection.add(9);
715
	         }
716
 
717
	         if ( mConnectionString.compareTo("iteration1") == 0 
718
	           || mConnectionString.compareTo("iteration2") == 0
719
	           || mConnectionString.compareTo("iteration3") == 0
720
	           || mConnectionString.compareTo("iteration4") == 0
721
	           || mConnectionString.compareTo("iteration5") == 0
722
	           || mConnectionString.compareTo("iteration6") == 0 )
723
	         {
724
	           p = findPackage(15, packageCollection);
725
	           p.mDependencyCollection.add("CommonDependency.tim");
726
	           p.mDependencyIDCollection.add(99);
727
	         }
728
	         else
729
	         {
730
	           p = findPackage(16, packageCollection);
731
	           p.mDependencyCollection.add("CommonDependency.tim");
732
	           p.mDependencyIDCollection.add(2);
733
	         }
734
 
735
	         if ( mConnectionString.compareTo("iteration1") == 0 )
736
	         {
737
	           p = findPackage(23, packageCollection);
738
	           p.mDependencyCollection.add("Banana.tim");
739
	           p.mDependencyIDCollection.add(22);
740
 
741
	           p = findPackage(24, packageCollection);
742
	           p.mDependencyCollection.add("Aardvark.tim");
743
	           p.mDependencyIDCollection.add(23);
744
	         }
745
 
746
	        /* released build info
747
	         * pv_id bm_name bsa_name
748
	         * 7     Solaris Debug
749
	         * 9     Linux   Debug
750
	         * 9     Solaris Debug
751
	         * 9     Win32   Production
752
	         * 10    Solaris Java 1.4
753
	         * 11    Linux   Production and Debug
754
	         * 12    Win32   Java 1.6
755
	         * 13    Generic Java 1.4
756
	         * 14    Linux   Debug
757
	         * 15    Linux   Debug
758
	         * 22    Linux   Java 1.6
759
	         * 23    Linux   Java 1.6
760
	         * 24    Linux   Java 1.6
761
	         */
762
	         if ( mConnectionString.compareTo("iteration1") != 0 )
763
	         {
764
	           p = findPackage(0, packageCollection);
765
	           bs = new BuildStandard(rippleEngine, "Linux", "Java 1.6");
766
	           p.mBuildStandardCollection.add(bs);
767
	         }
768
 
769
	         if ( mConnectionString.compareTo("iteration1") != 0 && mConnectionString.compareTo("iteration2") != 0 )
770
	         {
771
	           p = findPackage(2, packageCollection);
772
	           bs = new BuildStandard(rippleEngine, "Linux", "Debug");
773
	           p.mBuildStandardCollection.add(bs);
774
	           bs = new BuildStandard(rippleEngine, "Solaris", "Production");
775
	           p.mBuildStandardCollection.add(bs);
776
	           bs = new BuildStandard(rippleEngine, "Win32", "Production and Debug");
777
	           p.mBuildStandardCollection.add(bs);
778
	         }
779
 
780
	         if ( mConnectionString.compareTo("iteration1") != 0 
781
	           && mConnectionString.compareTo("iteration2") != 0
782
	           && mConnectionString.compareTo("iteration3") != 0 )
783
	         {
784
	           p = findPackage(3, packageCollection);
785
	           bs = new BuildStandard(rippleEngine, "Solaris", "Java 1.4");
786
	           p.mBuildStandardCollection.add(bs);
787
	         }
788
 
789
	         if ( mConnectionString.compareTo("iteration1") != 0 
790
	           && mConnectionString.compareTo("iteration2") != 0
791
	           && mConnectionString.compareTo("iteration3") != 0
792
	           && mConnectionString.compareTo("iteration4") != 0 )
793
	         {
794
	           p = findPackage(4, packageCollection);
795
	           bs = new BuildStandard(rippleEngine, "Generic", "Java 1.5");
796
	           p.mBuildStandardCollection.add(bs);
797
	         }
798
 
799
	         if ( mConnectionString.compareTo("iteration1") != 0 
800
	           && mConnectionString.compareTo("iteration2") != 0
801
	           && mConnectionString.compareTo("iteration3") != 0
802
	           && mConnectionString.compareTo("iteration4") != 0
803
	           && mConnectionString.compareTo("iteration5") != 0 )
804
	         {
805
	           p = findPackage(5, packageCollection);
806
	           bs = new BuildStandard(rippleEngine, "Linux", "Java 1.6");
807
	           p.mBuildStandardCollection.add(bs);
808
	           bs = new BuildStandard(rippleEngine, "Win32", "Java 1.6");
809
	           p.mBuildStandardCollection.add(bs);
810
	         }
811
 
812
	         p = findPackage(7, packageCollection);
813
	         bs = new BuildStandard(rippleEngine, "Solaris", "Debug");
814
	         p.mBuildStandardCollection.add(bs);
815
 
816
	         if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
817
	         {
818
	           p = findPackage(9, packageCollection);
819
	           bs = new BuildStandard(rippleEngine, "Linux", "Debug");
820
	           p.mBuildStandardCollection.add(bs);
821
	           bs = new BuildStandard(rippleEngine, "Solaris", "Debug");
822
	           p.mBuildStandardCollection.add(bs);
823
	           bs = new BuildStandard(rippleEngine, "Win32", "Production");
824
	           p.mBuildStandardCollection.add(bs);
825
	         }
826
 
827
	         if ( mConnectionString.compareTo("iteration1") == 0 
828
	           || mConnectionString.compareTo("iteration2") == 0
829
	           || mConnectionString.compareTo("iteration3") == 0 )
830
	         {
831
	           p = findPackage(10, packageCollection);
832
	           bs = new BuildStandard(rippleEngine, "Solaris", "Java 1.4");
833
	           p.mBuildStandardCollection.add(bs);
834
	         }
835
 
836
	         p = findPackage(11, packageCollection);
837
	         bs = new BuildStandard(rippleEngine, "Linux", "Production and Debug");
838
	         p.mBuildStandardCollection.add(bs);
839
 
840
	         p = findPackage(12, packageCollection);
841
	         bs = new BuildStandard(rippleEngine, "Win32", "Java 1.6");
842
	         p.mBuildStandardCollection.add(bs);
843
 
844
	         if ( mConnectionString.compareTo("iteration1") == 0 
845
	           || mConnectionString.compareTo("iteration2") == 0
846
	           || mConnectionString.compareTo("iteration3") == 0
847
	           || mConnectionString.compareTo("iteration4") == 0 )
848
	         {
849
	           p = findPackage(13, packageCollection);
850
	           bs = new BuildStandard(rippleEngine, "Generic", "Java 1.4");
851
	           p.mBuildStandardCollection.add(bs);
852
	         }
853
 
854
	         p = findPackage(14, packageCollection);
855
	         bs = new BuildStandard(rippleEngine, "Linux", "Debug");
856
	         p.mBuildStandardCollection.add(bs);
857
 
858
	         if ( mConnectionString.compareTo("iteration1") == 0 
859
	           || mConnectionString.compareTo("iteration2") == 0
860
	           || mConnectionString.compareTo("iteration3") == 0
861
	           || mConnectionString.compareTo("iteration4") == 0
862
	           || mConnectionString.compareTo("iteration5") == 0
863
	           || mConnectionString.compareTo("iteration6") == 0 )
864
	         {
865
	           p = findPackage(15, packageCollection);
866
	           bs = new BuildStandard(rippleEngine, "Linux", "Debug");
867
	           p.mBuildStandardCollection.add(bs);
868
	         }
869
	         else
870
	         {
871
	           p = findPackage(16, packageCollection);
872
	           bs = new BuildStandard(rippleEngine, "Linux", "Debug");
873
	           p.mBuildStandardCollection.add(bs);
874
	         }        
875
 
876
	         if ( mConnectionString.compareTo("iteration1") == 0 )
877
	         {
878
	           p = findPackage(22, packageCollection);
879
	           bs = new BuildStandard(rippleEngine, "Linux", "Java 1.6");
880
	           p.mBuildStandardCollection.add(bs);
881
 
882
	           p = findPackage(23, packageCollection);
883
	           bs = new BuildStandard(rippleEngine, "Linux", "Java 1.6");
884
	           p.mBuildStandardCollection.add(bs);
885
 
886
	           p = findPackage(24, packageCollection);
887
	           bs = new BuildStandard(rippleEngine, "Solaris", "Java 1.6");
888
	           p.mBuildStandardCollection.add(bs);
889
	         }
890
 
891
	         /* released package unit test info
892
	         * pv_id tt.test_type_name
893
	         * 9     Manual Test
894
	         * 9     Interactive Test
895
	         * 9     Integration Test
896
	         * 11    Autobuild UTF
897
	         */
898
	         if ( mConnectionString.compareTo("iteration1") != 0 
899
	           && mConnectionString.compareTo("iteration2") != 0
900
	           && mConnectionString.compareTo("iteration3") != 0
901
	           && mConnectionString.compareTo("iteration4") != 0
902
	           && mConnectionString.compareTo("iteration5") != 0 )
903
	         {
904
	           p = findPackage(5, packageCollection);
905
	           p.mHasAutomatedUnitTests = true;
906
	         }
907
 
908
	         p = findPackage(11, packageCollection);
909
	         p.mHasAutomatedUnitTests = true;
910
 
911
	        /* released build failure email info
912
	         * pv_id user_email
913
	         * 10    jimmyfishcake@vixtechnology.com
914
	         */
915
	         if ( mConnectionString.compareTo("iteration1") != 0 
916
	           && mConnectionString.compareTo("iteration2") != 0
917
	           && mConnectionString.compareTo("iteration3") != 0 )
918
	         {
919
	           p = findPackage(3, packageCollection);
920
	           p.addEmail("jimmyfishcake@vixtechnology.com");
921
	           p.addEmail("rayhaddock@vixtechnology.com");
922
	         }
923
 
924
	         if ( mConnectionString.compareTo("iteration1") != 0 
925
	           && mConnectionString.compareTo("iteration2") != 0
926
	           && mConnectionString.compareTo("iteration3") != 0
927
	           && mConnectionString.compareTo("iteration4") != 0
928
	           && mConnectionString.compareTo("iteration5") != 0 )
929
	         {
930
	           p = findPackage(5, packageCollection);
931
	           p.addEmail("timbutdim@vixtechnology.com");
932
	         }
933
 
934
	         if ( mConnectionString.compareTo("iteration1") == 0 
935
	           || mConnectionString.compareTo("iteration2") == 0
936
	           || mConnectionString.compareTo("iteration3") == 0 )
937
	         {
938
	           p = findPackage(10, packageCollection);
939
	           p.addEmail("jimmyfishcake@vixtechnology.com");
940
	         }
941
 
942
	        /* released advisory ripple info
943
	         * pv_id
944
	         * 14
945
	         */
946
	         if ( mConnectionString.compareTo("iteration1") != 0 )
947
	         {
948
	           p = findPackage(0, packageCollection);
949
	           p.mAdvisoryRipple = true;
950
	         }
951
 
952
	         p = findPackage(14, packageCollection);
953
	         p.mAdvisoryRipple = true;
954
 
955
		}
956
 
957
		@Override
958
		public void queryReleaseConfig(final String hostname) throws SQLException, Exception
959
		{
960
		    mReleaseConfigCollection.resetData();
961
 
962
		    if ( mConnectionString.compareTo("unit test spawn thread") == 0)
963
		    {
964
		        mLogger.info("queryReleaseConfig 3 unit test spawn thread");
965
		        // specifying a gbebuildfilter of unit test is designed to invoke a benign thread for unit test purposes
966
		        ReleaseConfig releaseConfig = new ReleaseConfig(1,1,'M', "DummyHost1","DummyTarget1", "DummyMachtype1", "Win32");
967
		        mReleaseConfigCollection.add(releaseConfig);
968
		        releaseConfig = new ReleaseConfig(2,2,'S', "DummyHost2","DummyTarget2", "DummyMachtype2", "Linux");
969
		        mReleaseConfigCollection.add(releaseConfig);
970
		    }
971
		}
972
 
973
		@Override 
974
		public boolean queryReleaseConfig(final int rtag_id, final int rcon_id,final String machine_hostname, final char daemon_mode,  final long threadStartTime) throws SQLException, Exception
975
		 {
976
		     boolean retVal = false;
977
 
978
		     if ( mConnectionString.compareTo("unit test exit") != 0 )
979
		     {
980
		         retVal = true;
981
		     }
982
		     return retVal;
983
		 }
984
 
985
		@Override
986
		 public void queryRunLevel(final int rtag_id) throws SQLException, Exception
987
		 {
988
		     if ( mConnectionString.compareTo("unit test coordinate slave threads") == 0)
989
		     {
990
 
991
		         if ( mRunLevelCollection.size() == 0)
992
		         {
993
		             // first time not all slave threads are waiting
994
		             RunLevelData runLevel = new RunLevelData(1, BuildState.DB_WAITING, 'S',0);
995
		             mRunLevelCollection.add(runLevel);
996
		             runLevel = new RunLevelData(2, BuildState.DB_IDLE, 'S',0);
997
		             mRunLevelCollection.add(runLevel);
998
		         }
999
		         else
1000
		         {
1001
		             // subsequent times all slave threads are waiting
1002
		             mRunLevelCollection.clear();
1003
		             RunLevelData runLevel = new RunLevelData(1, BuildState.DB_WAITING, 'S',0);
1004
		             mRunLevelCollection.add(runLevel);
1005
		             runLevel = new RunLevelData(2, BuildState.DB_WAITING, 'S',0);
1006
		             mRunLevelCollection.add(runLevel);
1007
		         }
1008
		     }
1009
		 }
1010
 
1011
		 public boolean queryRunLevelSchedule(Date resumeTime, boolean recover) throws SQLException, Exception
1012
		 {
1013
		     boolean retVal = true;
1014
 
1015
		     if ( mConnectionString.compareTo("unit test not allowed to proceed") == 0 )
1016
		     {
1017
		         // schedule a 100ms max wait
1018
		         resumeTime.setTime( resumeTime.getTime() + 100 );
1019
		         retVal = false;
1020
		     }
1021
		     return retVal;
1022
		 }
1023
	}
1024
 
1025
 
1026
    public DaemonBuildTestCase()
1027
    {
1028
        mLogger.debug("DaemonBuildTestCase");
1029
    }
1030
 
1031
    /**
1032
     * Test Case main line
1033
     */
1034
    public static void main(String[] args)
1035
    {
1036
        mLogger.debug("main");
1037
        JUnitCore.main("com.erggroup.buildtool.utf.DaemonBuildTestCase");
1038
    }
1039
 
1040
    /**
1041
     * set up performed prior to any test method
1042
     */
1043
    @BeforeClass
1044
    public static void TestCaseSetUp()
1045
    {
1046
        mLogger.debug("TestCaseSetUp");
1047
    }
1048
 
1049
    /**
1050
     * tear down performed after test methods
1051
     */
1052
    @AfterClass
1053
    public static void TestCaseTearDown()
1054
    {
1055
        mLogger.debug("TestCaseTearDown");
1056
    }
1057
 
1058
    /**
1059
     * set up performed prior to each test method
1060
     */
1061
    @Before
1062
    public void TestSetUp()
1063
    {
1064
        mLogger.debug("TestSetUp");
1065
        System.setProperty("vix.utf.name", "DaemonBuildTestCase");
1066
        Package.mGenericMachtype = "win32";
1067
        Package.mGbeDpkg = ".";
1068
    }
1069
 
1070
    /**
1071
     * tear down performed after each test method
1072
     */
1073
    @After
1074
    public void TestTearDown()
1075
    {
1076
        mLogger.debug("TestTearDown");
1077
    }
1078
 
1079
    /**
1080
     * test method designed primarily to test the sequence diagram spawn thread
1081
     * also tests thread control out of necessity:
1082
     * 1 constructs a BuildDaemon object, passing a connectionString of "unit test spawn thread"
1083
     * this utilises the following unit test hooks in the codebase:
1084
     * - BuildDaemon::BuildDaemon connectionString of "unit test spawn thread" exits while forever loop
1085
     * - BuildDaemon constructor, isActive and cleanUp made public for unit test use
1086
     * - ReleaseManager::queryReleaseConfig instantiates 2 ReleaseConfig objects
1087
     * with rcon_id's of 1 and 2, daemon_modes of 'M' and 'S' respectively, and gbebuildfilters of
1088
     * "unit test spawn thread"
1089
     * - MasterThread::run gbebuildfilter of "unit test spawn thread" limits method to sleep in while forever loop
1090
     * - SlaveThread::run gbebuildfilter of "unit test spawn thread" limits method to sleep in while forever loop
1091
     * 2 checks the number of threads in the thread group is 3 (mainline thread + MasterThread + SlaveThread)
1092
     * 3 checks isActive on the BuildDaemon object returns true when passed an rcon_id of 1
1093
     * 4 checks isActive on the BuildDaemon object returns true when passed an rcon_id of 2
1094
     * 5 checks isActive on the BuildDaemon object returns false when passed an rcon_id of 3
1095
     * 6 calls cleanUp on the BuildDaemon object
1096
     * 7 checks the number of threads in the thread group is 1 (mainline thread)
1097
     * 8 checks isActive on the BuildDaemon object returns false when passed an rcon_id of 1
1098
     * 9 checks isActive on the BuildDaemon object returns false when passed an rcon_id of 2
1099
     * 10 checks isActive on the BuildDaemon object returns false when passed an rcon_id of 3
1100
     */
1101
    @Test
1102
    public void TestSpawnThread()
1103
    {
1104
        mLogger.debug("TestSpawnThread");
1105
        int tcount;
1106
        releaseManager = new myReleaseManager("unit test spawn thread", "not used", "not used");
1107
        BuildDaemon buildDaemon = new BuildDaemon(releaseManager);
1108
        tcount = BuildThread.mThreadGroup.activeCount();
1109
        System.out.println("TestSpawnThread. tCount:" + tcount);
1110
        assertTrue(tcount == 2);
1111
        assertTrue(buildDaemon.isActive(1));
1112
        assertTrue(buildDaemon.isActive(2));
1113
        assertFalse(buildDaemon.isActive(3));
1114
        buildDaemon.cleanUp();
1115
        tcount = BuildThread.mThreadGroup.activeCount();
1116
        System.out.println("TestSpawnThread Cleanup. tCount:" + tcount);
1117
        assertTrue(tcount == 0);
1118
        assertFalse(buildDaemon.isActive(1));
1119
        assertFalse(buildDaemon.isActive(2));
1120
        assertFalse(buildDaemon.isActive(3));
1121
    }
1122
 
1123
    /**
1124
     * test method designed to test the sequence diagram coordinate slave thread:
1125
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test coordinate slave threads"
1126
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit test coordinate slave threads"
1127
     * this utilises the following unit test hooks in the codebase:
1128
     * - MasterThread constructor made public for unit test use
1129
     * - MasterThread::run gbebuildfilter of "unit test coordinate slave threads" limits method to the sequence diagram
1130
     * interrupts the thread if, on one pass, at least one RunLevel object does not have a run level DB_WAITING
1131
     * exits the while forever loop if, on one pass, all RunLevel objects have a run level DB_WAITING
1132
     * - ReleaseManager::queryRunLevel connectionString of "unit test coordinate slave threads" instantiates 2 RunLevel
1133
     * objects
1134
     * initially with run levels of waiting and idle
1135
     * subsequently with run levels both waiting
1136
     * 3 calls run on the MasterThread object
1137
     * 4 checks its thread has been interrupted
1138
     */
1139
    @Test
1140
    public void TestCoordinateSlaveThreads()
1141
    {
1142
        mLogger.debug("TestCoordinateSlaveThreads");
1143
        ReleaseManager releaseManager = new myReleaseManager("unit test coordinate slave threads", "not used", "not used");
1144
        MasterThread masterThread = new MasterThread(1, 1, releaseManager ,"unit test coordinate slave threads");
1145
        assertFalse(Thread.interrupted());
1146
        masterThread.run();
1147
        // interrupted checks and importantly clears the interrupted status of this thread for subsequent tests
1148
        assertTrue(Thread.interrupted());
1149
        assertFalse(Thread.interrupted());
1150
    }
1151
 
1152
    /**
1153
     * test method designed to test the sequence diagram generate build files
1154
     * note does not test the RippleEngine:
1155
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test generate build files"
1156
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit test generate build files"
1157
     * this utilises the following unit test hooks in the codebase:
1158
     * - MasterThread constructor made public for unit test use
1159
     * - MasterThread::run gbebuildfilter of "unit test generate build files" limits method to the sequence diagram
1160
     * exits the while forever loop
1161
     * - ReleaseManager::queryReleaseConfig instantiates 2 ReleaseConfig objects
1162
     * with rcon_id's of 1 and 2, daemon_modes of 'M' and 'S' respectively, and gbebuildfilters of
1163
     * "unit test spawn thread"
1164
     * - ReleaseManager::updateCurrentRunLevel utilises the public mPersistedRunLevelCollection
1165
     * 3 calls run on the MasterThread object
1166
     * 4 checks the first persisted run level is DB_ACTIVE
1167
     * 5 checks the second persisted run level is DB_ACTIVE
1168
     * 6 checks no further run levels were persisted
1169
     */
1170
    @Test
1171
    public void TestGenerateBuildFiles()
1172
    {
1173
        mLogger.debug("TestGenerateBuildFiles");
1174
        myReleaseManager releaseManager = new myReleaseManager("unit test generate build files", "not used", "not used");
1175
        MasterThread masterThread = new MasterThread(1, 1, releaseManager, "unit test generate build files");
1176
        masterThread.run();
1177
        assertTrue(RunLevelData.isAt(BuildState.DB_ACTIVE, releaseManager.mPersistedRunLevelCollection.get(0)));
1178
        assertTrue(RunLevelData.isAt(BuildState.DB_ACTIVE, releaseManager.mPersistedRunLevelCollection.get(1)));
1179
        assertTrue( releaseManager.mPersistedRunLevelCollection.size() == 2);
1180
    }
1181
 
1182
    /**
1183
     * test method designed to test the sequence diagram consume build files
1184
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test consume build files"
1185
     * 2 constructs a SlaveThread object, passing a gbebuildfilter of "unit test consume build files"
1186
     * this utilises the following unit test hooks in the codebase:
1187
     * - SlaveThread constructor made public for unit test use
1188
     * - SlaveThread::run gbebuildfilter of "unit test consume build files" limits method to the sequence diagram
1189
     * interrupts the thread if, on one pass, the current build file string is empty
1190
     * exits the while forever loop
1191
     * - ReleaseManager::queryRunLevel
1192
     * initially returns an empty current build file string
1193
     * subsequently returns a "unit test build file content" current build file string
1194
     * 3 calls run on the SlaveThread object
1195
     */
1196
     @Test
1197
    public void TestConsumeBuildFiles()
1198
    {
1199
        mLogger.debug("TestConsumeBuildFiles");
1200
        ReleaseManager releaseManager = new myReleaseManager("unit test consume build files", "not used", "not used");
1201
        SlaveThread slaveThread = new SlaveThread(1, 1, releaseManager, "unit test consume build files");
1202
        assertFalse(Thread.interrupted());
1203
        slaveThread.run();
1204
    }
1205
 
1206
    /**
1207
     * test method designed to test the sequence diagram allowed to proceed
1208
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test allowed to proceed"
1209
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit test allowed to proceed"
1210
     * this utilises the following unit test hooks in the codebase:
1211
     * - MasterThread constructor made public for unit test use
1212
     * - MasterThread::run gbebuildfilter of "unit test allowed to proceed" limits method to the sequence diagram
1213
     * exits the while forever loop
1214
     * - ReleaseManager::queryReleaseConfig, queryRunLevelSchedule, queryDirectedRunLevel methods return true
1215
     * - ReleaseManager::updateCurrentRunLevel utilises the public mPersistedRunLevelCollection
1216
     * 3 calls run on the MasterThread object
1217
     * 4 checks the first persisted run level is DB_IDLE
1218
     * 5 checks the second persisted run level is DB_IDLE
1219
     * 6 checks the third persisted run level is DB_WAITING
1220
     * 7 checks no further run levels were persisted
1221
     */
1222
    @Test
1223
    public void TestAllowedToProceed()
1224
    {
1225
        mLogger.debug("TestAllowedToProceed");
1226
        myReleaseManager releaseManager = new myReleaseManager("unit test allowed to proceed", "not used", "not used");
1227
        MasterThread masterThread = new MasterThread(1, 1, releaseManager, "unit test allowed to proceed");
1228
        masterThread.run();
1229
 
1230
        assertTrue( RunLevelData.isAt(BuildState.DB_IDLE, releaseManager.mPersistedRunLevelCollection.get(0)));
1231
        assertTrue( releaseManager.mPersistedRunLevelCollection.size() == 1);
1232
    }
1233
 
1234
    /**
1235
     * test method designed to test the sequence diagram not allowed to proceed
1236
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test not allowed to proceed"
1237
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit test not allowed to proceed"
1238
     * this utilises the following unit test hooks in the codebase:
1239
     * - MasterThread constructor made public for unit test use
1240
     * - MasterThread::run gbebuildfilter of "unit test not allowed to proceed" limits method to the sequence diagram
1241
     *   exits the while forever loop
1242
     * - ReleaseManager::queryReleaseConfig method returns true
1243
     * - ReleaseManager::queryRunLevelSchedule method returns false
1244
     * - ReleaseManager::updateCurrentRunLevel utilises the public mPersistedRunLevelCollection
1245
     * 3 calls run on the MasterThread object
1246
     * 4 checks the first persisted run level is DB_IDLE
1247
     * 5 checks the second persisted run level is DB_IDLE
1248
     * 6 checks the third persisted run level is DB_PAUSED
1249
     * 7 checks no further run levels were persisted
1250
     * nb cannot check only one thread is running,
1251
     * a Timer thread, though having run to completion, may still be "active"
1252
     */
1253
    @Test
1254
    public void TestNotAllowedToProceed()
1255
    {
1256
        mLogger.debug("TestNotAllowedToProceed");
1257
        myReleaseManager releaseManager = new myReleaseManager("unit test not allowed to proceed", "not used", "not used");
1258
        MasterThread masterThread = new MasterThread(1, 1, releaseManager, "unit test not allowed to proceed");
1259
        masterThread.run();
1260
 
1261
        assertTrue(RunLevelData.isAt(BuildState.DB_IDLE, releaseManager.mPersistedRunLevelCollection.get(0)));
1262
        assertTrue(RunLevelData.isAt(BuildState.DB_PAUSED, releaseManager.mPersistedRunLevelCollection.get(1)));
1263
        assertTrue( releaseManager.mPersistedRunLevelCollection.size() == 2);
1264
    }
1265
 
1266
    /**
1267
     * test method designed to test the sequence diagram exit
1268
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test exit"
1269
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit test exit"
1270
     * this utilises the following unit test hooks in the codebase:
1271
     * - MasterThread constructor made public for unit test use
1272
     * - MasterThread::run gbebuildfilter of "unit test exit" limits method to the sequence diagram
1273
     * - ReleaseManager::queryReleaseConfig method returns false
1274
     * - ReleaseManager::updateCurrentRunLevel utilises the public mPersistedRunLevelCollection
1275
     * 3 calls run on the MasterThread object
1276
     * 4 checks the first persisted run level is DB_IDLE
1277
     * 5 checks no further run levels were persisted
1278
     */
1279
    @Test
1280
    public void TestExit()
1281
    {
1282
        mLogger.debug("TestExit");
1283
        myReleaseManager releaseManager = new myReleaseManager("unit test exit", "not used", "not used");
1284
        MasterThread masterThread = new MasterThread(1, 1, releaseManager, "unit test exit");
1285
        masterThread.run();
1286
 
1287
        assertTrue(RunLevelData.isAt(BuildState.DB_IDLE, releaseManager.mPersistedRunLevelCollection.get(0)));
1288
        assertTrue( releaseManager.mPersistedRunLevelCollection.size() == 1);
1289
    }
1290
 
1291
    /**
1292
     * test method designed to test the sequence diagram check environment
1293
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit check environment"
1294
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit check environment"
1295
     * this utilises the following unit test hooks in the codebase:
1296
     * - MasterThread constructor made public for unit test use
1297
     * - MasterThread::run gbebuildfilter of "unit test check environment" limits method to the sequence diagram
1298
     * exits the while forever loop
1299
     * - MasterThread::housekeep method does not call deleteDirectory
1300
     * - MasterThread::hasSufficientDiskSpace initially returns false, then true
1301
     * - ReleaseManager::updateCurrentRunLevel utilises the public mPersistedRunLevelCollection
1302
     * 3 calls run on the MasterThread object
1303
     * 4 checks the first persisted run level is DB_CANNOT_CONTINUE
1304
     * 5 checks the next persisted run level is DB_ACTIVE
1305
     * 6 checks no further run levels were persisted
1306
     */
1307
    @Test
1308
    public void TestCheckEnvironment()
1309
    {
1310
        mLogger.debug("TestCheckEnvironment");
1311
        myReleaseManager releaseManager = new myReleaseManager("unit test check environment", "not used", "not used");
1312
        MasterThread masterThread = new MasterThread(1, 1, releaseManager, "unit test check environment");
1313
        masterThread.run();
1314
        assertTrue(RunLevelData.isAt(BuildState.DB_CANNOT_CONTINUE, releaseManager.mPersistedRunLevelCollection.get(0)));
1315
        assertTrue(RunLevelData.isAt(BuildState.DB_ACTIVE, releaseManager.mPersistedRunLevelCollection.get(1)));
1316
        assertTrue( releaseManager.mPersistedRunLevelCollection.size() == 2);
1317
    }
1318
 
1319
    /**
1320
     * test method designed to test the ripple engine
1321
     * 1 constructs a ReleaseManager object with connection string "iteration1"
1322
     * 2 constructs a RippleEngine object
1323
     * 3 calls planRelease on the RippleEngine object
1324
     * 4 calls getFirstBuildFileContent
1325
     * 5 checks it returns true
1326
     * 6 writes the content to "daemon1.xml"
1327
     * 7 checks the content matches the content in "expecteddaemon1.xml"
1328
     * 8 calls getNextBuildFileContent
1329
     * 9 checks it returns false
1330
     * 10 constructs a ReleaseManager object with connection string "iteration2"
1331
     * 11 calls planRelease on the RippleEngine object
1332
     * 12 calls getFirstBuildFileContent
1333
     * 13 checks it returns true
1334
     * 14 writes the content to "daemon2.xml"
1335
     * 15 checks the content matches the content in "expecteddaemon2.xml"
1336
     * 16 calls getNextBuildFileContent
1337
     * 17 checks it returns false
1338
     * 18 steps 10 to 17 are repeated for iteration3,4,5 and 6
1339
     * 19 constructs a ReleaseManager object with connection string "iteration7"
1340
     * 20 calls planRelease on the RippleEngine object
1341
     * 21 calls getFirstBuildFileContent
1342
     * 22 checks it returns true (a benign build file content)
1343
     */
1344
    @Test
1345
    public void TestPlanRelease_1()
1346
    {
1347
        mLogger.debug("TestPlanRelease");
1348
        System.out.println("TestPlanRelease - Iteration 1");
1349
        ReleaseManager releaseManager = new myReleaseManager("iteration1", "not used", "not used");
1350
 
1351
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1352
        // this is all the MasterThread does
1353
        try
1354
        {
1355
            rippleEngine.collectMetaData();
1356
            rippleEngine.planRelease(false);
1357
        }
1358
        catch (Exception e)
1359
        {
1360
        }
1361
 
1362
        boolean rv;
1363
        BuildFile buildFile;
1364
 
1365
        buildFile = rippleEngine.getFirstBuildFileContent();
1366
        assertTrue(buildFile != null);
1367
        assertTrue(buildFile.state != BuildFileState.Dummy);
1368
        assertTrue(buildFile.state != BuildFileState.Empty);
1369
 
1370
        rv = Utilities.checkBuildfile(buildFile.content, "daemon1");
1371
        assertTrue(rv);
1372
 
1373
        buildFile = rippleEngine.getNextBuildFileContent();
1374
        assertTrue(buildFile != null);
1375
        assertTrue(buildFile.state == BuildFileState.Empty);
1376
    }
1377
 
1378
    @Test
1379
    public void TestPlanRelease_2()
1380
    {
1381
        //
1382
        System.out.println("TestPlanRelease - Iteration 2");
1383
        releaseManager = new myReleaseManager("iteration2", "not used", "not used");
1384
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1385
 
1386
        // this is all the MasterThread does
1387
        try
1388
        {
1389
            rippleEngine.collectMetaData();
1390
            rippleEngine.planRelease(false);
1391
        }
1392
        catch (Exception e)
1393
        {
1394
        }
1395
 
1396
        boolean rv;
1397
        BuildFile buildFile;
1398
 
1399
        buildFile = rippleEngine.getFirstBuildFileContent();
1400
        assertTrue(buildFile != null);
1401
        assertTrue(buildFile.state != BuildFileState.Dummy);
1402
        assertTrue(buildFile.state != BuildFileState.Empty);
1403
 
1404
        rv = Utilities.checkBuildfile(buildFile.content, "daemon2");
1405
        assertTrue(rv);
1406
 
1407
        buildFile = rippleEngine.getNextBuildFileContent();
1408
        assertTrue(buildFile != null);
1409
        assertTrue(buildFile.state == BuildFileState.Empty);
1410
    }
1411
 
1412
    @Test
1413
    public void TestPlanRelease_3()
1414
    {
1415
        //
1416
        System.out.println("TestPlanRelease - Iteration 3");
1417
        releaseManager = new myReleaseManager("iteration3", "not used", "not used");
1418
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1419
 
1420
        // this is all the MasterThread does
1421
        try
1422
        {
1423
            rippleEngine.collectMetaData();
1424
            rippleEngine.planRelease(false);
1425
        }
1426
        catch (Exception e)
1427
        {
1428
        }
1429
 
1430
        boolean rv;
1431
        BuildFile buildFile;
1432
 
1433
        buildFile = rippleEngine.getFirstBuildFileContent();
1434
        assertTrue(buildFile != null);
1435
        assertTrue(buildFile.state != BuildFileState.Dummy);
1436
        assertTrue(buildFile.state != BuildFileState.Empty);
1437
 
1438
        rv = Utilities.checkBuildfile(buildFile.content, "daemon3");
1439
        assertTrue(rv);
1440
 
1441
        buildFile = rippleEngine.getNextBuildFileContent();
1442
        assertTrue(buildFile != null);
1443
        assertTrue(buildFile.state == BuildFileState.Empty);
1444
    }
1445
 
1446
    @Test
1447
    public void TestPlanRelease_4()
1448
    {
1449
 
1450
        // 
1451
        System.out.println("TestPlanRelease - Iteration 4");
1452
        releaseManager = new myReleaseManager("iteration4", "not used", "not used");
1453
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1454
 
1455
        // this is all the MasterThread does
1456
        try
1457
        {
1458
            rippleEngine.collectMetaData();
1459
            rippleEngine.planRelease(false);
1460
        }
1461
        catch (Exception e)
1462
        {
1463
        }
1464
 
1465
        boolean rv;
1466
        BuildFile buildFile;
1467
 
1468
        buildFile = rippleEngine.getFirstBuildFileContent();
1469
        assertTrue(buildFile != null);
1470
        assertTrue(buildFile.state != BuildFileState.Dummy);
1471
        assertTrue(buildFile.state != BuildFileState.Empty);
1472
 
1473
        rv = Utilities.checkBuildfile(buildFile.content, "daemon4");
1474
        assertTrue(rv)
1475
        ;
1476
        buildFile = rippleEngine.getNextBuildFileContent();
1477
        assertTrue(buildFile != null);
1478
        assertTrue(buildFile.state == BuildFileState.Empty);
1479
    }
1480
 
1481
    @Test
1482
    public void TestPlanRelease_5()
1483
    {
1484
 
1485
        //
1486
        System.out.println("TestPlanRelease - Iteration 5");
1487
        releaseManager = new myReleaseManager("iteration5", "not used", "not used");
1488
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1489
 
1490
        // this is all the MasterThread does
1491
        try
1492
        {
1493
            rippleEngine.collectMetaData();
1494
            rippleEngine.planRelease(false);
1495
        }
1496
        catch (Exception e)
1497
        {
1498
        }
1499
 
1500
        boolean rv;
1501
        BuildFile buildFile;
1502
 
1503
        buildFile = rippleEngine.getFirstBuildFileContent();
1504
        assertTrue(buildFile != null);
1505
        assertTrue(buildFile.state != BuildFileState.Dummy);
1506
        assertTrue(buildFile.state != BuildFileState.Empty);
1507
 
1508
        rv = Utilities.checkBuildfile(buildFile.content, "daemon5");
1509
        assertTrue(rv);
1510
 
1511
        buildFile = rippleEngine.getNextBuildFileContent();
1512
        assertTrue(buildFile != null);
1513
        assertTrue(buildFile.state == BuildFileState.Empty);
1514
    }
1515
 
1516
    @Test
1517
    public void TestPlanRelease_6()
1518
    {
1519
 
1520
        //
1521
        System.out.println("TestPlanRelease - Iteration 6");
1522
        releaseManager = new myReleaseManager("iteration6", "not used", "not used");
1523
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1524
 
1525
        // this is all the MasterThread does
1526
        try
1527
        {
1528
            rippleEngine.collectMetaData();
1529
            rippleEngine.planRelease(false);
1530
        }
1531
        catch (Exception e)
1532
        {
1533
        }
1534
 
1535
        boolean rv;
1536
        BuildFile buildFile;
1537
 
1538
        buildFile = rippleEngine.getFirstBuildFileContent();
1539
        assertTrue(buildFile != null);
1540
        assertTrue(buildFile.state != BuildFileState.Dummy);
1541
        assertTrue(buildFile.state != BuildFileState.Empty);
1542
 
1543
        rv = Utilities.checkBuildfile(buildFile.content, "daemon6");
1544
        assertTrue(rv);
1545
 
1546
        buildFile = rippleEngine.getNextBuildFileContent();
1547
        assertTrue(buildFile != null);
1548
        assertTrue(buildFile.state == BuildFileState.Empty);
1549
    }
1550
 
1551
    @Test
1552
    public void TestPlanRelease_7()
1553
    {
1554
 
1555
        //
1556
        System.out.println("TestPlanRelease - Iteration 7");
1557
        releaseManager = new myReleaseManager("iteration7", "not used", "not used");
1558
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1559
 
1560
        // this is all the MasterThread does
1561
        try
1562
        {
1563
            rippleEngine.collectMetaData();
1564
            rippleEngine.planRelease(false);
1565
        }
1566
        catch (Exception e)
1567
        {
1568
        }
1569
 
1570
        boolean rv;
1571
        BuildFile buildFile;
1572
 
1573
        buildFile = rippleEngine.getFirstBuildFileContent();
1574
        assertTrue(buildFile != null);
1575
        assertTrue(buildFile.state == BuildFileState.Dummy);
1576
 
1577
        rv = Utilities.checkBuildfile(buildFile.content, "daemon7");
1578
        assertTrue(rv);
1579
 
1580
        buildFile = rippleEngine.getNextBuildFileContent();
1581
        assertTrue(buildFile != null);
1582
        assertTrue(buildFile.state == BuildFileState.Empty);
1583
    }
1584
 
1585
 
1586
    /**
1587
     * test method designed to test ripple field limits
1588
     * 1 tests applyPV returns 1 for package with version a.b.1.2.0
1589
     */
1590
    @Test
1591
    public void TestRippleFieldLimits()
1592
    {
1593
        ReleaseManager rm = new myReleaseManager();
1594
        // for test purposes, p.mId will contain the return value of applyPV
1595
        // test applyPV returns 1 and leaves mVersion alone
1596
        Package p = new Package(rm, "a.b.1.2.0", 255, 255, 255, 255);
1597
        assertTrue(p.getId() == 1);
1598
        assertTrue(p.getVersion().compareTo("a.b.1.2.0") == 0);
1599
 
1600
        // test applyPV returns 2 and leaves mVersion alone
1601
        p = new Package(rm, "1.0.0000", 0, 0, 0, 0);
1602
        assertTrue(p.getId() == 2);
1603
        assertTrue(p.getVersion().compareTo("1.0.0000") == 0);
1604
 
1605
        // test applyPV returns 2 and leaves mVersion alone
1606
        p = new Package(rm, "1.0.0009", 0, 0, 0, 9);
1607
        assertTrue(p.getId() == 2);
1608
        assertTrue(p.getVersion().compareTo("1.0.0009") == 0);
1609
 
1610
        // test applyPV returns 2 and leaves mVersion alone
1611
        p = new Package(rm, "1.0.9000", 0, 0, 9, 0);
1612
        assertTrue(p.getId() == 2);
1613
        assertTrue(p.getVersion().compareTo("1.0.9000") == 0);
1614
 
1615
        // test applyPV returns 2 and leaves mVersion alone
1616
        p = new Package(rm, "1.9.0000", 0, 9, 0, 0);
1617
        assertTrue(p.getId() == 2);
1618
        assertTrue(p.getVersion().compareTo("1.9.0000") == 0);
1619
 
1620
        // test applyPV returns 2 and leaves mVersion alone
1621
        p = new Package(rm, "1.0.0000", 1, 0, 0, 0);
1622
        assertTrue(p.getId() == 2);
1623
        assertTrue(p.getVersion().compareTo("1.0.0000") == 0);
1624
 
1625
        // test applyPV returns 2 and leaves mVersion alone - wince style limits
1626
        p = new Package(rm, "9.9.9000", 9, 9, 9, 0);
1627
        assertTrue(p.getId() == 2);
1628
        assertTrue(p.getVersion().compareTo("9.9.9000") == 0);
1629
 
1630
        // test applyPV returns 0 and sets mVersion from 8.8.8000 to 8.8.9000
1631
        p = new Package(rm, "8.8.8000", 9, 9, 9, 0);
1632
        assertTrue(p.getId() == 0);
1633
        assertTrue(p.getVersion().compareTo("8.8.9000") == 0);
1634
 
1635
        // test applyPV returns 0 and sets mVersion from 8.8.9000 to 8.9.0000
1636
        p = new Package(rm, "8.8.9000", 9, 9, 9, 0);
1637
        assertTrue(p.getId() == 0);
1638
        assertTrue(p.getVersion().compareTo("8.9.0000") == 0);
1639
 
1640
        // test applyPV returns 0 and sets mVersion from 8.9.9000 to 9.0.0000
1641
        p = new Package(rm, "8.9.9000", 9, 9, 9, 0);
1642
        assertTrue(p.getId() == 0);
1643
        assertTrue(p.getVersion().compareTo("9.0.0000") == 0);
1644
 
1645
        // test applyPV returns 2 and leaves mVersion alone - mos style limits
1646
        p = new Package(rm, "99.99.0000", 99, 99, 0, 0);
1647
        assertTrue(p.getId() == 2);
1648
        assertTrue(p.getVersion().compareTo("99.99.0000") == 0);
1649
 
1650
        // test applyPV returns 0 and sets mVersion from 98.98.0000 to 98.99.0000
1651
        p = new Package(rm, "98.98.0000", 99, 99, 0, 0);
1652
        assertTrue(p.getId() == 0);
1653
        assertTrue(p.getVersion().compareTo("98.99.0000") == 0);
1654
 
1655
        // test applyPV returns 0 and sets mVersion from 98.99.0000 to 99.0.0000
1656
        p = new Package(rm, "98.99.0000", 99, 99, 0, 0);
1657
        assertTrue(p.getId() == 0);
1658
        assertTrue(p.getVersion().compareTo("99.0.0000") == 0);
1659
 
1660
    }
1661
 
1662
    /**
1663
     * test method designed to ripple of COTS packages
1664
     * 1 tests applyPV returns 1 for package with version a.b.1.2.0
1665
     */
1666
    @Test
1667
    public void TestCotsRipples()
1668
    {
1669
        ReleaseManager rm = new myReleaseManager();
1670
        // for test purposes, p.mId will contain the return value of applyPV
1671
        // test applyPV returns 1 and leaves mVersion alone
1672
 
1673
        mLogger.debug("TestCotsRipples: willNotRipple.cots");
1674
        Package p = new Package(rm, "willNotRipple.cots", 255, 255, 255, 255);
1675
        assertTrue(p.getId() == 1);
1676
        assertTrue(p.getVersion().compareTo("willNotRipple") == 0);
1677
 
1678
        mLogger.debug("TestCotsRipples: willRipple.0000.cots");
1679
        p = new Package(rm, "willRipple.0000.cots", 255, 255, 255, 255);
1680
        assertTrue(p.getId() == 0);
1681
        assertTrue(p.getVersion().compareTo("willRipple.1000") == 0);
1682
 
1683
        mLogger.debug("TestCotsRipples: willNotRipple.000.cots");
1684
        p = new Package(rm, "willNotRipple.000.cots", 255, 255, 255, 255);
1685
        assertTrue(p.getId() == 1);
1686
        assertTrue(p.getVersion().compareTo("willNotRipple.000") == 0);
1687
 
1688
    }
1689
 
1690
}