diff options
author | Alexander Kurtakov | 2017-09-19 15:22:56 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-09-19 15:25:39 +0000 |
commit | c4f4dcfa6ee5a5d9a4e4b8e426cea5cd37cd4e2e (patch) | |
tree | d24b2354ab7b4e722ca5c8f303d692814e486f20 | |
parent | 07de08ae780ef98f8f35b711c583cf6c193574d8 (diff) | |
download | rt.equinox.p2-I20170920-0100.tar.gz rt.equinox.p2-I20170920-0100.tar.xz rt.equinox.p2-I20170920-0100.zip |
Bug 522466 - Fix generification warnings in p2.testsI20170920-0100I20170919-2000
Yet another round.
Change-Id: Idfcc6a717588ea423249b45ca37c18fc832aaad1
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
36 files changed, 159 insertions, 156 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 7d07c6dea..08e2d36c3 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 @@ -67,11 +67,11 @@ public abstract class AbstractProvisioningTest extends TestCase { protected static final Version DEFAULT_VERSION = Version.createOSGi(1, 0, 0); public static final ITouchpointType TOUCHPOINT_OSGI = MetadataFactory.createTouchpointType("org.eclipse.equinox.p2.osgi", Version.createOSGi(1, 0, 0)); - protected static final Map NO_PROPERTIES = Collections.EMPTY_MAP; + protected static final Map<String, String> NO_PROPERTIES = Collections.emptyMap(); protected static final IProvidedCapability[] NO_PROVIDES = new IProvidedCapability[0]; protected static final IRequiredCapability[] NO_REQUIRES = new IRequiredCapability[0]; - protected static final ITouchpointData NO_TP_DATA = MetadataFactory.createTouchpointData(new HashMap()); + protected static final ITouchpointData NO_TP_DATA = MetadataFactory.createTouchpointData(new HashMap<>()); //flag used to disable currently failing (invalid) tests. This should always be set to true protected boolean DISABLED = true; @@ -396,7 +396,7 @@ public abstract class AbstractProvisioningTest extends TestCase { * Create a basic InstallableUnit with the given attributes. All other attributes * assume default values, and the default self capability is also added to the IU. */ - public static IInstallableUnit createIU(String name, Version version, IRequirement[] required, Map properties, boolean singleton) { + public static IInstallableUnit createIU(String name, Version version, IRequirement[] required, Map<String, String> properties, boolean singleton) { return createIU(name, version, null, required, NO_PROVIDES, properties, ITouchpointType.NONE, NO_TP_DATA, singleton); } @@ -416,7 +416,7 @@ public abstract class AbstractProvisioningTest extends TestCase { * Create a basic InstallableUnit with the given attributes. All other attributes * assume default values, and the default self capability is also added to the IU. */ - public static IInstallableUnit createIU(String name, Version version, IMatchExpression<IInstallableUnit> filter, IRequirement[] required, IProvidedCapability[] additionalProvides, Map properties, ITouchpointType tpType, ITouchpointData tpData, boolean singleton) { + public static IInstallableUnit createIU(String name, Version version, IMatchExpression<IInstallableUnit> filter, IRequirement[] required, IProvidedCapability[] additionalProvides, Map<String, String> properties, ITouchpointType tpType, ITouchpointData tpData, boolean singleton) { return createIU(name, version, filter, required, additionalProvides, properties, tpType, tpData, singleton, null, null); } @@ -424,7 +424,7 @@ public abstract class AbstractProvisioningTest extends TestCase { return createIUPatch(name, version, null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, ITouchpointType.NONE, NO_TP_DATA, singleton, null, changes, scope, lifeCycle, NO_REQUIRES); } - public static IInstallableUnitPatch createIUPatch(String name, Version version, IMatchExpression<IInstallableUnit> filter, IRequirement[] required, IProvidedCapability[] additionalProvides, Map properties, ITouchpointType tpType, ITouchpointData tpData, boolean singleton, IUpdateDescriptor update, IRequirementChange[] reqChanges, IRequirement[][] scope, IRequirement lifeCycle, IRequirement[] metaRequirements) { + public static IInstallableUnitPatch createIUPatch(String name, Version version, IMatchExpression<IInstallableUnit> filter, IRequirement[] required, IProvidedCapability[] additionalProvides, Map<String, String> properties, ITouchpointType tpType, ITouchpointData tpData, boolean singleton, IUpdateDescriptor update, IRequirementChange[] reqChanges, IRequirement[][] scope, IRequirement lifeCycle, IRequirement[] metaRequirements) { org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitPatchDescription iu = new MetadataFactory.InstallableUnitPatchDescription(); iu.setId(name); iu.setVersion(version); @@ -436,7 +436,7 @@ public abstract class AbstractProvisioningTest extends TestCase { } for (Iterator<String> iter = properties.keySet().iterator(); iter.hasNext();) { String nextKey = iter.next(); - String nextValue = (String) properties.get(nextKey); + String nextValue = properties.get(nextKey); iu.setProperty(nextKey, nextValue); } iu.setCapabilities(provides); @@ -453,7 +453,7 @@ public abstract class AbstractProvisioningTest extends TestCase { return MetadataFactory.createInstallableUnitPatch(iu); } - public static IInstallableUnit createIU(String name, Version version, IMatchExpression<IInstallableUnit> filter, IRequirement[] required, IProvidedCapability[] additionalProvides, Map properties, ITouchpointType tpType, ITouchpointData tpData, boolean singleton, IUpdateDescriptor update, IRequirement[] metaRequirements) { + public static IInstallableUnit createIU(String name, Version version, IMatchExpression<IInstallableUnit> filter, IRequirement[] required, IProvidedCapability[] additionalProvides, Map<String, String> properties, ITouchpointType tpType, ITouchpointData tpData, boolean singleton, IUpdateDescriptor update, IRequirement[] metaRequirements) { org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription(); iu.setId(name); iu.setVersion(version); @@ -465,7 +465,7 @@ public abstract class AbstractProvisioningTest extends TestCase { } for (Iterator<String> iter = properties.keySet().iterator(); iter.hasNext();) { String nextKey = iter.next(); - String nextValue = (String) properties.get(nextKey); + String nextValue = properties.get(nextKey); iu.setProperty(nextKey, nextValue); } iu.setCapabilities(provides); @@ -1298,7 +1298,7 @@ public abstract class AbstractProvisioningTest extends TestCase { } public static void assertContains(String message, IQueryable source, IQueryable destination) { - IQueryResult sourceCollector = source.query(QueryUtil.createIUAnyQuery(), null); + IQueryResult<IInstallableUnit> sourceCollector = source.query(QueryUtil.createIUAnyQuery(), null); Iterator<IInstallableUnit> it = sourceCollector.iterator(); while (it.hasNext()) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java index 73cb77539..edcb33f85 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java @@ -66,7 +66,7 @@ public class AggregateQueryTest extends TestCase { }; IQuery compoundQuery = QueryUtil.createCompoundQuery(getLatest, getAllBut3, true); - IQueryResult result = compoundQuery.perform(get123().iterator()); + IQueryResult<String> result = compoundQuery.perform(get123().iterator()); assertEquals(0, AbstractProvisioningTest.queryResultSize(result)); compoundQuery = QueryUtil.createCompoundQuery(getAllBut3, getLatest, true); @@ -245,8 +245,8 @@ public class AggregateQueryTest extends TestCase { } }; - IQuery compoundQuery = QueryUtil.createCompoundQuery(ABC, BCDE, false); - IQueryResult result = compoundQuery.perform(getABCDE().iterator()); + IQuery<String> compoundQuery = QueryUtil.createCompoundQuery(ABC, BCDE, false); + IQueryResult<String> result = compoundQuery.perform(getABCDE().iterator()); assertEquals("1.0", AbstractProvisioningTest.queryResultSize(result), 5); AbstractProvisioningTest.assertContains("1.1", result, "A"); AbstractProvisioningTest.assertContains("1.2", result, "B"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/AutomatedDirectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/AutomatedDirectorTest.java index fe54427a5..f229b4e66 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/AutomatedDirectorTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/AutomatedDirectorTest.java @@ -1,21 +1,20 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2007, 2017 IBM Corporation and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.director; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.HashMap; import java.util.Map; import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.IDirector; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; @@ -60,7 +59,7 @@ public class AutomatedDirectorTest extends AbstractProvisioningTest { IDirector director = createDirector(); //Install into a profile in which the filter is satisfied - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_ENVIRONMENTS, "FilterKey=true"); IProfile satisfied = createProfile("Satisfied." + getName(), properties); ProfileChangeRequest request = new ProfileChangeRequest(satisfied); @@ -144,7 +143,7 @@ public class AutomatedDirectorTest extends AbstractProvisioningTest { assertTrue("1.0", !result.isOK()); //try again with the filter satisfied - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_ENVIRONMENTS, "osgi.os=blort"); IProfile profile2 = createProfile("TestProfile2." + getName(), properties); request = new ProfileChangeRequest(profile2); @@ -171,7 +170,7 @@ public class AutomatedDirectorTest extends AbstractProvisioningTest { assertTrue("1.0", !result.isOK()); //try again with the filter satisfied - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_ENVIRONMENTS, "osgi.os=blort"); IProfile profile2 = createProfile("TestProfile2." + getName(), properties); request = new ProfileChangeRequest(profile2); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java index 484709afe..af63079d6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java @@ -23,13 +23,13 @@ import org.osgi.framework.BundleContext; * from the hosting framework. Any more access could result in ClassVerifier errors. */ public class EmbeddedEquinox { - private final Map frameworkProperties; + private final Map<String, String> frameworkProperties; private final String[] frameworkArgs; private Class<?> eclipseStarterClazz; private BundleContext context; private URL[] frameworkClassPath; - public EmbeddedEquinox(Map frameworkProperties, String[] frameworkArgs, URL[] frameworkClassPath) { + public EmbeddedEquinox(Map<String, String> frameworkProperties, String[] frameworkArgs, URL[] frameworkClassPath) { this.frameworkProperties = frameworkProperties; this.frameworkArgs = frameworkArgs; this.frameworkClassPath = frameworkClassPath; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java index de69fbe25..da4490148 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java @@ -323,7 +323,7 @@ public class EngineTest extends AbstractProvisioningTest { // This tests currently does not download anything. We need another sizing test to ensure sizes are retrieved public void testPerformSizingOSGiFrameworkNoArtifacts() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath()); IProfile profile = createProfile("testPerformSizing", properties); @@ -362,7 +362,7 @@ public class EngineTest extends AbstractProvisioningTest { // } public void testPerformInstallOSGiFramework() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath()); IProfile profile = createProfile("testPerformInstallOSGiFramework", properties); @@ -381,7 +381,7 @@ public class EngineTest extends AbstractProvisioningTest { } public void testPerformUpdateOSGiFramework() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath()); IProfile profile = createProfile("testPerformUpdateOSGiFramework", properties); @@ -405,7 +405,7 @@ public class EngineTest extends AbstractProvisioningTest { public void testPerformUninstallOSGiFramework() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath()); IProfile profile = createProfile("testPerformUninstallOSGiFramework", properties); @@ -418,7 +418,7 @@ public class EngineTest extends AbstractProvisioningTest { public void testPerformRollback() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath()); IProfile profile = createProfile("testPerformRollback", properties); @@ -458,7 +458,7 @@ public class EngineTest extends AbstractProvisioningTest { public void testPerformMissingAction() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath()); IProfile profile = createProfile("testPerformMissingAction", properties); @@ -476,7 +476,7 @@ public class EngineTest extends AbstractProvisioningTest { public void testPerformRollbackOnPhaseError() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath()); IProfile profile = createProfile("testPerformRollbackOnError", properties); NPEPhase phase = new NPEPhase(); @@ -498,7 +498,7 @@ public class EngineTest extends AbstractProvisioningTest { public void testPerformRollbackOnActionError() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath()); IProfile profile = createProfile("testPerformRollbackOnError", properties); ActionNPEPhase phase = new ActionNPEPhase(); @@ -517,13 +517,13 @@ public class EngineTest extends AbstractProvisioningTest { } public void testPerformForcedPhaseWithActionError() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath()); IProfile profile = createProfile("testPerformForceWithActionError", properties); ActionNPEPhase phase = new ActionNPEPhase(true); PhaseSet phaseSet = new TestPhaseSet(phase); - Iterator ius = getInstallableUnits(profile); + Iterator<?> ius = getInstallableUnits(profile); assertFalse(ius.hasNext()); IProvisioningPlan plan = engine.createPlan(profile, null); @@ -538,7 +538,7 @@ public class EngineTest extends AbstractProvisioningTest { } public void testPerformForcedUninstallWithBadUninstallIUActionThrowsException() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath()); IProfile profile = createProfile("testPerformForcedUninstallWithBadUninstallIUActionThrowsException", properties); @@ -576,7 +576,7 @@ public class EngineTest extends AbstractProvisioningTest { } public void testPerformForcedUninstallWithBadUninstallIUActionReturnsError() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath()); IProfile profile = createProfile("testPerformForcedUninstallWithBadUninstallIUActionReturnsError", properties); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java index 9a5898b78..f085f9415 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java @@ -195,7 +195,7 @@ public class PhaseSetTest extends AbstractProvisioningTest { context.setMetadataRepositories(new URI[] {repoLoc}); IEngine engine = getEngine(); // restrict the installation to 'linux & gtk & x86' to match the test repo - Map props = new HashMap<String, String>(); + Map<String, String> props = new HashMap<>(); props.put(IProfile.PROP_ENVIRONMENTS, "osgi.ws=gtk,osgi.arch=x86,osgi.os=linux"); props.put(IProfile.PROP_INSTALL_FOLDER, testFolder.getAbsolutePath()); IProfile profile = createProfile(profileId, props); 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 b1ac67366..6b21ce44a 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 @@ -65,9 +65,9 @@ public class ProfilePreferencesTest extends AbstractProvisioningTest { agent.setLocation(location); agent.setBundleContext(TestActivator.getContext()); IAgentLocation agentLocation = (IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME); - Hashtable props = new Hashtable(); + Hashtable<String, String> props = new Hashtable<>(); props.put("locationURI", location.toString()); - ServiceRegistration reg = TestActivator.getContext().registerService(IProvisioningAgent.SERVICE_NAME, agent, props); + ServiceRegistration<IProvisioningAgent> reg = TestActivator.getContext().registerService(IProvisioningAgent.class, agent, props); try { Preferences prefs = new ProfileScope(agentLocation, "TestProfile").getNode("org.eclipse.equinox.p2.ui.sdk"); assertEquals("1.0", "always", prefs.get("allowNonOKPlan", "")); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java index 752ba23a2..83c44ed84 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java @@ -326,9 +326,9 @@ public class ProfileTest extends AbstractProvisioningTest { } public class ProfilesProfileHandler extends ProfileHandler { - private final Map profileHandlers; + private final Map<String, ProfileHandler> profileHandlers; - public ProfilesProfileHandler(ProfilesHandler profilesHandler, Attributes attributes, Map profileHandlers) { + public ProfilesProfileHandler(ProfilesHandler profilesHandler, Attributes attributes, Map<String, ProfileHandler> profileHandlers) { this.profileHandlers = profileHandlers; this.parentHandler = profilesHandler; xmlReader.setContentHandler(this); @@ -350,7 +350,7 @@ public class ProfileTest extends AbstractProvisioningTest { @Override protected Object getRootObject() { - Map result = new HashMap(); + Map<String, IProfile> result = new HashMap<>(); for (int i = 0; i < profiles.length; i++) { result.put(profiles[i].getProfileId(), profiles[i]); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest.java index 1cc41bebe..47e52436e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest.java @@ -35,7 +35,7 @@ public class VariableTest extends AbstractProvisioningTest { public void testVariable() { Action.reinitForNextTest(); - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, getTempFolder().getAbsolutePath()); IProfile profile = createProfile("testVariable1", properties); @@ -52,7 +52,7 @@ public class VariableTest extends AbstractProvisioningTest { public void testUndo() { Action.reinitForNextTest(); Action.failMode = true; - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, getTempFolder().getAbsolutePath()); IProfile profile = createProfile("testVariable2", properties); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest2.java index 7e25f0d4b..91b739526 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest2.java @@ -35,7 +35,7 @@ public class VariableTest2 extends AbstractProvisioningTest { //Test that the values returned from the action are properly passed in and not mangled to string public void testNonStringValue() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, getTempFolder().getAbsolutePath()); IProfile profile = createProfile(this.getName(), properties); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest3.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest3.java index cdc37eb30..827999a20 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest3.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest3.java @@ -38,7 +38,7 @@ public class VariableTest3 extends AbstractProvisioningTest { //In the second invocation of the action no value is returned (we are returning the special value, no value) //In the third invocation we verify that lastResult is empty public void testLastResultIsReinitialized() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_INSTALL_FOLDER, getTempFolder().getAbsolutePath()); IProfile profile = createProfile(this.getName(), properties); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/RepoValidator.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/RepoValidator.java index 4086ea61c..fadcee82c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/RepoValidator.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/RepoValidator.java @@ -44,7 +44,7 @@ public class RepoValidator extends AbstractProvisioningTest { assertNotNull("Unable to aquire IMetadataManager service.", manager); IMetadataRepository repository = manager.loadRepository(repositoryLocation, null); - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put("osgi.os", context.getProperty("osgi.os")); properties.put("osgi.ws", context.getProperty("osgi.ws")); properties.put("osgi.arch", context.getProperty("osgi.arch")); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java index a4ad79726..5f8b293c0 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.metadata; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.*; import junit.framework.AssertionFailedError; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.query.IQueryable; import org.eclipse.equinox.p2.query.QueryUtil; @@ -177,7 +176,7 @@ public class FragmentTest extends AbstractProvisioningTest { } private IInstallableUnit createIUWithTouchpointData() { - ITouchpointData data = MetadataFactory.createTouchpointData(new HashMap()); + ITouchpointData data = MetadataFactory.createTouchpointData(new HashMap<>()); return createEclipseIU("iu.1", DEFAULT_VERSION, NO_REQUIRES, data); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java index 6eed3b348..9e6c90dc6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java @@ -32,7 +32,7 @@ public class AllServerTests extends TestCase { public static final String PROP_TESTSERVER_PORT = "org.osgi.service.http.port"; static UIServices hookedAuthDialog; - private static ServiceRegistration certificateUIRegistration; + private static ServiceRegistration<UIServices> certificateUIRegistration; private static int setUpCounter = 0; private static ServiceReference<PackageAdmin> packageAdminRef; @@ -116,10 +116,10 @@ public class AllServerTests extends TestCase { throw new IllegalStateException("Unable to start bundle " + BUNDLE_TESTSERVER); // We must ensure that our IServiceUI service wins because the SDK registers one declaratively - Hashtable properties = new Hashtable(1); + Hashtable<String, Integer> properties = new Hashtable<>(1); properties.put(org.osgi.framework.Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); - certificateUIRegistration = context.registerService(UIServices.class.getName(), new DelegatingAuthService(), properties); + certificateUIRegistration = context.registerService(UIServices.class, new DelegatingAuthService(), properties); setUpCounter = 1; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/BatchExecuteMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/BatchExecuteMetadataRepositoryTest.java index cd304cb69..ee8aed75c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/BatchExecuteMetadataRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/BatchExecuteMetadataRepositoryTest.java @@ -54,7 +54,7 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest try { repositoryFile = getTempFolder(); repositoryURI = repositoryFile.toURI(); - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI contentXML = new URI(repositoryFile.toURI().toString() + "/content.xml"); IStatus status = repo.executeBatch(monitor -> { @@ -80,7 +80,7 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest try { repositoryFile = getTempFolder(); repositoryURI = repositoryFile.toURI(); - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI contentXML = new URI(repositoryFile.toURI().toString() + "/content.xml"); IStatus status = repo.executeBatch(monitor -> { @@ -114,7 +114,7 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest try { repositoryFile = getTempFolder(); repositoryURI = repositoryFile.toURI(); - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI contentXML = new URI(repositoryFile.toURI().toString() + "/content.xml"); IStatus status = repo.executeBatch(monitor -> { @@ -139,7 +139,7 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest try { repositoryFile = getTempFolder(); repositoryURI = repositoryFile.toURI(); - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI contentXML = new URI(repositoryFile.toURI().toString() + "/content.xml"); IStatus status = repo.executeBatch(monitor -> { @@ -165,7 +165,7 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest try { repositoryFile = getTempFolder(); repositoryURI = repositoryFile.toURI(); - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI contentXML = new URI(repositoryFile.toURI().toString() + "/content.xml"); IStatus status = repo.executeBatch(monitor -> { @@ -192,7 +192,7 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest try { repositoryFile = getTempFolder(); repositoryURI = repositoryFile.toURI(); - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); IStatus status = repo.executeBatch(monitor -> { // empty @@ -330,7 +330,7 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest try { repositoryFile = getTempFolder(); repositoryURI = repositoryFile.toURI(); - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); repo.executeBatch(monitor -> { throw new RuntimeException(); @@ -353,7 +353,7 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest try { repositoryFile = getTempFolder(); repositoryURI = repositoryFile.toURI(); - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); repo.executeBatch(monitor -> { Field field; 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 f51596074..7f1f9abfb 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 @@ -87,7 +87,7 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest { System.setOut(stream); System.setErr(stream); MirrorApplication application = new MirrorApplication(); - Map map = new HashMap(); + Map<String, String> map = new HashMap<>(); map.put("metadataOrArtifacts", "artifacts"); application.setInitializationData(null, null, map); application.initializeFromArguments(args); @@ -755,7 +755,7 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest { public void testExistingArtifactRepoProperties() { //Setup: create the destination String name = "Destination Name"; - Map properties = null; //default properties + Map<String, String> properties = null; //default properties try { //create the repository and get the resulting properties properties = getArtifactRepositoryManager().createRepository(destRepoLocation.toURI(), name, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties).getProperties(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug249605.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug249605.java index 45d9d07f3..7ce35f748 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug249605.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug249605.java @@ -41,10 +41,10 @@ public class Bug249605 extends AbstractProvisioningTest { p1 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false)}}, null); IRequirementChange change2 = MetadataFactory.createRequirementChange(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", VersionRange.emptyRange, null, false, false, false), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.2.0, 1.3.0)"), null, false, false, true)); - p2 = createIUPatch("P", Version.create("1.2.0"), null, new IRequirement[0], new IProvidedCapability[0], new HashMap(), null, null, true, MetadataFactory.createUpdateDescriptor("P", new VersionRange("[1.0.0, 1.2.0)"), 0, null), new IRequirementChange[] {change2}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false)}}, null, new IRequirement[0]); + p2 = createIUPatch("P", Version.create("1.2.0"), null, new IRequirement[0], new IProvidedCapability[0], new HashMap<>(), null, null, true, MetadataFactory.createUpdateDescriptor("P", new VersionRange("[1.0.0, 1.2.0)"), 0, null), new IRequirementChange[] {change2}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false)}}, null, new IRequirement[0]); IRequirementChange change3 = MetadataFactory.createRequirementChange(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", VersionRange.emptyRange, null, false, false, false), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.3.0, 1.4.0)"), null, false, false, true)); - p3 = createIUPatch("P", Version.create("1.3.0"), null, new IRequirement[0], new IProvidedCapability[0], new HashMap(), null, null, true, MetadataFactory.createUpdateDescriptor("P", new VersionRange("[1.0.0, 1.3.0)"), 0, null), new IRequirementChange[] {change3}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false)}}, null, new IRequirement[0]); + p3 = createIUPatch("P", Version.create("1.3.0"), null, new IRequirement[0], new IProvidedCapability[0], new HashMap<>(), null, null, true, MetadataFactory.createUpdateDescriptor("P", new VersionRange("[1.0.0, 1.3.0)"), 0, null), new IRequirementChange[] {change3}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false)}}, null, new IRequirement[0]); createTestMetdataRepository(new IInstallableUnit[] {a1, b1, b2, b3, p1, p2, p3}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java index 7515827c0..a48152ac9 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java @@ -48,9 +48,9 @@ public class Bug254481dataSet2 extends AbstractProvisioningTest { } public void testInstallFeaturePatch() { - IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.jdt.feature.patch.feature.group"), new NullProgressMonitor()); + IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.jdt.feature.patch.feature.group"), new NullProgressMonitor()); assertEquals(1, queryResultSize(c)); - IInstallableUnit patch = (IInstallableUnit) c.iterator().next(); + IInstallableUnit patch = c.iterator().next(); ProfileChangeRequest request = new ProfileChangeRequest(profile); request.addInstallableUnits(new IInstallableUnit[] {patch}); request.setInstallableUnitInclusionRules(patch, ProfileInclusionRules.createOptionalInclusionRule(patch)); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java index d2e493eb1..c56dcdd55 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java @@ -11,7 +11,7 @@ package org.eclipse.equinox.p2.tests.planner; import java.util.ArrayList; -import java.util.Properties; +import java.util.HashMap; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; @@ -57,7 +57,7 @@ public class Bug278668 extends AbstractProvisioningTest { requirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "com.tssap.selena.model.providers.resources", new VersionRange("[1.0.0, 1.0.0]"), null, false, false)); requirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "com.tssap.selena.model", new VersionRange("[1.0.0, 1.0.0]"), null, false, false)); - IInstallableUnit group = createIU("com.borland.tg.modeling.feature.group", Version.create("8.2.0.v20081113-0500-_87S7nELRXmpf6G0dO3emm"), null, requirements.toArray(new IRequirement[requirements.size()]), new IProvidedCapability[] {MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "com.borland.tg.modeling", Version.create("8.2.0.v20081113-0500-_87S7nELRXmpf6G0dO3emm"))}, new Properties(), null, null, true); + IInstallableUnit group = createIU("com.borland.tg.modeling.feature.group", Version.create("8.2.0.v20081113-0500-_87S7nELRXmpf6G0dO3emm"), null, requirements.toArray(new IRequirement[requirements.size()]), new IProvidedCapability[] {MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "com.borland.tg.modeling", Version.create("8.2.0.v20081113-0500-_87S7nELRXmpf6G0dO3emm"))}, new HashMap<String, String>(), null, null, true); ProfileChangeRequest req = new ProfileChangeRequest(profile); req.addInstallableUnits(new IInstallableUnit[] {group}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306424.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306424.java index c29a7822c..d6033c94c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306424.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306424.java @@ -82,7 +82,7 @@ public class Bug306424 extends AbstractProvisioningTest { changeRequest.addExtraRequirements(extraReqs); IProvisioningPlan plan = planner.getProvisioningPlan(changeRequest, null, new NullProgressMonitor()); - IQueryable result = plan.getRemovals(); + IQueryable<IInstallableUnit> result = plan.getRemovals(); IQueryResult<IInstallableUnit> r = result.query(QueryUtil.ALL_UNITS, getMonitor()); assertFalse("1.0", r.isEmpty()); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309530.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309530.java index 3e80e79e6..5f4db03e2 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309530.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309530.java @@ -44,10 +44,6 @@ public class Bug309530 extends AbstractProvisioningTest { super.tearDown(); } - /* - * /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#setUp() - */ @Override protected void setUp() throws Exception { super.setUp(); @@ -87,7 +83,7 @@ public class Bug309530 extends AbstractProvisioningTest { for (int i = 0; i < 5; i++) { IProvisioningPlan plan = planner.getProvisioningPlan(changeRequest, null, new NullProgressMonitor()); - IQueryable result = plan.getRemovals(); + IQueryable<IInstallableUnit> result = plan.getRemovals(); IQueryResult<IInstallableUnit> r = result.query(QueryUtil.ALL_UNITS, getMonitor()); assertFalse("1.0." + i, r.isEmpty()); assertEquals("1.1." + i, origsize, changeRequest.getInstallableUnitProfilePropertiesToAdd().size()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindingPatchesThroughUpdates.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindingPatchesThroughUpdates.java index 5e7bc1526..d8edc122a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindingPatchesThroughUpdates.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindingPatchesThroughUpdates.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import java.util.Properties; +import java.util.HashMap; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; @@ -48,7 +48,7 @@ public class FindingPatchesThroughUpdates extends AbstractProvisioningTest { IRequirementChange change4 = MetadataFactory.createRequirementChange(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", VersionRange.emptyRange, null, false, false, false), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.1.0, 1.3.0)"), null, false, false, true)); IRequirement lifeCycle4 = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[2.0.0, 3.2.0]"), null, false, false); - anotherPatch3 = createIUPatch("ANOTHERPATCH", Version.create("2.0.0"), null, NO_REQUIRES, NO_PROVIDES, new Properties(), null, null, true, MetadataFactory.createUpdateDescriptor("ANOTHERPATCH", new VersionRange("[1.0.0, 1.0.0]"), 0, ""), new IRequirementChange[] {change4}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false)}}, lifeCycle4, NO_REQUIRES); + anotherPatch3 = createIUPatch("ANOTHERPATCH", Version.create("2.0.0"), null, NO_REQUIRES, NO_PROVIDES, new HashMap<String, String>(), null, null, true, MetadataFactory.createUpdateDescriptor("ANOTHERPATCH", new VersionRange("[1.0.0, 1.0.0]"), 0, ""), new IRequirementChange[] {change4}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false)}}, lifeCycle4, NO_REQUIRES); createTestMetdataRepository(new IInstallableUnit[] {a1, a120, patchA1, patchA2, anotherPatch2, anotherPatch3}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SWTFragment.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SWTFragment.java index 88ee626db..b18fbd18c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SWTFragment.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SWTFragment.java @@ -1,17 +1,16 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -48,7 +47,7 @@ public class SWTFragment extends AbstractProvisioningTest { req.addInstallableUnits(new IInstallableUnit[] {swt}); IProvisioningPlan plan = planner.getProvisioningPlan(req, null, null); assertOK("plan", plan.getStatus()); - Collector c = new Collector(); + Collector<IInstallableUnit> c = new Collector<>(); c.addAll(plan.getAdditions().query(QueryUtil.createIUQuery("SWT"), null)); c.addAll(plan.getAdditions().query(QueryUtil.createIUQuery("SWT.WIN32"), null)); assertEquals(2, c.size()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestFilteringOnAbsentProperty.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestFilteringOnAbsentProperty.java index 79b7c965a..46a8f9a44 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestFilteringOnAbsentProperty.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestFilteringOnAbsentProperty.java @@ -75,7 +75,7 @@ public class TestFilteringOnAbsentProperty extends AbstractProvisioningTest { } public void testWithBundledProperty() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put("osgi.os", "macosx"); properties.put("macosx-bundled", "true"); IProfile profile = createProfile("TestProfile." + getName(), properties); @@ -91,7 +91,7 @@ public class TestFilteringOnAbsentProperty extends AbstractProvisioningTest { } public void testWithoutBundledProperty() { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<>(); properties.put("osgi.os", "macosx"); IProfile profile = createProfile("TestProfile." + getName(), properties); IPlanner planner = createPlanner(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProduct.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProduct.java index 4d98fcd10..c8bafd453 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProduct.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProduct.java @@ -1,16 +1,17 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. and others + * Copyright (c) 2013, 2017 Red Hat, Inc. 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: * Red Hat, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import java.util.Properties; +import java.util.HashMap; +import java.util.Map; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.operations.RequestFlexer; import org.eclipse.equinox.p2.engine.*; @@ -51,16 +52,16 @@ public class TestRequestFlexerProduct extends AbstractProvisioningTest { private void setupSDK1() { IRequirement[] reqPlatform1 = new IRequirement[1]; reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "platform", new VersionRange("[1.0.0,1.0.0]"), null, false, false, true); - Properties p = new Properties(); - p.setProperty(MetadataFactory.InstallableUnitDescription.PROP_TYPE_PRODUCT, Boolean.TRUE.toString()); + Map<String, String> p = new HashMap<>(); + p.put(MetadataFactory.InstallableUnitDescription.PROP_TYPE_PRODUCT, Boolean.TRUE.toString()); sdk1 = createIU("SDK", Version.create("1.0.0"), null, reqPlatform1, new IProvidedCapability[0], p, null, null, true); } private void setupSDK2() { IRequirement[] reqPlatform1 = new IRequirement[1]; reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "platform", new VersionRange("[2.0.0,2.0.0]"), null, false, false, true); - Properties p = new Properties(); - p.setProperty(MetadataFactory.InstallableUnitDescription.PROP_TYPE_PRODUCT, Boolean.TRUE.toString()); + Map<String, String> p = new HashMap<>(); + p.put(MetadataFactory.InstallableUnitDescription.PROP_TYPE_PRODUCT, Boolean.TRUE.toString()); IUpdateDescriptor update = MetadataFactory.createUpdateDescriptor("SDK", new VersionRange("[1.0.0,2.0.0)"), 0, "description"); sdk2 = createIU("SDK", Version.create("2.0.0"), null, reqPlatform1, new IProvidedCapability[0], p, null, null, true, update, null); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProduct2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProduct2.java index d8a7502f9..a745c3e74 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProduct2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProduct2.java @@ -1,16 +1,17 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. and others + * Copyright (c) 2013, 2017 Red Hat, Inc. 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: * Red Hat, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import java.util.Properties; +import java.util.HashMap; +import java.util.Map; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.operations.RequestFlexer; import org.eclipse.equinox.p2.engine.*; @@ -47,16 +48,16 @@ public class TestRequestFlexerProduct2 extends AbstractProvisioningTest { private void setupSDK1() { IRequirement[] reqPlatform1 = new IRequirement[1]; reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "platform", new VersionRange("[1.0.0,1.0.0]"), null, false, false, true); - Properties p = new Properties(); - p.setProperty(MetadataFactory.InstallableUnitDescription.PROP_TYPE_PRODUCT, Boolean.TRUE.toString()); + Map<String, String> p = new HashMap<>(); + p.put(MetadataFactory.InstallableUnitDescription.PROP_TYPE_PRODUCT, Boolean.TRUE.toString()); sdk1 = createIU("SDK", Version.create("1.0.0"), null, reqPlatform1, new IProvidedCapability[0], p, null, null, true); } private void setupSDK2() { IRequirement[] reqPlatform1 = new IRequirement[1]; reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "platform", new VersionRange("[2.0.0,2.0.0]"), null, false, false, true); - Properties p = new Properties(); - p.setProperty(MetadataFactory.InstallableUnitDescription.PROP_TYPE_PRODUCT, Boolean.TRUE.toString()); + Map<String, String> p = new HashMap<>(); + p.put(MetadataFactory.InstallableUnitDescription.PROP_TYPE_PRODUCT, Boolean.TRUE.toString()); IUpdateDescriptor update = MetadataFactory.createUpdateDescriptor("SDK", new VersionRange("[1.0.0,2.0.0)"), 0, "description"); sdk2 = createIU("SDK", Version.create("2.0.0"), null, reqPlatform1, new IProvidedCapability[0], p, null, null, true, update, null); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProductWithLegacyMarkup.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProductWithLegacyMarkup.java index c4a9fedc0..e5fcfd64d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProductWithLegacyMarkup.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProductWithLegacyMarkup.java @@ -1,16 +1,17 @@ /******************************************************************************* - * Copyright (c) 2013 Red Hat, Inc. and others + * Copyright (c) 2013, 2017 Red Hat, Inc. 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: * Red Hat, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import java.util.Properties; +import java.util.HashMap; +import java.util.Map; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.operations.RequestFlexer; import org.eclipse.equinox.p2.engine.*; @@ -51,16 +52,16 @@ public class TestRequestFlexerProductWithLegacyMarkup extends AbstractProvisioni private void setupSDK1() { IRequirement[] reqPlatform1 = new IRequirement[1]; reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "platform", new VersionRange("[1.0.0,1.0.0]"), null, false, false, true); - Properties p = new Properties(); - p.setProperty("lineUp", Boolean.TRUE.toString()); + Map<String, String> p = new HashMap<>(); + p.put("lineUp", Boolean.TRUE.toString()); sdk1 = createIU("SDK", Version.create("1.0.0"), null, reqPlatform1, new IProvidedCapability[0], p, null, null, true); } private void setupSDK2() { IRequirement[] reqPlatform1 = new IRequirement[1]; reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "platform", new VersionRange("[2.0.0,2.0.0]"), null, false, false, true); - Properties p = new Properties(); - p.setProperty(MetadataFactory.InstallableUnitDescription.PROP_TYPE_PRODUCT, Boolean.TRUE.toString()); + Map<String, String> p = new HashMap<>(); + p.put(MetadataFactory.InstallableUnitDescription.PROP_TYPE_PRODUCT, Boolean.TRUE.toString()); IUpdateDescriptor update = MetadataFactory.createUpdateDescriptor("SDK", new VersionRange("[1.0.0,2.0.0)"), 0, "description"); sdk2 = createIU("SDK", Version.create("2.0.0"), null, reqPlatform1, new IProvidedCapability[0], p, null, null, true, update, null); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProductWithMixedMarkup.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProductWithMixedMarkup.java index 2876c81dd..a1a98f60e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProductWithMixedMarkup.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestRequestFlexerProductWithMixedMarkup.java @@ -4,13 +4,14 @@ * 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: * Red Hat, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import java.util.Properties; +import java.util.HashMap; +import java.util.Map; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.operations.RequestFlexer; import org.eclipse.equinox.p2.engine.*; @@ -51,16 +52,16 @@ public class TestRequestFlexerProductWithMixedMarkup extends AbstractProvisionin private void setupSDK1() { IRequirement[] reqPlatform1 = new IRequirement[1]; reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "platform", new VersionRange("[1.0.0,1.0.0]"), null, false, false, true); - Properties p = new Properties(); - p.setProperty("lineUp", Boolean.TRUE.toString()); + Map<String, String> p = new HashMap<>(); + p.put("lineUp", Boolean.TRUE.toString()); sdk1 = createIU("SDK", Version.create("1.0.0"), null, reqPlatform1, new IProvidedCapability[0], p, null, null, true); } private void setupSDK2() { IRequirement[] reqPlatform1 = new IRequirement[1]; reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "platform", new VersionRange("[2.0.0,2.0.0]"), null, false, false, true); - Properties p = new Properties(); - p.setProperty("lineUp", Boolean.TRUE.toString()); + Map<String, String> p = new HashMap<>(); + p.put("lineUp", Boolean.TRUE.toString()); IUpdateDescriptor update = MetadataFactory.createUpdateDescriptor("SDK", new VersionRange("[1.0.0,2.0.0)"), 0, "description"); sdk2 = createIU("SDK", Version.create("2.0.0"), null, reqPlatform1, new IProvidedCapability[0], p, null, null, true, update, null); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java index 99c4d497f..0e3a5fe7b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java @@ -21,7 +21,7 @@ public class TychoUsage extends AbstractProvisioningTest { private void setupTopLevelIU() { IRequirement[] reqPlatform1 = new IRequirement[1]; reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.emf.sdk.feature.group", new VersionRange("[2.7.2.v20120130-0943, 2.7.2.v20120130-0943]"), null, false, false, true); - Properties p = new Properties(); + Map<String, String> p = new HashMap<>(); topLevelIU = createIU("topLevelIU", Version.create("1.0.0"), null, reqPlatform1, new IProvidedCapability[0], p, null, null, true); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java index da76625b6..8510d3982 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java @@ -24,7 +24,6 @@ import org.eclipse.equinox.internal.provisional.frameworkadmin.ConfigData; import org.eclipse.equinox.p2.publisher.eclipse.*; import org.eclipse.equinox.p2.tests.TestActivator; -@SuppressWarnings({"unchecked"}) public class AccumulateConfigDataActionTest extends ActionTest { private static String EXECUTABLE_NAME = "run.exe"; //$NON-NLS-1$ @@ -100,7 +99,7 @@ public class AccumulateConfigDataActionTest extends ActionTest { protected void insertPublisherInfoBehavior() { ConfigData configData = new ConfigData(fwName, fwVersion, launcherName, launcherVersion); ConfigAdvice configAdvice = new ConfigAdvice(configData, configSpec); - ArrayList configList = new ArrayList(); + ArrayList<ConfigAdvice> configList = new ArrayList<>(); configList.add(configAdvice); publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(ConfigAdvice.class), EasyMock.capture(configAdviceCapture))); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java index 5175de167..4b57f75c6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java @@ -94,7 +94,7 @@ public abstract class ActionTest extends AbstractProvisioningTest { return result; } - protected Map getFileMap(Map map, File[] files, Path root) { + protected Map<String, Object[]> getFileMap(Map<String, Object[]> map, File[] files, Path root) { for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) map = getFileMap(map, files[i].listFiles(), root); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java index 8ff6112f4..5364a2571 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java @@ -27,7 +27,6 @@ import org.eclipse.equinox.p2.publisher.eclipse.*; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.p2.tests.*; -@SuppressWarnings({"unchecked"}) public class ConfigCUsActionTest extends ActionTest { private static File configLocation = new File(TestActivator.getTestDataFolder(), "ConfigCUsActionTest/level1/level2/config.ini"); //$NON-NLS-1$ private static File executableLocation = new File(TestActivator.getTestDataFolder(), "ConfigCUsActionTest/level1/run.exe"); //$NON-NLS-1$ @@ -51,7 +50,7 @@ public class ConfigCUsActionTest extends ActionTest { } private void verifyAction() { - ArrayList IUs = new ArrayList(publisherResult.getIUs(null, IPublisherResult.ROOT)); + ArrayList<IInstallableUnit> IUs = new ArrayList<>(publisherResult.getIUs(null, IPublisherResult.ROOT)); assertTrue(IUs.size() == 1); InstallableUnit iu = (InstallableUnit) IUs.get(0); assertTrue(iu.getId().equalsIgnoreCase(flavor + id + ".configuration")); //$NON-NLS-1$ @@ -74,7 +73,7 @@ public class ConfigCUsActionTest extends ActionTest { } private void verifyFragment(String cuType) { - ArrayList IUs = new ArrayList(publisherResult.getIUs(null, IPublisherResult.NON_ROOT)); + ArrayList<IInstallableUnit> IUs = new ArrayList<>(publisherResult.getIUs(null, IPublisherResult.NON_ROOT)); assertTrue(IUs.size() == 2); for (int i = 0; i < IUs.size(); i++) { InstallableUnit iu = (InstallableUnit) IUs.get(i); @@ -127,7 +126,7 @@ public class ConfigCUsActionTest extends ActionTest { //configure IConfigAdvice ConfigData configData = loader.getConfigData(); ConfigAdvice configAdvice = new ConfigAdvice(configData, configSpec); - ArrayList configList = new ArrayList(); + ArrayList<IConfigAdvice> configList = new ArrayList<>(); configList.add(configAdvice); expect(publisherInfo.getAdvice(EasyMock.matches(configSpec), EasyMock.eq(false), (String) EasyMock.anyObject(), (Version) EasyMock.anyObject(), EasyMock.eq(IConfigAdvice.class))).andReturn(configList).anyTimes(); @@ -135,7 +134,7 @@ public class ConfigCUsActionTest extends ActionTest { LauncherData launcherData = loader.getLauncherData(); LaunchingAdvice launchingAdvice = new LaunchingAdvice(launcherData, configSpec); - ArrayList launchingList = new ArrayList(); + ArrayList<IExecutableAdvice> launchingList = new ArrayList<>(); launchingList.add(launchingAdvice); try { 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 8a10fabd8..f08505d6c 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 @@ -160,17 +160,17 @@ public class EvaluatorTest extends AbstractProvisioningTest { assertNotNull(artifactManager); IArtifactRepository repo = artifactManager.loadRepository(artifactRepo, new NullProgressMonitor()); - IQueryResult result = repo.query(QueryUtil.createMatchQuery(IArtifactKey.class, "classifier ~= /*/"), new NullProgressMonitor()); + IQueryResult<IArtifactKey> result = repo.query(QueryUtil.createMatchQuery(IArtifactKey.class, "classifier ~= /*/"), new NullProgressMonitor()); assertTrue(queryResultSize(result) > 1); - Iterator itor = result.iterator(); + Iterator<IArtifactKey> itor = result.iterator(); while (itor.hasNext()) - assertTrue(itor.next() instanceof IArtifactKey); + assertNotNull(itor.next()); - result = repo.descriptorQueryable().query(QueryUtil.createMatchQuery(IArtifactDescriptor.class, "artifactKey.classifier ~= /*/"), new NullProgressMonitor()); - assertTrue(queryResultSize(result) > 1); - itor = result.iterator(); - while (itor.hasNext()) - assertTrue(itor.next() instanceof IArtifactDescriptor); + IQueryResult<IArtifactDescriptor> result2 = repo.descriptorQueryable().query(QueryUtil.createMatchQuery(IArtifactDescriptor.class, "artifactKey.classifier ~= /*/"), new NullProgressMonitor()); + assertTrue(queryResultSize(result2) > 1); + Iterator<IArtifactDescriptor> itor2 = result2.iterator(); + while (itor2.hasNext()) + assertNotNull(itor2.next()); } public void testClassConstructor() throws Exception { @@ -271,7 +271,7 @@ public class EvaluatorTest extends AbstractProvisioningTest { } public void testRootVariableSerialization() throws Exception { - List items = new ArrayList(); + List<Object> items = new ArrayList<>(); items.add(new MyObject("ian bull", "foo", "true")); @@ -300,15 +300,15 @@ public class EvaluatorTest extends AbstractProvisioningTest { public void testMatchQueryInjectionInContext() throws Exception { IMetadataRepository repo = getMDR("/testData/galileoM7"); - IContextExpression<IInstallableUnit> expr = factory.contextExpression(parser.parseQuery("select(x | iquery($0, x) || iquery($1, x)).latest()"), new MatchQuery() { + IContextExpression<IInstallableUnit> expr = factory.contextExpression(parser.parseQuery("select(x | iquery($0, x) || iquery($1, x)).latest()"), new MatchQuery<IInstallableUnit>() { @Override - public boolean isMatch(Object candidate) { - return "true".equals(((IInstallableUnit) candidate).getProperty("org.eclipse.equinox.p2.type.category")); + public boolean isMatch(IInstallableUnit candidate) { + return "true".equals(candidate.getProperty("org.eclipse.equinox.p2.type.category")); } - }, new MatchQuery() { + }, new MatchQuery<IInstallableUnit>() { @Override - public boolean isMatch(Object candidate) { - return "true".equals(((IInstallableUnit) candidate).getProperty("org.eclipse.equinox.p2.type.group")); + public boolean isMatch(IInstallableUnit candidate) { + return "true".equals(candidate.getProperty("org.eclipse.equinox.p2.type.group")); } }); IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createQuery(expr), new NullProgressMonitor()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java index bd1b02eae..f319d724b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java @@ -88,7 +88,7 @@ public abstract class AbstractSimpleConfiguratorTest extends AbstractProvisionin osgiBundleDevPath = new URL(osgiBundle, "bin/"); } - Map frameworkProperties = new HashMap(); + Map<String, String> frameworkProperties = new HashMap<>(); // note that any properties you do not want to be inherited from the hosting Equinox will need // to be nulled out. Otherwise you will pick them up from the hosting env. frameworkProperties.put("osgi.framework", null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddRepositoryActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddRepositoryActionTest.java index c241200a1..665910e72 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddRepositoryActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddRepositoryActionTest.java @@ -43,8 +43,16 @@ public class AddRepositoryActionTest extends AbstractProvisioningTest { /** * Returns a map containing valid arguments for this action. */ - private Map getValidArguments() { - Map args = new HashMap(); + private Map<String, Object> getValidArguments() { + Map<String, Object> args = new HashMap<>(); + args.put("location", TEST_LOCATION); + args.put("type", Integer.toString(IRepository.TYPE_ARTIFACT)); + args.put("enabled", "true"); + return args; + } + + private Map<String, String> getValidStringArguments() { + Map<String, String> args = new HashMap<>(); args.put("location", TEST_LOCATION); args.put("type", Integer.toString(IRepository.TYPE_ARTIFACT)); args.put("enabled", "true"); @@ -66,7 +74,7 @@ public class AddRepositoryActionTest extends AbstractProvisioningTest { } public void testInvalidEnablement() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); addAgent(args); args.put("enabled", "bogus enablement"); IStatus result = action.execute(args); @@ -75,12 +83,12 @@ public class AddRepositoryActionTest extends AbstractProvisioningTest { assertTrue("1.1", !getArtifactRepositoryManager().isEnabled(locationURI)); } - private void addAgent(Map args) { + private void addAgent(Map<String, Object> args) { args.put(ActionConstants.PARM_AGENT, getAgent()); } public void testInvalidLocation() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); addAgent(args); args.put("location", "bogus location"); IStatus result = action.execute(args); @@ -88,7 +96,7 @@ public class AddRepositoryActionTest extends AbstractProvisioningTest { } public void testInvalidType() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); addAgent(args); args.put("type", "bogus type"); IStatus result = action.execute(args); @@ -97,7 +105,7 @@ public class AddRepositoryActionTest extends AbstractProvisioningTest { public void testMissingEnablement() { //note enablement is optional, defaults to true - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); addAgent(args); args.remove("enabled"); IStatus result = action.execute(args); @@ -105,7 +113,7 @@ public class AddRepositoryActionTest extends AbstractProvisioningTest { } public void testMissingType() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); addAgent(args); args.remove("type"); IStatus result = action.execute(args); @@ -118,7 +126,7 @@ public class AddRepositoryActionTest extends AbstractProvisioningTest { } public void testUndo() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); addAgent(args); IStatus result = action.execute(args); assertTrue("1.0", result.isOK()); @@ -128,7 +136,7 @@ public class AddRepositoryActionTest extends AbstractProvisioningTest { } public void testMultipleActionAdd() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); addAgent(args); IStatus result = action.execute(args); assertTrue("1.0", result.isOK()); @@ -150,7 +158,7 @@ public class AddRepositoryActionTest extends AbstractProvisioningTest { // Should not occur } - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); addAgent(args); IStatus result = action.execute(args); assertTrue("1.0", result.isOK()); @@ -168,7 +176,7 @@ public class AddRepositoryActionTest extends AbstractProvisioningTest { String id = "AddRepositoryActionTest.testFullInstall"; Version version = Version.createOSGi(1, 0, 0); Map<String, Object> instructions = new HashMap<>(); - instructions.put("configure", TouchpointInstruction.encodeAction("addRepository", getValidArguments())); + instructions.put("configure", TouchpointInstruction.encodeAction("addRepository", getValidStringArguments())); ITouchpointData tpData = MetadataFactory.createTouchpointData(instructions); IInstallableUnit iu = createIU(id, version, null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, TOUCHPOINT_OSGI, tpData, true, createUpdateDescriptor(id, version), null); IProfile profile = createProfile(id); @@ -213,7 +221,7 @@ public class AddRepositoryActionTest extends AbstractProvisioningTest { //define new IU version = Version.createOSGi(1, 1, 0); Map<String, Object> instructions = new HashMap<>(); - instructions.put("configure", TouchpointInstruction.encodeAction("addRepository", getValidArguments())); + instructions.put("configure", TouchpointInstruction.encodeAction("addRepository", getValidStringArguments())); ITouchpointData tpData = MetadataFactory.createTouchpointData(instructions); IInstallableUnit newIU = createIU(id, version, null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, TOUCHPOINT_OSGI, tpData, true, createUpdateDescriptor(id, version), null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveRepositoryActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveRepositoryActionTest.java index 13defe036..934136a9a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveRepositoryActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/RemoveRepositoryActionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 2017 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 @@ -30,8 +30,8 @@ public class RemoveRepositoryActionTest extends AbstractProvisioningTest { /** * Returns a map containing valid arguments for this action. */ - private Map getValidArguments() { - Map args = new HashMap(); + private Map<String, Object> getValidArguments() { + Map<String, Object> args = new HashMap<>(); args.put(ActionConstants.PARM_AGENT, getAgent()); args.put("location", TEST_LOCATION); args.put("type", Integer.toString(IRepository.TYPE_ARTIFACT)); @@ -54,7 +54,7 @@ public class RemoveRepositoryActionTest extends AbstractProvisioningTest { } public void testInvalidEnablement() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); args.put("enabled", "bogus enablement"); IStatus result = action.execute(args); //enablement is not relevant for remove repository action @@ -63,7 +63,7 @@ public class RemoveRepositoryActionTest extends AbstractProvisioningTest { } public void testInvalidLocation() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); args.put("location", "bogus location"); IStatus result = action.execute(args); assertTrue("1.0", !result.isOK()); @@ -71,7 +71,7 @@ public class RemoveRepositoryActionTest extends AbstractProvisioningTest { } public void testInvalidType() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); args.put("type", "bogus type"); IStatus result = action.execute(args); assertTrue("1.0", !result.isOK()); @@ -85,7 +85,7 @@ public class RemoveRepositoryActionTest extends AbstractProvisioningTest { } public void testRemoveMetadataRepository() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); args.put("type", Integer.toString(IRepository.TYPE_METADATA)); getMetadataRepositoryManager().addRepository(locationURI); IStatus result = action.execute(args); @@ -94,7 +94,7 @@ public class RemoveRepositoryActionTest extends AbstractProvisioningTest { } public void testUndo() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); IStatus result = action.execute(args); assertTrue("1.0", result.isOK()); assertTrue("1.1", !getArtifactRepositoryManager().isEnabled(locationURI)); @@ -104,7 +104,7 @@ public class RemoveRepositoryActionTest extends AbstractProvisioningTest { } public void testUndoInvalidArgument() { - Map args = getValidArguments(); + Map<String, Object> args = getValidArguments(); IStatus result = action.execute(args); assertTrue("1.0", result.isOK()); assertTrue("1.1", !getArtifactRepositoryManager().isEnabled(locationURI)); |