Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2009-12-04 22:51:38 +0000
committerJohn Arthorne2009-12-04 22:51:38 +0000
commit67f1431612fc37aa5fbb04d918c2cad351095467 (patch)
treea496f9001d01d3b1cececde8010b3c19ce6cee63
parent4aeb8e4c37134e17ebaa4828e2bf9c963d22ffbf (diff)
downloadrt.equinox.p2-67f1431612fc37aa5fbb04d918c2cad351095467.tar.gz
rt.equinox.p2-67f1431612fc37aa5fbb04d918c2cad351095467.tar.xz
rt.equinox.p2-67f1431612fc37aa5fbb04d918c2cad351095467.zip
Bug 296656 - Exception installing in the dropins
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/DefaultPhaseSet.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Engine.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PhaseSet.java43
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/All p2 Tests.launch3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java61
5 files changed, 108 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/DefaultPhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/DefaultPhaseSet.java
index 4842ad1f1..0f5142ca6 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/DefaultPhaseSet.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/DefaultPhaseSet.java
@@ -18,13 +18,13 @@ public class DefaultPhaseSet extends PhaseSet {
private static final boolean forcedUninstall = Boolean.valueOf(EngineActivator.getContext().getProperty("org.eclipse.equinox.p2.engine.forcedUninstall")).booleanValue(); //$NON-NLS-1$
- public static int PHASE_CHECK_TRUST = 0x01;
public static int PHASE_COLLECT = 0x02;
- public static int PHASE_CONFIGURE = 0x04;
- public static int PHASE_INSTALL = 0x08;
- public static int PHASE_PROPERTY = 0x10;
public static int PHASE_UNCONFIGURE = 0x20;
public static int PHASE_UNINSTALL = 0x40;
+ public static int PHASE_PROPERTY = 0x10;
+ public static int PHASE_CHECK_TRUST = 0x01;
+ public static int PHASE_INSTALL = 0x08;
+ public static int PHASE_CONFIGURE = 0x04;
public DefaultPhaseSet() {
this(new Phase[] {new Collect(100), new Unconfigure(10, forcedUninstall), new Uninstall(50, forcedUninstall), new Property(1), new CheckTrust(10), new Install(50), new Configure(10)});
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Engine.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Engine.java
index f5391adb7..24780bab4 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Engine.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Engine.java
@@ -117,11 +117,11 @@ public class Engine implements IEngine {
}
public IPhaseSet createPhaseSetExcluding(String[] excludes) {
- return null;
+ return PhaseSet.createPhaseSetExcluding(excludes);
}
public IPhaseSet createPhaseSetIncluding(String[] includes) {
- return null;
+ return PhaseSet.createPhaseSetIncluding(includes);
}
public IProvisioningPlan createCustomPlan(IProfile profile, Operand[] operands, ProvisioningContext context) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PhaseSet.java
index 2e84549e3..277603edd 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PhaseSet.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PhaseSet.java
@@ -10,18 +10,55 @@
*******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.engine;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.engine.ActionManager;
import org.eclipse.equinox.internal.p2.engine.EngineActivator;
+import org.eclipse.equinox.internal.provisional.p2.engine.phases.*;
import org.eclipse.equinox.p2.engine.IPhaseSet;
import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
import org.eclipse.osgi.util.NLS;
-public abstract class PhaseSet implements IPhaseSet {
+public class PhaseSet implements IPhaseSet {
+
+ public static final List DEFAULT_PHASES = Arrays.asList(new String[] {IPhaseSet.PHASE_COLLECT, IPhaseSet.PHASE_UNCONFIGURE, IPhaseSet.PHASE_UNINSTALL, IPhaseSet.PHASE_PROPERTY, IPhaseSet.PHASE_CHECK_TRUST, IPhaseSet.PHASE_INSTALL, IPhaseSet.PHASE_CONFIGURE});
+
+ public static final boolean forcedUninstall = Boolean.valueOf(EngineActivator.getContext().getProperty("org.eclipse.equinox.p2.engine.forcedUninstall")).booleanValue(); //$NON-NLS-1$
+
private final Phase[] phases;
+ static IPhaseSet createPhaseSetExcluding(String[] excludes) {
+ ArrayList phases = new ArrayList(DEFAULT_PHASES);
+ if (excludes != null) {
+ for (int i = 0; i < excludes.length; i++) {
+ phases.remove(excludes[i]);
+ }
+ }
+ return createPhaseSetIncluding((String[]) phases.toArray(new String[phases.size()]));
+ }
+
+ static IPhaseSet createPhaseSetIncluding(String[] includes) {
+ ArrayList phases = new ArrayList();
+ for (int i = 0; i < includes.length; i++) {
+ String current = includes[i];
+ if (current.equals(IPhaseSet.PHASE_CONFIGURE))
+ phases.add(new Configure(10));
+ else if (current.equals(IPhaseSet.PHASE_CHECK_TRUST))
+ phases.add(new CheckTrust(10));
+ else if (current.equals(IPhaseSet.PHASE_COLLECT))
+ phases.add(new Collect(100));
+ else if (current.equals(IPhaseSet.PHASE_INSTALL))
+ phases.add(new Install(50));
+ else if (current.equals(IPhaseSet.PHASE_PROPERTY))
+ phases.add(new Property(1));
+ else if (current.equals(IPhaseSet.PHASE_UNCONFIGURE))
+ phases.add(new Unconfigure(10, forcedUninstall));
+ else if (current.equals(IPhaseSet.PHASE_UNINSTALL))
+ phases.add(new Uninstall(50, forcedUninstall));
+ }
+ return new PhaseSet((Phase[]) phases.toArray(new Phase[phases.size()]));
+ }
+
public PhaseSet(Phase[] phases) {
if (phases == null)
throw new IllegalArgumentException(Messages.null_phases);
diff --git a/bundles/org.eclipse.equinox.p2.tests/All p2 Tests.launch b/bundles/org.eclipse.equinox.p2.tests/All p2 Tests.launch
index 4bfd24e5f..b7f4c3c31 100644
--- a/bundles/org.eclipse.equinox.p2.tests/All p2 Tests.launch
+++ b/bundles/org.eclipse.equinox.p2.tests/All p2 Tests.launch
@@ -53,12 +53,11 @@
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.5.0 (MacOS X Default)"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.equinox.p2.tests.AutomatedTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consolelog -console"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.p2.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dorg.eclipse.equinox.p2.reconciler.tests.platform.archive=c:/Dev/Platform/zips/eclipse-platform-I20090825-1032-win32.zip&#13;&#10;-Dorg.eclipse.equinox.p2.reconciler.tests.35.platform.archive=c:/Dev/Platform/zips/eclipse-platform-3.5-win32.zip&#13;&#10;-Dorg.eclipse.equinox.p2.repository&#13;&#10;-Dorg.eclipse.equinox.p2.tests.current.build.repo=http://eclipsebuildserv/3.6-I-builds/&#13;&#13;&#10;-Xmx512m"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dorg.eclipse.equinox.p2.reconciler.tests.platform.archive=c:/builds/eclipse-platform-I20090811-0800-win32.zip&#13;&#10;-Dorg.eclipse.equinox.p2.reconciler.tests.35.platform.archive=c:/builds/eclipse-platform-3.5-win32.zip&#13;&#10;-Dorg.eclipse.equinox.p2.repository&#13;&#10;-Dorg.eclipse.equinox.p2.tests.current.build.repo=http://eclipsebuildserv/3.6-I-builds/&#13;&#13;&#10;-Xmx512m"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java
index 898657de9..2c7e22b92 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java
@@ -202,6 +202,67 @@ public class EngineTest extends AbstractProvisioningTest {
}
}
+ /*
+ * Tests for {@link IEngine#createPhaseSetExcluding}.
+ */
+ public void testCreatePhaseSetExcluding() {
+ //null argument
+ IPhaseSet set = engine.createPhaseSetExcluding(null);
+ assertEquals("1.0", 7, set.getPhaseIds().length);
+
+ //empty argument
+ set = engine.createPhaseSetExcluding(new String[0]);
+ assertEquals("2.0", 7, set.getPhaseIds().length);
+
+ //bogus argument
+ set = engine.createPhaseSetExcluding(new String[] {"blort"});
+ assertEquals("3.0", 7, set.getPhaseIds().length);
+
+ //valid argument
+ set = engine.createPhaseSetExcluding(new String[] {IPhaseSet.PHASE_CHECK_TRUST});
+ final String[] phases = set.getPhaseIds();
+ assertEquals("4.0", 6, phases.length);
+ for (int i = 0; i < phases.length; i++)
+ if (phases[i].equals(IPhaseSet.PHASE_CHECK_TRUST))
+ fail("4.1." + i);
+
+ }
+
+ /*
+ * Tests for {@link IEngine#createPhaseSetIncluding}.
+ */
+ public void testCreatePhaseSetIncluding() {
+ //null argument
+ try {
+ engine.createPhaseSetIncluding(null);
+ fail("1.0");
+ } catch (RuntimeException e) {
+ //expected
+ }
+ //empty argument
+ IPhaseSet set = engine.createPhaseSetIncluding(new String[0]);
+ assertNotNull("2.0", set);
+ assertEquals("2.1", 0, set.getPhaseIds().length);
+
+ //unknown argument
+ set = engine.createPhaseSetIncluding(new String[] {"blort", "not a phase", "bad input"});
+ assertNotNull("3.0", set);
+ assertEquals("3.1", 0, set.getPhaseIds().length);
+
+ //one valid phase
+ set = engine.createPhaseSetIncluding(new String[] {IPhaseSet.PHASE_COLLECT});
+ assertNotNull("4.0", set);
+ assertEquals("4.1", 1, set.getPhaseIds().length);
+ assertEquals("4.2", IPhaseSet.PHASE_COLLECT, set.getPhaseIds()[0]);
+
+ //one valid phase and one bogus
+ set = engine.createPhaseSetIncluding(new String[] {IPhaseSet.PHASE_COLLECT, "bogus"});
+ assertNotNull("4.0", set);
+ assertEquals("4.1", 1, set.getPhaseIds().length);
+ assertEquals("4.2", IPhaseSet.PHASE_COLLECT, set.getPhaseIds()[0]);
+
+ }
+
public void testEmptyOperands() {
IProfile profile = createProfile("test");

Back to the top