blob: d17b03a60e368224aa3f8b5e185e1f1410f5093b (
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
|
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.p2.tests.planner;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand;
import org.eclipse.equinox.internal.p2.engine.Operand;
import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.junit.Assert;
/**
* @since 1.0
*/
public class Bug302580 extends AbstractPlannerTest {
@Override
protected String getTestDataPath() {
return "testData/bug302580";
}
@Override
protected String getProfileId() {
return "bootProfile";
}
public void testInstall() {
IQueryResult<IInstallableUnit> ius = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
IPlanner planner = createPlanner();
ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(createProfileChangeRequest(ius.toSet(), null, null), null, new NullProgressMonitor());
Operand ops[] = plan.getOperands();
String message = "The plan:\n";
for (int i = 0; i < ops.length; i++) {
if (ops[i] instanceof InstallableUnitOperand) {
InstallableUnitOperand iuo = (InstallableUnitOperand) ops[i];
if (iuo.first() == null) {
message += iuo.second() + " will be installed\n";
}
if (iuo.second() == null) {
message += iuo.first() + " will be uninstalled\n";
}
if (iuo.first() != null && iuo.second() != null) {
message += iuo.first() + " will be replaced with " + iuo.second() + "\n";
}
}
}
System.out.println(message);
for (int i = 0; i < ops.length; i++) {
if (ops[i] instanceof InstallableUnitOperand) {
InstallableUnitOperand iuo = (InstallableUnitOperand) ops[i];
if (iuo.second() == null) {
String id = iuo.first().getId();
if (id.equals("toolingorg.eclipse.equinox.launcher") || id.equals("toolingorg.eclipse.equinox.p2.reconciler.dropins") || id.equals("toolingorg.eclipse.equinox.simpleconfigurator")) {
Assert.fail("Core plug-in to be unistalled");
}
}
}
}
}
}
|