| Line 1... |
Line 1... |
| 1 |
package com.erggroup.buildtool.utf;
|
1 |
package com.erggroup.buildtool.utf;
|
| 2 |
|
2 |
|
| 3 |
import com.erggroup.buildtool.daemon.BuildDaemon;
|
3 |
import com.erggroup.buildtool.daemon.BuildDaemon;
|
| 4 |
import com.erggroup.buildtool.daemon.BuildThread;
|
4 |
import com.erggroup.buildtool.daemon.BuildThread;
|
| 5 |
|
- |
|
| 6 |
import com.erggroup.buildtool.daemon.MasterThread;
|
5 |
import com.erggroup.buildtool.daemon.MasterThread;
|
| 7 |
import com.erggroup.buildtool.daemon.SlaveThread;
|
6 |
import com.erggroup.buildtool.daemon.SlaveThread;
|
| 8 |
import com.erggroup.buildtool.ripple.MutableString;
|
7 |
import com.erggroup.buildtool.ripple.MutableString;
|
| 9 |
import com.erggroup.buildtool.ripple.ReleaseManager;
|
8 |
import com.erggroup.buildtool.ripple.ReleaseManager;
|
| 10 |
import com.erggroup.buildtool.ripple.Package;
|
9 |
import com.erggroup.buildtool.ripple.Package;
|
| Line 15... |
Line 14... |
| 15 |
import java.io.FileWriter;
|
14 |
import java.io.FileWriter;
|
| 16 |
import java.io.IOException;
|
15 |
import java.io.IOException;
|
| 17 |
|
16 |
|
| 18 |
import org.apache.log4j.Logger;
|
17 |
import org.apache.log4j.Logger;
|
| 19 |
import org.apache.log4j.xml.DOMConfigurator;
|
18 |
import org.apache.log4j.xml.DOMConfigurator;
|
| 20 |
|
- |
|
| 21 |
import org.junit.AfterClass;
|
19 |
import org.junit.AfterClass;
|
| 22 |
import org.junit.BeforeClass;
|
20 |
import org.junit.BeforeClass;
|
| 23 |
import org.junit.After;
|
21 |
import org.junit.After;
|
| 24 |
import org.junit.Before;
|
22 |
import org.junit.Before;
|
| 25 |
import org.junit.Test;
|
23 |
import org.junit.Test;
|
| 26 |
import org.junit.runner.JUnitCore;
|
24 |
import org.junit.runner.JUnitCore;
|
| - |
|
25 |
|
| 27 |
import static org.junit.Assert.*;
|
26 |
import static org.junit.Assert.*;
|
| 28 |
|
27 |
|
| 29 |
/**container of Build Daemon test methods
|
28 |
/**container of Build Daemon test methods
|
| 30 |
*/
|
29 |
*/
|
| 31 |
public class DaemonBuildTestCase
|
30 |
public class DaemonBuildTestCase
|
| Line 41... |
Line 40... |
| 41 |
*/
|
40 |
*/
|
| 42 |
public static void main(String[] args)
|
41 |
public static void main(String[] args)
|
| 43 |
{
|
42 |
{
|
| 44 |
DOMConfigurator.configure("utf.xml");
|
43 |
DOMConfigurator.configure("utf.xml");
|
| 45 |
mLogger.debug("main");
|
44 |
mLogger.debug("main");
|
| - |
|
45 |
System.setProperty("vix.utf.name", "DaemonBuildTestCase");
|
| 46 |
JUnitCore.main( "com.erggroup.buildtool.utf.DaemonBuildTestCase" );
|
46 |
JUnitCore.main( "com.erggroup.buildtool.utf.DaemonBuildTestCase" );
|
| 47 |
}
|
47 |
}
|
| 48 |
|
48 |
|
| 49 |
/**set up performed prior to any test method
|
49 |
/**set up performed prior to any test method
|
| 50 |
*/
|
50 |
*/
|
| Line 66... |
Line 66... |
| 66 |
*/
|
66 |
*/
|
| 67 |
@Before
|
67 |
@Before
|
| 68 |
public void TestSetUp()
|
68 |
public void TestSetUp()
|
| 69 |
{
|
69 |
{
|
| 70 |
mLogger.debug("TestSetUp");
|
70 |
mLogger.debug("TestSetUp");
|
| - |
|
71 |
mLogger.fatal("TestSetUp: Property:" + System.getProperty("vix.utf.name"));
|
| 71 |
ReleaseManager.mUseDatabase = false;
|
72 |
ReleaseManager.mUseDatabase = false;
|
| 72 |
}
|
73 |
}
|
| 73 |
|
74 |
|
| 74 |
/**tear down performed after each test method
|
75 |
/**tear down performed after each test method
|
| 75 |
*/
|
76 |
*/
|
| Line 103... |
Line 104... |
| 103 |
*/
|
104 |
*/
|
| 104 |
@Test
|
105 |
@Test
|
| 105 |
public void TestSpawnThread()
|
106 |
public void TestSpawnThread()
|
| 106 |
{
|
107 |
{
|
| 107 |
mLogger.debug("TestSpawnThread");
|
108 |
mLogger.debug("TestSpawnThread");
|
| 108 |
BuildDaemon buildDaemon =
|
109 |
int tcount;
|
| 109 |
new BuildDaemon("unit test spawn thread", "not used", "not used");
|
110 |
BuildDaemon buildDaemon = new BuildDaemon("unit test spawn thread", "not used", "not used");
|
| 110 |
assertTrue(BuildThread.mThreadGroup.activeCount() == 2 );
|
111 |
tcount = BuildThread.mThreadGroup.activeCount();
|
| - |
|
112 |
assertTrue(tcount == 2 );
|
| 111 |
assertTrue(buildDaemon.isActive(1));
|
113 |
assertTrue(buildDaemon.isActive(1));
|
| 112 |
assertTrue(buildDaemon.isActive(2));
|
114 |
assertTrue(buildDaemon.isActive(2));
|
| 113 |
assertFalse(buildDaemon.isActive(3));
|
115 |
assertFalse(buildDaemon.isActive(3));
|
| 114 |
buildDaemon.cleanUp();
|
116 |
buildDaemon.cleanUp();
|
| 115 |
assertTrue(BuildThread.mThreadGroup.activeCount() == 0);
|
117 |
tcount = BuildThread.mThreadGroup.activeCount();
|
| - |
|
118 |
assertTrue(tcount == 0);
|
| 116 |
assertFalse(buildDaemon.isActive(1));
|
119 |
assertFalse(buildDaemon.isActive(1));
|
| 117 |
assertFalse(buildDaemon.isActive(2));
|
120 |
assertFalse(buildDaemon.isActive(2));
|
| 118 |
assertFalse(buildDaemon.isActive(3));
|
121 |
assertFalse(buildDaemon.isActive(3));
|
| 119 |
}
|
122 |
}
|
| 120 |
|
123 |
|
| Line 130... |
Line 133... |
| 130 |
* initially with run levels of waiting and idle
|
133 |
* initially with run levels of waiting and idle
|
| 131 |
* subsequently with run levels both waiting
|
134 |
* subsequently with run levels both waiting
|
| 132 |
* 3 calls run on the MasterThread object
|
135 |
* 3 calls run on the MasterThread object
|
| 133 |
* 4 checks its thread has been interrupted
|
136 |
* 4 checks its thread has been interrupted
|
| 134 |
*/
|
137 |
*/
|
| - |
|
138 |
@SuppressWarnings("unused")
|
| 135 |
@Test
|
139 |
@Test
|
| 136 |
public void TestCoordinateSlaveThreads()
|
140 |
public void TestCoordinateSlaveThreads()
|
| 137 |
{
|
141 |
{
|
| 138 |
mLogger.debug("TestCoordinateSlaveThreads");
|
142 |
mLogger.debug("TestCoordinateSlaveThreads");
|
| 139 |
ReleaseManager releaseManager = new ReleaseManager("unit test coordinate slave threads", "not used", "not used");
|
143 |
ReleaseManager releaseManager = new ReleaseManager("unit test coordinate slave threads", "not used", "not used");
|
| 140 |
MasterThread masterThread = new MasterThread(1, 1, "unit test coordinate slave threads");
|
144 |
MasterThread masterThread = new MasterThread(1, 1, "unit test coordinate slave threads");
|
| Line 159... |
Line 163... |
| 159 |
* 3 calls run on the MasterThread object
|
163 |
* 3 calls run on the MasterThread object
|
| 160 |
* 4 checks the first persisted run level is DB_ACTIVE
|
164 |
* 4 checks the first persisted run level is DB_ACTIVE
|
| 161 |
* 5 checks the second persisted run level is DB_ACTIVE
|
165 |
* 5 checks the second persisted run level is DB_ACTIVE
|
| 162 |
* 6 checks no further run levels were persisted
|
166 |
* 6 checks no further run levels were persisted
|
| 163 |
*/
|
167 |
*/
|
| - |
|
168 |
@SuppressWarnings("unused")
|
| 164 |
@Test
|
169 |
@Test
|
| 165 |
public void TestGenerateBuildFiles()
|
170 |
public void TestGenerateBuildFiles()
|
| 166 |
{
|
171 |
{
|
| 167 |
mLogger.debug("TestGenerateBuildFiles");
|
172 |
mLogger.debug("TestGenerateBuildFiles");
|
| 168 |
ReleaseManager releaseManager = new ReleaseManager("unit test generate build files", "not used", "not used");
|
173 |
ReleaseManager releaseManager = new ReleaseManager("unit test generate build files", "not used", "not used");
|
| 169 |
MasterThread masterThread = new MasterThread(1, 1, "unit test generate build files");
|
174 |
MasterThread masterThread = new MasterThread(1, 1, "unit test generate build files");
|
| Line 197... |
Line 202... |
| 197 |
* - ReleaseManager::queryRunLevel
|
202 |
* - ReleaseManager::queryRunLevel
|
| 198 |
* initially returns an empty current build file string
|
203 |
* initially returns an empty current build file string
|
| 199 |
* subsequently returns a "unit test build file content" current build file string
|
204 |
* subsequently returns a "unit test build file content" current build file string
|
| 200 |
* 3 calls run on the SlaveThread object
|
205 |
* 3 calls run on the SlaveThread object
|
| 201 |
*/
|
206 |
*/
|
| - |
|
207 |
@SuppressWarnings("unused")
|
| 202 |
@Test
|
208 |
@Test
|
| 203 |
public void TestConsumeBuildFiles()
|
209 |
public void TestConsumeBuildFiles()
|
| 204 |
{
|
210 |
{
|
| 205 |
mLogger.debug("TestConsumeBuildFiles");
|
211 |
mLogger.debug("TestConsumeBuildFiles");
|
| 206 |
ReleaseManager releaseManager = new ReleaseManager("unit test consume build files", "not used", "not used");
|
212 |
ReleaseManager releaseManager = new ReleaseManager("unit test consume build files", "not used", "not used");
|
| 207 |
SlaveThread slaveThread = new SlaveThread(1, 1, "unit test consume build files");
|
213 |
SlaveThread slaveThread = new SlaveThread(1, 1, "unit test consume build files");
|
| Line 223... |
Line 229... |
| 223 |
* 5 checks the second persisted run level is DB_IDLE
|
229 |
* 5 checks the second persisted run level is DB_IDLE
|
| 224 |
* 6 checks the third persisted run level is DB_WAITING
|
230 |
* 6 checks the third persisted run level is DB_WAITING
|
| 225 |
* 7 checks no further run levels were persisted
|
231 |
* 7 checks no further run levels were persisted
|
| 226 |
*/
|
232 |
*/
|
| 227 |
@Test
|
233 |
@Test
|
| - |
|
234 |
@SuppressWarnings("unused")
|
| 228 |
public void TestAllowedToProceed()
|
235 |
public void TestAllowedToProceed()
|
| 229 |
{
|
236 |
{
|
| 230 |
mLogger.debug("TestAllowedToProceed");
|
237 |
mLogger.debug("TestAllowedToProceed");
|
| 231 |
ReleaseManager releaseManager = new ReleaseManager("unit test allowed to proceed", "not used", "not used");
|
238 |
ReleaseManager releaseManager = new ReleaseManager("unit test allowed to proceed", "not used", "not used");
|
| 232 |
MasterThread masterThread = new MasterThread(1, 1, "unit test allowed to proceed");
|
239 |
MasterThread masterThread = new MasterThread(1, 1, "unit test allowed to proceed");
|
| Line 264... |
Line 271... |
| 264 |
* 7 checks no further run levels were persisted
|
271 |
* 7 checks no further run levels were persisted
|
| 265 |
* nb cannot check only one thread is running,
|
272 |
* nb cannot check only one thread is running,
|
| 266 |
* a Timer thread, though having run to completion, may still be "active"
|
273 |
* a Timer thread, though having run to completion, may still be "active"
|
| 267 |
*/
|
274 |
*/
|
| 268 |
@Test
|
275 |
@Test
|
| - |
|
276 |
@SuppressWarnings("unused")
|
| 269 |
public void TestNotAllowedToProceed()
|
277 |
public void TestNotAllowedToProceed()
|
| 270 |
{
|
278 |
{
|
| 271 |
mLogger.debug("TestNotAllowedToProceed");
|
279 |
mLogger.debug("TestNotAllowedToProceed");
|
| 272 |
ReleaseManager releaseManager = new ReleaseManager("unit test not allowed to proceed", "not used", "not used");
|
280 |
ReleaseManager releaseManager = new ReleaseManager("unit test not allowed to proceed", "not used", "not used");
|
| 273 |
MasterThread masterThread = new MasterThread(1, 1, "unit test not allowed to proceed");
|
281 |
MasterThread masterThread = new MasterThread(1, 1, "unit test not allowed to proceed");
|
| Line 301... |
Line 309... |
| 301 |
* 3 calls run on the MasterThread object
|
309 |
* 3 calls run on the MasterThread object
|
| 302 |
* 4 checks the first persisted run level is DB_IDLE
|
310 |
* 4 checks the first persisted run level is DB_IDLE
|
| 303 |
* 5 checks no further run levels were persisted
|
311 |
* 5 checks no further run levels were persisted
|
| 304 |
*/
|
312 |
*/
|
| 305 |
@Test
|
313 |
@Test
|
| - |
|
314 |
@SuppressWarnings("unused")
|
| 306 |
public void TestExit()
|
315 |
public void TestExit()
|
| 307 |
{
|
316 |
{
|
| 308 |
mLogger.debug("TestExit");
|
317 |
mLogger.debug("TestExit");
|
| 309 |
ReleaseManager releaseManager = new ReleaseManager("unit test exit", "not used", "not used");
|
318 |
ReleaseManager releaseManager = new ReleaseManager("unit test exit", "not used", "not used");
|
| 310 |
MasterThread masterThread = new MasterThread(1, 1, "unit test exit");
|
319 |
MasterThread masterThread = new MasterThread(1, 1, "unit test exit");
|
| Line 340... |
Line 349... |
| 340 |
* 4 checks the first persisted run level is DB_CANNOT_CONTINUE
|
349 |
* 4 checks the first persisted run level is DB_CANNOT_CONTINUE
|
| 341 |
* 5 checks the next persisted run level is DB_ACTIVE
|
350 |
* 5 checks the next persisted run level is DB_ACTIVE
|
| 342 |
* 6 checks no further run levels were persisted
|
351 |
* 6 checks no further run levels were persisted
|
| 343 |
*/
|
352 |
*/
|
| 344 |
@Test
|
353 |
@Test
|
| - |
|
354 |
@SuppressWarnings("unused")
|
| 345 |
public void TestCheckEnvironment()
|
355 |
public void TestCheckEnvironment()
|
| 346 |
{
|
356 |
{
|
| 347 |
mLogger.debug("TestCheckEnvironment");
|
357 |
mLogger.debug("TestCheckEnvironment");
|
| 348 |
ReleaseManager releaseManager = new ReleaseManager("unit test check environment", "not used", "not used");
|
358 |
ReleaseManager releaseManager = new ReleaseManager("unit test check environment", "not used", "not used");
|
| 349 |
MasterThread masterThread = new MasterThread(1, 1, "unit test check environment");
|
359 |
MasterThread masterThread = new MasterThread(1, 1, "unit test check environment");
|
| Line 406... |
Line 416... |
| 406 |
}
|
416 |
}
|
| 407 |
catch(Exception e)
|
417 |
catch(Exception e)
|
| 408 |
{
|
418 |
{
|
| 409 |
}
|
419 |
}
|
| 410 |
|
420 |
|
| 411 |
String ExpectedBuildFileContent = new String();
|
421 |
boolean rv;
|
| 412 |
MutableString buildFileContent = new MutableString();
|
422 |
MutableString buildFileContent = new MutableString();
|
| - |
|
423 |
|
| 413 |
boolean moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
424 |
boolean moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
| 414 |
assertTrue(moreBuildFiles);
|
425 |
assertTrue(moreBuildFiles);
|
| 415 |
|
426 |
|
| 416 |
// persist the generated build file content to daemon1.xml for visibility
|
- |
|
| 417 |
File cwd = new File( "." );
|
- |
|
| 418 |
String buildFileName = new String("daemon1.xml");
|
- |
|
| 419 |
try
|
- |
|
| 420 |
{
|
- |
|
| 421 |
File buildFile = new File(cwd, buildFileName);
|
- |
|
| 422 |
FileWriter buildFileWriter = new FileWriter(buildFile);
|
- |
|
| 423 |
buildFileWriter.write(buildFileContent.value);
|
427 |
rv = checkBuildfile(buildFileContent,"daemon1");
|
| 424 |
buildFileWriter.close();
|
428 |
assertTrue(rv);
|
| 425 |
File expectedBuildFile = new File(cwd, "expecteddaemon1.xml");
|
- |
|
| 426 |
FileReader expectedBuildFileReader = new FileReader(expectedBuildFile);
|
- |
|
| 427 |
char[] expectedBuildFileContent = new char[(int)expectedBuildFile.length()];
|
- |
|
| 428 |
expectedBuildFileReader.read(expectedBuildFileContent);
|
- |
|
| 429 |
expectedBuildFileReader.close();
|
- |
|
| 430 |
String temp = new String(expectedBuildFileContent);
|
- |
|
| 431 |
ExpectedBuildFileContent = temp;
|
- |
|
| 432 |
}
|
- |
|
| 433 |
catch( IOException e )
|
- |
|
| 434 |
{
|
- |
|
| 435 |
System.out.println("DaemonBuildTestCase::TestPlanRelease caught IOException");
|
- |
|
| 436 |
}
|
- |
|
| 437 |
|
- |
|
| 438 |
assertTrue(buildFileContent.value.compareTo(ExpectedBuildFileContent) == 0);
|
- |
|
| 439 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
429 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
| 440 |
assertFalse(moreBuildFiles);
|
430 |
assertFalse(moreBuildFiles);
|
| 441 |
|
431 |
|
| 442 |
releaseManager =
|
432 |
releaseManager =
|
| 443 |
new ReleaseManager("iteration2", "not used", "not used");
|
433 |
new ReleaseManager("iteration2", "not used", "not used");
|
| 444 |
|
434 |
|
| 445 |
// this is all the MasterThread does
|
435 |
// this is all the MasterThread does
|
| 446 |
try
|
436 |
try
|
| Line 453... |
Line 443... |
| 453 |
}
|
443 |
}
|
| 454 |
|
444 |
|
| 455 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
445 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
| 456 |
assertTrue(moreBuildFiles);
|
446 |
assertTrue(moreBuildFiles);
|
| 457 |
|
447 |
|
| 458 |
// persist the generated build file content to daemon2.xml for visibility
|
- |
|
| 459 |
buildFileName = new String("daemon2.xml");
|
- |
|
| 460 |
try
|
- |
|
| 461 |
{
|
- |
|
| 462 |
File buildFile = new File(cwd, buildFileName);
|
- |
|
| 463 |
FileWriter buildFileWriter = new FileWriter(buildFile);
|
- |
|
| 464 |
buildFileWriter.write(buildFileContent.value);
|
448 |
rv = checkBuildfile(buildFileContent,"daemon2");
|
| 465 |
buildFileWriter.close();
|
449 |
assertTrue(rv);
|
| 466 |
File expectedBuildFile = new File(cwd, "expecteddaemon2.xml");
|
- |
|
| 467 |
FileReader expectedBuildFileReader = new FileReader(expectedBuildFile);
|
- |
|
| 468 |
char[] expectedBuildFileContent = new char[(int)expectedBuildFile.length()];
|
- |
|
| 469 |
expectedBuildFileReader.read(expectedBuildFileContent);
|
- |
|
| 470 |
expectedBuildFileReader.close();
|
- |
|
| 471 |
String temp = new String(expectedBuildFileContent);
|
- |
|
| 472 |
ExpectedBuildFileContent = temp;
|
- |
|
| 473 |
}
|
- |
|
| 474 |
catch( IOException e )
|
- |
|
| 475 |
{
|
- |
|
| 476 |
System.out.println("DaemonBuildTestCase::TestPlanRelease caught IOException");
|
- |
|
| 477 |
}
|
- |
|
| 478 |
|
- |
|
| 479 |
assertTrue(buildFileContent.value.compareTo(ExpectedBuildFileContent) == 0);
|
- |
|
| 480 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
450 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
| 481 |
assertFalse(moreBuildFiles);
|
451 |
assertFalse(moreBuildFiles);
|
| 482 |
|
452 |
|
| 483 |
releaseManager =
|
453 |
releaseManager =
|
| 484 |
new ReleaseManager("iteration3", "not used", "not used");
|
454 |
new ReleaseManager("iteration3", "not used", "not used");
|
| Line 494... |
Line 464... |
| 494 |
}
|
464 |
}
|
| 495 |
|
465 |
|
| 496 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
466 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
| 497 |
assertTrue(moreBuildFiles);
|
467 |
assertTrue(moreBuildFiles);
|
| 498 |
|
468 |
|
| 499 |
// persist the generated build file content to daemon3.xml for visibility
|
- |
|
| 500 |
buildFileName = new String("daemon3.xml");
|
- |
|
| 501 |
try
|
- |
|
| 502 |
{
|
- |
|
| 503 |
File buildFile = new File(cwd, buildFileName);
|
- |
|
| 504 |
FileWriter buildFileWriter = new FileWriter(buildFile);
|
- |
|
| 505 |
buildFileWriter.write(buildFileContent.value);
|
469 |
rv = checkBuildfile(buildFileContent,"daemon3");
|
| 506 |
buildFileWriter.close();
|
470 |
assertTrue(rv);
|
| 507 |
File expectedBuildFile = new File(cwd, "expecteddaemon3.xml");
|
- |
|
| 508 |
FileReader expectedBuildFileReader = new FileReader(expectedBuildFile);
|
- |
|
| 509 |
char[] expectedBuildFileContent = new char[(int)expectedBuildFile.length()];
|
- |
|
| 510 |
expectedBuildFileReader.read(expectedBuildFileContent);
|
- |
|
| 511 |
expectedBuildFileReader.close();
|
- |
|
| 512 |
String temp = new String(expectedBuildFileContent);
|
- |
|
| 513 |
ExpectedBuildFileContent = temp;
|
- |
|
| 514 |
}
|
- |
|
| 515 |
catch( IOException e )
|
- |
|
| 516 |
{
|
- |
|
| 517 |
System.out.println("DaemonBuildTestCase::TestPlanRelease caught IOException");
|
- |
|
| 518 |
}
|
- |
|
| 519 |
|
- |
|
| 520 |
assertTrue(buildFileContent.value.compareTo(ExpectedBuildFileContent) == 0);
|
- |
|
| 521 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
471 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
| 522 |
assertFalse(moreBuildFiles);
|
472 |
assertFalse(moreBuildFiles);
|
| 523 |
|
473 |
|
| 524 |
releaseManager =
|
474 |
releaseManager =
|
| 525 |
new ReleaseManager("iteration4", "not used", "not used");
|
475 |
new ReleaseManager("iteration4", "not used", "not used");
|
| Line 534... |
Line 484... |
| 534 |
{
|
484 |
{
|
| 535 |
}
|
485 |
}
|
| 536 |
|
486 |
|
| 537 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
487 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
| 538 |
assertTrue(moreBuildFiles);
|
488 |
assertTrue(moreBuildFiles);
|
| 539 |
|
- |
|
| 540 |
// persist the generated build file content to daemon4.xml for visibility
|
- |
|
| 541 |
buildFileName = new String("daemon4.xml");
|
- |
|
| 542 |
try
|
- |
|
| 543 |
{
|
- |
|
| 544 |
File buildFile = new File(cwd, buildFileName);
|
- |
|
| 545 |
FileWriter buildFileWriter = new FileWriter(buildFile);
|
- |
|
| 546 |
buildFileWriter.write(buildFileContent.value);
|
489 |
rv = checkBuildfile(buildFileContent,"daemon4");
|
| 547 |
buildFileWriter.close();
|
490 |
assertTrue(rv);
|
| 548 |
File expectedBuildFile = new File(cwd, "expecteddaemon4.xml");
|
- |
|
| 549 |
FileReader expectedBuildFileReader = new FileReader(expectedBuildFile);
|
- |
|
| 550 |
char[] expectedBuildFileContent = new char[(int)expectedBuildFile.length()];
|
- |
|
| 551 |
expectedBuildFileReader.read(expectedBuildFileContent);
|
- |
|
| 552 |
expectedBuildFileReader.close();
|
- |
|
| 553 |
String temp = new String(expectedBuildFileContent);
|
- |
|
| 554 |
ExpectedBuildFileContent = temp;
|
- |
|
| 555 |
}
|
- |
|
| 556 |
catch( IOException e )
|
- |
|
| 557 |
{
|
- |
|
| 558 |
System.out.println("DaemonBuildTestCase::TestPlanRelease caught IOException");
|
- |
|
| 559 |
}
|
- |
|
| 560 |
|
- |
|
| 561 |
assertTrue(buildFileContent.value.compareTo(ExpectedBuildFileContent) == 0);
|
- |
|
| 562 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
491 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
| 563 |
assertFalse(moreBuildFiles);
|
492 |
assertFalse(moreBuildFiles);
|
| 564 |
|
493 |
|
| 565 |
releaseManager =
|
494 |
releaseManager =
|
| 566 |
new ReleaseManager("iteration5", "not used", "not used");
|
495 |
new ReleaseManager("iteration5", "not used", "not used");
|
| Line 576... |
Line 505... |
| 576 |
}
|
505 |
}
|
| 577 |
|
506 |
|
| 578 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
507 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
| 579 |
assertTrue(moreBuildFiles);
|
508 |
assertTrue(moreBuildFiles);
|
| 580 |
|
509 |
|
| 581 |
// persist the generated build file content to daemon5.xml for visibility
|
- |
|
| 582 |
buildFileName = new String("daemon5.xml");
|
- |
|
| 583 |
try
|
- |
|
| 584 |
{
|
- |
|
| 585 |
File buildFile = new File(cwd, buildFileName);
|
- |
|
| 586 |
FileWriter buildFileWriter = new FileWriter(buildFile);
|
- |
|
| 587 |
buildFileWriter.write(buildFileContent.value);
|
510 |
rv = checkBuildfile(buildFileContent,"daemon5");
|
| 588 |
buildFileWriter.close();
|
511 |
assertTrue(rv);
|
| 589 |
File expectedBuildFile = new File(cwd, "expecteddaemon5.xml");
|
- |
|
| 590 |
FileReader expectedBuildFileReader = new FileReader(expectedBuildFile);
|
- |
|
| 591 |
char[] expectedBuildFileContent = new char[(int)expectedBuildFile.length()];
|
- |
|
| 592 |
expectedBuildFileReader.read(expectedBuildFileContent);
|
- |
|
| 593 |
expectedBuildFileReader.close();
|
- |
|
| 594 |
String temp = new String(expectedBuildFileContent);
|
- |
|
| 595 |
ExpectedBuildFileContent = temp;
|
- |
|
| 596 |
}
|
- |
|
| 597 |
catch( IOException e )
|
- |
|
| 598 |
{
|
- |
|
| 599 |
System.out.println("DaemonBuildTestCase::TestPlanRelease caught IOException");
|
- |
|
| 600 |
}
|
- |
|
| 601 |
|
- |
|
| 602 |
assertTrue(buildFileContent.value.compareTo(ExpectedBuildFileContent) == 0);
|
- |
|
| 603 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
512 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
| 604 |
assertFalse(moreBuildFiles);
|
513 |
assertFalse(moreBuildFiles);
|
| 605 |
|
514 |
|
| 606 |
releaseManager =
|
515 |
releaseManager =
|
| 607 |
new ReleaseManager("iteration6", "not used", "not used");
|
516 |
new ReleaseManager("iteration6", "not used", "not used");
|
| Line 617... |
Line 526... |
| 617 |
}
|
526 |
}
|
| 618 |
|
527 |
|
| 619 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
528 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
| 620 |
assertTrue(moreBuildFiles);
|
529 |
assertTrue(moreBuildFiles);
|
| 621 |
|
530 |
|
| 622 |
// persist the generated build file content to daemon6.xml for visibility
|
- |
|
| 623 |
buildFileName = new String("daemon6.xml");
|
- |
|
| 624 |
try
|
- |
|
| 625 |
{
|
- |
|
| 626 |
File buildFile = new File(cwd, buildFileName);
|
- |
|
| 627 |
FileWriter buildFileWriter = new FileWriter(buildFile);
|
- |
|
| 628 |
buildFileWriter.write(buildFileContent.value);
|
531 |
rv = checkBuildfile(buildFileContent,"daemon6");
|
| 629 |
buildFileWriter.close();
|
532 |
assertTrue(rv);
|
| 630 |
File expectedBuildFile = new File(cwd, "expecteddaemon6.xml");
|
- |
|
| 631 |
FileReader expectedBuildFileReader = new FileReader(expectedBuildFile);
|
- |
|
| 632 |
char[] expectedBuildFileContent = new char[(int)expectedBuildFile.length()];
|
- |
|
| 633 |
expectedBuildFileReader.read(expectedBuildFileContent);
|
- |
|
| 634 |
expectedBuildFileReader.close();
|
- |
|
| 635 |
String temp = new String(expectedBuildFileContent);
|
- |
|
| 636 |
ExpectedBuildFileContent = temp;
|
- |
|
| 637 |
}
|
- |
|
| 638 |
catch( IOException e )
|
- |
|
| 639 |
{
|
- |
|
| 640 |
System.out.println("DaemonBuildTestCase::TestPlanRelease caught IOException");
|
- |
|
| 641 |
}
|
- |
|
| 642 |
|
- |
|
| 643 |
assertTrue(buildFileContent.value.compareTo(ExpectedBuildFileContent) == 0);
|
- |
|
| 644 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
533 |
moreBuildFiles = rippleEngine.getNextBuildFileContent(buildFileContent);
|
| 645 |
assertFalse(moreBuildFiles);
|
534 |
assertFalse(moreBuildFiles);
|
| 646 |
|
535 |
|
| 647 |
releaseManager =
|
536 |
releaseManager =
|
| 648 |
new ReleaseManager("iteration7", "not used", "not used");
|
537 |
new ReleaseManager("iteration7", "not used", "not used");
|
| Line 659... |
Line 548... |
| 659 |
|
548 |
|
| 660 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
549 |
moreBuildFiles = rippleEngine.getFirstBuildFileContent(buildFileContent);
|
| 661 |
assertTrue(moreBuildFiles);
|
550 |
assertTrue(moreBuildFiles);
|
| 662 |
}
|
551 |
}
|
| 663 |
|
552 |
|
| - |
|
553 |
/** Check build file against golden image
|
| - |
|
554 |
*
|
| - |
|
555 |
* @param buildFileContent - Generated build file
|
| - |
|
556 |
* @param baseName - Base name used to save buildfile and for golden image
|
| - |
|
557 |
* @return boolean - True if the build file matches the golden image
|
| - |
|
558 |
*/
|
| - |
|
559 |
private boolean checkBuildfile(MutableString buildFileContent, String baseName) {
|
| - |
|
560 |
String buildFileName;
|
| - |
|
561 |
String testFilename;
|
| - |
|
562 |
String expected = "";
|
| - |
|
563 |
String user = "";
|
| - |
|
564 |
File cwd = new File( "." );
|
| - |
|
565 |
|
| - |
|
566 |
// persist the generated build file content to daemon2.xml for visibility
|
| - |
|
567 |
buildFileName = new String(baseName + ".xml");
|
| - |
|
568 |
testFilename = new String("expected" + baseName + ".xml");
|
| - |
|
569 |
|
| - |
|
570 |
try
|
| - |
|
571 |
{
|
| - |
|
572 |
File buildFile = new File(cwd, buildFileName);
|
| - |
|
573 |
FileWriter buildFileWriter = new FileWriter(buildFile);
|
| - |
|
574 |
buildFileWriter.write(buildFileContent.value);
|
| - |
|
575 |
buildFileWriter.close();
|
| - |
|
576 |
|
| - |
|
577 |
File expectedBuildFile = new File(cwd, testFilename);
|
| - |
|
578 |
FileReader expectedBuildFileReader = new FileReader(expectedBuildFile);
|
| - |
|
579 |
char[] expectedBuildFileContent = new char[(int)expectedBuildFile.length()];
|
| - |
|
580 |
expectedBuildFileReader.read(expectedBuildFileContent);
|
| - |
|
581 |
expectedBuildFileReader.close();
|
| - |
|
582 |
|
| - |
|
583 |
expected = new String(expectedBuildFileContent);
|
| - |
|
584 |
expected = expected.replace("\r", "");
|
| - |
|
585 |
|
| - |
|
586 |
user = buildFileContent.value.replace("\r", "");
|
| - |
|
587 |
}
|
| - |
|
588 |
catch( IOException e )
|
| - |
|
589 |
{
|
| - |
|
590 |
System.out.println("DaemonBuildTestCase::TestPlanRelease caught IOException:" + baseName);
|
| - |
|
591 |
expected = "";
|
| - |
|
592 |
}
|
| - |
|
593 |
int retVal = user.compareTo(expected);
|
| - |
|
594 |
return retVal == 0;
|
| - |
|
595 |
}
|
| - |
|
596 |
|
| 664 |
/**test method designed to test ripple field limits
|
597 |
/**test method designed to test ripple field limits
|
| 665 |
* 1 tests applyPV returns 1 for package with version a.b.1.2.0
|
598 |
* 1 tests applyPV returns 1 for package with version a.b.1.2.0
|
| 666 |
*/
|
599 |
*/
|
| 667 |
@Test
|
600 |
@Test
|
| 668 |
public void TestRippleFieldLimits()
|
601 |
public void TestRippleFieldLimits()
|