Subversion Repositories DevTools

Rev

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