| 814 |
mhunt |
1 |
package com.erggroup.buildtool.utf;
|
|
|
2 |
|
|
|
3 |
import com.erggroup.buildtool.escrow.ESCROWBuild;
|
|
|
4 |
import com.erggroup.buildtool.ripple.MutableString;
|
|
|
5 |
import com.erggroup.buildtool.ripple.ReleaseManager;
|
|
|
6 |
|
|
|
7 |
import java.io.File;
|
|
|
8 |
import java.io.FileReader;
|
|
|
9 |
import java.io.IOException;
|
|
|
10 |
|
|
|
11 |
import org.apache.log4j.Logger;
|
|
|
12 |
import org.apache.log4j.xml.DOMConfigurator;
|
|
|
13 |
|
|
|
14 |
import org.junit.Test;
|
|
|
15 |
import org.junit.runner.JUnitCore;
|
|
|
16 |
import static org.junit.Assert.*;
|
|
|
17 |
|
|
|
18 |
public class ESCROWBuildTestCase
|
|
|
19 |
{
|
|
|
20 |
private static final Logger mLogger = Logger.getLogger(DaemonBuildTestCase.class);
|
|
|
21 |
|
|
|
22 |
/**constructor
|
|
|
23 |
*/
|
|
|
24 |
public ESCROWBuildTestCase()
|
|
|
25 |
{
|
|
|
26 |
mLogger.debug("ESCROWBuildTestCase");
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
/**Test Case main line
|
|
|
30 |
*/
|
|
|
31 |
public static void main(String[] args)
|
|
|
32 |
{
|
|
|
33 |
DOMConfigurator.configure("utf.xml");
|
|
|
34 |
mLogger.debug("main");
|
|
|
35 |
JUnitCore.main( "com.erggroup.buildtool.utf.ESCROWBuildTestCase" );
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
/**test method designed to test sequence diagram escrow build
|
|
|
39 |
* 1 instructs all ReleaseManager objects not to use the database
|
|
|
40 |
* under this circumstance, the ReleaseManager generates the following packages:
|
|
|
41 |
* CotsWithFunnyVersion
|
|
|
42 |
* NotInAnyWayReproducible
|
|
|
43 |
* CommonDependency
|
|
|
44 |
* SolarisCentricProduct
|
|
|
45 |
* LinuxCentricProduct
|
|
|
46 |
* Win32CentricProduct
|
|
|
47 |
* GenericProduct
|
|
|
48 |
* AdvisoryDependency
|
|
|
49 |
* 2 constructs an ESCROWBuild object
|
|
|
50 |
* 3 calls main on the ESCROWBuild object with args -c "not_used" -u "not used" -p "not used" -b 99999
|
|
|
51 |
* 4 checks the ESCROWBuild generates a build1.xml that matches expected1.xml
|
|
|
52 |
* this file reports the following packages are not reproducible:
|
|
|
53 |
* NotInAnyWayReproducible
|
|
|
54 |
* this file reports the following packages are not reproducible on build platforms associated with this baseline:
|
|
|
55 |
* Win32CentricProduct
|
|
|
56 |
* this file contains build information for the following packages:
|
|
|
57 |
* CotsWithFunnyVersion
|
|
|
58 |
* LinuxCentricProduct
|
|
|
59 |
* AdvisoryDependency
|
|
|
60 |
* 5 checks the ESCROWBuild generates a build2.xml that matches expected2.xml
|
|
|
61 |
* this file contains build information for the following packages:
|
|
|
62 |
* CommonDependency
|
|
|
63 |
* SolarisCentricProduct
|
|
|
64 |
* GenericProduct
|
|
|
65 |
*/
|
|
|
66 |
@Test
|
|
|
67 |
public void TestESCROWBuild()
|
|
|
68 |
{
|
|
|
69 |
mLogger.debug("TestESCROWBuild");
|
|
|
70 |
ReleaseManager.mUseDatabase = false;
|
|
|
71 |
ESCROWBuild escrowBuild = new ESCROWBuild();
|
|
|
72 |
String args[] = {"-c", "not used", "-u", "not used", "-p", "not used", "-b", "99999"};
|
|
|
73 |
escrowBuild.main(args);
|
|
|
74 |
File cwd = new File( "." );
|
|
|
75 |
boolean caughtException = false;
|
|
|
76 |
|
|
|
77 |
try
|
|
|
78 |
{
|
|
|
79 |
File expected1 = new File(cwd, "expected1.xml");
|
|
|
80 |
FileReader expected1Reader = new FileReader(expected1);
|
|
|
81 |
char[] expected1Content = new char[(int)expected1.length()];
|
|
|
82 |
expected1Reader.read(expected1Content);
|
|
|
83 |
expected1Reader.close();
|
|
|
84 |
String readExpected1Content = new String(expected1Content);
|
|
|
85 |
File buildFile1 = new File(cwd, "build1.xml");
|
|
|
86 |
FileReader buildFile1Reader = new FileReader(buildFile1);
|
|
|
87 |
char[] buildFile1Content = new char[(int)buildFile1.length()];
|
|
|
88 |
buildFile1Reader.read(buildFile1Content);
|
|
|
89 |
buildFile1Reader.close();
|
|
|
90 |
String readBuildFile1Content = new String(buildFile1Content);
|
|
|
91 |
assertTrue( readExpected1Content.compareTo( readBuildFile1Content ) == 0 );
|
|
|
92 |
|
|
|
93 |
File expected2 = new File(cwd, "expected2.xml");
|
|
|
94 |
FileReader expected2Reader = new FileReader(expected2);
|
|
|
95 |
char[] expected2Content = new char[(int)expected2.length()];
|
|
|
96 |
expected2Reader.read(expected2Content);
|
|
|
97 |
expected2Reader.close();
|
|
|
98 |
String readExpected2Content = new String(expected2Content);
|
|
|
99 |
File buildFile2 = new File(cwd, "build2.xml");
|
|
|
100 |
FileReader buildFile2Reader = new FileReader(buildFile2);
|
|
|
101 |
char[] buildFile2Content = new char[(int)buildFile2.length()];
|
|
|
102 |
buildFile2Reader.read(buildFile2Content);
|
|
|
103 |
buildFile2Reader.close();
|
|
|
104 |
String readBuildFile2Content = new String(buildFile2Content);
|
|
|
105 |
assertTrue( readExpected2Content.compareTo( readBuildFile2Content ) == 0 );
|
|
|
106 |
}
|
|
|
107 |
catch( IOException e )
|
|
|
108 |
{
|
|
|
109 |
caughtException = true;
|
|
|
110 |
}
|
|
|
111 |
assertTrue(!caughtException);
|
|
|
112 |
}
|
|
|
113 |
}
|