Skip to main content
summaryrefslogtreecommitdiffstats
blob: 48e544f41a02f65879b2377229b6c3ef5287f9f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*******************************************************************************
 * Copyright (c) 2008, 2017 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.equinox.p2.tests.reconciler.dropins;

import java.util.Enumeration;
import java.util.Vector;
import junit.framework.*;

public class ReconcilerTestSuite extends TestSuite {

	private Test INITIALIZE;
	private Test CLEANUP;
	private String propertyToPlatformArchive;

	public ReconcilerTestSuite() {
		super();
		INITIALIZE = getInitializationTest();
		CLEANUP = getCleanUpTest();
	}

	public ReconcilerTestSuite(String propertyToPlatformArchive) {
		super();
		this.propertyToPlatformArchive = propertyToPlatformArchive;
		INITIALIZE = getInitializationTest();
		CLEANUP = getCleanUpTest();
	}

	protected String getPlatformArchive() {
		return propertyToPlatformArchive;
	}

	@Override
	public Enumeration tests() {
		Vector result = new Vector();
		result.add(INITIALIZE);
		for (Enumeration e = super.tests(); e.hasMoreElements();)
			result.add(e.nextElement());
		result.add(CLEANUP);
		return result.elements();
	}

	@Override
	public int testCount() {
		return super.testCount() + 2;
	}

	@Override
	public Test testAt(int index) {
		if (index == 0)
			return INITIALIZE;
		if (index == testCount() - 1)
			return CLEANUP;
		return super.testAt(index - 1);
	}

	public Test getInitializationTest() {
		return new AbstractReconcilerTest("initialize", propertyToPlatformArchive);
	}

	public Test getCleanUpTest() {
		return new AbstractReconcilerTest("cleanup");
	}

	/**
	 * Runs the tests and collects their result in a TestResult.
	 *
	 * We must override this method in order to run against JUnit4 which doesn't
	 * invoke tests().
	 */
	@Override
	public void run(TestResult result) {
		for (Enumeration e = tests(); e.hasMoreElements();) {
			Test each = (Test) e.nextElement();
			if (result.shouldStop())
				break;
			runTest(each, result);
		}
	}

}

Back to the top