Subversion Repositories DevTools

Rev

Rev 7033 | Go to most recent revision | Details | 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
 
22
import org.apache.log4j.Logger;
23
import org.apache.log4j.xml.DOMConfigurator;
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
{
38
    private static final Logger mLogger = Logger.getLogger(DaemonBuildTestCase.class);
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
        DOMConfigurator.configure("utf.xml");
1037
        mLogger.debug("main");
1038
        JUnitCore.main("com.erggroup.buildtool.utf.DaemonBuildTestCase");
1039
    }
1040
 
1041
    /**
1042
     * set up performed prior to any test method
1043
     */
1044
    @BeforeClass
1045
    public static void TestCaseSetUp()
1046
    {
1047
        mLogger.debug("TestCaseSetUp");
1048
    }
1049
 
1050
    /**
1051
     * tear down performed after test methods
1052
     */
1053
    @AfterClass
1054
    public static void TestCaseTearDown()
1055
    {
1056
        mLogger.debug("TestCaseTearDown");
1057
    }
1058
 
1059
    /**
1060
     * set up performed prior to each test method
1061
     */
1062
    @Before
1063
    public void TestSetUp()
1064
    {
1065
        mLogger.debug("TestSetUp");
1066
        System.setProperty("vix.utf.name", "DaemonBuildTestCase");
1067
        Package.mGenericMachtype = "win32";
1068
        Package.mGbeDpkg = ".";
1069
    }
1070
 
1071
    /**
1072
     * tear down performed after each test method
1073
     */
1074
    @After
1075
    public void TestTearDown()
1076
    {
1077
        mLogger.debug("TestTearDown");
1078
    }
1079
 
1080
    /**
1081
     * test method designed primarily to test the sequence diagram spawn thread
1082
     * also tests thread control out of necessity:
1083
     * 1 constructs a BuildDaemon object, passing a connectionString of "unit test spawn thread"
1084
     * this utilises the following unit test hooks in the codebase:
1085
     * - BuildDaemon::BuildDaemon connectionString of "unit test spawn thread" exits while forever loop
1086
     * - BuildDaemon constructor, isActive and cleanUp made public for unit test use
1087
     * - ReleaseManager::queryReleaseConfig instantiates 2 ReleaseConfig objects
1088
     * with rcon_id's of 1 and 2, daemon_modes of 'M' and 'S' respectively, and gbebuildfilters of
1089
     * "unit test spawn thread"
1090
     * - MasterThread::run gbebuildfilter of "unit test spawn thread" limits method to sleep in while forever loop
1091
     * - SlaveThread::run gbebuildfilter of "unit test spawn thread" limits method to sleep in while forever loop
1092
     * 2 checks the number of threads in the thread group is 3 (mainline thread + MasterThread + SlaveThread)
1093
     * 3 checks isActive on the BuildDaemon object returns true when passed an rcon_id of 1
1094
     * 4 checks isActive on the BuildDaemon object returns true when passed an rcon_id of 2
1095
     * 5 checks isActive on the BuildDaemon object returns false when passed an rcon_id of 3
1096
     * 6 calls cleanUp on the BuildDaemon object
1097
     * 7 checks the number of threads in the thread group is 1 (mainline thread)
1098
     * 8 checks isActive on the BuildDaemon object returns false when passed an rcon_id of 1
1099
     * 9 checks isActive on the BuildDaemon object returns false when passed an rcon_id of 2
1100
     * 10 checks isActive on the BuildDaemon object returns false when passed an rcon_id of 3
1101
     */
1102
    @Test
1103
    public void TestSpawnThread()
1104
    {
1105
        mLogger.debug("TestSpawnThread");
1106
        int tcount;
1107
        releaseManager = new myReleaseManager("unit test spawn thread", "not used", "not used");
1108
        BuildDaemon buildDaemon = new BuildDaemon(releaseManager);
1109
        tcount = BuildThread.mThreadGroup.activeCount();
1110
        System.out.println("TestSpawnThread. tCount:" + tcount);
1111
        assertTrue(tcount == 2);
1112
        assertTrue(buildDaemon.isActive(1));
1113
        assertTrue(buildDaemon.isActive(2));
1114
        assertFalse(buildDaemon.isActive(3));
1115
        buildDaemon.cleanUp();
1116
        tcount = BuildThread.mThreadGroup.activeCount();
1117
        System.out.println("TestSpawnThread Cleanup. tCount:" + tcount);
1118
        assertTrue(tcount == 0);
1119
        assertFalse(buildDaemon.isActive(1));
1120
        assertFalse(buildDaemon.isActive(2));
1121
        assertFalse(buildDaemon.isActive(3));
1122
    }
1123
 
1124
    /**
1125
     * test method designed to test the sequence diagram coordinate slave thread:
1126
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test coordinate slave threads"
1127
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit test coordinate slave threads"
1128
     * this utilises the following unit test hooks in the codebase:
1129
     * - MasterThread constructor made public for unit test use
1130
     * - MasterThread::run gbebuildfilter of "unit test coordinate slave threads" limits method to the sequence diagram
1131
     * interrupts the thread if, on one pass, at least one RunLevel object does not have a run level DB_WAITING
1132
     * exits the while forever loop if, on one pass, all RunLevel objects have a run level DB_WAITING
1133
     * - ReleaseManager::queryRunLevel connectionString of "unit test coordinate slave threads" instantiates 2 RunLevel
1134
     * objects
1135
     * initially with run levels of waiting and idle
1136
     * subsequently with run levels both waiting
1137
     * 3 calls run on the MasterThread object
1138
     * 4 checks its thread has been interrupted
1139
     */
1140
    @Test
1141
    public void TestCoordinateSlaveThreads()
1142
    {
1143
        mLogger.debug("TestCoordinateSlaveThreads");
1144
        ReleaseManager releaseManager = new myReleaseManager("unit test coordinate slave threads", "not used", "not used");
1145
        MasterThread masterThread = new MasterThread(1, 1, releaseManager ,"unit test coordinate slave threads");
1146
        assertFalse(Thread.interrupted());
1147
        masterThread.run();
1148
        // interrupted checks and importantly clears the interrupted status of this thread for subsequent tests
1149
        assertTrue(Thread.interrupted());
1150
        assertFalse(Thread.interrupted());
1151
    }
1152
 
1153
    /**
1154
     * test method designed to test the sequence diagram generate build files
1155
     * note does not test the RippleEngine:
1156
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test generate build files"
1157
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit test generate build files"
1158
     * this utilises the following unit test hooks in the codebase:
1159
     * - MasterThread constructor made public for unit test use
1160
     * - MasterThread::run gbebuildfilter of "unit test generate build files" limits method to the sequence diagram
1161
     * exits the while forever loop
1162
     * - ReleaseManager::queryReleaseConfig instantiates 2 ReleaseConfig objects
1163
     * with rcon_id's of 1 and 2, daemon_modes of 'M' and 'S' respectively, and gbebuildfilters of
1164
     * "unit test spawn thread"
1165
     * - ReleaseManager::updateCurrentRunLevel utilises the public mPersistedRunLevelCollection
1166
     * 3 calls run on the MasterThread object
1167
     * 4 checks the first persisted run level is DB_ACTIVE
1168
     * 5 checks the second persisted run level is DB_ACTIVE
1169
     * 6 checks no further run levels were persisted
1170
     */
1171
    @Test
1172
    public void TestGenerateBuildFiles()
1173
    {
1174
        mLogger.debug("TestGenerateBuildFiles");
1175
        myReleaseManager releaseManager = new myReleaseManager("unit test generate build files", "not used", "not used");
1176
        MasterThread masterThread = new MasterThread(1, 1, releaseManager, "unit test generate build files");
1177
        masterThread.run();
1178
        assertTrue(RunLevelData.isAt(BuildState.DB_ACTIVE, releaseManager.mPersistedRunLevelCollection.get(0)));
1179
        assertTrue(RunLevelData.isAt(BuildState.DB_ACTIVE, releaseManager.mPersistedRunLevelCollection.get(1)));
1180
        assertTrue( releaseManager.mPersistedRunLevelCollection.size() == 2);
1181
    }
1182
 
1183
    /**
1184
     * test method designed to test the sequence diagram consume build files
1185
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test consume build files"
1186
     * 2 constructs a SlaveThread object, passing a gbebuildfilter of "unit test consume build files"
1187
     * this utilises the following unit test hooks in the codebase:
1188
     * - SlaveThread constructor made public for unit test use
1189
     * - SlaveThread::run gbebuildfilter of "unit test consume build files" limits method to the sequence diagram
1190
     * interrupts the thread if, on one pass, the current build file string is empty
1191
     * exits the while forever loop
1192
     * - ReleaseManager::queryRunLevel
1193
     * initially returns an empty current build file string
1194
     * subsequently returns a "unit test build file content" current build file string
1195
     * 3 calls run on the SlaveThread object
1196
     */
1197
     @Test
1198
    public void TestConsumeBuildFiles()
1199
    {
1200
        mLogger.debug("TestConsumeBuildFiles");
1201
        ReleaseManager releaseManager = new myReleaseManager("unit test consume build files", "not used", "not used");
1202
        SlaveThread slaveThread = new SlaveThread(1, 1, releaseManager, "unit test consume build files");
1203
        assertFalse(Thread.interrupted());
1204
        slaveThread.run();
1205
    }
1206
 
1207
    /**
1208
     * test method designed to test the sequence diagram allowed to proceed
1209
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test allowed to proceed"
1210
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit test allowed to proceed"
1211
     * this utilises the following unit test hooks in the codebase:
1212
     * - MasterThread constructor made public for unit test use
1213
     * - MasterThread::run gbebuildfilter of "unit test allowed to proceed" limits method to the sequence diagram
1214
     * exits the while forever loop
1215
     * - ReleaseManager::queryReleaseConfig, queryRunLevelSchedule, queryDirectedRunLevel methods return true
1216
     * - ReleaseManager::updateCurrentRunLevel utilises the public mPersistedRunLevelCollection
1217
     * 3 calls run on the MasterThread object
1218
     * 4 checks the first persisted run level is DB_IDLE
1219
     * 5 checks the second persisted run level is DB_IDLE
1220
     * 6 checks the third persisted run level is DB_WAITING
1221
     * 7 checks no further run levels were persisted
1222
     */
1223
    @Test
1224
    public void TestAllowedToProceed()
1225
    {
1226
        mLogger.debug("TestAllowedToProceed");
1227
        myReleaseManager releaseManager = new myReleaseManager("unit test allowed to proceed", "not used", "not used");
1228
        MasterThread masterThread = new MasterThread(1, 1, releaseManager, "unit test allowed to proceed");
1229
        masterThread.run();
1230
 
1231
        assertTrue( RunLevelData.isAt(BuildState.DB_IDLE, releaseManager.mPersistedRunLevelCollection.get(0)));
1232
        assertTrue( releaseManager.mPersistedRunLevelCollection.size() == 1);
1233
    }
1234
 
1235
    /**
1236
     * test method designed to test the sequence diagram not allowed to proceed
1237
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test not allowed to proceed"
1238
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit test not allowed to proceed"
1239
     * this utilises the following unit test hooks in the codebase:
1240
     * - MasterThread constructor made public for unit test use
1241
     * - MasterThread::run gbebuildfilter of "unit test not allowed to proceed" limits method to the sequence diagram
1242
     *   exits the while forever loop
1243
     * - ReleaseManager::queryReleaseConfig method returns true
1244
     * - ReleaseManager::queryRunLevelSchedule method returns false
1245
     * - ReleaseManager::updateCurrentRunLevel utilises the public mPersistedRunLevelCollection
1246
     * 3 calls run on the MasterThread object
1247
     * 4 checks the first persisted run level is DB_IDLE
1248
     * 5 checks the second persisted run level is DB_IDLE
1249
     * 6 checks the third persisted run level is DB_PAUSED
1250
     * 7 checks no further run levels were persisted
1251
     * nb cannot check only one thread is running,
1252
     * a Timer thread, though having run to completion, may still be "active"
1253
     */
1254
    @Test
1255
    public void TestNotAllowedToProceed()
1256
    {
1257
        mLogger.debug("TestNotAllowedToProceed");
1258
        myReleaseManager releaseManager = new myReleaseManager("unit test not allowed to proceed", "not used", "not used");
1259
        MasterThread masterThread = new MasterThread(1, 1, releaseManager, "unit test not allowed to proceed");
1260
        masterThread.run();
1261
 
1262
        assertTrue(RunLevelData.isAt(BuildState.DB_IDLE, releaseManager.mPersistedRunLevelCollection.get(0)));
1263
        assertTrue(RunLevelData.isAt(BuildState.DB_PAUSED, releaseManager.mPersistedRunLevelCollection.get(1)));
1264
        assertTrue( releaseManager.mPersistedRunLevelCollection.size() == 2);
1265
    }
1266
 
1267
    /**
1268
     * test method designed to test the sequence diagram exit
1269
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit test exit"
1270
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit test exit"
1271
     * this utilises the following unit test hooks in the codebase:
1272
     * - MasterThread constructor made public for unit test use
1273
     * - MasterThread::run gbebuildfilter of "unit test exit" limits method to the sequence diagram
1274
     * - ReleaseManager::queryReleaseConfig method returns false
1275
     * - ReleaseManager::updateCurrentRunLevel utilises the public mPersistedRunLevelCollection
1276
     * 3 calls run on the MasterThread object
1277
     * 4 checks the first persisted run level is DB_IDLE
1278
     * 5 checks no further run levels were persisted
1279
     */
1280
    @Test
1281
    public void TestExit()
1282
    {
1283
        mLogger.debug("TestExit");
1284
        myReleaseManager releaseManager = new myReleaseManager("unit test exit", "not used", "not used");
1285
        MasterThread masterThread = new MasterThread(1, 1, releaseManager, "unit test exit");
1286
        masterThread.run();
1287
 
1288
        assertTrue(RunLevelData.isAt(BuildState.DB_IDLE, releaseManager.mPersistedRunLevelCollection.get(0)));
1289
        assertTrue( releaseManager.mPersistedRunLevelCollection.size() == 1);
1290
    }
1291
 
1292
    /**
1293
     * test method designed to test the sequence diagram check environment
1294
     * 1 constructs a ReleaseManager object, passing a connectionString of "unit check environment"
1295
     * 2 constructs a MasterThread object, passing a gbebuildfilter of "unit check environment"
1296
     * this utilises the following unit test hooks in the codebase:
1297
     * - MasterThread constructor made public for unit test use
1298
     * - MasterThread::run gbebuildfilter of "unit test check environment" limits method to the sequence diagram
1299
     * exits the while forever loop
1300
     * - MasterThread::housekeep method does not call deleteDirectory
1301
     * - MasterThread::hasSufficientDiskSpace initially returns false, then true
1302
     * - ReleaseManager::updateCurrentRunLevel utilises the public mPersistedRunLevelCollection
1303
     * 3 calls run on the MasterThread object
1304
     * 4 checks the first persisted run level is DB_CANNOT_CONTINUE
1305
     * 5 checks the next persisted run level is DB_ACTIVE
1306
     * 6 checks no further run levels were persisted
1307
     */
1308
    @Test
1309
    public void TestCheckEnvironment()
1310
    {
1311
        mLogger.debug("TestCheckEnvironment");
1312
        myReleaseManager releaseManager = new myReleaseManager("unit test check environment", "not used", "not used");
1313
        MasterThread masterThread = new MasterThread(1, 1, releaseManager, "unit test check environment");
1314
        masterThread.run();
1315
        assertTrue(RunLevelData.isAt(BuildState.DB_CANNOT_CONTINUE, releaseManager.mPersistedRunLevelCollection.get(0)));
1316
        assertTrue(RunLevelData.isAt(BuildState.DB_ACTIVE, releaseManager.mPersistedRunLevelCollection.get(1)));
1317
        assertTrue( releaseManager.mPersistedRunLevelCollection.size() == 2);
1318
    }
1319
 
1320
    /**
1321
     * test method designed to test the ripple engine
1322
     * 1 constructs a ReleaseManager object with connection string "iteration1"
1323
     * 2 constructs a RippleEngine object
1324
     * 3 calls planRelease on the RippleEngine object
1325
     * 4 calls getFirstBuildFileContent
1326
     * 5 checks it returns true
1327
     * 6 writes the content to "daemon1.xml"
1328
     * 7 checks the content matches the content in "expecteddaemon1.xml"
1329
     * 8 calls getNextBuildFileContent
1330
     * 9 checks it returns false
1331
     * 10 constructs a ReleaseManager object with connection string "iteration2"
1332
     * 11 calls planRelease on the RippleEngine object
1333
     * 12 calls getFirstBuildFileContent
1334
     * 13 checks it returns true
1335
     * 14 writes the content to "daemon2.xml"
1336
     * 15 checks the content matches the content in "expecteddaemon2.xml"
1337
     * 16 calls getNextBuildFileContent
1338
     * 17 checks it returns false
1339
     * 18 steps 10 to 17 are repeated for iteration3,4,5 and 6
1340
     * 19 constructs a ReleaseManager object with connection string "iteration7"
1341
     * 20 calls planRelease on the RippleEngine object
1342
     * 21 calls getFirstBuildFileContent
1343
     * 22 checks it returns true (a benign build file content)
1344
     */
1345
    @Test
1346
    public void TestPlanRelease_1()
1347
    {
1348
        mLogger.debug("TestPlanRelease");
1349
        System.out.println("TestPlanRelease - Iteration 1");
1350
        ReleaseManager releaseManager = new myReleaseManager("iteration1", "not used", "not used");
1351
 
1352
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1353
        // this is all the MasterThread does
1354
        try
1355
        {
1356
            rippleEngine.collectMetaData();
1357
            rippleEngine.planRelease(false);
1358
        }
1359
        catch (Exception e)
1360
        {
1361
        }
1362
 
1363
        boolean rv;
1364
        BuildFile buildFile;
1365
 
1366
        buildFile = rippleEngine.getFirstBuildFileContent();
1367
        assertTrue(buildFile != null);
1368
        assertTrue(buildFile.state != BuildFileState.Dummy);
1369
        assertTrue(buildFile.state != BuildFileState.Empty);
1370
 
1371
        rv = Utilities.checkBuildfile(buildFile.content, "daemon1");
1372
        assertTrue(rv);
1373
 
1374
        buildFile = rippleEngine.getNextBuildFileContent();
1375
        assertTrue(buildFile != null);
1376
        assertTrue(buildFile.state == BuildFileState.Empty);
1377
    }
1378
 
1379
    @Test
1380
    public void TestPlanRelease_2()
1381
    {
1382
        //
1383
        System.out.println("TestPlanRelease - Iteration 2");
1384
        releaseManager = new myReleaseManager("iteration2", "not used", "not used");
1385
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1386
 
1387
        // this is all the MasterThread does
1388
        try
1389
        {
1390
            rippleEngine.collectMetaData();
1391
            rippleEngine.planRelease(false);
1392
        }
1393
        catch (Exception e)
1394
        {
1395
        }
1396
 
1397
        boolean rv;
1398
        BuildFile buildFile;
1399
 
1400
        buildFile = rippleEngine.getFirstBuildFileContent();
1401
        assertTrue(buildFile != null);
1402
        assertTrue(buildFile.state != BuildFileState.Dummy);
1403
        assertTrue(buildFile.state != BuildFileState.Empty);
1404
 
1405
        rv = Utilities.checkBuildfile(buildFile.content, "daemon2");
1406
        assertTrue(rv);
1407
 
1408
        buildFile = rippleEngine.getNextBuildFileContent();
1409
        assertTrue(buildFile != null);
1410
        assertTrue(buildFile.state == BuildFileState.Empty);
1411
    }
1412
 
1413
    @Test
1414
    public void TestPlanRelease_3()
1415
    {
1416
        //
1417
        System.out.println("TestPlanRelease - Iteration 3");
1418
        releaseManager = new myReleaseManager("iteration3", "not used", "not used");
1419
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1420
 
1421
        // this is all the MasterThread does
1422
        try
1423
        {
1424
            rippleEngine.collectMetaData();
1425
            rippleEngine.planRelease(false);
1426
        }
1427
        catch (Exception e)
1428
        {
1429
        }
1430
 
1431
        boolean rv;
1432
        BuildFile buildFile;
1433
 
1434
        buildFile = rippleEngine.getFirstBuildFileContent();
1435
        assertTrue(buildFile != null);
1436
        assertTrue(buildFile.state != BuildFileState.Dummy);
1437
        assertTrue(buildFile.state != BuildFileState.Empty);
1438
 
1439
        rv = Utilities.checkBuildfile(buildFile.content, "daemon3");
1440
        assertTrue(rv);
1441
 
1442
        buildFile = rippleEngine.getNextBuildFileContent();
1443
        assertTrue(buildFile != null);
1444
        assertTrue(buildFile.state == BuildFileState.Empty);
1445
    }
1446
 
1447
    @Test
1448
    public void TestPlanRelease_4()
1449
    {
1450
 
1451
        // 
1452
        System.out.println("TestPlanRelease - Iteration 4");
1453
        releaseManager = new myReleaseManager("iteration4", "not used", "not used");
1454
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1455
 
1456
        // this is all the MasterThread does
1457
        try
1458
        {
1459
            rippleEngine.collectMetaData();
1460
            rippleEngine.planRelease(false);
1461
        }
1462
        catch (Exception e)
1463
        {
1464
        }
1465
 
1466
        boolean rv;
1467
        BuildFile buildFile;
1468
 
1469
        buildFile = rippleEngine.getFirstBuildFileContent();
1470
        assertTrue(buildFile != null);
1471
        assertTrue(buildFile.state != BuildFileState.Dummy);
1472
        assertTrue(buildFile.state != BuildFileState.Empty);
1473
 
1474
        rv = Utilities.checkBuildfile(buildFile.content, "daemon4");
1475
        assertTrue(rv)
1476
        ;
1477
        buildFile = rippleEngine.getNextBuildFileContent();
1478
        assertTrue(buildFile != null);
1479
        assertTrue(buildFile.state == BuildFileState.Empty);
1480
    }
1481
 
1482
    @Test
1483
    public void TestPlanRelease_5()
1484
    {
1485
 
1486
        //
1487
        System.out.println("TestPlanRelease - Iteration 5");
1488
        releaseManager = new myReleaseManager("iteration5", "not used", "not used");
1489
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1490
 
1491
        // this is all the MasterThread does
1492
        try
1493
        {
1494
            rippleEngine.collectMetaData();
1495
            rippleEngine.planRelease(false);
1496
        }
1497
        catch (Exception e)
1498
        {
1499
        }
1500
 
1501
        boolean rv;
1502
        BuildFile buildFile;
1503
 
1504
        buildFile = rippleEngine.getFirstBuildFileContent();
1505
        assertTrue(buildFile != null);
1506
        assertTrue(buildFile.state != BuildFileState.Dummy);
1507
        assertTrue(buildFile.state != BuildFileState.Empty);
1508
 
1509
        rv = Utilities.checkBuildfile(buildFile.content, "daemon5");
1510
        assertTrue(rv);
1511
 
1512
        buildFile = rippleEngine.getNextBuildFileContent();
1513
        assertTrue(buildFile != null);
1514
        assertTrue(buildFile.state == BuildFileState.Empty);
1515
    }
1516
 
1517
    @Test
1518
    public void TestPlanRelease_6()
1519
    {
1520
 
1521
        //
1522
        System.out.println("TestPlanRelease - Iteration 6");
1523
        releaseManager = new myReleaseManager("iteration6", "not used", "not used");
1524
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1525
 
1526
        // this is all the MasterThread does
1527
        try
1528
        {
1529
            rippleEngine.collectMetaData();
1530
            rippleEngine.planRelease(false);
1531
        }
1532
        catch (Exception e)
1533
        {
1534
        }
1535
 
1536
        boolean rv;
1537
        BuildFile buildFile;
1538
 
1539
        buildFile = rippleEngine.getFirstBuildFileContent();
1540
        assertTrue(buildFile != null);
1541
        assertTrue(buildFile.state != BuildFileState.Dummy);
1542
        assertTrue(buildFile.state != BuildFileState.Empty);
1543
 
1544
        rv = Utilities.checkBuildfile(buildFile.content, "daemon6");
1545
        assertTrue(rv);
1546
 
1547
        buildFile = rippleEngine.getNextBuildFileContent();
1548
        assertTrue(buildFile != null);
1549
        assertTrue(buildFile.state == BuildFileState.Empty);
1550
    }
1551
 
1552
    @Test
1553
    public void TestPlanRelease_7()
1554
    {
1555
 
1556
        //
1557
        System.out.println("TestPlanRelease - Iteration 7");
1558
        releaseManager = new myReleaseManager("iteration7", "not used", "not used");
1559
        RippleEngine rippleEngine = new RippleEngine(releaseManager, 11111, true);
1560
 
1561
        // this is all the MasterThread does
1562
        try
1563
        {
1564
            rippleEngine.collectMetaData();
1565
            rippleEngine.planRelease(false);
1566
        }
1567
        catch (Exception e)
1568
        {
1569
        }
1570
 
1571
        boolean rv;
1572
        BuildFile buildFile;
1573
 
1574
        buildFile = rippleEngine.getFirstBuildFileContent();
1575
        assertTrue(buildFile != null);
1576
        assertTrue(buildFile.state == BuildFileState.Dummy);
1577
 
1578
        rv = Utilities.checkBuildfile(buildFile.content, "daemon7");
1579
        assertTrue(rv);
1580
 
1581
        buildFile = rippleEngine.getNextBuildFileContent();
1582
        assertTrue(buildFile != null);
1583
        assertTrue(buildFile.state == BuildFileState.Empty);
1584
    }
1585
 
1586
 
1587
    /**
1588
     * test method designed to test ripple field limits
1589
     * 1 tests applyPV returns 1 for package with version a.b.1.2.0
1590
     */
1591
    @Test
1592
    public void TestRippleFieldLimits()
1593
    {
1594
        ReleaseManager rm = new myReleaseManager();
1595
        // for test purposes, p.mId will contain the return value of applyPV
1596
        // test applyPV returns 1 and leaves mVersion alone
1597
        Package p = new Package(rm, "a.b.1.2.0", 255, 255, 255, 255);
1598
        assertTrue(p.getId() == 1);
1599
        assertTrue(p.getVersion().compareTo("a.b.1.2.0") == 0);
1600
 
1601
        // test applyPV returns 2 and leaves mVersion alone
1602
        p = new Package(rm, "1.0.0000", 0, 0, 0, 0);
1603
        assertTrue(p.getId() == 2);
1604
        assertTrue(p.getVersion().compareTo("1.0.0000") == 0);
1605
 
1606
        // test applyPV returns 2 and leaves mVersion alone
1607
        p = new Package(rm, "1.0.0009", 0, 0, 0, 9);
1608
        assertTrue(p.getId() == 2);
1609
        assertTrue(p.getVersion().compareTo("1.0.0009") == 0);
1610
 
1611
        // test applyPV returns 2 and leaves mVersion alone
1612
        p = new Package(rm, "1.0.9000", 0, 0, 9, 0);
1613
        assertTrue(p.getId() == 2);
1614
        assertTrue(p.getVersion().compareTo("1.0.9000") == 0);
1615
 
1616
        // test applyPV returns 2 and leaves mVersion alone
1617
        p = new Package(rm, "1.9.0000", 0, 9, 0, 0);
1618
        assertTrue(p.getId() == 2);
1619
        assertTrue(p.getVersion().compareTo("1.9.0000") == 0);
1620
 
1621
        // test applyPV returns 2 and leaves mVersion alone
1622
        p = new Package(rm, "1.0.0000", 1, 0, 0, 0);
1623
        assertTrue(p.getId() == 2);
1624
        assertTrue(p.getVersion().compareTo("1.0.0000") == 0);
1625
 
1626
        // test applyPV returns 2 and leaves mVersion alone - wince style limits
1627
        p = new Package(rm, "9.9.9000", 9, 9, 9, 0);
1628
        assertTrue(p.getId() == 2);
1629
        assertTrue(p.getVersion().compareTo("9.9.9000") == 0);
1630
 
1631
        // test applyPV returns 0 and sets mVersion from 8.8.8000 to 8.8.9000
1632
        p = new Package(rm, "8.8.8000", 9, 9, 9, 0);
1633
        assertTrue(p.getId() == 0);
1634
        assertTrue(p.getVersion().compareTo("8.8.9000") == 0);
1635
 
1636
        // test applyPV returns 0 and sets mVersion from 8.8.9000 to 8.9.0000
1637
        p = new Package(rm, "8.8.9000", 9, 9, 9, 0);
1638
        assertTrue(p.getId() == 0);
1639
        assertTrue(p.getVersion().compareTo("8.9.0000") == 0);
1640
 
1641
        // test applyPV returns 0 and sets mVersion from 8.9.9000 to 9.0.0000
1642
        p = new Package(rm, "8.9.9000", 9, 9, 9, 0);
1643
        assertTrue(p.getId() == 0);
1644
        assertTrue(p.getVersion().compareTo("9.0.0000") == 0);
1645
 
1646
        // test applyPV returns 2 and leaves mVersion alone - mos style limits
1647
        p = new Package(rm, "99.99.0000", 99, 99, 0, 0);
1648
        assertTrue(p.getId() == 2);
1649
        assertTrue(p.getVersion().compareTo("99.99.0000") == 0);
1650
 
1651
        // test applyPV returns 0 and sets mVersion from 98.98.0000 to 98.99.0000
1652
        p = new Package(rm, "98.98.0000", 99, 99, 0, 0);
1653
        assertTrue(p.getId() == 0);
1654
        assertTrue(p.getVersion().compareTo("98.99.0000") == 0);
1655
 
1656
        // test applyPV returns 0 and sets mVersion from 98.99.0000 to 99.0.0000
1657
        p = new Package(rm, "98.99.0000", 99, 99, 0, 0);
1658
        assertTrue(p.getId() == 0);
1659
        assertTrue(p.getVersion().compareTo("99.0.0000") == 0);
1660
 
1661
    }
1662
 
1663
    /**
1664
     * test method designed to ripple of COTS packages
1665
     * 1 tests applyPV returns 1 for package with version a.b.1.2.0
1666
     */
1667
    @Test
1668
    public void TestCotsRipples()
1669
    {
1670
        ReleaseManager rm = new myReleaseManager();
1671
        // for test purposes, p.mId will contain the return value of applyPV
1672
        // test applyPV returns 1 and leaves mVersion alone
1673
 
1674
        mLogger.debug("TestCotsRipples: willNotRipple.cots");
1675
        Package p = new Package(rm, "willNotRipple.cots", 255, 255, 255, 255);
1676
        assertTrue(p.getId() == 1);
1677
        assertTrue(p.getVersion().compareTo("willNotRipple") == 0);
1678
 
1679
        mLogger.debug("TestCotsRipples: willRipple.0000.cots");
1680
        p = new Package(rm, "willRipple.0000.cots", 255, 255, 255, 255);
1681
        assertTrue(p.getId() == 0);
1682
        assertTrue(p.getVersion().compareTo("willRipple.1000") == 0);
1683
 
1684
        mLogger.debug("TestCotsRipples: willNotRipple.000.cots");
1685
        p = new Package(rm, "willNotRipple.000.cots", 255, 255, 255, 255);
1686
        assertTrue(p.getId() == 1);
1687
        assertTrue(p.getVersion().compareTo("willNotRipple.000") == 0);
1688
 
1689
    }
1690
 
1691
}