Subversion Repositories DevTools

Rev

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