Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 00c41b749b94719bd5a3d2990baeee6ed787915a (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
/*******************************************************************************
 *  Copyright (c) 2008, 2010 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.ui.actions;

import org.eclipse.equinox.internal.p2.ui.model.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;

/**
 * Abstract class to set up different IU selection combinations
 */
public abstract class ProfileModificationActionTest extends ActionTest {
	protected IInstallableUnit[] getMixedIUs() {
		return new IInstallableUnit[] {top1, top2, nested};
	}

	protected Object[] getCategoryAndChildIUElements() {
		CategoryElement element = new CategoryElement(null, category);
		AvailableIUElement child = new AvailableIUElement(element, uninstalled, TESTPROFILE, true);
		return new Object[] {element, child};
	}

	protected Object[] getNestedCategoriesAndChildIUElements() {
		CategoryElement element = new CategoryElement(null, category);
		CategoryElement nested = new CategoryElement(element, category);
		AvailableIUElement child = new AvailableIUElement(nested, uninstalled, TESTPROFILE, true);
		return new Object[] {element, nested, child};
	}

	protected IInstallableUnit[] getTopLevelIUs() {
		return new IInstallableUnit[] {top1, top2};
	}

	protected IInstallableUnit[] getTopLevelIUsWithLockedIU() {
		return new IInstallableUnit[] {top1, top2, locked};
	}

	protected IIUElement[] getTopLevelIUElements() {
		return new IIUElement[] {element(top1), element(top2)};
	}

	protected Object[] getMixedIUElements() {
		return new IIUElement[] {element(top1), element(top2), element(nested)};
	}

	protected Object[] getTopLevelIUElementsWithLockedIU() {
		return new IIUElement[] {element(top1), element(top2), element(locked)};
	}

	protected Object[] getMixedIUsAndElements() {
		return new Object[] {top1, element(top2)};
	}

	protected Object[] getMixedIUsAndNonIUs() {
		return new Object[] {top1, top2, new Object()};
	}

	protected Object[] getNonIUSelection() {
		return getInvalidSelection();
	}

	protected IIUElement element(IInstallableUnit iu) {
		return new InstalledIUElement(profileElement, profile.getProfileId(), iu);
	}
}

Back to the top