Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2019-01-23 06:44:37 -0500
committerAlexander Kurtakov2019-01-23 10:27:30 -0500
commit14297cdf8c5f9e3a78193c2911770bb55623d900 (patch)
treec4fb10667fdcf3f28a3d6fc144fda2a39dfbc69f
parent01c280d99f64fb7c12c2283ab84e9ca655f11940 (diff)
downloadrt.equinox.p2-14297cdf8c5f9e3a78193c2911770bb55623d900.tar.gz
rt.equinox.p2-14297cdf8c5f9e3a78193c2911770bb55623d900.tar.xz
rt.equinox.p2-14297cdf8c5f9e3a78193c2911770bb55623d900.zip
Make use of the generified IProvisioningAgent.getService in tests.
Change-Id: I1dbd17868e0bfb6d343cdf91153a7a7554ad0416 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java69
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.verifier/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestAgentProvider.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/JarURLArtifactRepositoryTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest2.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/StatsTest.java48
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/DirectorApplicationTest.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfilePreferencesTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest2.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java42
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AuthTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/RepositorManagerDifferentAgentTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/TimeoutTest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306279b.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309717.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug311330.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TwoVersionsOfWSDL.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java23
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/TestIndexes.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ProfileSynchronizerTest.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ProfileSynchronizerTest2.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/NTLMTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UtilTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/UpdateCheckerTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java51
58 files changed, 624 insertions, 311 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
index 504d3e134..a6807dbbe 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.tests.ui
-Bundle-Version: 1.2.200.qualifier
+Bundle-Version: 1.2.300.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.100",
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
index b4532aec4..29c913d95 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
@@ -21,7 +21,7 @@
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.tests.ui</artifactId>
- <version>1.2.200-SNAPSHOT</version>
+ <version>1.2.300-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
index 6ab91e12c..fbdbd5fa7 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
@@ -43,7 +43,8 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
- ServiceTracker<P2ImportExport, P2ImportExport> tracker = new ServiceTracker<>(TestActivator.getContext(), P2ImportExport.class, null);
+ ServiceTracker<P2ImportExport, P2ImportExport> tracker = new ServiceTracker<>(TestActivator.getContext(),
+ P2ImportExport.class, null);
tracker.open();
importexportService = tracker.getService();
assertNotNull("Fail to get ImportExport service", importexportService);
@@ -54,31 +55,34 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
public void tearDown() throws Exception {
super.tearDown();
importexportService = null;
- IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMan = getAgent().getService(IMetadataRepositoryManager.class);
URI[] urls = repoMan.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
for (int i = 0; i < urls.length; i++) {
repoMan.removeRepository(urls[i]);
}
}
- public void testExportFeaturesFromRemoteRepository() throws URISyntaxException, IOException, ProvisionException, OperationCanceledException {
+ public void testExportFeaturesFromRemoteRepository()
+ throws URISyntaxException, IOException, ProvisionException, OperationCanceledException {
File testFile = File.createTempFile("test", "p2f");
URI uri = getTestRepository();
try {
- IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metaManager = getAgent().getService(IMetadataRepositoryManager.class);
IMetadataRepository repo = metaManager.loadRepository(uri, null);
assertNotNull("Fail to load remote repo", repo);
IInstallableUnit iu = AbstractProvisioningTest.createIU("A", Version.create("1.0.0"));
try (OutputStream output = new FileOutputStream(testFile)) {
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] { iu }, false, null);
assertTrue("Not expected return result.", status.isOK());
}
try (InputStream input = new FileInputStream(testFile)) {
List<IUDetail> ius = importexportService.importP2F(input);
assertEquals("Exported the number of features is not expected.", 1, ius.size());
assertTrue("Exported feature is not expected.", iu.equals(ius.get(0).getIU()));
- assertEquals("Exported the number of referred repositories is not expected.", 1, ius.get(0).getReferencedRepositories().size());
- assertEquals("Exported referred repository is not expected.", uri, ius.get(0).getReferencedRepositories().get(0));
+ assertEquals("Exported the number of referred repositories is not expected.", 1,
+ ius.get(0).getReferencedRepositories().size());
+ assertEquals("Exported referred repository is not expected.", uri,
+ ius.get(0).getReferencedRepositories().get(0));
}
} finally {
testFile.delete();
@@ -95,7 +99,8 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
String osPath = new Path(FileLocator.toFileURL(base).getPath()).toOSString();
File result = new File(osPath);
if (!result.getCanonicalPath().equals(result.getPath()))
- fail(message + " result path: " + result.getPath() + " does not match canonical path: " + result.getCanonicalFile().getPath());
+ fail(message + " result path: " + result.getPath() + " does not match canonical path: "
+ + result.getCanonicalFile().getPath());
return result;
} catch (IOException e) {
fail(message);
@@ -104,11 +109,12 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
return null;
}
- public void testExportFeaturesFromBothRemoteRepositoryAndLocalRepository() throws URISyntaxException, IOException, ProvisionException, OperationCanceledException {
+ public void testExportFeaturesFromBothRemoteRepositoryAndLocalRepository()
+ throws URISyntaxException, IOException, ProvisionException, OperationCanceledException {
File testFile = File.createTempFile("test", "p2f");
URI uri = getTestRepository();
try {
- IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metaManager = getAgent().getService(IMetadataRepositoryManager.class);
File localRepoFile = getTestData("Error load data", "testData/importexport/repo1");
IMetadataRepository localRepo = metaManager.loadRepository(localRepoFile.toURI(), null);
assertNotNull("Fail to load local repo", localRepo);
@@ -116,15 +122,17 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
assertNotNull("Fail to load remote repo", repo);
IInstallableUnit iu = AbstractProvisioningTest.createIU("A", Version.create("1.0.0"));
try (OutputStream output = new FileOutputStream(testFile)) {
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] { iu }, false, null);
assertTrue("Not expected return result.", status.isOK());
}
try (InputStream input = new FileInputStream(testFile)) {
List<IUDetail> ius = importexportService.importP2F(input);
assertEquals("Exported the number of features is not expected.", 1, ius.size());
assertTrue("Exported feature is not expected.", iu.equals(ius.get(0).getIU()));
- assertEquals("Exported the number of referred repositories is not expected.", 1, ius.get(0).getReferencedRepositories().size());
- assertEquals("Exported referred repository is not expected.", uri, ius.get(0).getReferencedRepositories().get(0));
+ assertEquals("Exported the number of referred repositories is not expected.", 1,
+ ius.get(0).getReferencedRepositories().size());
+ assertEquals("Exported referred repository is not expected.", uri,
+ ius.get(0).getReferencedRepositories().get(0));
}
} finally {
testFile.delete();
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
index 7cc7b3e54..84353aeea 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
@@ -73,7 +73,8 @@ public class ImportExportTests extends AbstractProvisioningTest {
if ("org.polarion.eclipse.team.svn.connector.feature.group".equals(iu.getIU().getId())) {
counter++;
assertTrue("Should have two referred repository.", iu.getReferencedRepositories().size() == 2);
- } else if ("org.polarion.eclipse.team.svn.connector.svnkit16.feature.group".equals(iu.getIU().getId())) {
+ } else if ("org.polarion.eclipse.team.svn.connector.svnkit16.feature.group"
+ .equals(iu.getIU().getId())) {
counter++;
assertTrue("Should have one referred repository", iu.getReferencedRepositories().size() == 1);
}
@@ -102,39 +103,42 @@ public class ImportExportTests extends AbstractProvisioningTest {
}
}
- public void testExportFeaturesInstalledFromLocal() throws ProvisionException, OperationCanceledException, IOException {
+ public void testExportFeaturesInstalledFromLocal()
+ throws ProvisionException, OperationCanceledException, IOException {
File testFile = File.createTempFile("test", "p2f");
try {
- IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metaManager = getAgent().getService(IMetadataRepositoryManager.class);
File localRepoFile = getTestData("Error load data", "testData/importexport/repo1");
IMetadataRepository repo = metaManager.loadRepository(localRepoFile.toURI(), null);
assertNotNull("Fail to load local repo", repo);
IInstallableUnit iu = createIU("A", Version.create("1.0.0"));
try (OutputStream output = new FileOutputStream(testFile)) {
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] { iu }, false, null);
assertFalse("Not expected return result.", status.isOK());
assertTrue("Should be a multiple status", status.isMultiStatus());
boolean hasFeaturesIgnored = false;
for (IStatus s : getChildren(status))
if (s.getCode() == ImportExportImpl.IGNORE_LOCAL_REPOSITORY)
hasFeaturesIgnored = true;
- assertTrue("Should have features ignored due to they're installed from local repository.", hasFeaturesIgnored);
+ assertTrue("Should have features ignored due to they're installed from local repository.",
+ hasFeaturesIgnored);
}
} finally {
testFile.delete();
}
}
- public void testAllowExportFeaturesInstalledFromLocal() throws ProvisionException, OperationCanceledException, IOException {
+ public void testAllowExportFeaturesInstalledFromLocal()
+ throws ProvisionException, OperationCanceledException, IOException {
File testFile = File.createTempFile("test", "p2f");
try {
- IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metaManager = getAgent().getService(IMetadataRepositoryManager.class);
File localRepoFile = getTestData("Error load data", "testData/importexport/repo1");
IMetadataRepository repo = metaManager.loadRepository(localRepoFile.toURI(), null);
assertNotNull("Fail to load local repo", repo);
IInstallableUnit iu = createIU("A", Version.create("1.0.0"));
try (OutputStream output = new FileOutputStream(testFile)) {
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, true, null);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] { iu }, true, null);
assertTrue(status.isOK());
}
} finally {
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
index b0c629150..c9ab3a6ef 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
@@ -87,14 +87,16 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes
install((nested = createIU(NESTEDIU)), false, false);
install((locked = createIU(LOCKEDIU)), true, true);
uninstalled = createIU(UNINSTALLEDIU);
- IUpdateDescriptor update = MetadataFactory.createUpdateDescriptor(TOPLEVELIU, new VersionRange("[1.0.0, 1.0.0]"), 0, "update description");
- upgrade = createIU(TOPLEVELIU, Version.createOSGi(2, 0, 0), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, null, NO_TP_DATA, false, update, NO_REQUIRES);
+ IUpdateDescriptor update = MetadataFactory.createUpdateDescriptor(TOPLEVELIU,
+ new VersionRange("[1.0.0, 1.0.0]"), 0, "update description");
+ upgrade = createIU(TOPLEVELIU, Version.createOSGi(2, 0, 0), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, null,
+ NO_TP_DATA, false, update, NO_REQUIRES);
category = createNamedIU(CATEGORYIU, CATEGORYIU, Version.create("1.0.0"), true);
- createTestMetdataRepository(new IInstallableUnit[] {top1, top2, uninstalled, upgrade});
+ createTestMetdataRepository(new IInstallableUnit[] { top1, top2, uninstalled, upgrade });
- metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
- artifactManager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ metaManager = getAgent().getService(IMetadataRepositoryManager.class);
+ artifactManager = getAgent().getService(IArtifactRepositoryManager.class);
File site = new File(TestActivator.getTestDataFolder().toString(), TEST_REPO_PATH);
testRepoLocation = site.toURI();
metaManager.addRepository(testRepoLocation);
@@ -137,15 +139,18 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes
req.setInstallableUnitProfileProperty(iu, IProfile.PROP_PROFILE_ROOT_IU, Boolean.toString(true));
}
if (lock) {
- req.setInstallableUnitProfileProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU, Integer.valueOf(IProfile.LOCK_UNINSTALL | IProfile.LOCK_UPDATE).toString());
+ req.setInstallableUnitProfileProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU,
+ Integer.valueOf(IProfile.LOCK_UNINSTALL | IProfile.LOCK_UPDATE).toString());
}
// Use an empty provisioning context to prevent repo access
ProvisioningContext context = new ProvisioningContext(getAgent());
context.setMetadataRepositories(new URI[] {});
- IProvisioningPlan plan = getPlanner(getSession().getProvisioningAgent()).getProvisioningPlan(req, context, getMonitor());
+ IProvisioningPlan plan = getPlanner(getSession().getProvisioningAgent()).getProvisioningPlan(req, context,
+ getMonitor());
if (plan.getStatus().getSeverity() == IStatus.ERROR || plan.getStatus().getSeverity() == IStatus.CANCEL)
return plan.getStatus();
- return getSession().performProvisioningPlan(plan, PhaseSetFactory.createDefaultPhaseSet(), new ProvisioningContext(getAgent()), getMonitor());
+ return getSession().performProvisioningPlan(plan, PhaseSetFactory.createDefaultPhaseSet(),
+ new ProvisioningContext(getAgent()), getMonitor());
}
protected IInstallableUnit createNamedIU(String id, String name, Version version, boolean isCategory) {
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java
index 3f0c56f84..8c102ab0b 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java
@@ -39,8 +39,9 @@ import org.osgi.framework.Constants;
*/
public class RemediationTest extends WizardTest {
- // private static final String AVAILABLE_SOFTWARE_PAGE = "AvailableSoftwarePage";
- // private static final String MAIN_IU = "MainIU";
+ // private static final String AVAILABLE_SOFTWARE_PAGE =
+ // "AvailableSoftwarePage";
+ // private static final String MAIN_IU = "MainIU";
public static final int INSTALLATION_SUCCEEDED = 1;
public static final int INSTALLATION_REMEDIATED = 2;
public static final int INSTALLATION_FAILED = 3;
@@ -63,7 +64,7 @@ public class RemediationTest extends WizardTest {
IInstallableUnit toInstall;
public void visibleSetup(int type) throws Exception {
- //Clearout repositories
+ // Clearout repositories
name = "PROFILE_" + type;
URI[] repos = getMetadataRepositoryManager().getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
for (URI uri : repos) {
@@ -86,41 +87,43 @@ public class RemediationTest extends WizardTest {
regLicenseManager = TestActivator.getContext().registerService(LicenseManager.class, manager, properties);
profileElement = new ProfileElement(null, name);
IULoader.loadIUs(this);
- ILicense[] licenses = new ILicense[] {MetadataFactory.createLicense(URI.create("http://eclipse.org"), "license text"), MetadataFactory.createLicense(URI.create("http://apache.org"), "license text2")};
+ ILicense[] licenses = new ILicense[] {
+ MetadataFactory.createLicense(URI.create("http://eclipse.org"), "license text"),
+ MetadataFactory.createLicense(URI.create("http://apache.org"), "license text2") };
((InstallableUnit) jboss60).setLicenses(licenses);
switch (type) {
- case INSTALLATION_SUCCEEDED :
- createTestMetdataRepository(new IInstallableUnit[] {jboss60, m2e11, m2e12});
- install(m2e12, true, false);
- toInstall = jboss60;
- break;
- case INSTALLATION_REMEDIATED :
- createTestMetdataRepository(new IInstallableUnit[] {jboss60, m2e11, m2e12});
- install(m2e11, true, false);
- toInstall = jboss60;
- break;
- case INSTALLATION_FAILED :
- createTestMetdataRepository(new IInstallableUnit[] {jboss60, m2e11});
- install(m2e11, true, false);
- toInstall = jboss60;
- break;
- case CHECK_FOR_UPDATES :
- createTestMetdataRepository(new IInstallableUnit[] {jboss60, m2e11, m2e12});
- install(m2e11, true, false);
- break;
- case UPDATE_ONE_IU :
- createTestMetdataRepository(new IInstallableUnit[] {jboss55, jboss60, m2e11, m2e12});
- install(jboss55, true, false);
- install(m2e11, true, false);
- break;
- default :
- createTestMetdataRepository(new IInstallableUnit[] {jboss60, m2e11});
- install(m2e11, true, false);
+ case INSTALLATION_SUCCEEDED:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss60, m2e11, m2e12 });
+ install(m2e12, true, false);
+ toInstall = jboss60;
+ break;
+ case INSTALLATION_REMEDIATED:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss60, m2e11, m2e12 });
+ install(m2e11, true, false);
+ toInstall = jboss60;
+ break;
+ case INSTALLATION_FAILED:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss60, m2e11 });
+ install(m2e11, true, false);
+ toInstall = jboss60;
+ break;
+ case CHECK_FOR_UPDATES:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss60, m2e11, m2e12 });
+ install(m2e11, true, false);
+ break;
+ case UPDATE_ONE_IU:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss55, jboss60, m2e11, m2e12 });
+ install(jboss55, true, false);
+ install(m2e11, true, false);
+ break;
+ default:
+ createTestMetdataRepository(new IInstallableUnit[] { jboss60, m2e11 });
+ install(m2e11, true, false);
}
- metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
- artifactManager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ metaManager = getAgent().getService(IMetadataRepositoryManager.class);
+ artifactManager = getAgent().getService(IArtifactRepositoryManager.class);
File site = new File(TestActivator.getTestDataFolder().toString(), TEST_REPO_PATH);
testRepoLocation = site.toURI();
metaManager.addRepository(testRepoLocation);
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java
index 1349af791..a378d88dd 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java
@@ -47,7 +47,7 @@ public class TranslationSupportTests extends AbstractQueryTest {
}
public void testFeatureProperties() {
- IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMan = getAgent().getService(IMetadataRepositoryManager.class);
File site = getTestData("0.1", "/testData/metadataRepo/externalized");
URI location = site.toURI();
IMetadataRepository repository;
@@ -57,7 +57,8 @@ public class TranslationSupportTests extends AbstractQueryTest {
fail("1.99", e);
return;
}
- IQueryResult<IInstallableUnit> result = repository.query(QueryUtil.createIUQuery("test.feature.feature.group"), getMonitor());
+ IQueryResult<IInstallableUnit> result = repository.query(QueryUtil.createIUQuery("test.feature.feature.group"),
+ getMonitor());
assertTrue("1.0", !result.isEmpty());
IInstallableUnit unit = result.iterator().next();
@@ -65,7 +66,7 @@ public class TranslationSupportTests extends AbstractQueryTest {
assertEquals("1.1", "Test Copyright", copyright.getBody());
ILicense license = unit.getLicenses(null).iterator().next();
assertEquals("1.2", "Test License", license.getBody());
- // assertEquals("1.3", "license.html", license.getURL().toExternalForm());
+ // assertEquals("1.3", "license.html", license.getURL().toExternalForm());
String name = unit.getProperty(IInstallableUnit.PROP_NAME, null);
assertEquals("1.4", "Test Feature Name", name);
String description = unit.getProperty(IInstallableUnit.PROP_DESCRIPTION, null);
@@ -78,13 +79,16 @@ public class TranslationSupportTests extends AbstractQueryTest {
String germanLicense = "German License";
String canadianFRLicense = "Canadian French License";
- // Create a IU that has a license, but the license body is simply %license. This will be filled in by
+ // Create a IU that has a license, but the license body is simply %license. This
+ // will be filled in by
// a fragment
org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription iuDescription = new org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription();
iuDescription.setId("some IU");
iuDescription.setVersion(Version.createOSGi(1, 0, 0));
- iuDescription.setLicenses(new ILicense[] {MetadataFactory.createLicense(new URI("http://example.com"), "%license")});
- iuDescription.addProvidedCapabilities(Collections.singleton(MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "some IU", Version.createOSGi(1, 0, 0))));
+ iuDescription.setLicenses(
+ new ILicense[] { MetadataFactory.createLicense(new URI("http://example.com"), "%license") });
+ iuDescription.addProvidedCapabilities(Collections.singleton(MetadataFactory
+ .createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "some IU", Version.createOSGi(1, 0, 0))));
IInstallableUnit iu = MetadataFactory.createInstallableUnit(iuDescription);
// Create a bunch of fragments which spec our IU as their host
@@ -93,36 +97,47 @@ public class TranslationSupportTests extends AbstractQueryTest {
org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription installableUnitFragmentDescription = new org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription();
installableUnitFragmentDescription.setId("fragment number: " + i);
installableUnitFragmentDescription.setVersion(Version.createOSGi(1, 0, 0));
- installableUnitFragmentDescription.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false)});
- installableUnitFragmentDescription.setProperty(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT, "true");
- IInstallableUnitFragment iuFragment = MetadataFactory.createInstallableUnitFragment(installableUnitFragmentDescription);
+ installableUnitFragmentDescription.setHost(new IRequirement[] { MetadataFactory
+ .createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false) });
+ installableUnitFragmentDescription.setProperty(
+ org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT,
+ "true");
+ IInstallableUnitFragment iuFragment = MetadataFactory
+ .createInstallableUnitFragment(installableUnitFragmentDescription);
profile.addInstallableUnit(iuFragment);
}
// Create fragment with a German license
org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription installableUnitFragmentDescription = new org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription();
- IProvidedCapability providedCapability = MetadataFactory.createProvidedCapability("org.eclipse.equinox.p2.localization", "de", Version.createOSGi(1, 0, 0));
+ IProvidedCapability providedCapability = MetadataFactory
+ .createProvidedCapability("org.eclipse.equinox.p2.localization", "de", Version.createOSGi(1, 0, 0));
ArrayList<IProvidedCapability> list = new ArrayList<>();
list.add(providedCapability);
installableUnitFragmentDescription.addProvidedCapabilities(list);
installableUnitFragmentDescription.setId("german fragment");
installableUnitFragmentDescription.setVersion(Version.createOSGi(1, 0, 0));
- installableUnitFragmentDescription.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false)});
- installableUnitFragmentDescription.setProperty(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT, "true");
+ installableUnitFragmentDescription.setHost(new IRequirement[] { MetadataFactory
+ .createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false) });
+ installableUnitFragmentDescription.setProperty(
+ org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT, "true");
installableUnitFragmentDescription.setProperty("de.license", germanLicense);
- IInstallableUnitFragment iuFragment = MetadataFactory.createInstallableUnitFragment(installableUnitFragmentDescription);
+ IInstallableUnitFragment iuFragment = MetadataFactory
+ .createInstallableUnitFragment(installableUnitFragmentDescription);
profile.addInstallableUnit(iuFragment);
// Create a French fragment with an fr_CA license
installableUnitFragmentDescription = new org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription();
- providedCapability = MetadataFactory.createProvidedCapability("org.eclipse.equinox.p2.localization", "fr", Version.createOSGi(1, 0, 0));
+ providedCapability = MetadataFactory.createProvidedCapability("org.eclipse.equinox.p2.localization", "fr",
+ Version.createOSGi(1, 0, 0));
list = new ArrayList<>();
list.add(providedCapability);
installableUnitFragmentDescription.addProvidedCapabilities(list);
installableUnitFragmentDescription.setId("cnd french fragment");
installableUnitFragmentDescription.setVersion(Version.createOSGi(1, 0, 0));
- installableUnitFragmentDescription.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false)});
- installableUnitFragmentDescription.setProperty(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT, "true");
+ installableUnitFragmentDescription.setHost(new IRequirement[] { MetadataFactory
+ .createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "some IU", ANY_VERSION, null, false, false) });
+ installableUnitFragmentDescription.setProperty(
+ org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription.PROP_TYPE_FRAGMENT, "true");
installableUnitFragmentDescription.setProperty("fr_CA.license", canadianFRLicense);
iuFragment = MetadataFactory.createInstallableUnitFragment(installableUnitFragmentDescription);
diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF
index 61f0b5596..f9c55c2d4 100644
--- a/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Test Install Verifier
Bundle-SymbolicName: org.eclipse.equinox.p2.tests.verifier;singleton:=true
-Bundle-Version: 1.2.100.qualifier
+Bundle-Version: 1.2.200.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.tests.verifier.Activator
Export-Package: org.eclipse.equinox.internal.p2.tests.verifier;x-internal:=true
Require-Bundle: org.eclipse.core.runtime,
diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/pom.xml b/bundles/org.eclipse.equinox.p2.tests.verifier/pom.xml
index d777d4366..cfc27292e 100644
--- a/bundles/org.eclipse.equinox.p2.tests.verifier/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.tests.verifier/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.tests.verifier</artifactId>
- <version>1.2.100-SNAPSHOT</version>
+ <version>1.2.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
index c33753094..484a0447e 100644
--- a/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
+++ b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
@@ -283,7 +283,7 @@ public class VerifierApplication implements IApplication {
* Ensure we have a profile registry and can access the SELF profile.
*/
private IStatus checkProfileRegistry() {
- IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+ IProfileRegistry registry = agent.getService(IProfileRegistry.class);
if (registry == null)
return createError("Profile registry service not available."); //$NON-NLS-1$
IProfile profile = registry.getProfile(IProfileRegistry.SELF);
@@ -344,7 +344,7 @@ public class VerifierApplication implements IApplication {
if (properties.getProperty("checkMigration.cancelAnswer") == null)
return;
new Display();
- IProfileRegistry reg = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+ IProfileRegistry reg = agent.getService(IProfileRegistry.class);
IProfile profile = reg.getProfile(IProfileRegistry.SELF);
MigrationWizard wizardPage = new MigrationWizard(profile, Collections.emptyList(), new URI[0], false);
@@ -440,7 +440,7 @@ public class VerifierApplication implements IApplication {
if (properties.getProperty("checkProfileResetFlag") == null || "false".equals(properties.getProperty("checkProfileResetFlag")))
return Status.OK_STATUS;
//Make sure that the profile is already loaded
- IProfileRegistry reg = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+ IProfileRegistry reg = agent.getService(IProfileRegistry.class);
IProfile profile = reg.getProfile(IProfileRegistry.SELF);
String profileId = profile.getProfileId();
@@ -465,7 +465,7 @@ public class VerifierApplication implements IApplication {
if (properties.getProperty("checkMigrationWizard") == null)
return Status.OK_STATUS;
- IProfileRegistry reg = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+ IProfileRegistry reg = agent.getService(IProfileRegistry.class);
IProfile profile = reg.getProfile(IProfileRegistry.SELF);
//Fake the opening of the wizard
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
index 45b687881..d8790d442 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
@@ -336,7 +336,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
public static IDirector createDirector() {
- return (IDirector) getAgent().getService(IDirector.SERVICE_NAME);
+ return getAgent().getService(IDirector.class);
}
/**
@@ -368,7 +368,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
public static IEngine createEngine() {
- return (IEngine) getAgent().getService(IEngine.SERVICE_NAME);
+ return getAgent().getService(IEngine.class);
}
/**
@@ -613,7 +613,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
public static IPlanner createPlanner() {
- return (IPlanner) getAgent().getService(IPlanner.SERVICE_NAME);
+ return getAgent().getService(IPlanner.class);
}
/**
@@ -912,19 +912,19 @@ public abstract class AbstractProvisioningTest extends TestCase {
protected static IAgentLocation getAgentLocation() {
//get the location of the currently running system
- return (IAgentLocation) getAgent().getService(IAgentLocation.SERVICE_NAME);
+ return getAgent().getService(IAgentLocation.class);
}
protected static IArtifactRepositoryManager getArtifactRepositoryManager() {
- return (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ return getAgent().getService(IArtifactRepositoryManager.class);
}
protected IProfileRegistry getProfileRegistry() {
- return (IProfileRegistry) getAgent().getService(IProfileRegistry.SERVICE_NAME);
+ return getAgent().getService(IProfileRegistry.class);
}
protected Transport getTransport() {
- return (Transport) getAgent().getService(Transport.SERVICE_NAME);
+ return getAgent().getService(Transport.class);
}
protected IMetadataRepository createMetadataRepository(URI location, Map<String, String> properties) throws ProvisionException {
@@ -959,7 +959,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
protected static IMetadataRepositoryManager getMetadataRepositoryManager() {
- return (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ return getAgent().getService(IMetadataRepositoryManager.class);
}
public static String getUniqueString() {
@@ -1167,7 +1167,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
protected IProvisioningEventBus getEventBus() {
- IProvisioningEventBus bus = (IProvisioningEventBus) getAgent().getService(IProvisioningEventBus.SERVICE_NAME);
+ IProvisioningEventBus bus = getAgent().getService(IProvisioningEventBus.class);
assertNotNull(bus);
return bus;
}
@@ -1627,11 +1627,11 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
public IEngine getEngine() {
- return (IEngine) getAgent().getService(IEngine.SERVICE_NAME);
+ return getAgent().getService(IEngine.class);
}
public IPlanner getPlanner(IProvisioningAgent agent) {
- return (IPlanner) agent.getService(IPlanner.SERVICE_NAME);
+ return agent.getService(IPlanner.class);
}
public void assertNoContents(File file, String[] lines) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestAgentProvider.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestAgentProvider.java
index 50ab98d5c..11c87de6b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestAgentProvider.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestAgentProvider.java
@@ -15,10 +15,14 @@ package org.eclipse.equinox.p2.tests;
import java.io.File;
import java.io.IOException;
-import org.eclipse.equinox.p2.core.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.junit.rules.ExternalResource;
import org.junit.rules.TemporaryFolder;
-import org.osgi.framework.*;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
/**
* Provides {@link IProvisioningAgent} instances for tests. Use as JUnit 4 {@link Rule}.
@@ -72,7 +76,7 @@ public final class TestAgentProvider extends ExternalResource {
/**
* Returns a service from the current agent.
- *
+ *
* @see #getAgent()
*/
public <T> T getService(Class<T> type) throws ProvisionException {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java
index 314ed8063..2504d4a2e 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java
@@ -14,7 +14,10 @@
package org.eclipse.equinox.p2.tests.artifact.repository;
import java.io.File;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactDescriptor;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
@@ -75,7 +78,7 @@ public class ArtifactLockingTest extends AbstractProvisioningTest {
Thread.sleep(100);
}
- IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager artifactManager = getAgent().getService(IArtifactRepositoryManager.class);
boolean expected = false;
try {
artifactManager.loadRepository(targetLocation.toURI(), progressMonitor);
@@ -102,7 +105,7 @@ public class ArtifactLockingTest extends AbstractProvisioningTest {
while (!canContinue) {
Thread.sleep(100);
}
- IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager artifactManager = getAgent().getService(IArtifactRepositoryManager.class);
SimpleArtifactRepository artifactRepository = (SimpleArtifactRepository) artifactManager.loadRepository(targetLocation.toURI(), new NullProgressMonitor());
assertEquals(1, artifactRepository.getDescriptors().size());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java
index ea0eb8209..16b9ed323 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java
@@ -14,7 +14,9 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.repository;
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
import java.net.URI;
import java.net.URISyntaxException;
import junit.framework.Test;
@@ -29,7 +31,10 @@ import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
-import org.eclipse.equinox.p2.tests.*;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.p2.tests.StringBufferStream;
+import org.eclipse.equinox.p2.tests.TestActivator;
+import org.eclipse.equinox.p2.tests.TestRepositoryListener;
import org.eclipse.equinox.security.storage.EncodingUtils;
import org.osgi.framework.BundleException;
import org.osgi.service.prefs.BackingStoreException;
@@ -121,7 +126,7 @@ public class ArtifactRepositoryManagerTest extends AbstractProvisioningTest {
//bash the repository preference file (don't try this at home, kids)
final String REPO_BUNDLE = "org.eclipse.equinox.p2.artifact.repository";
IPreferencesService prefService = ServiceHelper.getService(TestActivator.getContext(), IPreferencesService.class);
- IAgentLocation agentLocation = (IAgentLocation) getAgent().getService(IAgentLocation.SERVICE_NAME);
+ IAgentLocation agentLocation = getAgent().getService(IAgentLocation.class);
String locationString = EncodingUtils.encodeSlashes(agentLocation.getRootLocation().toString());
Preferences prefs = prefService.getRootNode().node("/profile/" + locationString + "/_SELF_/" + REPO_BUNDLE + "/repositories"); //$NON-NLS-1$ //$NON-NLS-2$
try {
@@ -141,7 +146,7 @@ public class ArtifactRepositoryManagerTest extends AbstractProvisioningTest {
}
//everybody's happy again
- manager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ manager = getAgent().getService(IArtifactRepositoryManager.class);
assertTrue("1.0", manager.contains(location));
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java
index e32dd12d8..827d5aaa7 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java
@@ -13,16 +13,26 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.repository;
-import java.io.*;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
import java.net.URI;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.p2.core.ProvisionException;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.engine.IEngine;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
-import org.eclipse.equinox.p2.repository.artifact.*;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
@@ -40,7 +50,7 @@ public class Bug265577 extends AbstractProvisioningTest {
super.setUp();
profile = createProfile(Bug265577.class.getName());
- engine = (IEngine) getAgent().getService(IEngine.SERVICE_NAME);
+ engine = getAgent().getService(IEngine.class);
// Load repositories
File repoLocation = getTestData("Repository location", "/testData/bug265577/zipRepo.zip");
if (repoLocation == null)
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java
index 3adeca2cd..9a607f1c3 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java
@@ -15,17 +15,39 @@ package org.eclipse.equinox.p2.tests.artifact.repository;
import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.errorStatus;
import static org.eclipse.equinox.p2.tests.publisher.actions.StatusMatchers.statusWithMessageWhich;
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertThat;
-import java.io.*;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
import java.lang.reflect.Field;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.artifact.repository.*;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
+import org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRepositoryManager;
+import org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRequest;
+import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
+import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepositoryFactory;
+import org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
@@ -38,9 +60,15 @@ import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.repository.IRepository;
-import org.eclipse.equinox.p2.repository.artifact.*;
+import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
-import org.eclipse.equinox.p2.tests.*;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.p2.tests.StringBufferStream;
+import org.eclipse.equinox.p2.tests.TestArtifactRepository;
import org.eclipse.equinox.spi.p2.publisher.PublisherHelper;
public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
@@ -1038,7 +1066,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
source.addChild(child.getLocation());
// Create mirror request
- MirrorRequest request = new MirrorRequest(descriptor.getArtifactKey(), destination, null, null, (Transport) getAgent().getService(Transport.SERVICE_NAME));
+ MirrorRequest request = new MirrorRequest(descriptor.getArtifactKey(), destination, null, null, getAgent().getService(Transport.class));
request.perform(source, new NullProgressMonitor());
IStatus status = request.getResult();
// The download should have completed 'successfully'
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java
index 720eabcff..49f78b0d8 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java
@@ -19,14 +19,18 @@ import java.io.FileFilter;
import java.net.URL;
import java.util.Iterator;
import junit.framework.TestCase;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.query.IQueryResult;
-import org.eclipse.equinox.p2.repository.artifact.*;
+import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
import org.eclipse.equinox.p2.tests.TestActivator;
@@ -47,7 +51,7 @@ public class FoldersRepositoryTest extends TestCase {
@Override
protected void setUp() throws Exception {
IProvisioningAgent agent = ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class);
- manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
+ manager = agent.getService(IArtifactRepositoryManager.class);
}
@Override
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/JarURLArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/JarURLArtifactRepositoryTest.java
index 575a4edc8..4c838d1db 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/JarURLArtifactRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/JarURLArtifactRepositoryTest.java
@@ -15,7 +15,10 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.repository;
-import java.net.*;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
import junit.framework.TestCase;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
@@ -42,7 +45,7 @@ public class JarURLArtifactRepositoryTest extends TestCase {
@Override
protected void setUp() throws Exception {
IProvisioningAgent agent = ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class);
- manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
+ manager = agent.getService(IArtifactRepositoryManager.class);
}
@Override
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
index 81f34ef26..df7ed61a4 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
@@ -13,14 +13,23 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.repository;
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
import java.lang.reflect.Field;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.*;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Queue;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest;
import org.eclipse.equinox.internal.p2.artifact.repository.MirrorSelector;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
@@ -29,14 +38,22 @@ import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.repository.IRepository;
-import org.eclipse.equinox.p2.repository.artifact.*;
+import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest;
import org.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository;
import org.eclipse.equinox.p2.repository.spi.AbstractRepository;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
import org.eclipse.equinox.p2.tests.AbstractWrappedArtifactRepository;
-import org.w3c.dom.*;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
public class MirrorRequestTest extends AbstractProvisioningTest {
private static final String testDataLocation = "testData/artifactRepo/emptyJarRepo";
@@ -74,7 +91,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest {
IArtifactKey key = new ArtifactKey("org.eclipse.update.feature", "HelloWorldFeature", Version.createOSGi(1, 0, 0));
Map<String, String> targetProperties = new HashMap<>();
targetProperties.put("artifact.folder", "true");
- MirrorRequest request = new MirrorRequest(key, targetRepository, null, targetProperties, (Transport) getAgent().getService(Transport.SERVICE_NAME));
+ MirrorRequest request = new MirrorRequest(key, targetRepository, null, targetProperties, getAgent().getService(Transport.class));
request.perform(sourceRepository, new NullProgressMonitor());
assertTrue(request.getResult().matches(IStatus.ERROR));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest2.java
index 6073e6521..3c28a739c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest2.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest2.java
@@ -19,7 +19,9 @@ import java.lang.reflect.Field;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest;
import org.eclipse.equinox.internal.p2.artifact.repository.MirrorSelector;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
@@ -29,9 +31,13 @@ import org.eclipse.equinox.internal.p2.transport.ecf.RepositoryTransport;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.repository.IRepository;
-import org.eclipse.equinox.p2.repository.artifact.*;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest;
import org.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
import org.eclipse.equinox.p2.tests.testserver.helper.AbstractTestServerClientCase;
@@ -52,13 +58,13 @@ public class MirrorRequestTest2 extends AbstractTestServerClientCase {
URI location = URI.create(getBaseURL() + "/mirrorrequest");
- IArtifactRepositoryManager mgr = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager mgr = getAgent().getService(IArtifactRepositoryManager.class);
sourceRepository = (SimpleArtifactRepository) mgr.loadRepository(location, null);
}
@Override
public void tearDown() throws Exception {
- IArtifactRepositoryManager mgr = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager mgr = getAgent().getService(IArtifactRepositoryManager.class);
mgr.removeRepository(targetLocation.toURI());
AbstractProvisioningTest.delete(targetLocation);
super.tearDown();
@@ -67,11 +73,11 @@ public class MirrorRequestTest2 extends AbstractTestServerClientCase {
public void testRetryMirrorAfterTimeout() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
// call test
IArtifactKey key = new ArtifactKey("test.txt", "HelloWorldText", Version.parseVersion("1.0.0"));
- MirrorRequest request = new MirrorRequest(key, targetRepository, null, null, (Transport) getAgent().getService(Transport.SERVICE_NAME));
+ MirrorRequest request = new MirrorRequest(key, targetRepository, null, null, getAgent().getService(Transport.class));
MirrorRepo mirrorRepo = new MirrorRepo(sourceRepository);
Field field = sourceRepository.getClass().getDeclaredField("mirrors");
field.setAccessible(true);
- field.set(sourceRepository, new MirrorSelector(mirrorRepo, (Transport) getAgent().getService(Transport.SERVICE_NAME)) {
+ field.set(sourceRepository, new MirrorSelector(mirrorRepo, getAgent().getService(Transport.class)) {
private int count = 0;
@Override
@@ -99,7 +105,7 @@ public class MirrorRequestTest2 extends AbstractTestServerClientCase {
System.setProperty(RepositoryTransport.TIMEOUT_RETRY, "4");
// call test
IArtifactKey key = new ArtifactKey("test.txt", "HelloWorldText", Version.parseVersion("1.0.0"));
- MirrorRequest request = new MirrorRequest(key, targetRepository, null, null, (Transport) getAgent().getService(Transport.SERVICE_NAME));
+ MirrorRequest request = new MirrorRequest(key, targetRepository, null, null, getAgent().getService(Transport.class));
request.perform(sourceRepository, new NullProgressMonitor());
// The download succeeded
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/StatsTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/StatsTest.java
index 4c6bd903d..8a6b009f1 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/StatsTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/StatsTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2017 WindRiver Corporation and others.
+ * Copyright (c) 2012, 2019 WindRiver Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,9 +13,17 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.repository;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
import java.net.URI;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest;
@@ -25,9 +33,19 @@ import org.eclipse.equinox.internal.p2.engine.Profile;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.p2.repository.AuthenticationFailedException;
import org.eclipse.equinox.internal.p2.repository.Transport;
-import org.eclipse.equinox.p2.engine.*;
-import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.engine.IEngine;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IProvidedCapability;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.metadata.MetadataFactory;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
+import org.eclipse.equinox.p2.metadata.Version;
+import org.eclipse.equinox.p2.metadata.VersionRange;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.IRepository;
@@ -54,7 +72,7 @@ public class StatsTest extends AbstractTestServerClientCase {
@Override
public void setUp() throws Exception {
super.setUp();
- IArtifactRepositoryManager artifactRepositoryManager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager artifactRepositoryManager = getAgent().getService(IArtifactRepositoryManager.class);
String tempDir = System.getProperty("java.io.tmpdir");
repositoryFile = new File(tempDir, "SimpleArtifactRepositoryTest");
AbstractProvisioningTest.delete(repositoryFile);
@@ -74,7 +92,7 @@ public class StatsTest extends AbstractTestServerClientCase {
((ArtifactDescriptor) descriptors[1]).setProperty("download.stats", "testKeyId2");
sourceRepo.addDescriptors(descriptors, null);
- IMetadataRepositoryManager manager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager manager = getAgent().getService(IMetadataRepositoryManager.class);
properties = new HashMap<>();
properties.put(IRepository.PROP_COMPRESSED, "true");
metaRepo = manager.createRepository(repositoryURI, "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
@@ -108,8 +126,8 @@ public class StatsTest extends AbstractTestServerClientCase {
super.tearDown();
//repository location is not used by all tests
if (repositoryURI != null) {
- ((IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME)).removeRepository(repositoryURI);
- ((IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME)).removeRepository(repositoryURI);
+ getAgent().getService(IArtifactRepositoryManager.class).removeRepository(repositoryURI);
+ getAgent().getService(IMetadataRepositoryManager.class).removeRepository(repositoryURI);
repositoryURI = null;
}
if (repositoryFile != null) {
@@ -117,7 +135,7 @@ public class StatsTest extends AbstractTestServerClientCase {
repositoryFile = null;
}
if (targetLocation != null) {
- ((IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME)).removeRepository(targetLocation.toURI());
+ getAgent().getService(IArtifactRepositoryManager.class).removeRepository(targetLocation.toURI());
AbstractProvisioningTest.delete(targetLocation);
targetLocation = null;
}
@@ -129,7 +147,7 @@ public class StatsTest extends AbstractTestServerClientCase {
public void testCustomizedDownloadStats() throws CoreException, IOException {
IArtifactKey key = new ArtifactKey(PublisherHelper.BINARY_ARTIFACT_CLASSIFIER, "testKeyId", Version.parseVersion("1.2.3"));
- MirrorRequest request = new MirrorRequest(key, targetRepository, null, null, (Transport) getAgent().getService(Transport.SERVICE_NAME), "package=test");
+ MirrorRequest request = new MirrorRequest(key, targetRepository, null, null, getAgent().getService(Transport.class), "package=test");
request.perform(sourceRepo, new NullProgressMonitor());
assertTrue("Failed on mirroring artifact.", request.getResult().isOK());
@@ -137,7 +155,7 @@ public class StatsTest extends AbstractTestServerClientCase {
}
protected void checkStatsResult(final String checkpoint) throws FileNotFoundException, CoreException, AuthenticationFailedException, IOException {
- final Transport transport = (Transport) getAgent().getService(Transport.SERVICE_NAME);
+ final Transport transport = getAgent().getService(Transport.class);
try (BufferedReader statsResult = new BufferedReader(new InputStreamReader(transport.stream(statsURL, null)))) {
String line = statsResult.readLine();
@@ -151,7 +169,7 @@ public class StatsTest extends AbstractTestServerClientCase {
}
public void testDownloadStatsWhileInstall() throws AuthenticationFailedException, FileNotFoundException, CoreException, IOException {
- IProfileRegistry registry = (IProfileRegistry) getAgent().getService(IProfileRegistry.SERVICE_NAME);
+ IProfileRegistry registry = getAgent().getService(IProfileRegistry.class);
final String profileName = "downloadStats";
Map<String, String> properties = new HashMap<>();
properties.put(IProfile.PROP_STATS_PARAMETERS, "os=linux&ws=gtk&package=jee");
@@ -162,12 +180,12 @@ public class StatsTest extends AbstractTestServerClientCase {
Profile profile = (Profile) registry.addProfile(profileName, properties);
ProfileChangeRequest req = new ProfileChangeRequest(profile);
req.addInstallableUnits(metaRepo.query(QueryUtil.ALL_UNITS, null).toArray(IInstallableUnit.class));
- IPlanner planner = (IPlanner) getAgent().getService(IPlanner.SERVICE_NAME);
+ IPlanner planner = getAgent().getService(IPlanner.class);
ProvisioningContext context = new ProvisioningContext(getAgent());
context.setArtifactRepositories(new URI[] {repositoryURI});
context.setMetadataRepositories(new URI[] {repositoryURI});
IProvisioningPlan plan = planner.getProvisioningPlan(req, context, null);
- IEngine engine = (IEngine) getAgent().getService(IEngine.SERVICE_NAME);
+ IEngine engine = getAgent().getService(IEngine.class);
assertTrue("Failed on install test iu.", engine.perform(plan, null).isOK());
profile = (Profile) registry.getProfile(profileName);
assertEquals("Didn't install iu.", 1, profile.query(QueryUtil.ALL_UNITS, null).toUnmodifiableSet().size());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java
index b539dff89..fd4e953e9 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Red Hat Inc. - Bug 460967
@@ -16,7 +16,9 @@ package org.eclipse.equinox.p2.tests.core;
import java.net.URI;
import java.net.URISyntaxException;
-import org.eclipse.equinox.p2.core.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
@@ -41,19 +43,19 @@ public class ProvisioningAgentTest extends AbstractProvisioningTest {
IProvisioningAgentProvider provider = TestActivator.context.getService(providerRef);
IProvisioningAgent firstAgent = provider.createAgent(p2location);
- IProfileRegistry firstProfileRegistry = (IProfileRegistry) firstAgent.getService(IProfileRegistry.SERVICE_NAME);
+ IProfileRegistry firstProfileRegistry = firstAgent.getService(IProfileRegistry.class);
firstProfileRegistry.removeProfile(PROFILE_ID);
firstProfileRegistry.addProfile(PROFILE_ID);
- IMetadataRepositoryManager firstMdrMgr = (IMetadataRepositoryManager) firstAgent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager firstMdrMgr = firstAgent.getService(IMetadataRepositoryManager.class);
firstMdrMgr.addRepository(repoLocation);
firstMdrMgr.setEnabled(repoLocation, false);
firstAgent.stop();
IProvisioningAgent secondAgent = provider.createAgent(p2location);
- IProfileRegistry secondProfileRegistry = (IProfileRegistry) secondAgent.getService(IProfileRegistry.SERVICE_NAME);
+ IProfileRegistry secondProfileRegistry = secondAgent.getService(IProfileRegistry.class);
secondProfileRegistry.removeProfile(PROFILE_ID);
secondProfileRegistry.addProfile(PROFILE_ID);
- IMetadataRepositoryManager secondMdrMgr = (IMetadataRepositoryManager) secondAgent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager secondMdrMgr = secondAgent.getService(IMetadataRepositoryManager.class);
secondMdrMgr.removeRepository(repoLocation);
secondAgent.stop();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/DirectorApplicationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/DirectorApplicationTest.java
index 21dd9b907..6923b17ba 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/DirectorApplicationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/DirectorApplicationTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Cloudsmith Inc - tests for new DirectorApplication
@@ -21,13 +21,19 @@ import java.io.File;
import java.io.PrintStream;
import java.net.MalformedURLException;
import java.net.URI;
-import java.security.*;
-import java.security.cert.*;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PublicKey;
+import java.security.SignatureException;
import java.security.cert.Certificate;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.director.app.DirectorApplication;
import org.eclipse.equinox.internal.simpleconfigurator.utils.URIUtil;
-import org.eclipse.equinox.p2.core.*;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.core.UIServices;
import org.eclipse.equinox.p2.core.UIServices.TrustInfo;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
@@ -602,7 +608,7 @@ public class DirectorApplicationTest extends AbstractProvisioningTest {
delete(destinationRepo);
}
- /**
+ /**
* Test that the application only considers repositories that are pass in and not those that are previously known
* by the managers
*/
@@ -610,8 +616,8 @@ public class DirectorApplicationTest extends AbstractProvisioningTest {
File artifactRepo1 = getTestData("12.0", "/testData/mirror/mirrorSourceRepo3");
File metadataRepo1 = getTestData("12.1", "/testData/mirror/mirrorSourceRepo3");
- IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
- IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager artifactManager = getAgent().getService(IArtifactRepositoryManager.class);
+ IMetadataRepositoryManager metadataManager = getAgent().getService(IMetadataRepositoryManager.class);
assertNotNull(artifactManager);
assertNotNull(metadataManager);
@@ -651,8 +657,8 @@ public class DirectorApplicationTest extends AbstractProvisioningTest {
File artifactRepo1 = getTestData("13.0", "/testData/mirror/mirrorSourceRepo4");
File metadataRepo1 = getTestData("13.1", "/testData/mirror/mirrorSourceRepo4");
- IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
- IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager artifactManager = getAgent().getService(IArtifactRepositoryManager.class);
+ IMetadataRepositoryManager metadataManager = getAgent().getService(IMetadataRepositoryManager.class);
assertNotNull(artifactManager);
assertNotNull(metadataManager);
@@ -752,8 +758,8 @@ public class DirectorApplicationTest extends AbstractProvisioningTest {
public void testUninstallIgnoresPassedInRepos() throws Exception {
File srcRepo = getTestData("14.0", "/testData/mirror/mirrorSourceRepo4");
- IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
- IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager artifactManager = getAgent().getService(IArtifactRepositoryManager.class);
+ IMetadataRepositoryManager metadataManager = getAgent().getService(IMetadataRepositoryManager.class);
assertNotNull(artifactManager);
assertNotNull(metadataManager);
@@ -819,7 +825,7 @@ public class DirectorApplicationTest extends AbstractProvisioningTest {
public void testAvoidTrustPromptServiceTrustsManyCertificates() {
final Certificate certificate1 = new DummyCertificate(""); //$NON-NLS-1$
final Certificate certificate2 = new DummyCertificate(""); //$NON-NLS-1$
- final TrustInfo trustInfo = getTrustInfoFor(new Certificate[][] { {certificate1}, {certificate2}});
+ final TrustInfo trustInfo = getTrustInfoFor(new Certificate[][] {{certificate1}, {certificate2}});
assertNotNull(trustInfo);
final Certificate[] trustedCertificates = trustInfo.getTrustedCertificates();
assertEquals(2, trustedCertificates.length);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java
index ad5c14e13..170698e84 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java
@@ -14,14 +14,22 @@
package org.eclipse.equinox.p2.tests.director;
import java.net.URI;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.director.DirectorActivator;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.provisional.p2.director.IDirector;
import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.equinox.p2.core.ProvisionException;
-import org.eclipse.equinox.p2.engine.*;
-import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.metadata.MetadataFactory;
+import org.eclipse.equinox.p2.metadata.Version;
+import org.eclipse.equinox.p2.metadata.VersionRange;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
@@ -64,8 +72,8 @@ public class RollbackTest extends AbstractProvisioningTest {
}
private IMetadataRepository getRollbackRepository() throws ProvisionException {
- IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
- URI location = ((IAgentLocation) getAgent().getService(IAgentLocation.SERVICE_NAME)).getDataArea(DirectorActivator.PI_DIRECTOR);
+ IMetadataRepositoryManager repoMan = getAgent().getService(IMetadataRepositoryManager.class);
+ URI location = getAgent().getService(IAgentLocation.class).getDataArea(DirectorActivator.PI_DIRECTOR);
return repoMan.loadRepository(URIUtil.append(location, "rollback"), null);
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfilePreferencesTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfilePreferencesTest.java
index ce91046ea..d2238385a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfilePreferencesTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfilePreferencesTest.java
@@ -48,7 +48,7 @@ public class ProfilePreferencesTest extends AbstractProvisioningTest {
public void testInvalidProfile() {
try {
//reading and storing for a non-existent profile shouldn't cause any errors
- IAgentLocation agentLocation = (IAgentLocation) getAgent().getService(IAgentLocation.SERVICE_NAME);
+ IAgentLocation agentLocation = getAgent().getService(IAgentLocation.class);
String locationString = EncodingUtils.encodeSlashes(agentLocation.getRootLocation().toString());
Preferences node = prefServ.getRootNode().node("/profile/" + locationString + "/NonExistantProfile/testing");
node.sync();
@@ -67,7 +67,7 @@ public class ProfilePreferencesTest extends AbstractProvisioningTest {
ProvisioningAgent agent = new ProvisioningAgent();
agent.setLocation(location);
agent.setBundleContext(TestActivator.getContext());
- IAgentLocation agentLocation = (IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME);
+ IAgentLocation agentLocation = agent.getService(IAgentLocation.class);
Hashtable<String, String> props = new Hashtable<>();
props.put("locationURI", location.toString());
ServiceRegistration<IProvisioningAgent> reg = TestActivator.getContext().registerService(IProvisioningAgent.class, agent, props);
@@ -85,7 +85,7 @@ public class ProfilePreferencesTest extends AbstractProvisioningTest {
String key = "Test";
String value = "Value";
- IAgentLocation agentLocation = (IAgentLocation) getAgent().getService(IAgentLocation.SERVICE_NAME);
+ IAgentLocation agentLocation = getAgent().getService(IAgentLocation.class);
String locationString = EncodingUtils.encodeSlashes(agentLocation.getRootLocation().toString());
try {
pref = prefServ.getRootNode().node("/profile/" + locationString + "/_SELF_/testing");
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java
index 7b446c282..c336097c9 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java
@@ -52,7 +52,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest {
}
protected void getServices() {
- registry = (IProfileRegistry) getAgent().getService(IProfileRegistry.SERVICE_NAME);
+ registry = getAgent().getService(IProfileRegistry.class);
}
private void ungetServices() {
@@ -312,11 +312,11 @@ public class ProfileRegistryTest extends AbstractProvisioningTest {
simpleRgy.lockProfile(simpleProfile);
simpleRgy.unlockProfile(simpleProfile);
// Create a lock file to confirm locking
-
+
File lockDirectory = new File(getResourceAsBundleRelFile("testData/engineTest/SimpleRegistry/"), SIMPLE_PROFILE + ".profile");
File lockFile = new File(lockDirectory, ".lock");
assertTrue("Lock file does not exist", lockFile.exists());
-
+
ProfileLock profileLock = new ProfileLock(lockDirectory);
boolean locked = profileLock.lock();
try {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest2.java
index dc38eef85..56df20e45 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest2.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest2.java
@@ -17,7 +17,9 @@ import java.net.URI;
import java.util.EventObject;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.equinox.internal.p2.core.ProvisioningAgent;
import org.eclipse.equinox.internal.p2.engine.CommitOperationEvent;
import org.eclipse.equinox.internal.p2.engine.RollbackOperationEvent;
@@ -26,7 +28,11 @@ import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
import org.eclipse.equinox.p2.core.ProvisionException;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.engine.IEngine;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
@@ -42,7 +48,7 @@ public class ProvisioningEventTest2 extends AbstractTestServerClientCase {
public void testDownloadEventFromMultipleAgents() throws ProvisionException, OperationCanceledException, InterruptedException {
ProvisioningAgent newAgent = new ProvisioningAgent();
newAgent.setBundleContext(TestActivator.getContext());
- IProvisioningEventBus eventBus = (IProvisioningEventBus) newAgent.getService(IProvisioningEventBus.SERVICE_NAME);
+ IProvisioningEventBus eventBus = newAgent.getService(IProvisioningEventBus.class);
class DownloadProvisiongEventListener implements ProvisioningListener {
boolean notifiedDownloadProgressEvent = false;
CountDownLatch latch = new CountDownLatch(1);
@@ -59,12 +65,12 @@ public class ProvisioningEventTest2 extends AbstractTestServerClientCase {
DownloadProvisiongEventListener provListener1 = new DownloadProvisiongEventListener();
eventBus.addListener(provListener);
- IProvisioningEventBus eventBus2 = (IProvisioningEventBus) getAgent().getService(IProvisioningEventBus.SERVICE_NAME);
+ IProvisioningEventBus eventBus2 = getAgent().getService(IProvisioningEventBus.class);
try {
URI repoLoc = URI.create(getBaseURL() + "/public/emptyJarRepo");
//remove any existing profile with the same name
final String name = "testProfile";
- IProfileRegistry profileRegistry = (IProfileRegistry) getAgent().getService(IProfileRegistry.SERVICE_NAME);
+ IProfileRegistry profileRegistry = getAgent().getService(IProfileRegistry.class);
profileRegistry.removeProfile(name);
IProfile profile = profileRegistry.addProfile(name, null);
// clean possible cached artifacts
@@ -73,9 +79,9 @@ public class ProvisioningEventTest2 extends AbstractTestServerClientCase {
ProvisioningContext context = new ProvisioningContext(getAgent());
context.setArtifactRepositories(new URI[] {repoLoc});
context.setMetadataRepositories(new URI[] {repoLoc});
- IEngine engine = (IEngine) getAgent().getService(IEngine.SERVICE_NAME);
+ IEngine engine = getAgent().getService(IEngine.class);
IProvisioningPlan plan = engine.createPlan(profile, context);
- IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metaManager = getAgent().getService(IMetadataRepositoryManager.class);
IQueryResult<IInstallableUnit> allIUs = metaManager.loadRepository(repoLoc, null).query(QueryUtil.ALL_UNITS, null);
for (IInstallableUnit iu : allIUs.toSet()) {
plan.addInstallableUnit(iu);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java
index ec5eb16b7..c0021b750 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java
@@ -16,26 +16,46 @@ package org.eclipse.equinox.p2.tests.full;
import java.io.File;
import java.net.URI;
-import java.util.*;
-import org.eclipse.core.runtime.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.provisional.frameworkadmin.FrameworkAdmin;
import org.eclipse.equinox.internal.provisional.p2.director.IDirector;
-import org.eclipse.equinox.p2.core.*;
-import org.eclipse.equinox.p2.engine.*;
-import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IProvidedCapability;
+import org.eclipse.equinox.p2.metadata.MetadataFactory;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.metadata.VersionedId;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
import org.eclipse.equinox.p2.tests.TestActivator;
import org.eclipse.osgi.service.environment.EnvironmentInfo;
-import org.osgi.framework.*;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
/**
@@ -54,13 +74,13 @@ public abstract class AbstractEnd2EndTest extends AbstractProvisioningTest {
ServiceReference<IProvisioningAgentProvider> sr = TestActivator.context.getServiceReference(IProvisioningAgentProvider.class);
IProvisioningAgentProvider agentFactory = TestActivator.context.getService(sr);
end2endAgent = agentFactory.createAgent(getTempFolder().toURI());
- metadataRepoManager = (IMetadataRepositoryManager) end2endAgent.getService(IMetadataRepositoryManager.SERVICE_NAME);
- artifactRepoManager = (IArtifactRepositoryManager) end2endAgent.getService(IArtifactRepositoryManager.SERVICE_NAME);
- director = (IDirector) end2endAgent.getService(IDirector.SERVICE_NAME);
+ metadataRepoManager = end2endAgent.getService(IMetadataRepositoryManager.class);
+ artifactRepoManager = end2endAgent.getService(IArtifactRepositoryManager.class);
+ director = end2endAgent.getService(IDirector.class);
}
protected IProfile createProfile(String profileId, String installFolder) {
- IProfileRegistry profileRegistry = (IProfileRegistry) end2endAgent.getService(IProfileRegistry.SERVICE_NAME);
+ IProfileRegistry profileRegistry = end2endAgent.getService(IProfileRegistry.class);
if (profileRegistry == null) {
throw new RuntimeException("Profile registry service not available");
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java
index 7d4d13d64..68a4d6971 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java
@@ -49,7 +49,7 @@ public class DirectorTest extends AbstractProvisioningTest {
throw new RuntimeException("Director could not be loaded");
}
- IMetadataRepositoryManager mgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager mgr = getAgent().getService(IMetadataRepositoryManager.class);
if (mgr == null) {
throw new RuntimeException("Repository manager could not be loaded");
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AuthTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AuthTest.java
index 5b65f0422..82d00504f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AuthTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AuthTest.java
@@ -29,7 +29,7 @@ public class AuthTest extends ServerBasedTestCase {
super.setUp();
PRIVATE_REPO = super.getBaseURL() + "/private/mdr/composite/one";
NEVER_REPO = super.getBaseURL() + "/proxy/never";
- mgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ mgr = getAgent().getService(IMetadataRepositoryManager.class);
if (mgr == null) {
throw new RuntimeException("Repository manager could not be loaded");
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java
index 548ff366f..024e357a5 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java
@@ -31,7 +31,7 @@ public class HttpStatusTest extends ServerBasedTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
- mgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ mgr = getAgent().getService(IMetadataRepositoryManager.class);
if (mgr == null) {
throw new RuntimeException("Repository manager could not be loaded");
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java
index a6835a1de..5184b2e32 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java
@@ -16,7 +16,9 @@ package org.eclipse.equinox.p2.tests.metadata.repository;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -44,7 +46,7 @@ public class MetadataRepositoryManagerExceptionsTest extends AbstractProvisionin
@Override
protected void setUp() throws Exception {
super.setUp();
- manager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ manager = getAgent().getService(IMetadataRepositoryManager.class);
}
@Override
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
index 97889f4be..1aaa7a533 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
@@ -70,7 +70,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest {
@Override
protected void setUp() throws Exception {
super.setUp();
- manager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ manager = getAgent().getService(IMetadataRepositoryManager.class);
//only enable the failing repository factory for this test to avoid noise in other tests.
FailingMetadataRepositoryFactory.FAIL = true;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/RepositorManagerDifferentAgentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/RepositorManagerDifferentAgentTest.java
index 5b9dba5d7..5bef4d418 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/RepositorManagerDifferentAgentTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/RepositorManagerDifferentAgentTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Sonatype - initial API and implementation
* IBM - ongoing development
@@ -19,10 +19,14 @@ import java.io.File;
import java.io.IOException;
import java.net.URI;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.p2.core.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
-import org.eclipse.equinox.p2.tests.*;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.p2.tests.TestActivator;
+import org.eclipse.equinox.p2.tests.TestData;
public class RepositorManagerDifferentAgentTest extends AbstractProvisioningTest {
@@ -30,9 +34,9 @@ public class RepositorManagerDifferentAgentTest extends AbstractProvisioningTest
IProvisioningAgentProvider agentProvider = ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgentProvider.class);
File testLocation = TestData.getFile("ProfilePreferencesTest", "DifferentAgent");
IProvisioningAgent agent = agentProvider.createAgent(testLocation.toURI());
- IMetadataRepositoryManager mgr = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager mgr = agent.getService(IMetadataRepositoryManager.class);
URI[] repositories = mgr.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
- //HERE WE SHOULD GET MUCH MORE REPOSITORIES THAN THIS.
+ //HERE WE SHOULD GET MUCH MORE REPOSITORIES THAN THIS.
System.out.println(repositories);
fail();
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java
index dccfc2272..7c8dc873c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java
@@ -30,7 +30,7 @@ public class ResumeDownloadTest extends AbstractProvisioningTest {
repoLoc = new URI(UPDATE_SITE);
originalResumeProp = System.getProperty("org.eclipse.equinox.p2.metadata.repository.resumable", "true");
- mgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ mgr = getAgent().getService(IMetadataRepositoryManager.class);
if (mgr == null) {
throw new RuntimeException("Repository manager could not be loaded");
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/TimeoutTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/TimeoutTest.java
index 326fed6a2..69c6176ed 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/TimeoutTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/TimeoutTest.java
@@ -10,7 +10,11 @@ package org.eclipse.equinox.p2.tests.metadata.repository;
import java.net.URI;
import java.security.cert.Certificate;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.core.UIServices;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
@@ -26,7 +30,7 @@ public class TimeoutTest extends ServerBasedTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
- mgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ mgr = getAgent().getService(IMetadataRepositoryManager.class);
if (mgr == null) {
throw new RuntimeException("Repository manager could not be loaded");
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java
index 99c572a39..56d01d377 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java
@@ -18,7 +18,9 @@ import java.util.Iterator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.engine.IEngine;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.planner.ProfileInclusionRules;
@@ -37,7 +39,7 @@ public class AllOrbit extends AbstractProvisioningTest {
@Override
protected void setUp() throws Exception {
super.setUp();
- IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMan = getAgent().getService(IMetadataRepositoryManager.class);
repo = repoMan.loadRepository(getTestData("repository for wsdl test", "testData/orbitRepo/").toURI(), new NullProgressMonitor());
profile1 = createProfile("TestProfile." + getName());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java
index c8bb15f62..b9f800d9f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java
@@ -16,8 +16,13 @@ package org.eclipse.equinox.p2.tests.planner;
import java.io.File;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.p2.core.*;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.engine.IEngine;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.planner.IPlanner;
@@ -42,7 +47,7 @@ public class Bug300104 extends AbstractProvisioningTest {
IProvisioningAgentProvider provider = getAgentProvider();
agent = provider.createAgent(tempFolder.toURI());
- profileRegistry = ((IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME));
+ profileRegistry = agent.getService(IProfileRegistry.class);
assertNotNull(profileRegistry.getProfile(profileLoadedId));
}
@@ -107,11 +112,11 @@ public class Bug300104 extends AbstractProvisioningTest {
}
private IEngine getEngineService() {
- return ((IEngine) agent.getService(IEngine.SERVICE_NAME));
+ return agent.getService(IEngine.class);
}
private IPlanner getPlannerService() {
- return ((IPlanner) agent.getService(IPlanner.SERVICE_NAME));
+ return agent.getService(IPlanner.class);
}
private String createInclusionRule(IInstallableUnit unit, boolean optional) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572.java
index 7e3757960..7153bd59e 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Sonatype, Inc. - initial API and implementation
*******************************************************************************/
@@ -15,11 +15,18 @@ package org.eclipse.equinox.p2.tests.planner;
import java.util.Iterator;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.equinox.p2.core.*;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.planner.*;
+import org.eclipse.equinox.p2.planner.IPlanner;
+import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
+import org.eclipse.equinox.p2.planner.ProfileInclusionRules;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
@@ -31,15 +38,15 @@ public class Bug300572 extends AbstractProvisioningTest {
public void testInstallSecondPatch() throws ProvisionException {
IProvisioningAgentProvider provider = getAgentProvider();
IProvisioningAgent agent = provider.createAgent(getTestData("Bug300572 data", "testData/bug300572/p2").toURI());
- IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMgr = agent.getService(IMetadataRepositoryManager.class);
//The following repo contains the second patch to be installed
IMetadataRepository repo = repoMgr.loadRepository(getTestData("bug300572 data", "testData/bug300572/repo/").toURI(), new NullProgressMonitor());
IInstallableUnit[] ius = repo.query(QueryUtil.createIUQuery("hellopatch.feature.group"), null).toArray(IInstallableUnit.class);
System.out.println(ius);
- IPlanner planner = (IPlanner) agent.getService(IPlanner.SERVICE_NAME);
+ IPlanner planner = agent.getService(IPlanner.class);
//The profile already contains a a feature (hellofeature) and a patch for it (hellopatch).
- IProfile sdkProfile = ((IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME)).getProfile("SDKProfile");
+ IProfile sdkProfile = agent.getService(IProfileRegistry.class).getProfile("SDKProfile");
assertFalse(sdkProfile.query(QueryUtil.createIUQuery("hellopatch.feature.group"), null).isEmpty());
assertFalse(sdkProfile.query(QueryUtil.createIUQuery("hellofeature.feature.group"), null).isEmpty());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java
index 5b58f02ce..5a6607ccd 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2010, 2017 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/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
@@ -17,7 +17,9 @@ import java.io.File;
import java.util.Iterator;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.p2.core.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -45,7 +47,7 @@ public class Bug302582d extends AbstractProvisioningTest {
IProvisioningAgentProvider provider = getAgentProvider();
agent = provider.createAgent(tempFolder.toURI());
- profileRegistry = ((IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME));
+ profileRegistry = agent.getService(IProfileRegistry.class);
assertNotNull(profileRegistry.getProfile(profileLoadedId));
}
@@ -56,7 +58,7 @@ public class Bug302582d extends AbstractProvisioningTest {
}
public void testInstall() {
- IMetadataRepositoryManager mgr = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager mgr = agent.getService(IMetadataRepositoryManager.class);
try {
repo = mgr.loadRepository(getTestData("test data bug bug302582d repo", "testData/bug302582d/repo").toURI(), null);
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306279b.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306279b.java
index 6ee0ca4c3..427ff3013 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306279b.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306279b.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Sonatype, Inc. - initial API and implementation
* IBM Corporation - ongoing development
@@ -20,7 +20,10 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.planner.IPlanner;
@@ -35,14 +38,14 @@ public class Bug306279b extends AbstractProvisioningTest {
public void testGreedy() throws ProvisionException, OperationCanceledException {
IProvisioningAgent agent = getAgentProvider().createAgent(getTestData("test data bug306279", "testData/bug306279/p2").toURI());
- IMetadataRepository repo1 = ((IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME)).loadRepository(getTestData("helios", "testData/bug306279/repo/helios").toURI(), null);
+ IMetadataRepository repo1 = agent.getService(IMetadataRepositoryManager.class).loadRepository(getTestData("helios", "testData/bug306279/repo/helios").toURI(), null);
assertFalse(repo1.query(QueryUtil.createIUQuery("org.eclipse.rap.jface.databinding"), new NullProgressMonitor()).isEmpty());
URI rienaRepo = getTestData("repo for bug306279", "testData/bug306279/repo/riena").toURI();
- IMetadataRepository repo2 = ((IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME)).loadRepository(rienaRepo, null);
+ IMetadataRepository repo2 = agent.getService(IMetadataRepositoryManager.class).loadRepository(rienaRepo, null);
IPlanner planner = getPlanner(agent);
- IProfile profile = ((IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME)).getProfile("SDKProfile");
+ IProfile profile = agent.getService(IProfileRegistry.class).getProfile("SDKProfile");
IProfileChangeRequest request = planner.createChangeRequest(profile);
Set<IInstallableUnit> ius = repo2.query(QueryUtil.createIUQuery("org.eclipse.riena.toolbox.feature.feature.group", Version.create("2.0.0.201003181312")), new NullProgressMonitor()).toUnmodifiableSet();
request.addAll(ius);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309717.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309717.java
index c25ddfec8..5e3dad312 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309717.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309717.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Sonatype, Inc. - initial API and implementation
* IBM Corporation - ongoing development
@@ -32,21 +32,21 @@ public class Bug309717 extends AbstractProvisioningTest {
public void testUpdate() throws ProvisionException, OperationCanceledException, URISyntaxException {
IProvisioningAgent agent = getAgentProvider().createAgent(getTestData("test data bug309717", "testData/bug309717/p2").toURI());
- IMetadataRepository repo1 = ((IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME)).loadRepository(new URI("http://download.eclipse.org/releases/helios"), null);
+ IMetadataRepository repo1 = agent.getService(IMetadataRepositoryManager.class).loadRepository(new URI("http://download.eclipse.org/releases/helios"), null);
// assertFalse(repo1.query(QueryUtil.createIUQuery("org.eclipse.rap.jface.databinding"), new NullProgressMonitor()).isEmpty());
assertNotNull(repo1);
URI jazz = getTestData("repo for bug309717", "testData/bug309717/repo/jazz").toURI();
- IMetadataRepository repo2 = ((IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME)).loadRepository(jazz, null);
+ IMetadataRepository repo2 = agent.getService(IMetadataRepositoryManager.class).loadRepository(jazz, null);
assertNotNull(repo2);
URI jdojo = getTestData("repo for bug309717", "testData/bug309717/repo/jdojo").toURI();
- IMetadataRepository repo3 = ((IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME)).loadRepository(jdojo, null);
+ IMetadataRepository repo3 = agent.getService(IMetadataRepositoryManager.class).loadRepository(jdojo, null);
assertNotNull(repo3);
- IMetadataRepository repo4 = ((IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME)).loadRepository(new URI("http://download.eclipse.org/eclipse/updates/3.6"), null);
+ IMetadataRepository repo4 = agent.getService(IMetadataRepositoryManager.class).loadRepository(new URI("http://download.eclipse.org/eclipse/updates/3.6"), null);
// assertFalse(repo1.query(QueryUtil.createIUQuery("org.eclipse.rap.jface.databinding"), new NullProgressMonitor()).isEmpty());
assertNotNull(repo4);
IPlanner planner = getPlanner(agent);
- IProfile profile = ((IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME)).getProfile("PlatformProfile");
+ IProfile profile = agent.getService(IProfileRegistry.class).getProfile("PlatformProfile");
IProfileChangeRequest request = planner.createChangeRequest(profile);
assertNotNull(request);
// Set<IInstallableUnit> ius = repo2.query(QueryUtil.createIUQuery("org.eclipse.riena.toolbox.feature.feature.group", Version.create("2.0.0.201003181312")), new NullProgressMonitor()).toUnmodifiableSet();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug311330.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug311330.java
index 9904a5e71..c6f48df2c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug311330.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug311330.java
@@ -36,8 +36,8 @@ public class Bug311330 extends AbstractProvisioningTest {
public void testValidateProfile() throws ProvisionException {
IProvisioningAgentProvider provider = getAgentProvider();
IProvisioningAgent agent = provider.createAgent(getTestData("bug311330 data", "testData/bug311330/p2").toURI());
- IPlanner planner = (IPlanner) agent.getService(IPlanner.SERVICE_NAME);
- IProfile sdkProfile = ((IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME)).getProfile("SDKProfile");
+ IPlanner planner = agent.getService(IPlanner.class);
+ IProfile sdkProfile = agent.getService(IProfileRegistry.class).getProfile("SDKProfile");
IProfileChangeRequest request = planner.createChangeRequest(sdkProfile);
assertFalse("rap.jface not found", sdkProfile.available(QueryUtil.createIUQuery("org.eclipse.rap.jface"), null).isEmpty());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java
index 62e80858e..e6fe1f706 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java
@@ -15,10 +15,20 @@
package org.eclipse.equinox.p2.tests.planner;
import java.net.URI;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.equinox.p2.core.*;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
@@ -31,10 +41,10 @@ public class EPPPackageInstallStability_bug323322 extends AbstractProvisioningTe
public void testInstallEppJavaPackage() throws ProvisionException {
IProvisioningAgentProvider provider = getAgentProvider();
IProvisioningAgent agent = provider.createAgent(getTempFolder().toURI());
- IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMgr = agent.getService(IMetadataRepositoryManager.class);
repoMgr.addRepository(getTestData("Helios SR0", "testData/helios-sr0/").toURI());
- IPlanner planner = (IPlanner) agent.getService(IPlanner.SERVICE_NAME);
+ IPlanner planner = agent.getService(IPlanner.class);
Map<String, String> profileArgs = new HashMap<>();
profileArgs.put("osgi.os", "linux");
profileArgs.put("osgi.ws", "gtk");
@@ -42,7 +52,7 @@ public class EPPPackageInstallStability_bug323322 extends AbstractProvisioningTe
Set<IInstallableUnit> iusFromFirstResolution = new HashSet<>();
{
- IProfile eppProfile1 = ((IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME)).addProfile("epp.install.1", profileArgs);
+ IProfile eppProfile1 = agent.getService(IProfileRegistry.class).addProfile("epp.install.1", profileArgs);
IProfileChangeRequest request = planner.createChangeRequest(eppProfile1);
request.add(repoMgr.query(QueryUtil.createIUQuery("epp.package.java"), null).iterator().next());
@@ -60,7 +70,7 @@ public class EPPPackageInstallStability_bug323322 extends AbstractProvisioningTe
}
{
- IProfile eppProfile2 = ((IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME)).addProfile("epp.install.2", profileArgs);
+ IProfile eppProfile2 = agent.getService(IProfileRegistry.class).addProfile("epp.install.2", profileArgs);
IProfileChangeRequest request = planner.createChangeRequest(eppProfile2);
request.add(repoMgr.query(QueryUtil.createIUQuery("epp.package.java"), null).iterator().next());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java
index d4ca31f22..dcf3c8346 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java
@@ -16,17 +16,33 @@
package org.eclipse.equinox.p2.tests.planner;
import java.net.URI;
-import java.util.*;
-import org.eclipse.core.runtime.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.operations.Activator;
import org.eclipse.equinox.internal.p2.operations.Messages;
-import org.eclipse.equinox.p2.core.*;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery;
-import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IVersionedId;
+import org.eclipse.equinox.p2.metadata.VersionedId;
import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.equinox.p2.operations.SynchronizeOperation;
-import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
@@ -44,11 +60,11 @@ public class SynchronizeOperationTest extends AbstractProvisioningTest {
URI p2location = getTestData("p2 location", "testData/synchronizeOperation/p2").toURI();
URI repoLocation = getTestData("p2 location", "testData/synchronizeOperation/repo").toURI();
IProvisioningAgent firstAgent = provider.createAgent(p2location);
- IMetadataRepositoryManager mgr = (IMetadataRepositoryManager) firstAgent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager mgr = firstAgent.getService(IMetadataRepositoryManager.class);
IMetadataRepository repo = mgr.loadRepository(repoLocation, new NullProgressMonitor());
ProvisioningSession session = new ProvisioningSession(firstAgent);
SynchronizeOperation sync = new SynchronizeOperation(session, repo.query(QueryUtil.ALL_UNITS, new NullProgressMonitor()).toUnmodifiableSet());
- Set<IInstallableUnit> installedIUs = ((IProfileRegistry) firstAgent.getService(IProfileRegistry.SERVICE_NAME)).getProfile("DefaultProfile").query(new UserVisibleRootQuery(), new NullProgressMonitor()).toUnmodifiableSet();
+ Set<IInstallableUnit> installedIUs = firstAgent.getService(IProfileRegistry.class).getProfile("DefaultProfile").query(new UserVisibleRootQuery(), new NullProgressMonitor()).toUnmodifiableSet();
System.out.println(installedIUs);
sync.setProfileId("DefaultProfile");
sync.resolveModal(new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TwoVersionsOfWSDL.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TwoVersionsOfWSDL.java
index 89cfe7980..bb2194875 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TwoVersionsOfWSDL.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TwoVersionsOfWSDL.java
@@ -16,7 +16,9 @@ package org.eclipse.equinox.p2.tests.planner;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.engine.IEngine;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.VersionRange;
import org.eclipse.equinox.p2.planner.IPlanner;
@@ -36,7 +38,7 @@ public class TwoVersionsOfWSDL extends AbstractProvisioningTest {
@Override
protected void setUp() throws Exception {
super.setUp();
- IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMan = getAgent().getService(IMetadataRepositoryManager.class);
IMetadataRepository repo = repoMan.loadRepository(getTestData("repository for wsdl test", "testData/metadataRepo/wsdlTestRepo/").toURI(), new NullProgressMonitor());
wsdl15 = repo.query(QueryUtil.createIUQuery("javax.wsdl", new VersionRange("[1.5, 1.6)")), null).iterator().next();
wsdl14 = repo.query(QueryUtil.createIUQuery("javax.wsdl", new VersionRange("[1.4, 1.5)")), null).iterator().next();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java
index 0b181d21f..147e2ddd7 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java
@@ -15,17 +15,43 @@ package org.eclipse.equinox.p2.tests.ql;
import java.io.File;
import java.net.URI;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.director.QueryableArray;
import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
-import org.eclipse.equinox.p2.metadata.*;
-import org.eclipse.equinox.p2.metadata.expression.*;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IProvidedCapability;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.metadata.KeyWithLocale;
+import org.eclipse.equinox.p2.metadata.MetadataFactory;
+import org.eclipse.equinox.p2.metadata.Version;
+import org.eclipse.equinox.p2.metadata.VersionRange;
+import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil;
+import org.eclipse.equinox.p2.metadata.expression.IContextExpression;
+import org.eclipse.equinox.p2.metadata.expression.IEvaluationContext;
+import org.eclipse.equinox.p2.metadata.expression.IExpression;
+import org.eclipse.equinox.p2.metadata.expression.IExpressionFactory;
+import org.eclipse.equinox.p2.metadata.expression.IExpressionParser;
+import org.eclipse.equinox.p2.metadata.expression.IMatchExpression;
import org.eclipse.equinox.p2.publisher.PublisherInfo;
import org.eclipse.equinox.p2.publisher.PublisherResult;
import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction;
-import org.eclipse.equinox.p2.query.*;
-import org.eclipse.equinox.p2.repository.artifact.*;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.MatchQuery;
+import org.eclipse.equinox.p2.query.QueryUtil;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
@@ -351,7 +377,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
private IMetadataRepository getMDR(String uri) throws Exception {
URI metadataRepo = getTestData("1.1", uri).toURI();
- IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metadataManager = getAgent().getService(IMetadataRepositoryManager.class);
assertNotNull(metadataManager);
return metadataManager.loadRepository(metadataRepo, new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java
index 31cf4fb57..69563505a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java
@@ -14,16 +14,29 @@
package org.eclipse.equinox.p2.tests.ql;
import java.net.URI;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.equinox.internal.p2.director.*;
+import org.eclipse.equinox.internal.p2.director.PermissiveSlicer;
+import org.eclipse.equinox.internal.p2.director.QueryableArray;
+import org.eclipse.equinox.internal.p2.director.Slicer;
import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
import org.eclipse.equinox.internal.p2.metadata.expression.MatchIteratorFilter;
import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository;
-import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IProvidedCapability;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.metadata.MetadataFactory;
+import org.eclipse.equinox.p2.metadata.Version;
+import org.eclipse.equinox.p2.metadata.VersionRange;
import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil;
import org.eclipse.equinox.p2.metadata.expression.IExpressionParser;
-import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.query.MatchQuery;
+import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
@@ -364,7 +377,7 @@ public class PerformanceTest extends AbstractProvisioningTest {
private IMetadataRepository getMDR(String uri) throws Exception {
URI metadataRepo = getTestData("1.1", uri).toURI();
- IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metadataManager = getAgent().getService(IMetadataRepositoryManager.class);
assertNotNull(metadataManager);
return metadataManager.loadRepository(metadataRepo, new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/TestIndexes.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/TestIndexes.java
index 7316db590..d72d28e43 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/TestIndexes.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/TestIndexes.java
@@ -15,8 +15,12 @@ package org.eclipse.equinox.p2.tests.ql;
import java.net.URI;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.equinox.p2.metadata.*;
-import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.metadata.MetadataFactory;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
@@ -69,7 +73,7 @@ public class TestIndexes extends AbstractProvisioningTest {
private IMetadataRepository getMDR(String uri) throws Exception {
URI metadataRepo = getTestData("1.1", uri).toURI();
- IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metadataManager = getAgent().getService(IMetadataRepositoryManager.class);
assertNotNull(metadataManager);
return metadataManager.loadRepository(metadataRepo, new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ProfileSynchronizerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ProfileSynchronizerTest.java
index 96e0c02dd..43fc1ec8f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ProfileSynchronizerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ProfileSynchronizerTest.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Sonatype Inc. - Initial API and implementation
* IBM Corporation - Ongoing development
@@ -20,7 +20,10 @@ import java.util.ArrayList;
import java.util.Set;
import org.eclipse.equinox.internal.p2.reconciler.dropins.ProfileSynchronizer;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.engine.IEngine;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.QueryUtil;
@@ -41,8 +44,8 @@ public class ProfileSynchronizerTest extends AbstractProvisioningTest {
copy("copying initialProfile", getTestData("p2 folder for synchronizer test", "testData/profileSynchronizerTest/"), tmpFolder);
agent = getAgentProvider().createAgent(new File(tmpFolder, "p2").toURI());
- registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
- IEngine engine = (IEngine) agent.getService(IEngine.SERVICE_NAME);
+ registry = agent.getService(IProfileRegistry.class);
+ IEngine engine = agent.getService(IEngine.class);
sdkProfile = registry.getProfile("SDKProfile");
//Reset some properties to not break local install
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ProfileSynchronizerTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ProfileSynchronizerTest2.java
index a569af318..98c4a3875 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ProfileSynchronizerTest2.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ProfileSynchronizerTest2.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Sonatype Inc. - Initial API and implementation
* IBM Corporation - Ongoing development
@@ -20,7 +20,10 @@ import java.util.ArrayList;
import java.util.Set;
import org.eclipse.equinox.internal.p2.reconciler.dropins.ProfileSynchronizer;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.engine.IEngine;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.QueryUtil;
@@ -41,8 +44,8 @@ public class ProfileSynchronizerTest2 extends AbstractProvisioningTest {
File tmpFolder = getTempFolder();
copy("copying initialProfile", getTestData("p2 folder for synchronizer test", "testData/profileSynchronizerTest2/"), tmpFolder);
agent = getAgentProvider().createAgent(new File(tmpFolder, "p2").toURI());
- registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
- IEngine engine = (IEngine) agent.getService(IEngine.SERVICE_NAME);
+ registry = agent.getService(IProfileRegistry.class);
+ IEngine engine = agent.getService(IEngine.class);
sdkProfile = registry.getProfile("SDKProfile");
//Reset some properties to not break local install
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java
index cf3bdfb3b..245ab1551 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java
@@ -14,10 +14,16 @@ import java.io.File;
import java.io.IOException;
import java.net.URI;
import junit.framework.TestCase;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.equinox.internal.p2.repository.CacheManager;
import org.eclipse.equinox.internal.p2.repository.Transport;
-import org.eclipse.equinox.p2.core.*;
+import org.eclipse.equinox.p2.core.IAgentLocation;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -36,7 +42,7 @@ public class CacheManagerTest extends TestCase {
ServiceReference<IProvisioningAgentProvider> serviceReference = bundle.getServiceReference(IProvisioningAgentProvider.class);
IProvisioningAgentProvider agentServiceFactory = bundle.getService(serviceReference);
IProvisioningAgent agent = agentServiceFactory.createAgent(repositoryLocation);
- Transport transport = (Transport) agent.getService(Transport.SERVICE_NAME);
+ Transport transport = agent.getService(Transport.class);
cacheManager = new CacheManager(new AgentLocationMock(), transport);
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/NTLMTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/NTLMTest.java
index 43a3127b0..0d70cb006 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/NTLMTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/NTLMTest.java
@@ -25,7 +25,7 @@ public class NTLMTest extends AbstractTestServerClientCase {
@Override
public void setUp() throws Exception {
super.setUp();
- mgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ mgr = getAgent().getService(IMetadataRepositoryManager.class);
if (mgr == null) {
throw new RuntimeException("Repository manager could not be loaded");
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java
index c73dd07ef..404a31f5d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java
@@ -88,7 +88,7 @@ public class SharedProfilePreferencesTest extends AbstractProvisioningTest {
}
public void testCountRepoInSharedInstallThroughRepoManagerAPI() {
- IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMgr = getAgent().getService(IMetadataRepositoryManager.class);
URI[] repos = repoMgr.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
assertEquals(3, repos.length);
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java
index 0fe497e7f..83a4b6024 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java
@@ -64,7 +64,7 @@ public class SharedProfilePreferencesTestWithDataInUser extends AbstractProvisio
}
public void testCountRepoInSharedInstallThroughRepoManagerAPI() {
- IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMgr = getAgent().getService(IMetadataRepositoryManager.class);
URI[] repos = repoMgr.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
assertEquals(4, repos.length);
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UtilTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UtilTest.java
index f3e4d3620..819885ce5 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UtilTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/UtilTest.java
@@ -49,7 +49,7 @@ public class UtilTest extends AbstractProvisioningTest {
public void testDefaultBundlePool() {
IProfile profile = createProfile("test");
- IAgentLocation agentLocation = (IAgentLocation) getAgent().getService(IAgentLocation.SERVICE_NAME);
+ IAgentLocation agentLocation = getAgent().getService(IAgentLocation.class);
assertEquals(agentLocation.getDataArea("org.eclipse.equinox.p2.touchpoint.eclipse"), Util.getBundlePoolLocation(getAgent(), profile));
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/UpdateCheckerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/UpdateCheckerTest.java
index 103a8e2bf..db0b7e79f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/UpdateCheckerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/UpdateCheckerTest.java
@@ -20,7 +20,10 @@ import org.eclipse.equinox.internal.provisional.p2.director.IDirector;
import org.eclipse.equinox.internal.provisional.p2.updatechecker.IUpdateChecker;
import org.eclipse.equinox.internal.provisional.p2.updatechecker.UpdateEvent;
import org.eclipse.equinox.p2.engine.IProfile;
-import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.ITouchpointType;
+import org.eclipse.equinox.p2.metadata.IUpdateDescriptor;
+import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
import org.eclipse.equinox.p2.tests.TestActivator;
@@ -33,7 +36,7 @@ public class UpdateCheckerTest extends AbstractProvisioningTest {
IInstallableUnit toInstallIU, update;
protected IUpdateChecker getChecker() {
- IUpdateChecker checker = (IUpdateChecker) getAgent().getService(IUpdateChecker.SERVICE_NAME);
+ IUpdateChecker checker = getAgent().getService(IUpdateChecker.class);
assertNotNull(checker);
return checker;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
index 86c6fa2b2..09a97a01a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
@@ -13,16 +13,26 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.updatesite;
-import java.io.*;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
import java.lang.reflect.Field;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.*;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.artifact.repository.MirrorSelector;
import org.eclipse.equinox.internal.p2.artifact.repository.RawMirrorRequest;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
@@ -32,18 +42,31 @@ import org.eclipse.equinox.internal.p2.updatesite.SiteFeature;
import org.eclipse.equinox.internal.p2.updatesite.UpdateSite;
import org.eclipse.equinox.internal.p2.updatesite.artifact.UpdateSiteArtifactRepository;
import org.eclipse.equinox.p2.core.ProvisionException;
-import org.eclipse.equinox.p2.metadata.*;
-import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.metadata.ITouchpointData;
+import org.eclipse.equinox.p2.metadata.ITouchpointInstruction;
+import org.eclipse.equinox.p2.metadata.Version;
+import org.eclipse.equinox.p2.metadata.VersionRange;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
-import org.eclipse.equinox.p2.repository.artifact.*;
+import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.repository.spi.AbstractRepository;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
import org.eclipse.equinox.p2.tests.StringBufferStream;
-import org.w3c.dom.*;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
/**
* @since 1.0
@@ -594,7 +617,7 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
}
public void testRepoWithFeatureWithNullUpdateURL() {
- IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMan = getAgent().getService(IMetadataRepositoryManager.class);
assertNotNull(repoMan);
File site = getTestData("Update site", "/testData/updatesite/missingUpdateURLFeature/");
IMetadataRepository metadataRepo = null;
@@ -618,7 +641,7 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
* Tests that a feature requiring a bundle with no range is converted correctly.
*/
public void testBug243422() {
- IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMan = getAgent().getService(IMetadataRepositoryManager.class);
assertNotNull(repoMan);
File site = getTestData("Update site", "/testData/updatesite/UpdateSite243422/");
IMetadataRepository metadataRepo = null;
@@ -641,7 +664,7 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
}
public void testShortenVersionNumberInFeature() {
- IArtifactRepositoryManager repoMan = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager repoMan = getAgent().getService(IArtifactRepositoryManager.class);
assertNotNull(repoMan);
File site = getTestData("Update site", "/testData/updatesite/240121/UpdateSite240121/");
IArtifactRepository artifactRepo = null;
@@ -663,7 +686,7 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
* unzipping the feature on install.
*/
public void testFeatureJarUnzipInstruction() {
- IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager repoMan = getAgent().getService(IMetadataRepositoryManager.class);
File site = getTestData("0.1", "/testData/updatesite/site");
URI location = null;
location = site.toURI();
@@ -693,7 +716,7 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
URI testUpdateSite = new URI("http://download.eclipse.org/test/updatesite/");
URI testDiscoverySite = new URI("http://download.eclipse.org/test/discoverysite");
- IMetadataRepositoryManager manager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager manager = getAgent().getService(IMetadataRepositoryManager.class);
assertNotNull(manager);
manager.removeRepository(testUpdateSite);
manager.removeRepository(testDiscoverySite);
@@ -715,7 +738,7 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
File site = getTestData("0.1", "/testData/updatesite/site");
URI siteURI = site.toURI();
- IMetadataRepositoryManager metadataRepoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metadataRepoMan = getAgent().getService(IMetadataRepositoryManager.class);
assertNotNull(metadataRepoMan);
URI[] knownRepos = metadataRepoMan.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
@@ -741,7 +764,7 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
File site = getTestData("0.1", "/testData/updatesite/site");
URI siteURI = site.toURI();
- IArtifactRepositoryManager artifactRepoMan = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager artifactRepoMan = getAgent().getService(IArtifactRepositoryManager.class);
assertNotNull(artifactRepoMan);
URI[] knownRepos = artifactRepoMan.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);

Back to the top