Subversion Repositories DevTools

Rev

Rev 7033 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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