Subversion Repositories DevTools

Rev

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