| 6914 |
dpurdie |
1 |
/**
|
|
|
2 |
*
|
|
|
3 |
*/
|
|
|
4 |
package com.erggroup.buildtool.utf;
|
|
|
5 |
|
|
|
6 |
import static org.junit.Assert.*;
|
|
|
7 |
|
|
|
8 |
import java.sql.SQLException;
|
|
|
9 |
import java.util.ArrayList;
|
|
|
10 |
|
|
|
11 |
import org.apache.log4j.xml.DOMConfigurator;
|
|
|
12 |
import org.junit.After;
|
|
|
13 |
import org.junit.Before;
|
|
|
14 |
import org.junit.Test;
|
|
|
15 |
import org.junit.runner.JUnitCore;
|
|
|
16 |
|
|
|
17 |
import com.erggroup.buildtool.ripple.BuildFile;
|
|
|
18 |
import com.erggroup.buildtool.ripple.BuildStandard;
|
|
|
19 |
import com.erggroup.buildtool.ripple.Package;
|
|
|
20 |
import com.erggroup.buildtool.ripple.ReleaseManager;
|
|
|
21 |
import com.erggroup.buildtool.ripple.RippleEngine;
|
|
|
22 |
import com.erggroup.buildtool.ripple.BuildFile.BuildFileState;
|
|
|
23 |
|
|
|
24 |
/**
|
|
|
25 |
* Test the behavior of 'pegged' packages
|
|
|
26 |
*
|
|
|
27 |
*/
|
|
|
28 |
public class PeggedPackageRippleTest {
|
|
|
29 |
|
|
|
30 |
ReleaseManager releaseManager = null;
|
|
|
31 |
RippleEngine rippleEngine = null;
|
|
|
32 |
|
|
|
33 |
/**
|
|
|
34 |
* Test Case main line
|
|
|
35 |
*/
|
|
|
36 |
public static void main(String[] args)
|
|
|
37 |
{
|
|
|
38 |
DOMConfigurator.configure("utf.xml");
|
|
|
39 |
JUnitCore.main("com.erggroup.buildtool.utf.PeggedPackageRippleTest");
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
/** Subclass and override key methods so that the test can control
|
|
|
43 |
* the data being used
|
|
|
44 |
*/
|
|
|
45 |
public class myReleaseManager extends ReleaseManagerUtf
|
|
|
46 |
{
|
|
|
47 |
public myReleaseManager(final String connectionString, final String username, final String password)
|
|
|
48 |
{
|
|
|
49 |
super(connectionString, username, password);
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
public String queryBaselineName(int baseline) throws SQLException, Exception
|
|
|
53 |
{
|
|
|
54 |
return "Pegged Package Test";
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
public void queryPackageVersions(RippleEngine rippleEngine, ArrayList<Package> packageCollection,
|
|
|
59 |
int baseline) throws SQLException, Exception
|
|
|
60 |
{
|
|
|
61 |
BuildStandard bs = null;
|
|
|
62 |
Package p = null;
|
|
|
63 |
|
|
|
64 |
// Flag packages in the full release - by pv_id
|
|
|
65 |
rippleEngine.mReleasedPvIDCollection.add(1);
|
|
|
66 |
rippleEngine.mReleasedPvIDCollection.add(2);
|
|
|
67 |
|
|
|
68 |
p = new Package(76, 1, "Package1", "1.0.0000", ".p1","Package1.p1", "Package1_vcstag", 'b', 'P');
|
|
|
69 |
//p.mDirectlyPlanned = true;
|
|
|
70 |
bs = new BuildStandard(rippleEngine, "Linux", "Java 1.6");
|
|
|
71 |
p.mBuildStandardCollection.add(bs);
|
|
|
72 |
packageCollection.add(p);
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
p = new Package(1011, 2, "Package2", "2.0.0000", ".p2","Package2.p1", "Package2_vcstag", 'b', 'P');
|
|
|
76 |
p.mIsSdk = true;
|
|
|
77 |
p.mDirectlyPlanned = true;
|
|
|
78 |
bs = new BuildStandard(rippleEngine, "Linux", "Java 1.6");
|
|
|
79 |
p.mBuildStandardCollection.add(bs);
|
|
|
80 |
packageCollection.add(p);
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
// Planned dependencies
|
|
|
84 |
// p2 depends on p1
|
|
|
85 |
p = findPackage(2, packageCollection);
|
|
|
86 |
p.mDependencyCollection.add("Package1.p1");
|
|
|
87 |
p.mDependencyIDCollection.add(1);
|
|
|
88 |
}
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
/**
|
|
|
93 |
* @throws java.lang.Exception
|
|
|
94 |
*/
|
|
|
95 |
@Before
|
|
|
96 |
public void setUp() throws Exception {
|
|
|
97 |
releaseManager = new myReleaseManager("PeggedPackageRipple", "not used", "not used");
|
|
|
98 |
rippleEngine = new RippleEngine(releaseManager, 11111, true);
|
|
|
99 |
|
|
|
100 |
// Force a known machtype
|
|
|
101 |
Package.mGenericMachtype = "win32";
|
|
|
102 |
|
|
|
103 |
try {
|
|
|
104 |
rippleEngine.collectMetaData();
|
|
|
105 |
rippleEngine.planRelease(false);
|
|
|
106 |
} catch (Exception e) {
|
|
|
107 |
}
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
/**
|
|
|
111 |
* @throws java.lang.Exception
|
|
|
112 |
*/
|
|
|
113 |
@After
|
|
|
114 |
public void tearDown() throws Exception {
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
@Test
|
|
|
118 |
public void test() {
|
|
|
119 |
|
|
|
120 |
boolean rv;
|
|
|
121 |
BuildFile buildFile;
|
|
|
122 |
|
|
|
123 |
buildFile = rippleEngine.getFirstBuildFileContent();
|
|
|
124 |
assertTrue(buildFile != null);
|
|
|
125 |
assertTrue(buildFile.state != BuildFileState.Empty);
|
|
|
126 |
|
|
|
127 |
rv = Utilities.checkBuildfile(buildFile.content,"PeggedPackageBuild");
|
|
|
128 |
assertTrue(rv);
|
|
|
129 |
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
}
|