diff options
author | Ian Bull | 2012-04-30 05:21:01 +0000 |
---|---|---|
committer | Ian Bull | 2012-04-30 05:21:01 +0000 |
commit | 939c41ed5b5ba458a2a71dda55cf30f0fdb2322d (patch) | |
tree | 110e8453c603583ab82b2a2512f87d7b0bf05b66 | |
parent | 26d5380498537de47e86cf6316bc4954fea5da58 (diff) | |
parent | 9a7f17bd7ade6f6728b0c7b1051d0aab799aeb84 (diff) | |
download | rt.equinox.p2-939c41ed5b5ba458a2a71dda55cf30f0fdb2322d.tar.gz rt.equinox.p2-939c41ed5b5ba458a2a71dda55cf30f0fdb2322d.tar.xz rt.equinox.p2-939c41ed5b5ba458a2a71dda55cf30f0fdb2322d.zip |
Merge branch 'master' into integration
9 files changed, 119 insertions, 56 deletions
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java index 46fe0e617..feef577e7 100644 --- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java +++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java @@ -36,16 +36,19 @@ public class ProvisioningHelper { static IMetadataRepository addMetadataRepository(IProvisioningAgent agent, URI location) { IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); + boolean createRepo = "file".equals(location.getScheme()); //$NON-NLS-1$ + if (manager == null) - throw new IllegalStateException("No metadata repository manager found"); + throw new IllegalStateException("No metadata repository manager found"); //$NON-NLS-1$ try { return manager.loadRepository(location, null); } catch (ProvisionException e) { - //fall through and create a new repository + if (!createRepo) + return null; } // for convenience create and add a repository here - String repositoryName = location + " - metadata"; + String repositoryName = location + " - metadata"; //$NON-NLS-1$ try { return manager.createRepository(location, repositoryName, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); } catch (ProvisionException e) { @@ -56,7 +59,7 @@ public class ProvisioningHelper { static IMetadataRepository getMetadataRepository(IProvisioningAgent agent, URI location) { IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); if (manager == null) - throw new IllegalStateException("No metadata repository manager found"); + throw new IllegalStateException("No metadata repository manager found"); //$NON-NLS-1$ try { return manager.loadRepository(location, null); } catch (ProvisionException e) { @@ -67,22 +70,26 @@ public class ProvisioningHelper { static void removeMetadataRepository(IProvisioningAgent agent, URI location) { IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); if (manager == null) - throw new IllegalStateException("No metadata repository manager found"); + throw new IllegalStateException("No metadata repository manager found"); //$NON-NLS-1$ manager.removeRepository(location); } static IArtifactRepository addArtifactRepository(IProvisioningAgent agent, URI location) { IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); + boolean createRepo = "file".equals(location.getScheme()); //$NON-NLS-1$ + if (manager == null) - // TODO log here - return null; + throw new IllegalStateException("No metadata repository manager found"); //$NON-NLS-1$ + try { return manager.loadRepository(location, null); } catch (ProvisionException e) { //fall through and create a new repository + if (!createRepo) + return null; } // could not load a repo at that location so create one as a convenience - String repositoryName = location + " - artifacts"; + String repositoryName = location + " - artifacts"; //$NON-NLS-1$ try { return manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); } catch (ProvisionException e) { @@ -112,7 +119,7 @@ public class ProvisioningHelper { if (info != null) profileProperties.put(IProfile.PROP_ENVIRONMENTS, "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ else - profileProperties.put(IProfile.PROP_ENVIRONMENTS, ""); + profileProperties.put(IProfile.PROP_ENVIRONMENTS, ""); //$NON-NLS-1$ } return profileRegistry.addProfile(profileId, profileProperties); @@ -181,23 +188,23 @@ public class ProvisioningHelper { IQueryResult<IInstallableUnit> units = getInstallableUnits(agent, (URI) null, QueryUtil.createIUQuery(unitId, Version.create(version)), progress); if (units.isEmpty()) { StringBuffer error = new StringBuffer(); - error.append("Installable unit not found: " + unitId + ' ' + version + '\n'); - error.append("Repositories searched:\n"); + error.append("Installable unit not found: " + unitId + ' ' + version + '\n'); //$NON-NLS-1$ + error.append("Repositories searched:\n");//$NON-NLS-1$ URI[] repos = getMetadataRepositories(agent); if (repos != null) { for (int i = 0; i < repos.length; i++) - error.append(repos[i] + "\n"); + error.append(repos[i] + "\n");//$NON-NLS-1$ } throw new ProvisionException(error.toString()); } IPlanner planner = (IPlanner) agent.getService(IPlanner.SERVICE_NAME); if (planner == null) - throw new ProvisionException("No planner service found."); + throw new ProvisionException("No planner service found.");//$NON-NLS-1$ IEngine engine = (IEngine) agent.getService(IEngine.SERVICE_NAME); if (engine == null) - throw new ProvisionException("No director service found."); + throw new ProvisionException("No director service found."); //$NON-NLS-1$ ProvisioningContext context = new ProvisioningContext(agent); IProfileChangeRequest request = planner.createChangeRequest(profile); request.addAll(units.toUnmodifiableSet()); @@ -208,8 +215,7 @@ public class ProvisioningHelper { static URI[] getArtifactRepositories(IProvisioningAgent agent) { IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); if (manager == null) - // TODO log here - return null; + throw new IllegalStateException("No metadata repository manager found"); //$NON-NLS-1$ URI[] repos = manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL); if (repos.length > 0) return repos; @@ -240,13 +246,13 @@ public class ProvisioningHelper { static IStatus revertToPreviousState(IProvisioningAgent agent, IProfile profile, long revertToPreviousState) throws ProvisionException { IEngine engine = (IEngine) agent.getService(IEngine.SERVICE_NAME); if (engine == null) - throw new ProvisionException("No p2 engine found."); + throw new ProvisionException("No p2 engine found."); //$NON-NLS-1$ IPlanner planner = (IPlanner) agent.getService(IPlanner.SERVICE_NAME); if (planner == null) - throw new ProvisionException("No planner found."); + throw new ProvisionException("No planner found."); //$NON-NLS-1$ IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); if (profileRegistry == null) - throw new ProvisionException("profile registry cannot be null"); + throw new ProvisionException("profile registry cannot be null"); //$NON-NLS-1$ // If given profile is null, then get/use the self profile if (profile == null) { profile = getProfile(agent, IProfileRegistry.SELF); @@ -262,7 +268,7 @@ public class ProvisioningHelper { targetProfile = profileRegistry.getProfile(profile.getProfileId(), revertToPreviousState); } if (targetProfile == null) - throw new ProvisionException("target profile with timestamp=" + revertToPreviousState + " not found"); + throw new ProvisionException("target profile with timestamp=" + revertToPreviousState + " not found"); //$NON-NLS-1$//$NON-NLS-2$ URI[] artifactRepos = getArtifactRepositories(agent); URI[] metadataRepos = getMetadataRepositories(agent); IProvisioningPlan plan = planner.getDiffPlan(profile, targetProfile, new NullProgressMonitor()); @@ -281,8 +287,8 @@ public class ProvisioningHelper { IQueryResult<IInstallableUnit> units = profile.query(QueryUtil.createIUQuery(unitId, Version.create(version)), progress); if (units.isEmpty()) { StringBuffer error = new StringBuffer(); - error.append("Installable unit not found: " + unitId + ' ' + version + '\n'); - error.append("Repositories searched:\n"); + error.append("Installable unit not found: " + unitId + ' ' + version + '\n'); //$NON-NLS-1$ + error.append("Repositories searched:\n"); //$NON-NLS-1$ URI[] repos = getMetadataRepositories(agent); if (repos != null) { for (int i = 0; i < repos.length; i++) @@ -293,11 +299,11 @@ public class ProvisioningHelper { IPlanner planner = (IPlanner) agent.getService(IPlanner.SERVICE_NAME); if (planner == null) - throw new ProvisionException("No planner service found."); + throw new ProvisionException("No planner service found."); //$NON-NLS-1$ IEngine engine = (IEngine) agent.getService(IEngine.SERVICE_NAME); if (engine == null) - throw new ProvisionException("No engine service found."); + throw new ProvisionException("No engine service found."); //$NON-NLS-1$ ProvisioningContext context = new ProvisioningContext(agent); IProfileChangeRequest request = planner.createChangeRequest(profile); request.removeAll(units.toUnmodifiableSet()); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java index 3bb000f44..9ee9acf7f 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java @@ -86,7 +86,8 @@ public class ApplicationLauncherAction extends AbstractPublisherAction { */ private void createLauncherAdvice(IPublisherInfo publisherInfo, IPublisherResult results) { Collection<IInstallableUnit> ius = getIUs(results.getIUs(null, null), EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER); - ius.addAll(getIUs(publisherInfo.getContextMetadataRepository().query(QueryUtil.ALL_UNITS, null).toUnmodifiableSet(), EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER)); + if (publisherInfo.getContextMetadataRepository() != null) + ius.addAll(getIUs(publisherInfo.getContextMetadataRepository().query(QueryUtil.ALL_UNITS, null).toUnmodifiableSet(), EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER)); VersionAdvice advice = new VersionAdvice(); boolean found = false; for (IInstallableUnit iu : ius) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java index 7255475e3..88c2b186d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java @@ -19,6 +19,7 @@ import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.*; +import org.eclipse.equinox.internal.p2.repository.DownloadProgressEvent; import org.eclipse.equinox.internal.p2.touchpoint.natives.Util; import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener; import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent; @@ -260,32 +261,55 @@ public class PhaseSetTest extends AbstractProvisioningTest { public void testCancelPausedProvisioing() throws ProvisionException, InterruptedException { URI repoLoc = getTestData("Load test data.", "/testData/pausefeature").toURI(); final PhaseSet phaseSet = (PhaseSet) PhaseSetFactory.createDefaultPhaseSet(); - pause = new PauseJob("pause") { - protected IStatus run(IProgressMonitor monitor) { - if (!phaseSet.pause()) - return new Status(IStatus.ERROR, TestActivator.PI_PROV_TESTS, "pause() failed."); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - System.out.println(new Date() + " -- paused provisioning."); - // wait seconds - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - // - } - setPause(true); - return Status.OK_STATUS; + class ProvListener implements ProvisioningListener { + boolean hasDownloadEvent = false; + + public void notify(EventObject o) { + if (o instanceof DownloadProgressEvent) + hasDownloadEvent = true; } + }; + final ProvListener listener = new ProvListener(); + getEventBus().addListener(listener); + try { - basicTest(repoLoc, phaseSet, pause, QueryUtil.createLatestQuery(QueryUtil.createIUQuery("org.eclipse.equinox.executable.feature.group")), 3000, IStatus.CANCEL, new NullProgressMonitor() { - @Override - public boolean isCanceled() { - return pause.isPaused(); - } - }); + pause = new PauseJob("pause") { + protected IStatus run(IProgressMonitor monitor) { + while (!listener.hasDownloadEvent) { + try { + Thread.sleep(10); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } + if (!phaseSet.pause()) + return new Status(IStatus.ERROR, TestActivator.PI_PROV_TESTS, "pause() failed."); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + System.out.println(new Date() + " -- paused provisioning."); + // wait seconds + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + // + } + setPause(true); + return Status.OK_STATUS; + } + }; + + basicTest(repoLoc, phaseSet, pause, QueryUtil.createLatestQuery(QueryUtil.createIUQuery("org.eclipse.equinox.executable.feature.group")), 0, IStatus.CANCEL, new NullProgressMonitor() { + @Override + public boolean isCanceled() { + return pause.isPaused(); + } + }); + } finally { + getEventBus().removeListener(listener); + } } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java index f23fc9d8e..9a2c8f028 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java @@ -108,7 +108,10 @@ public class EquinoxExecutableActionTest extends ActionTest { verifyExecIU(iuList, idBase, configSpec); verifyEclipseIU(iuList, idBase, configSpec); verifyCU(iuList, idBase, configSpec); - assertTrue(iuList.size() == 3); + if (configSpec.contains("macosx")) + assertTrue(iuList.size() == 4); + else + assertTrue(iuList.size() == 3); } @SuppressWarnings("hiding") @@ -127,7 +130,10 @@ public class EquinoxExecutableActionTest extends ActionTest { Collection<IRequirement> requiredCapability = fragment.getHost(); verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + configSpec, new VersionRange(version, true, version, true)); //$NON-NLS-1$ assertTrue(requiredCapability.size() == 1); - assertTrue(fragment.getFilter().equals(InstallableUnit.parseFilter("(& (osgi.ws=" + ws + ")(osgi.os=" + os + ")(osgi.arch=" + arch + "))"))); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ + + assertTrue(fragment.getFilter().getParameters()[0].toString().indexOf("(osgi.ws=" + ws + ")") != -1); + assertTrue(fragment.getFilter().getParameters()[0].toString().indexOf("(osgi.os=" + os + ")") != -1); + assertTrue(fragment.getFilter().getParameters()[0].toString().indexOf("(osgi.arch=" + arch + ")") != -1); assertTrue(fragment.getProperty("org.eclipse.equinox.p2.type.fragment").equals("true")); //$NON-NLS-1$ //$NON-NLS-2$ return;//pass } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java index 214523f61..d926dabaa 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java @@ -186,13 +186,25 @@ public class FileReaderTest2 extends AbstractProvisioningTest { } } - private void doFileReaderTest(PauseJob pauseJob, IProgressMonitor monitor) throws IOException, CoreException { + private void doFileReaderTest(final PauseJob pauseJob, IProgressMonitor monitor) throws IOException, CoreException { final String testRemoteFileURL = "http://ftp.osuosl.org/pub/eclipse/rt/ecf/3.5.4/site.p2/plugins/org.eclipse.ecf.doc_1.3.0.v20111230-0120.jar"; OutputStream out = null; OutputStream out1 = null; File tmpFolder = getTempFolder(); File tmpFile = new File(tmpFolder, "testDownloadPauseResume.zip"); File tmpFile1 = new File(tmpFolder, "testDownloadWithoutPause.zip"); + ProvisioningListener listener = new ProvisioningListener() { + boolean startedPauseJob = false; + + public void notify(EventObject o) { + if (!startedPauseJob && o instanceof DownloadProgressEvent) { + pauseJob.schedule(); + startedPauseJob = true; + } + + } + }; + getEventBus().addListener(listener); try { tmpFile1.createNewFile(); out1 = new FileOutputStream(tmpFile1); @@ -203,12 +215,12 @@ public class FileReaderTest2 extends AbstractProvisioningTest { tmpFile.createNewFile(); out = new FileOutputStream(tmpFile); FileReader reader = pauseJob.getReader(); - pauseJob.schedule(5000); reader.readInto(URI.create(testRemoteFileURL), out, monitor); assertNotNull(reader.getResult()); assertTrue(reader.getResult().isOK()); assertEquals("File with pausing/resuming is not identical with file without pausing.", tmpFile1.length(), tmpFile.length()); } finally { + getEventBus().removeListener(listener); if (out1 != null) out1.close(); tmpFile1.delete(); diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/nativeTouchpoint/a.dir.zip b/bundles/org.eclipse.equinox.p2.tests/testData/nativeTouchpoint/a.dir.zip Binary files differnew file mode 100644 index 000000000..64e9bf4b4 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/nativeTouchpoint/a.dir.zip diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF index 7b0e33bee..59196cde2 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/META-INF/MANIFEST.MF @@ -12,8 +12,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.core.runtime, org.eclipse.equinox.p2.ui Import-Package: javax.xml.parsers, - org.eclipse.compare, - org.eclipse.compare.structuremergeviewer, + org.eclipse.compare;resolution:=optional, + org.eclipse.compare.structuremergeviewer;resolution:=optional, org.eclipse.equinox.p2.core;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.engine;version="[2.0.0,3.0.0)", org.eclipse.equinox.p2.engine.query;version="[2.0.0,3.0.0)", diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java index 0c9408981..7ffab9d32 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java @@ -99,7 +99,7 @@ public class Policy { private boolean allowDrilldown = true; private boolean repositoriesVisible = true; private boolean showLatestVersionsOnly = true; - private int restartPolicy = RESTART_POLICY_PROMPT_RESTART_OR_APPLY; + private int restartPolicy = RESTART_POLICY_PROMPT; private String repoPrefPageId; private String repoPrefPageName; private boolean filterOnEnv = false; diff --git a/org.eclipse.equinox.p2.releng/p2-indigo.target b/org.eclipse.equinox.p2.releng/p2-indigo.target new file mode 100644 index 000000000..81c1b4344 --- /dev/null +++ b/org.eclipse.equinox.p2.releng/p2-indigo.target @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?pde version="3.6"?> + +<target name="p2 - target to develop p2" sequenceNumber="0"> +<locations> +<location includeAllPlatforms="false" includeMode="planner" includeSource="true" type="InstallableUnit"> +<unit id="org.eclipse.sdk.ide" version="3.7.2.M20120208-0800"/> +<unit id="org.eclipse.test.feature.group" version="3.5.0.v20110503-7R7aBjBgLiJz0Cv6Q4DG58520281"/> +<unit id="org.eclipse.core.tests.harness" version="3.7.0.v20110505"/> +<repository location="http://download.eclipse.org/eclipse/updates/3.7"/> + +</location> +</locations> +</target> |