Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestActivator.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/JarURLArtifactRepositoryTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfilePreferencesTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/RepositorManagerDifferentAgentTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ServerBasedTestCase.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/AbstractTestServerClientCase.java5
18 files changed, 76 insertions, 54 deletions
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 92f62bac3..7f5c07251 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
@@ -1,10 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2007, 2015 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors: IBM Corporation - initial API and implementation
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
******************************************************************************/
package org.eclipse.equinox.p2.tests;
@@ -863,12 +866,12 @@ public abstract class AbstractProvisioningTest extends TestCase {
protected static IProvisioningAgent getAgent() {
//get the global agent for the currently running system
- return (IProvisioningAgent) ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.SERVICE_NAME);
+ return ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class);
}
protected static IProvisioningAgentProvider getAgentProvider() {
//get the global agent for the currently running system
- return (IProvisioningAgentProvider) ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgentProvider.SERVICE_NAME);
+ return ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgentProvider.class);
}
protected static IAgentLocation getAgentLocation() {
@@ -932,7 +935,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
protected File getTestFolder(String name) {
- Location instanceLocation = (Location) ServiceHelper.getService(TestActivator.getContext(), Location.class.getName(), Location.INSTANCE_FILTER);
+ Location instanceLocation = ServiceHelper.getService(TestActivator.getContext(), Location.class, Location.INSTANCE_FILTER);
URL url = instanceLocation != null ? instanceLocation.getURL() : null;
if (instanceLocation == null || !instanceLocation.isSet() || url == null) {
String tempDir = System.getProperty("java.io.tmpdir");
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestActivator.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestActivator.java
index 96380bb8c..789d4cc8c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestActivator.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestActivator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests;
@@ -23,7 +24,7 @@ public class TestActivator implements BundleActivator {
public static final String PI_PROV_TESTS = "org.eclipse.equinox.p2.test";
public static BundleContext context;
private static PackageAdmin packageAdmin = null;
- private static ServiceReference packageAdminRef = null;
+ private static ServiceReference<PackageAdmin> packageAdminRef = null;
public static String TEST_DATA_PATH = "testData"; //$NON-NLS-1$
public static BundleContext getContext() {
@@ -34,14 +35,14 @@ public class TestActivator implements BundleActivator {
* Return a file handle to the framework log file, or null if it is not available.
*/
public static File getLogFile() {
- FrameworkLog log = (FrameworkLog) ServiceHelper.getService(context, FrameworkLog.class.getName());
+ FrameworkLog log = ServiceHelper.getService(context, FrameworkLog.class);
return log == null ? null : log.getFile();
}
public void start(BundleContext context) throws Exception {
TestActivator.context = context;
- packageAdminRef = context.getServiceReference(PackageAdmin.class.getName());
- packageAdmin = (PackageAdmin) context.getService(packageAdminRef);
+ packageAdminRef = context.getServiceReference(PackageAdmin.class);
+ packageAdmin = context.getService(packageAdminRef);
//This is a hack because the junit plugin launch config do not allow to start bundles
AbstractProvisioningTest.startBundle(getBundle("org.eclipse.equinox.frameworkadmin.equinox"));
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 21b5f1cbd..34045a785 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.repository;
@@ -115,7 +116,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 = (IPreferencesService) ServiceHelper.getService(TestActivator.getContext(), IPreferencesService.class.getName());
+ IPreferencesService prefService = ServiceHelper.getService(TestActivator.getContext(), IPreferencesService.class);
IAgentLocation agentLocation = (IAgentLocation) getAgent().getService(IAgentLocation.SERVICE_NAME);
String locationString = EncodingUtils.encodeSlashes(agentLocation.getRootLocation().toString());
Preferences prefs = prefService.getRootNode().node("/profile/" + locationString + "/_SELF_/" + REPO_BUNDLE + "/repositories"); //$NON-NLS-1$ //$NON-NLS-2$
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 423818aba..39a355c21 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.repository;
@@ -41,7 +42,7 @@ public class FoldersRepositoryTest extends TestCase {
}
protected void setUp() throws Exception {
- IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.SERVICE_NAME);
+ IProvisioningAgent agent = ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class);
manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
}
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 8b7e1c66c..74b46ce99 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Sonatype Inc - ongoing development
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.repository;
@@ -36,7 +37,7 @@ public class JarURLArtifactRepositoryTest extends TestCase {
}
protected void setUp() throws Exception {
- IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.SERVICE_NAME);
+ IProvisioningAgent agent = ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class);
manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
}
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 a1dd9c26b..da9dfd70c 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.engine;
@@ -34,7 +35,7 @@ public class ProfilePreferencesTest extends AbstractProvisioningTest {
protected void setUp() throws Exception {
super.setUp();
- prefServ = (IPreferencesService) ServiceHelper.getService(TestActivator.context, IPreferencesService.class.getName());
+ prefServ = ServiceHelper.getService(TestActivator.context, IPreferencesService.class);
}
/**
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 4d07779aa..c658bc457 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.full;
@@ -62,7 +63,7 @@ public abstract class AbstractEnd2EndTest extends AbstractProvisioningTest {
Map properties = new HashMap();
properties.put(IProfile.PROP_INSTALL_FOLDER, installFolder);
- EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(TestActivator.getContext(), EnvironmentInfo.class.getName());
+ EnvironmentInfo info = ServiceHelper.getService(TestActivator.getContext(), EnvironmentInfo.class);
if (info != null)
properties.put(IProfile.PROP_ENVIRONMENTS, "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch());
properties.put("org.eclipse.update.install.features", "true");
@@ -255,7 +256,7 @@ public abstract class AbstractEnd2EndTest extends AbstractProvisioningTest {
protected static String getLauncherName(String name, String os) {
if (os == null) {
- EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(TestActivator.getContext(), EnvironmentInfo.class.getName());
+ EnvironmentInfo info = ServiceHelper.getService(TestActivator.getContext(), EnvironmentInfo.class);
if (info != null)
os = info.getOS();
}
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 0d35e8fed..8c1c17870 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.full;
@@ -69,7 +70,7 @@ public class DirectorTest extends AbstractProvisioningTest {
} else {
Map properties = new HashMap();
properties.put(IProfile.PROP_INSTALL_FOLDER, installFolder);
- EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(TestActivator.getContext(), EnvironmentInfo.class.getName());
+ EnvironmentInfo info = ServiceHelper.getService(TestActivator.getContext(), EnvironmentInfo.class);
if (info != null)
properties.put(IProfile.PROP_ENVIRONMENTS, "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch());
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 6a49b333d..a316f8e49 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.metadata.repository;
@@ -342,7 +343,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest {
*/
public void testMetadataCachingLocalRepo() throws ProvisionException {
File repoLocation = getTempLocation();
- IAgentLocation agentLocation = (IAgentLocation) ServiceHelper.getService(TestActivator.getContext(), IAgentLocation.SERVICE_NAME);
+ IAgentLocation agentLocation = ServiceHelper.getService(TestActivator.getContext(), IAgentLocation.class);
URI dataArea = agentLocation.getDataArea("org.eclipse.equinox.p2.metadata.repository/cache/");
File dataAreaFile = URIUtil.toFile(dataArea);
File cacheFileXML = new File(dataAreaFile, "content" + repoLocation.hashCode() + ".xml");
@@ -364,7 +365,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest {
URI repoLocation = new URI("http://download.eclipse.org/eclipse/updates/3.4milestones/");
if (!repoAvailable(repoLocation))
return;
- IAgentLocation agentLocation = (IAgentLocation) ServiceHelper.getService(TestActivator.getContext(), IAgentLocation.SERVICE_NAME);
+ IAgentLocation agentLocation = ServiceHelper.getService(TestActivator.getContext(), IAgentLocation.class);
URI dataArea = agentLocation.getDataArea("org.eclipse.equinox.p2.metadata.repository/cache/");
File dataAreaFile = URIUtil.toFile(dataArea);
File cacheFileXML = new File(dataAreaFile, "content" + repoLocation.hashCode() + ".xml");
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 665dd3fee..af26c1011 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Sonatype and others.
+ * Copyright (c) 2010, 2015 Sonatype and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* Sonatype - initial API and implementation
* IBM - ongoing development
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.metadata.repository;
@@ -23,7 +24,7 @@ import org.eclipse.equinox.p2.tests.*;
public class RepositorManagerDifferentAgentTest extends AbstractProvisioningTest {
public void testLoadRepo() throws ProvisionException, IOException {
- IProvisioningAgentProvider agentProvider = (IProvisioningAgentProvider) ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgentProvider.SERVICE_NAME);
+ 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);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ServerBasedTestCase.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ServerBasedTestCase.java
index c835a734b..859e9c4c9 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ServerBasedTestCase.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ServerBasedTestCase.java
@@ -1,9 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010, Cloudsmith Inc.
+ * Copyright (c) 2006, 2015, Cloudsmith Inc.
* The code, documentation and other materials contained herein have been
* licensed under the Eclipse Public License - v 1.0 by the copyright holder
* listed above, as the Initial Contributor under such license. The text of
* such license is available at www.eclipse.org.
+ *
+ * Contributors:
+ * Cloudsmith Inc. - Initial API and implementation.
+ * Red Hat Inc. - Bug 460967
******************************************************************************/
package org.eclipse.equinox.p2.tests.metadata.repository;
@@ -34,7 +38,7 @@ public class ServerBasedTestCase extends TestCase {
protected static IProvisioningAgent getAgent() {
//get the global agent for the currently running system
- return (IProvisioningAgent) ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.SERVICE_NAME);
+ return ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class);
}
protected void basicRun(TestResult result) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java
index c1012adb6..61c79eec8 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java
@@ -1,11 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2010 EclipseSource and others. All rights reserved. This
+* Copyright (c) 2010, 2015 EclipseSource and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* EclipseSource - initial API and implementation
+* Red Hat Inc. - Bug 460967
******************************************************************************/
package org.eclipse.equinox.p2.tests.metadata.repository;
@@ -33,7 +34,7 @@ public class SiteIndexFileTest extends AbstractProvisioningTest {
class VisibleMetadataRepositoryManager extends MetadataRepositoryManager {
public VisibleMetadataRepositoryManager() {
- super((IProvisioningAgent) ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.SERVICE_NAME));
+ super(ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class));
}
public String[] sortSuffixes(String[] suffixes, URI location, String[] preferredOrder) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java
index a3bb0d0d8..e0ace2233 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.mirror;
@@ -1243,7 +1244,7 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest {
//for Bug 259112
public void testErrorLoggingNoVerbose() {
//initialize log file
- FrameworkLog log = (FrameworkLog) ServiceHelper.getService(Activator.getContext(), FrameworkLog.class.getName());
+ FrameworkLog log = ServiceHelper.getService(Activator.getContext(), FrameworkLog.class);
assertNotNull("Assert log file is not null", log);
assertTrue("Clearing log file", log.getFile().delete());
@@ -1283,7 +1284,7 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest {
//for Bug 259112
public void testErrorLoggingWithVerbose() {
//initialize log file
- FrameworkLog log = (FrameworkLog) ServiceHelper.getService(Activator.getContext(), FrameworkLog.class.getName());
+ FrameworkLog log = ServiceHelper.getService(Activator.getContext(), FrameworkLog.class);
assertNotNull("Assert log file is not null", log);
assertTrue("Clearing log file", log.getFile().delete());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java
index df65a10ce..44a48c8ad 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.mirror;
@@ -1301,7 +1302,7 @@ public class NewMirrorApplicationArtifactTest extends AbstractProvisioningTest {
//for Bug 259112
public void testErrorLoggingNoVerbose() {
//initialize log file
- FrameworkLog log = (FrameworkLog) ServiceHelper.getService(Activator.getContext(), FrameworkLog.class.getName());
+ FrameworkLog log = ServiceHelper.getService(Activator.getContext(), FrameworkLog.class);
assertNotNull("Assert log file is not null", log);
assertTrue("Clearing log file", log.getFile().delete());
@@ -1346,7 +1347,7 @@ public class NewMirrorApplicationArtifactTest extends AbstractProvisioningTest {
//for Bug 259112
public void testErrorLoggingWithVerbose() {
//initialize log file
- FrameworkLog log = (FrameworkLog) ServiceHelper.getService(Activator.getContext(), FrameworkLog.class.getName());
+ FrameworkLog log = ServiceHelper.getService(Activator.getContext(), FrameworkLog.class);
assertNotNull("Assert log file is not null", log);
assertTrue("Clearing log file", log.getFile().exists() && log.getFile().delete());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
index 3ce8ba575..4a7ad3e53 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Ericsson AB - Ongoing development
- * Red Hat, Inc. - Fragment support added.
+ * Red Hat, Inc. - Fragment support added. Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.reconciler.dropins;
@@ -158,7 +158,7 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest {
* Helper method to return the install location. Return null if it is unavailable.
*/
public static File getInstallLocation() {
- Location installLocation = (Location) ServiceHelper.getService(TestActivator.getContext(), Location.class.getName(), Location.INSTALL_FILTER);
+ Location installLocation = ServiceHelper.getService(TestActivator.getContext(), Location.class, Location.INSTALL_FILTER);
if (installLocation == null || !installLocation.isSet())
return null;
URL url = installLocation.getURL();
@@ -701,7 +701,7 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest {
public int runDirectorToInstall(String message, File installFolder, String sourceRepo, String iuToInstall) {
String[] command = new String[] {//
- "-application", "org.eclipse.equinox.p2.director", //
+ "-application", "org.eclipse.equinox.p2.director", //
"-repository", sourceRepo, "-installIU", iuToInstall, //
"-destination", installFolder.getAbsolutePath(), //
"-bundlepool", installFolder.getAbsolutePath(), //
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 3a2672155..0a138eac4 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
@@ -1,7 +1,5 @@
-package org.eclipse.equinox.p2.tests.sharedinstall;
-
/*******************************************************************************
- * Copyright (c) 2012 Ericsson and others.
+ * Copyright (c) 2012, 2015 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,7 +7,10 @@ package org.eclipse.equinox.p2.tests.sharedinstall;
*
* Contributors:
* Pascal Rapicault (Ericsson) - Initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
+package org.eclipse.equinox.p2.tests.sharedinstall;
+
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
@@ -50,13 +51,13 @@ public class SharedProfilePreferencesTest extends AbstractProvisioningTest {
System.setProperty("osgi.configuration.area", new File(userHome, "configuration").toURI().toString() + '/');
System.setProperty("eclipse.p2.profile", "epp.package.java");
System.setProperty("eclipse.p2.data.area", "@config.dir/../p2");
- IPreferencesService prefService = (IPreferencesService) ServiceHelper.getService(TestActivator.getContext(), IPreferencesService.class.getName());
+ IPreferencesService prefService = ServiceHelper.getService(TestActivator.getContext(), IPreferencesService.class);
prefService.getRootNode().node("/profile/").removeNode();
p2Core.start();
}
public void testCountReposInSharedInstallPreferences() {
- IPreferencesService prefService = (IPreferencesService) ServiceHelper.getService(TestActivator.getContext(), IPreferencesService.class.getName());
+ IPreferencesService prefService = ServiceHelper.getService(TestActivator.getContext(), IPreferencesService.class);
assertNotNull(prefService);
try {
URI defaultLocation = adjustTrailingSlash(URIUtil.makeAbsolute(URIUtil.fromString(TestActivator.getContext().getProperty("osgi.configuration.area") + "/../p2/"), new URI(".")), true);
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 3fdf1e2c7..72637cb55 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson and others.
+ * Copyright (c) 2012, 2015 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Pascal Rapicault (Ericsson) - Initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.sharedinstall;
@@ -47,7 +48,7 @@ public class SharedProfilePreferencesTestWithDataInUser extends AbstractProvisio
System.setProperty("osgi.configuration.area", new File(userHome, "configuration").toURI().toString() + '/');
System.setProperty("eclipse.p2.profile", "epp.package.java");
System.setProperty("eclipse.p2.data.area", "@config.dir/../p2");
- IPreferencesService prefService = (IPreferencesService) ServiceHelper.getService(Activator.getContext(), IPreferencesService.class.getName());
+ IPreferencesService prefService = ServiceHelper.getService(Activator.getContext(), IPreferencesService.class);
prefService.getRootNode().node("/profile/").removeNode();
p2Core.start();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/AbstractTestServerClientCase.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/AbstractTestServerClientCase.java
index de7ffb8eb..a4d07e4cd 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/AbstractTestServerClientCase.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/AbstractTestServerClientCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Cloudsmith and others.
+ * Copyright (c) 2009, 2015 Cloudsmith and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Cloudsmith - initial API and implementation
+ * Red Hat Inc. - Bug 460967
*******************************************************************************/
package org.eclipse.equinox.p2.tests.testserver.helper;
@@ -42,7 +43,7 @@ public class AbstractTestServerClientCase extends TestCase {
protected static IProvisioningAgent getAgent() {
//get the global agent for the currently running system
- return (IProvisioningAgent) ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.SERVICE_NAME);
+ return ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class);
}
protected void basicRun(TestResult result) {

Back to the top