Subversion Repositories DevTools

Rev

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