| 6914 |
dpurdie |
1 |
package com.erggroup.buildtool.utf;
|
|
|
2 |
|
|
|
3 |
import java.sql.SQLException;
|
|
|
4 |
|
|
|
5 |
import com.erggroup.buildtool.escrow.ESCROWBuild;
|
|
|
6 |
import com.erggroup.buildtool.ripple.BuildStandard;
|
|
|
7 |
import com.erggroup.buildtool.ripple.Package;
|
| 7186 |
dpurdie |
8 |
import com.erggroup.buildtool.ripple.PackageCollection;
|
| 6914 |
dpurdie |
9 |
import com.erggroup.buildtool.ripple.ReleaseManager;
|
|
|
10 |
import com.erggroup.buildtool.ripple.RippleEngine;
|
|
|
11 |
|
| 7033 |
dpurdie |
12 |
import org.slf4j.Logger;
|
|
|
13 |
import org.slf4j.LoggerFactory;
|
| 6914 |
dpurdie |
14 |
import org.junit.Test;
|
|
|
15 |
import org.junit.runner.JUnitCore;
|
|
|
16 |
|
|
|
17 |
import static org.junit.Assert.*;
|
|
|
18 |
|
|
|
19 |
public class ESCROWBuildTestCase
|
|
|
20 |
{
|
| 7186 |
dpurdie |
21 |
private static final Logger mLogger = LoggerFactory.getLogger(DaemonBuildTestCase.class);
|
|
|
22 |
ReleaseManager releaseManager = null;
|
|
|
23 |
RippleEngine rippleEngine = null;
|
| 6914 |
dpurdie |
24 |
|
| 7186 |
dpurdie |
25 |
/**
|
|
|
26 |
* constructor
|
|
|
27 |
*/
|
|
|
28 |
public ESCROWBuildTestCase()
|
|
|
29 |
{
|
|
|
30 |
mLogger.debug("ESCROWBuildTestCase");
|
|
|
31 |
setUpEscrow();
|
|
|
32 |
}
|
| 6914 |
dpurdie |
33 |
|
| 7186 |
dpurdie |
34 |
/**
|
|
|
35 |
* Test Case main line
|
|
|
36 |
*/
|
|
|
37 |
public static void main(String[] args)
|
| 6914 |
dpurdie |
38 |
{
|
| 7186 |
dpurdie |
39 |
mLogger.debug("main");
|
|
|
40 |
JUnitCore.main("com.erggroup.buildtool.utf.ESCROWBuildTestCase");
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
/** Subclass and override key methods so that the test can control
|
|
|
44 |
* the data being used
|
|
|
45 |
*/
|
|
|
46 |
public class myReleaseManager extends ReleaseManagerUtf
|
|
|
47 |
{
|
|
|
48 |
|
|
|
49 |
public myReleaseManager(final String connectionString, final String username, final String password)
|
| 6914 |
dpurdie |
50 |
{
|
|
|
51 |
super(connectionString, username, password);
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
public String queryBaselineName(int baseline) throws SQLException, Exception
|
|
|
55 |
{
|
|
|
56 |
return "TIMBUKTU (TIM) > R7 7.9";
|
|
|
57 |
}
|
|
|
58 |
|
| 7186 |
dpurdie |
59 |
public void queryPackageVersions(RippleEngine rippleEngine, PackageCollection packageCollection,
|
| 6914 |
dpurdie |
60 |
int baseline) throws SQLException, Exception
|
|
|
61 |
{
|
|
|
62 |
/* prod_id pkg_name pkg_version v_ext pkg_vcs_tag
|
| 7186 |
dpurdie |
63 |
* 8 NotInAnyWayReproducible 1.0.0.tim .tim NA NA
|
|
|
64 |
* 10 SolarisCentricProduct 1.0.0000.tim .tim SolarisCentricProduct_1.0.0000.tim \vob\SolarisCentricProduct
|
|
|
65 |
* 11 LinuxCentricProduct 1.0.0000.tim .tim LinuxCentricProduct_1.0.0000.tim \vob\LinuxCentricProduct
|
|
|
66 |
* 12 Win32CentricProduct 1.0.0000.tim .tim Win32CentricProduct_1.0.0000.tim \vob\Win32CentricProduct
|
|
|
67 |
* 13 GenericProduct 1.0.0000.tim .tim GenericProduct_1.0.0000.tim \vob\ToBeMovedFromHere
|
|
|
68 |
*/
|
|
|
69 |
Package p8 = new Package(1, 8, "NotInAnyWayReproducible", "1.0.0.tim", ".tim", "NotInAnyWayReproducible.1.0.0.tim", "CC::NA::NA", 'x');
|
|
|
70 |
Package p10 = new Package(2, 10, "SolarisCentricProduct", "1.0.0000.tim", ".tim", "SolarisCentricProduct.1.0.0000.tim", "CC::/vob/SolarisCentricProduct::SolarisCentricProduct_1.0.0000.tim", 'x');
|
|
|
71 |
Package p11 = new Package(3, 11, "LinuxCentricProduct", "1.0.0000.tim", ".tim", "LinuxCentricProduct.1.0.0000.tim", "CC::/vob/LinuxCentricProduct::LinuxCentricProduct_1.0.0000.tim", 'x');
|
|
|
72 |
Package p12 = new Package(4, 12, "Win32CentricProduct", "1.0.0000.tim", ".tim", "Win32CentricProduct.1.0.0000.tim", "CC::/vob/Win32CentricProduct::Win32CentricProduct_1.0.0000.tim", 'x');
|
|
|
73 |
Package p13 = new Package(5, 13, "GenericProduct", "1.0.0000.tim", ".tim", "GenericProduct.1.0.0000.tim", "CC::/vob/ToBeMovedFromHere::GenericProduct_1.0.0000.tim", 'x');
|
| 6914 |
dpurdie |
74 |
|
|
|
75 |
|
| 7186 |
dpurdie |
76 |
/* the above products have the following dependencies which will be discovered in traverseDependencies
|
|
|
77 |
* pv_id pkg_name, dpv.pkg_version, dpv.v_ext, dpv.pkg_vcs_tag
|
|
|
78 |
* 7 CotsWithFunnyVersion hoopla2_x.cots .cots CotsWithFunnyVersion_hoopla2_x.cots \vob\CotsWithFunnyVersion
|
|
|
79 |
* 9 CommonDependency 1.0.0000.tim .tim CommonDependency_1.0.0000.tim \vob\CommonDependency
|
|
|
80 |
* 14 AdvisoryDependency 1.0.0000.tim .tim AdvisoryDependency_1.0.0000.tim \vob\AdvisoryDependency
|
|
|
81 |
* the above packages have the following build info
|
|
|
82 |
* pv_id bm_name bsa_name
|
|
|
83 |
* 7 Solaris Debug
|
|
|
84 |
* 9 Linux Debug
|
|
|
85 |
* 9 Solaris Debug
|
|
|
86 |
* 9 Win32 Production
|
|
|
87 |
* 10 Solaris Java 1.4
|
|
|
88 |
* 11 Linux Production and Debug
|
|
|
89 |
* 12 Win32 Java 1.6
|
|
|
90 |
* 13 Generic Java 1.4
|
|
|
91 |
* 14 Linux Debug
|
|
|
92 |
*/
|
|
|
93 |
|
|
|
94 |
Package p9 = new Package(1, 9, "CommonDependency", "1.0.0000.tim", ".tim", "CommonDependency.1.0.0000.tim", "CC::/vob/CommonDependency::CommonDependency_1.0.0000.tim", 'x');
|
|
|
95 |
Package p7 = new Package(2, 7, "CotsWithFunnyVersion", "hoopla2_x.cots", ".cots", "CotsWithFunnyVersion.hoopla2_x.cots", "CC::/vob/CotsWithFunnyVersion::CotsWithFunnyVersion_hoopla2_x.cots", 'x');
|
|
|
96 |
Package p14 = new Package(3, 14, "AdvisoryDependency", "1.0.0000.tim", ".tim", "AdvisoryDependency.1.0.0000.tim", "CC::/vob/AdvisoryDependency::AdvisoryDependency_1.0.0000.tim", 'x');
|
|
|
97 |
|
|
|
98 |
// Insert in order created by original test harness
|
|
|
99 |
packageCollection.add(p8);
|
|
|
100 |
packageCollection.add(p7);
|
|
|
101 |
packageCollection.add(p9);
|
|
|
102 |
packageCollection.add(p10);
|
|
|
103 |
packageCollection.add(p11);
|
|
|
104 |
packageCollection.add(p14);
|
|
|
105 |
packageCollection.add(p12);
|
|
|
106 |
packageCollection.add(p13);
|
| 6914 |
dpurdie |
107 |
|
| 7186 |
dpurdie |
108 |
p8.addDependency(p9);
|
|
|
109 |
p9.addDependency(p7);
|
|
|
110 |
p10.addDependency(p9);
|
|
|
111 |
p11.addDependency(p14);
|
|
|
112 |
p13.addDependency(p9);
|
| 6914 |
dpurdie |
113 |
|
|
|
114 |
|
| 7186 |
dpurdie |
115 |
BuildStandard bs7 = new BuildStandard(rippleEngine,"Solaris", "Debug");
|
|
|
116 |
p7.mBuildStandardCollection.add(bs7);
|
| 6914 |
dpurdie |
117 |
|
| 7186 |
dpurdie |
118 |
BuildStandard bs9 = new BuildStandard(rippleEngine, "Linux", "Debug");
|
|
|
119 |
p9.mBuildStandardCollection.add(bs9);
|
|
|
120 |
bs9 = new BuildStandard(rippleEngine, "Solaris", "Debug");
|
|
|
121 |
p9.mBuildStandardCollection.add(bs9);
|
|
|
122 |
bs9 = new BuildStandard(rippleEngine, "Win32", "Production");
|
|
|
123 |
p9.mBuildStandardCollection.add(bs9);
|
|
|
124 |
|
|
|
125 |
BuildStandard bs10 = new BuildStandard(rippleEngine, "Solaris", "Java 1.4");
|
|
|
126 |
p10.mBuildStandardCollection.add(bs10);
|
|
|
127 |
|
|
|
128 |
BuildStandard bs = new BuildStandard(rippleEngine, "Linux", "Production and Debug");
|
|
|
129 |
p11.mBuildStandardCollection.add(bs);
|
|
|
130 |
|
|
|
131 |
BuildStandard bs12 = new BuildStandard(rippleEngine, "Win32", "Java 1.6");
|
|
|
132 |
p12.mBuildStandardCollection.add(bs12);
|
|
|
133 |
|
|
|
134 |
BuildStandard bs13 = new BuildStandard(rippleEngine, "Generic", "Java 1.4");
|
|
|
135 |
p13.mBuildStandardCollection.add(bs13);
|
|
|
136 |
|
|
|
137 |
BuildStandard bs14 = new BuildStandard(rippleEngine, "Linux", "Debug");
|
|
|
138 |
p14.mBuildStandardCollection.add(bs14);
|
| 6914 |
dpurdie |
139 |
}
|
|
|
140 |
|
| 7186 |
dpurdie |
141 |
}
|
| 6914 |
dpurdie |
142 |
|
|
|
143 |
|
| 7186 |
dpurdie |
144 |
/** Setup and Run the Escrow
|
|
|
145 |
* The tests will be the results of the escrow run
|
|
|
146 |
*/
|
|
|
147 |
public void setUpEscrow()
|
|
|
148 |
{
|
|
|
149 |
mLogger.debug("TestESCROWBuild");
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
// Construct a Release Manager and Ripple Builder
|
|
|
153 |
// Run the Escrow Engine
|
|
|
154 |
//
|
|
|
155 |
releaseManager = new myReleaseManager("not used", "not used", "not used");
|
|
|
156 |
releaseManager.mUseDatabase = false;
|
|
|
157 |
rippleEngine = new RippleEngine(releaseManager, 99999, false);
|
|
|
158 |
ESCROWBuild.generateEscrowFiles(rippleEngine, "build");
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
@Test
|
|
|
162 |
public void TestEscrowBuildFiles()
|
|
|
163 |
{
|
|
|
164 |
// Examine the results
|
|
|
165 |
//
|
|
|
166 |
boolean rv1 = Utilities.checkBuildfiles("build1.xml");
|
|
|
167 |
boolean rv2 = Utilities.checkBuildfiles("build2.xml");
|
|
|
168 |
boolean rv3 = Utilities.checkBuildfiles("build3.xml");
|
|
|
169 |
|
|
|
170 |
// Test assertions - after all files have been processed
|
|
|
171 |
//
|
|
|
172 |
assertTrue(rv1);
|
|
|
173 |
assertTrue(rv2);
|
|
|
174 |
assertTrue(rv3);
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
@Test
|
|
|
178 |
public void TestEscrowDataFiles()
|
|
|
179 |
{
|
|
|
180 |
// Examine the other escrow files
|
|
|
181 |
boolean rv4 = Utilities.checkBuildfiles("escrow_set_up");
|
|
|
182 |
boolean rv5 = Utilities.checkBuildfiles("raw_data.csv");
|
|
|
183 |
|
|
|
184 |
assertTrue(rv4);
|
|
|
185 |
assertTrue(rv5);
|
|
|
186 |
}
|
|
|
187 |
|
|
|
188 |
|
| 6914 |
dpurdie |
189 |
}
|