blob: 7d5babb263a5fd04cde91f82e606b75580d12899 (
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
|
/*******************************************************************************
* Copyright (c) 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.planner;
import junit.framework.Assert;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.engine.*;
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;
/**
* @since 1.0
*/
public class Bug302580 extends AbstractPlannerTest {
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.tests.planner.AbstractPlannerTest#getTestDataPath()
*/
@Override
protected String getTestDataPath() {
return "testData/bug302580";
}
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.tests.planner.AbstractPlannerTest#getProfileId()
*/
@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");
}
}
}
}
}
}
|