Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-09-19 10:32:57 +0000
committerAlexander Kurtakov2017-09-19 10:32:57 +0000
commitd82772338ce8da045203918c9b5e5a45f18ee73f (patch)
tree412074edbfe6436a427961cedd2a8e800e0c5120
parentd36a8f030d2427dc776f7bf5e3879782ac3f7fec (diff)
downloadrt.equinox.p2-d82772338ce8da045203918c9b5e5a45f18ee73f.tar.gz
rt.equinox.p2-d82772338ce8da045203918c9b5e5a45f18ee73f.tar.xz
rt.equinox.p2-d82772338ce8da045203918c9b5e5a45f18ee73f.zip
Bug 522466 - Fix generification warnings in p2.tests
Second round. Change-Id: I624199cb119e374788521bf20189852e4c15d3cc Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ReducedCUDFParser.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestData.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/FileUtilsTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/OrderedPropertiesTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OperationGenerationTest.java92
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/AbstractDirectoryWatcherTest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/ProfileSynchronizerTest.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java42
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest2.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest3.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistNegation.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/expression/FilterTest.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationSeveralConflictingRoots.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement2.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ORTesting.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest12.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest2.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest6.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest9.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest1.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest2.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestFilteringOnAbsentProperty.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ConfigurationTests.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/ChmodActionTest.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java18
54 files changed, 330 insertions, 356 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 605117120..e2d477502 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
@@ -80,12 +80,12 @@ public abstract class AbstractProvisioningTest extends TestCase {
* Tracks the metadata repositories created by this test instance. The repositories
* will be removed automatically at the end of the test.
*/
- private List metadataRepos = new ArrayList();
+ private List<IMetadataRepository> metadataRepos = new ArrayList<>();
/**
* Tracks the profile ids created by this test instance. The profiles
* will be removed automatically at the end of the test.
*/
- protected List profilesToRemove = new ArrayList();
+ protected List<String> profilesToRemove = new ArrayList<>();
private File testFolder = null;
protected Object previousSelfValue = null;
@@ -935,17 +935,14 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
}
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
@Override
protected void tearDown() throws Exception {
super.tearDown();
//remove all metadata repositories created by this test
IMetadataRepositoryManager repoMan = getMetadataRepositoryManager();
if (!metadataRepos.isEmpty()) {
- for (Iterator it = metadataRepos.iterator(); it.hasNext();) {
- IMetadataRepository repo = (IMetadataRepository) it.next();
+ for (Iterator<IMetadataRepository> it = metadataRepos.iterator(); it.hasNext();) {
+ IMetadataRepository repo = it.next();
repoMan.removeRepository(repo.getLocation());
}
metadataRepos.clear();
@@ -961,8 +958,8 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
//remove all profiles created by this test
IProfileRegistry profileRegistry = getProfileRegistry();
- for (Iterator it = profilesToRemove.iterator(); it.hasNext();) {
- String toRemove = (String) it.next();
+ for (Iterator<String> it = profilesToRemove.iterator(); it.hasNext();) {
+ String toRemove = it.next();
profileRegistry.removeProfile(toRemove);
}
profilesToRemove.clear();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ReducedCUDFParser.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ReducedCUDFParser.java
index 19f8ce65c..6ee15d0b2 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ReducedCUDFParser.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ReducedCUDFParser.java
@@ -23,15 +23,13 @@ public class ReducedCUDFParser {
private static final boolean TIMING = true; //TO SET TO FALSE FOR COMPETITION
private InstallableUnitDescription currentIU = null;
// private ProfileChangeRequest currentRequest = null;
- private List allIUs = new ArrayList();
+ private List<IInstallableUnit> allIUs = new ArrayList<>();
// private QueryableArray query = null;
- private List currentKeepRequests = new ArrayList();
class Tuple {
String name;
String version;
String operator;
- Set extraData;
Tuple(String line) {
String[] tuple = new String[3];
@@ -148,7 +146,7 @@ public class ReducedCUDFParser {
if (TIMING)
// Log.println("Time to parse:" + (System.currentTimeMillis() - start));
if (DEBUG)
- for (Iterator iter = allIUs.iterator(); iter.hasNext();)
+ for (Iterator<IInstallableUnit> iter = allIUs.iterator(); iter.hasNext();)
debug((InstallableUnit) iter.next());
// if (FORCE_QUERY) {
// if (query == null)
@@ -222,7 +220,6 @@ public class ReducedCUDFParser {
allIUs.add(MetadataFactory.createInstallableUnit(currentIU));
// reset to be ready for the next stanza
currentIU = null;
- currentKeepRequests.clear();
}
// private void handleInstalled(String line) {
@@ -369,9 +366,9 @@ public class ReducedCUDFParser {
* If there is more than one entry for a particular package, the extra entries are included
* in the extraData field of the Tuple.
*/
- private List createPackageList(String line) {
+ private List<Tuple> createPackageList(String line) {
StringTokenizer tokenizer = new StringTokenizer(line, ",");
- List result = new ArrayList(tokenizer.countTokens());
+ List<Tuple> result = new ArrayList<>(tokenizer.countTokens());
while (tokenizer.hasMoreElements()) {
result.add(new Tuple(tokenizer.nextToken()));
}
@@ -439,7 +436,7 @@ public class ReducedCUDFParser {
// if (expandNotEquals) {
// return new ORRequirement(new IRequiredCapability[] {new RequiredCapability(id, createRange3("<", version), optional), new RequiredCapability(id, createRange3(">", version), optional)}, optional);
// }
- ArrayList res = new ArrayList(2);
+ ArrayList<IRequirement> res = new ArrayList<>(2);
res.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, createRange3("<", version), null, optional, false, true));
res.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, createRange3(">", version), null, optional, false, true));
return res;
@@ -470,7 +467,6 @@ public class ReducedCUDFParser {
private IProvidedCapability createProvidedCapability(Tuple tuple) {
//At this point the parser only deal with standard provided capabilities and not ranges like cudf does.
- assert tuple.extraData == null;
assert tuple.operator == null;
return MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, tuple.name, Version.create(tuple.version));
// Set extraData = tuple.extraData;
@@ -537,11 +533,11 @@ public class ReducedCUDFParser {
private void handleProvides(String line) {
line = line.substring("provides: ".length());
- List pkgs = createPackageList(line);
+ List<Tuple> pkgs = createPackageList(line);
IProvidedCapability[] providedCapabilities = new ProvidedCapability[pkgs.size() + 2];
int i = 0;
- for (Iterator iter = pkgs.iterator(); iter.hasNext();) {
- providedCapabilities[i++] = createProvidedCapability((Tuple) iter.next());
+ for (Iterator<Tuple> iter = pkgs.iterator(); iter.hasNext();) {
+ providedCapabilities[i++] = createProvidedCapability(iter.next());
}
providedCapabilities[i++] = MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, currentIU.getId(), currentIU.getVersion());
providedCapabilities[i++] = MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, currentIU.getId(), currentIU.getVersion());
@@ -604,6 +600,6 @@ public class ReducedCUDFParser {
public IInstallableUnit getIU() {
assert allIUs.size() == 1;
- return (IInstallableUnit) allIUs.get(0);
+ return allIUs.get(0);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestData.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestData.java
index 2ca901c68..ddb4dd90c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestData.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
+ * Copyright (c) 2007, 2017 compeople AG 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
@@ -28,7 +28,7 @@ public class TestData {
private static final String PREFIX_SEPERATOR = "~";
/**
- * Get an input stream from the resource testDataName within the folder
+ * Get an input stream from the resource testDataName within the folder
* testDataFolder of the testData folder of this project.
* @param testDataFolder
* @param testDataName
@@ -40,7 +40,7 @@ public class TestData {
}
/**
- * Get a File from the resource testDataName within the folder
+ * Get a File from the resource testDataName within the folder
* testDataFolder of the testData folder of this project.
* @param testDataFolder
* @return test data File
@@ -51,7 +51,7 @@ public class TestData {
}
/**
- * Create a temporary file for the test data. The temporary file will be deleted
+ * Create a temporary file for the test data. The temporary file will be deleted
* when the jvm exists. If testDataName contains an extension this extension will
* be used as suffix for the temporary file.
* @param testDataFolder
@@ -67,8 +67,8 @@ public class TestData {
}
/**
- * Create a temporary file. This file will be deleted if the jvm exits.
- * If testDataName contains an extension this extension will be used as
+ * Create a temporary file. This file will be deleted if the jvm exits.
+ * If testDataName contains an extension this extension will be used as
* suffix for the temporary file.
* @param testDataName
* @return temporary file
@@ -124,12 +124,12 @@ public class TestData {
* @throws IOException
*/
public static void assertEquals(ZipInputStream expected, ZipInputStream actual) throws IOException {
- Map jar1 = getEntries(expected);
- Map jar2 = getEntries(actual);
- for (Iterator i = jar1.keySet().iterator(); i.hasNext();) {
- String name = (String) i.next();
- Object[] file1 = (Object[]) jar1.get(name);
- Object[] file2 = (Object[]) jar2.remove(name);
+ Map<String, Object[]> jar1 = getEntries(expected);
+ Map<String, Object[]> jar2 = getEntries(actual);
+ for (Iterator<String> i = jar1.keySet().iterator(); i.hasNext();) {
+ String name = i.next();
+ Object[] file1 = jar1.get(name);
+ Object[] file2 = jar2.remove(name);
Assert.assertNotNull(file2);
ZipEntry entry1 = (ZipEntry) file1[0];
@@ -154,19 +154,19 @@ public class TestData {
/**
* Asserts that the file bytes in <code>fileList</code> are contained in <code>input2</code>
* by matching the entry name with the root's path + fileList path.
- *
+ *
* @param fileMap a map of files to verify in <code>input2</code> keyed by relative paths
* i.e. Map<String filePath, File fileBytes>
* @param input2
* @throws IOException
*/
public static void assertContains(Map fileMap, ZipInputStream input2, boolean compareContent) throws IOException {
- Map jar2 = getEntries(input2);
+ Map<String, Object[]> jar2 = getEntries(input2);
- for (Iterator i = fileMap.keySet().iterator(); i.hasNext();) {
- String name = (String) i.next();
+ for (Iterator<String> i = fileMap.keySet().iterator(); i.hasNext();) {
+ String name = i.next();
Object[] file1 = (Object[]) fileMap.get(name);
- Object[] file2 = (Object[]) jar2.remove(name);
+ Object[] file2 = jar2.remove(name);
Assert.assertNotNull(file2);
File entry1 = (File) file1[0];
@@ -179,8 +179,8 @@ public class TestData {
}
}
- private static Map getEntries(ZipInputStream input) throws IOException {
- Map result = new HashMap();
+ private static Map<String, Object[]> getEntries(ZipInputStream input) throws IOException {
+ Map<String, Object[]> result = new HashMap<>();
while (true) {
ZipEntry entry = input.getNextEntry();
if (entry == null)
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java
index 2c47261d8..2726da16a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java
@@ -44,7 +44,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
try {
repositoryFile = getTempFolder();
repositoryURI = repositoryFile.toURI();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
final URI artifactXML = new URI(repositoryFile.toURI().toString() + "/artifacts.xml");
IStatus status = repo.executeBatch(monitor -> {
@@ -70,7 +70,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
try {
repositoryFile = getTempFolder();
repositoryURI = repositoryFile.toURI();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
final URI artifactXML = new URI(repositoryFile.toURI().toString() + "/artifacts.xml");
IStatus status = repo.executeBatch(monitor -> {
@@ -104,7 +104,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
try {
repositoryFile = getTempFolder();
repositoryURI = repositoryFile.toURI();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
final URI artifactXML = new URI(repositoryFile.toURI().toString() + "/artifacts.xml");
IStatus status = repo.executeBatch(monitor -> {
@@ -129,7 +129,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
try {
repositoryFile = getTempFolder();
repositoryURI = repositoryFile.toURI();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
final URI artifactXML = new URI(repositoryFile.toURI().toString() + "/artifacts.xml");
IStatus status = repo.executeBatch(monitor -> {
@@ -155,7 +155,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
try {
repositoryFile = getTempFolder();
repositoryURI = repositoryFile.toURI();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
final URI artifactXML = new URI(repositoryFile.toURI().toString() + "/artifacts.xml");
IStatus status = repo.executeBatch(monitor -> {
@@ -192,7 +192,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
try {
repositoryFile = getTempFolder();
repositoryURI = repositoryFile.toURI();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
IStatus status = repo.executeBatch(monitor -> {
// empty
@@ -211,7 +211,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
* @param location
* @param properties
*/
- public FailingSimpleArtifactRepository(String repositoryName, URI location, Map properties) {
+ public FailingSimpleArtifactRepository(String repositoryName, URI location, Map<String, String> properties) {
super(getAgent(), repositoryName, location, properties);
}
@@ -236,7 +236,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
* @param location
* @param properties
*/
- public FailingCompositeArtifactRepository(IArtifactRepositoryManager manager, String repositoryName, URI location, Map properties) {
+ public FailingCompositeArtifactRepository(IArtifactRepositoryManager manager, String repositoryName, URI location, Map<String, String> properties) {
super(manager, location, repositoryName, properties);
}
@@ -294,7 +294,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
*/
public void testBatchProcessingCancelled() {
try {
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
repositoryFile = getTempFolder();
repositoryURI = repositoryFile.toURI();
SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
@@ -357,7 +357,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
* @param location
* @param properties
*/
- public TrackSavignSimpleArtifactRepository(String repositoryName, URI location, Map properties) {
+ public TrackSavignSimpleArtifactRepository(String repositoryName, URI location, Map<String, String> properties) {
super(getAgent(), repositoryName, location, properties);
}
@@ -414,7 +414,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
try {
repositoryFile = getTempFolder();
repositoryURI = repositoryFile.toURI();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
repo.executeBatch(monitor -> {
throw new RuntimeException();
@@ -437,7 +437,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
try {
repositoryFile = getTempFolder();
repositoryURI = repositoryFile.toURI();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
repo.executeBatch(monitor -> {
Field field;
@@ -471,7 +471,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
try {
repositoryFile = getTempFolder();
repositoryURI = repositoryFile.toURI();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
CompositeArtifactRepository repo = (CompositeArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, properties);
repo.executeBatch(monitor -> {
throw new RuntimeException();
@@ -493,7 +493,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
try {
repositoryFile = getTempFolder();
repositoryURI = repositoryFile.toURI();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
final CompositeArtifactRepository repo = (CompositeArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, properties);
repo.executeBatch(monitor -> {
Field field;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java
index 2e53e8162..d547a506c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java
@@ -212,7 +212,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
} catch (ProvisionException e) {
fail("Cannot create repository: ", e);
}
- Map properties = repo.getProperties();
+ Map<String, String> properties = repo.getProperties();
assertTrue("1.0", !properties.containsKey(TEST_KEY));
repo.setProperty(TEST_KEY, TEST_VALUE);
@@ -1303,9 +1303,9 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
Field field = CompositeArtifactRepository.class.getDeclaredField("loadedRepos");
field.setAccessible(true);
- Class[] classes = CompositeArtifactRepository.class.getDeclaredClasses();
+ Class<?>[] classes = CompositeArtifactRepository.class.getDeclaredClasses();
- Class childInfo = null;
+ Class<?> childInfo = null;
for (int i = 0; i < classes.length && childInfo == null; i++) {
if (classes[i].getName().equals("org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository$ChildInfo"))
childInfo = classes[i];
@@ -1317,8 +1317,8 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
Field good = childInfo.getDeclaredField("good");
good.setAccessible(true);
- List list = (List) field.get(parent);
- for (Iterator listIter = list.iterator(); listIter.hasNext();) {
+ List<?> list = (List<?>) field.get(parent);
+ for (Iterator<?> listIter = list.iterator(); listIter.hasNext();) {
Object obj = listIter.next();
if (child.equals(repo.get(obj))) {
good.set(obj, false);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
index f06e62ced..395e23053 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java
@@ -208,7 +208,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest {
}
class StatusSequenceRepository extends AbstractWrappedArtifactRepository {
- Queue sequence;
+ Queue<IStatus> sequence;
public StatusSequenceRepository(IArtifactRepository repo) {
super(repo);
@@ -233,10 +233,10 @@ public class MirrorRequestTest extends AbstractProvisioningTest {
}
if (sequence.isEmpty())
return Status.OK_STATUS;
- return (IStatus) sequence.remove();
+ return sequence.remove();
}
- public void setSequence(Queue queue) {
+ public void setSequence(Queue<IStatus> queue) {
sequence = queue;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/FileUtilsTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/FileUtilsTest.java
index 9c209c7f7..23ff71a75 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/FileUtilsTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/FileUtilsTest.java
@@ -213,8 +213,8 @@ public class FileUtilsTest extends AbstractProvisioningTest {
fail(message + " file does not exist.");
try (ZipFile zip = new ZipFile(archive)) {
boolean found = false;
- for (Enumeration e = zip.entries(); !found && e.hasMoreElements();) {
- ZipEntry zipEntry = (ZipEntry) e.nextElement();
+ for (Enumeration<? extends ZipEntry> e = zip.entries(); !found && e.hasMoreElements();) {
+ ZipEntry zipEntry = e.nextElement();
if (entry.equals(zipEntry.getName()))
found = true;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/OrderedPropertiesTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/OrderedPropertiesTest.java
index 9d853130c..7cfb61f4c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/OrderedPropertiesTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/OrderedPropertiesTest.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * 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
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -34,7 +34,7 @@ public class OrderedPropertiesTest extends AbstractProvisioningTest {
}
/**
- * Ordered properties guarantees that iteration order is the same as the
+ * Ordered properties guarantees that iteration order is the same as the
* insertion order. This test verifies the claim is true.
*/
public void testIterationOrder() {
@@ -42,14 +42,14 @@ public class OrderedPropertiesTest extends AbstractProvisioningTest {
OrderedProperties props = new OrderedProperties();
props.setProperty("one", "one");
props.setProperty("two", "two");
- for (Iterator it = props.keySet().iterator(); it.hasNext();) {
+ for (Iterator<String> it = props.keySet().iterator(); it.hasNext();) {
assertEquals("one", it.next());
assertEquals("two", it.next());
}
props = new OrderedProperties();
props.setProperty("two", "two");
props.setProperty("one", "one");
- for (Iterator it = props.keySet().iterator(); it.hasNext();) {
+ for (Iterator<String> it = props.keySet().iterator(); it.hasNext();) {
assertEquals("two", it.next());
assertEquals("one", it.next());
}
@@ -57,7 +57,7 @@ public class OrderedPropertiesTest extends AbstractProvisioningTest {
//removing and re-adding a property should move it to the back of the insertion order
props.remove("two");
props.setProperty("two", "two");
- for (Iterator it = props.keySet().iterator(); it.hasNext();) {
+ for (Iterator<String> it = props.keySet().iterator(); it.hasNext();) {
assertEquals("one", it.next());
assertEquals("two", it.next());
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OperationGenerationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OperationGenerationTest.java
index 6f34646c9..5168d7752 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OperationGenerationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OperationGenerationTest.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * 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
*******************************************************************************/
@@ -24,13 +24,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnit a2 = createIU("a", Version.createOSGi(2, 0, 0), false);
IInstallableUnit a3 = createIU("a", Version.createOSGi(3, 0, 0), false);
- Collection from;
- from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(a1);
from.add(a2);
- Collection to;
- to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(a1);
to.add(a3);
@@ -47,13 +45,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnit a2 = createIU("a", Version.createOSGi(2, 0, 0), false);
IInstallableUnit a3 = createIU("a", Version.createOSGi(3, 0, 0), false);
- Collection from;
- from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(a1);
from.add(a3);
- Collection to;
- to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(a1);
to.add(a3);
to.add(a2);
@@ -70,14 +66,12 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnit a2 = createIU("a", Version.createOSGi(2, 0, 0), false);
IInstallableUnit a3 = createIU("a", Version.createOSGi(3, 0, 0), false);
- Collection from;
- from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(a1);
from.add(a2);
from.add(a3);
- Collection to;
- to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(a1);
to.add(a3);
@@ -96,12 +90,10 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
b.setVersion(Version.createOSGi(1, 0, 0));
b.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor("a", new VersionRange("[1.0.0, 2.0.0)"), IUpdateDescriptor.NORMAL, null));
- Collection from;
- from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(a);
- Collection to;
- to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(MetadataFactory.createInstallableUnit(b));
ProvisioningPlan plan = (ProvisioningPlan) getEngine().createPlan(createProfile("temp"), null);
@@ -120,13 +112,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
b.setVersion(Version.createOSGi(1, 0, 0));
b.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor("a", new VersionRange("[1.0.0, 3.0.0)"), IUpdateDescriptor.NORMAL, null));
- Collection from;
- from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(a1);
from.add(a2);
- Collection to;
- to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(MetadataFactory.createInstallableUnit(b));
ProvisioningPlan plan = (ProvisioningPlan) getEngine().createPlan(createProfile("temp"), null);
@@ -151,13 +141,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
c.setVersion(Version.createOSGi(1, 0, 0));
c.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor("a", new VersionRange("[2.0.0, 2.3.0)"), IUpdateDescriptor.NORMAL, null));
- Collection from;
- from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(a1);
from.add(a2);
- Collection to;
- to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(MetadataFactory.createInstallableUnit(b));
to.add(MetadataFactory.createInstallableUnit(c));
@@ -178,14 +166,12 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
b2.setVersion(Version.createOSGi(2, 0, 0));
b2.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor("b", new VersionRange("[1.0.0, 2.0.0)"), IUpdateDescriptor.NORMAL, null));
- Collection from;
- from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(a1);
from.add(a2);
from.add(b1);
- Collection to;
- to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(a1);
to.add(a2);
to.add(MetadataFactory.createInstallableUnit(b2));
@@ -207,14 +193,12 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
b2.setVersion(Version.createOSGi(2, 0, 0));
b2.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor("b", new VersionRange("[1.0.0, 2.0.0)"), IUpdateDescriptor.NORMAL, null));
- Collection from;
- from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(a1);
from.add(a2);
from.add(b1);
- Collection to;
- to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(a1);
to.add(MetadataFactory.createInstallableUnit(b2));
@@ -236,12 +220,12 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IUpdateDescriptor update3 = createUpdateDescriptor(id, Version.create("3.0.0"));
IInstallableUnit three = createIU(id, Version.create("3.0.0"), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, ITouchpointType.NONE, NO_TP_DATA, false, update3, null);
- Collection from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(MetadataFactory.createResolvedInstallableUnit(one, new IInstallableUnitFragment[0]));
from.add(MetadataFactory.createResolvedInstallableUnit(two, new IInstallableUnitFragment[0]));
from.add(MetadataFactory.createResolvedInstallableUnit(three, new IInstallableUnitFragment[0]));
- Collection to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(MetadataFactory.createResolvedInstallableUnit(three, new IInstallableUnitFragment[0]));
ProvisioningPlan plan = (ProvisioningPlan) getEngine().createPlan(createProfile("temp"), null);
@@ -268,11 +252,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IUpdateDescriptor update3 = createUpdateDescriptor(id, Version.create("3.0.0"));
IInstallableUnit three = createIU("anotherBundle", Version.create("3.0.0"), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, ITouchpointType.NONE, NO_TP_DATA, false, update3, null);
- Collection from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(MetadataFactory.createResolvedInstallableUnit(one, new IInstallableUnitFragment[0]));
from.add(MetadataFactory.createResolvedInstallableUnit(two, new IInstallableUnitFragment[0]));
- Collection to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(MetadataFactory.createResolvedInstallableUnit(two, new IInstallableUnitFragment[0]));
to.add(MetadataFactory.createResolvedInstallableUnit(three, new IInstallableUnitFragment[0]));
@@ -301,11 +285,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
// IUpdateDescriptor update3 = createUpdateDescriptor(id, Version.create("3.0.0"));
IInstallableUnit three = createIU("anotherBundle", Version.create("3.0.0"), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, ITouchpointType.NONE, NO_TP_DATA, false, update3, null);
- Collection from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(MetadataFactory.createResolvedInstallableUnit(one, new IInstallableUnitFragment[0]));
from.add(MetadataFactory.createResolvedInstallableUnit(two, new IInstallableUnitFragment[0]));
- Collection to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(MetadataFactory.createResolvedInstallableUnit(two, new IInstallableUnitFragment[0]));
to.add(MetadataFactory.createResolvedInstallableUnit(three, new IInstallableUnitFragment[0]));
@@ -332,11 +316,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
update = createUpdateDescriptor(id, Version.create("2.0.0"));
IInstallableUnit two = createIU(id, Version.create("2.0.0"), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, ITouchpointType.NONE, NO_TP_DATA, false, update, null);
- Collection from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
from.add(MetadataFactory.createResolvedInstallableUnit(one, new IInstallableUnitFragment[0]));
from.add(MetadataFactory.createResolvedInstallableUnit(two, new IInstallableUnitFragment[0]));
- Collection to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
to.add(MetadataFactory.createResolvedInstallableUnit(two, new IInstallableUnitFragment[0]));
ProvisioningPlan plan = (ProvisioningPlan) getEngine().createPlan(createProfile("temp"), null);
@@ -356,12 +340,12 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnitFragment cu1 = createIUFragment(anIU, cuId, Version.create("1.0.0"));
IInstallableUnitFragment cu2 = createIUFragment(anIU, cuId, Version.create("2.0.0"));
- Collection from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
ResolvedInstallableUnit fromResolved = (ResolvedInstallableUnit) MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu1});
from.add(fromResolved);
from.add(MetadataFactory.createResolvedInstallableUnit(anotherIU, new IInstallableUnitFragment[0]));
- Collection to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
IInstallableUnit toResolved = MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu2});
to.add(toResolved);
to.add(MetadataFactory.createResolvedInstallableUnit(anotherIU2, new IInstallableUnitFragment[0]));
@@ -392,11 +376,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnit anIU = createIU(id, Version.create("1.0.0"), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, ITouchpointType.NONE, NO_TP_DATA, false, null, null);
IInstallableUnitFragment cu2 = createIUFragment(anIU, cuId, Version.create("2.0.0"));
- Collection from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
ResolvedInstallableUnit fromResolved = (ResolvedInstallableUnit) MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[0]);
from.add(fromResolved);
- Collection to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
IInstallableUnit toResolved = MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu2});
to.add(toResolved);
@@ -414,11 +398,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnit anIU = createIU(id, Version.create("1.0.0"), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, ITouchpointType.NONE, NO_TP_DATA, false, null, null);
IInstallableUnitFragment cu2 = createIUFragment(anIU, cuId, Version.create("2.0.0"));
- Collection from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
ResolvedInstallableUnit fromResolved = (ResolvedInstallableUnit) MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu2});
from.add(fromResolved);
- Collection to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
IInstallableUnit toResolved = MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[0]);
to.add(toResolved);
@@ -436,11 +420,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnit anIU = createIU(id, Version.create("1.0.0"), null, NO_REQUIRES, NO_PROVIDES, NO_PROPERTIES, ITouchpointType.NONE, NO_TP_DATA, false, null, null);
IInstallableUnitFragment cu2 = createIUFragment(anIU, cuId, Version.create("2.0.0"));
- Collection from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
ResolvedInstallableUnit fromResolved = (ResolvedInstallableUnit) MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu2});
from.add(fromResolved);
- Collection to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
IInstallableUnit toResolved = MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu2});
to.add(toResolved);
@@ -458,11 +442,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnitFragment cu2 = createIUFragment(anIU, cuId, Version.create("2.0.0"));
IInstallableUnitFragment cu1 = createIUFragment(anIU, cuId, Version.create("1.0.0"));
- Collection from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
ResolvedInstallableUnit fromResolved = (ResolvedInstallableUnit) MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu1, cu2});
from.add(fromResolved);
- Collection to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
IInstallableUnit toResolved = MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu2, cu1});
to.add(toResolved);
@@ -481,11 +465,11 @@ public class OperationGenerationTest extends AbstractProvisioningTest {
IInstallableUnitFragment cu1 = createIUFragment(anIU, cuId, Version.create("1.0.0"));
IInstallableUnitFragment cu3 = createIUFragment(anIU, cuId, Version.create("3.0.0"));
- Collection from = new ArrayList();
+ Collection<IInstallableUnit> from = new ArrayList<>();
ResolvedInstallableUnit fromResolved = (ResolvedInstallableUnit) MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu1, cu2});
from.add(fromResolved);
- Collection to = new ArrayList();
+ Collection<IInstallableUnit> to = new ArrayList<>();
IInstallableUnit toResolved = MetadataFactory.createResolvedInstallableUnit(anIU, new IInstallableUnitFragment[] {cu1, cu3});
to.add(toResolved);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/AbstractDirectoryWatcherTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/AbstractDirectoryWatcherTest.java
index df8c71c70..6f5687b01 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/AbstractDirectoryWatcherTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/AbstractDirectoryWatcherTest.java
@@ -20,7 +20,7 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
public abstract class AbstractDirectoryWatcherTest extends AbstractProvisioningTest {
// list of File objects to remove later during teardown
- protected Set toRemove = new HashSet();
+ protected Set<File> toRemove = new HashSet<>();
/*
* Constructor for the class.
@@ -32,9 +32,9 @@ public abstract class AbstractDirectoryWatcherTest extends AbstractProvisioningT
@Override
protected void tearDown() throws Exception {
super.tearDown();
- for (Iterator iter = toRemove.iterator(); iter.hasNext();)
- delete((File) iter.next());
- toRemove = new HashSet();
+ for (Iterator<File> iter = toRemove.iterator(); iter.hasNext();)
+ delete(iter.next());
+ toRemove = new HashSet<>();
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/ProfileSynchronizerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/ProfileSynchronizerTest.java
index f2280cdde..6f564b858 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/ProfileSynchronizerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/ProfileSynchronizerTest.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * 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
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -41,20 +41,20 @@ public class ProfileSynchronizerTest extends AbstractDirectoryWatcherTest {
/*
* Test that we only try to install bundles with matching platform filters.
- *
+ *
* TODO we don't want to test to see if the bundles are in the repo, but if
* the bundles are filtered when they are installed into a profile.
*/
public void _testPlatformFilter() {
String base = "/testData/profileSynchronizer/";
String[] extensions = new String[] {"bbb_1.0.0.jar", "bbb.linux_1.0.0.jar", "bbb.win32_1.0.0.jar"};
- Set jars = new HashSet();
+ Set<File> jars = new HashSet<>();
for (int i = 0; i < extensions.length; i++)
jars.add(getTestData("0.99", base + extensions[i]));
File folder = getTempFolder();
toRemove.add(folder);
- for (Iterator iter = jars.iterator(); iter.hasNext();) {
- File next = (File) iter.next();
+ for (Iterator<File> iter = jars.iterator(); iter.hasNext();) {
+ File next = iter.next();
copy("1.0 " + next.getAbsolutePath(), next, new File(folder, next.getName()));
}
@@ -66,7 +66,7 @@ public class ProfileSynchronizerTest extends AbstractDirectoryWatcherTest {
watcher.poll();
// which IUs we are expecting is dependent on which OS we are running
- Set expected = new HashSet();
+ Set<String> expected = new HashSet<>();
expected.add("bbb");
String os = System.getProperty("osgi.os");
if ("win32".equals(os)) {
@@ -85,7 +85,7 @@ public class ProfileSynchronizerTest extends AbstractDirectoryWatcherTest {
/*
* Test to ensure that we only try to install the highest version of singleton bundles
* where multiple versions exist.
- *
+ *
* TODO we don't want to test to see if the bundles are in the repo, but if
* the bundles are filtered when they are installed into a profile.
*/
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 fc983c2ee..dcce51747 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
@@ -85,7 +85,7 @@ public class EngineTest extends AbstractProvisioningTest {
}
@Override
- protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
super.completePhase(monitor, profile, parameters);
throw new NullPointerException();
}
@@ -110,12 +110,12 @@ public class EngineTest extends AbstractProvisioningTest {
ProvisioningAction action = new ProvisioningAction() {
@Override
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
throw new NullPointerException();
}
@Override
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
throw new NullPointerException();
}
};
@@ -327,9 +327,9 @@ public class EngineTest extends AbstractProvisioningTest {
properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath());
IProfile profile = createProfile("testPerformSizing", properties);
- for (Iterator it = getInstallableUnits(profile); it.hasNext();) {
+ for (Iterator<IInstallableUnit> it = getInstallableUnits(profile); it.hasNext();) {
IProvisioningPlan plan = engine.createPlan(profile, null);
- IInstallableUnit doomed = (IInstallableUnit) it.next();
+ IInstallableUnit doomed = it.next();
plan.removeInstallableUnit(doomed);
engine.perform(plan, new NullProgressMonitor());
}
@@ -366,9 +366,9 @@ public class EngineTest extends AbstractProvisioningTest {
properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath());
IProfile profile = createProfile("testPerformInstallOSGiFramework", properties);
- for (Iterator it = getInstallableUnits(profile); it.hasNext();) {
+ for (Iterator<IInstallableUnit> it = getInstallableUnits(profile); it.hasNext();) {
IProvisioningPlan plan = engine.createPlan(profile, null);
- IInstallableUnit doomed = (IInstallableUnit) it.next();
+ IInstallableUnit doomed = it.next();
plan.removeInstallableUnit(doomed);
engine.perform(plan, new NullProgressMonitor());
}
@@ -376,7 +376,7 @@ public class EngineTest extends AbstractProvisioningTest {
plan.addInstallableUnit(createOSGiIU());
IStatus result = engine.perform(plan, new NullProgressMonitor());
assertTrue(result.isOK());
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertTrue(ius.hasNext());
}
@@ -392,7 +392,7 @@ public class EngineTest extends AbstractProvisioningTest {
plan.addInstallableUnit(iu33);
IStatus result = engine.perform(plan, new NullProgressMonitor());
assertTrue(result.isOK());
- Iterator ius = profile.query(QueryUtil.createIUQuery(iu33), null).iterator();
+ Iterator<IInstallableUnit> ius = profile.query(QueryUtil.createIUQuery(iu33), null).iterator();
assertTrue(ius.hasNext());
plan = engine.createPlan(profile, null);
@@ -422,7 +422,7 @@ public class EngineTest extends AbstractProvisioningTest {
properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath());
IProfile profile = createProfile("testPerformRollback", properties);
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertFalse(ius.hasNext());
IProvisioningPlan plan = engine.createPlan(profile, null);
@@ -462,7 +462,7 @@ public class EngineTest extends AbstractProvisioningTest {
properties.put(IProfile.PROP_INSTALL_FOLDER, testProvisioning.getAbsolutePath());
IProfile profile = createProfile("testPerformMissingAction", properties);
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertFalse(ius.hasNext());
IProvisioningPlan plan = engine.createPlan(profile, null);
@@ -482,7 +482,7 @@ public class EngineTest extends AbstractProvisioningTest {
NPEPhase phase = new NPEPhase();
PhaseSet phaseSet = new TestPhaseSet(phase);
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertFalse(ius.hasNext());
IProvisioningPlan plan = engine.createPlan(profile, null);
@@ -504,7 +504,7 @@ public class EngineTest extends AbstractProvisioningTest {
ActionNPEPhase phase = new ActionNPEPhase();
PhaseSet phaseSet = new TestPhaseSet(phase);
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertFalse(ius.hasNext());
IProvisioningPlan plan = engine.createPlan(profile, null);
@@ -523,7 +523,7 @@ public class EngineTest extends AbstractProvisioningTest {
ActionNPEPhase phase = new ActionNPEPhase(true);
PhaseSet phaseSet = new TestPhaseSet(phase);
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertFalse(ius.hasNext());
IProvisioningPlan plan = engine.createPlan(profile, null);
@@ -545,7 +545,7 @@ public class EngineTest extends AbstractProvisioningTest {
// forcedUninstall is false by default
IPhaseSet phaseSet = PhaseSetFactory.createDefaultPhaseSet();
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertFalse(ius.hasNext());
IProvisioningPlan plan = engine.createPlan(profile, null);
@@ -582,7 +582,7 @@ public class EngineTest extends AbstractProvisioningTest {
// forcedUninstall is false by default
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertFalse(ius.hasNext());
IProvisioningPlan plan = engine.createPlan(profile, null);
@@ -638,7 +638,7 @@ public class EngineTest extends AbstractProvisioningTest {
description.setId("org.eclipse.osgi");
description.setVersion(Version.create(version));
description.setTouchpointType(AbstractProvisioningTest.TOUCHPOINT_OSGI);
- Map touchpointData = new HashMap();
+ Map<String, Object> touchpointData = new HashMap<>();
String manifest = "Manifest-Version: 1.0\r\n" + "Bundle-Activator: org.eclipse.osgi.framework.internal.core.SystemBundl\r\n" + " eActivator\r\n" + "Bundle-RequiredExecutionEnvironment: J2SE-1.4,OSGi/Minimum-1.0\r\n" + "Export-Package: org.eclipse.osgi.event;version=\"1.0\",org.eclipse.osgi.\r\n" + " framework.console;version=\"1.0\",org.eclipse.osgi.framework.eventmgr;v\r\n" + " ersion=\"1.0\",org.eclipse.osgi.framework.log;version=\"1.0\",org.eclipse\r\n" + " .osgi.service.datalocation;version=\"1.0\",org.eclipse.osgi.service.deb\r\n" + " ug;version=\"1.0\",org.eclipse.osgi.service.environment;version=\"1.0\",o\r\n" + " rg.eclipse.osgi.service.localization;version=\"1.0\",org.eclipse.osgi.s\r\n" + " ervice.pluginconversion;version=\"1.0\",org.eclipse.osgi.service.resolv\r\n"
+ " er;version=\"1.1\",org.eclipse.osgi.service.runnable;version=\"1.0\",org.\r\n" + " eclipse.osgi.service.urlconversion;version=\"1.0\",org.eclipse.osgi.sto\r\n" + " ragemanager;version=\"1.0\",org.eclipse.osgi.util;version=\"1.0\",org.osg\r\n" + " i.framework;version=\"1.3\",org.osgi.service.condpermadmin;version=\"1.0\r\n" + " \",org.osgi.service.packageadmin;version=\"1.2\",org.osgi.service.permis\r\n" + " sionadmin;version=\"1.2\",org.osgi.service.startlevel;version=\"1.0\",org\r\n" + " .osgi.service.url;version=\"1.0\",org.osgi.util.tracker;version=\"1.3.2\"\r\n" + " ,org.eclipse.core.runtime.adaptor;x-friends:=\"org.eclipse.core.runtim\r\n" + " e\",org.eclipse.core.runtime.internal.adaptor;x-internal:=true,org.ecl\r\n"
+ " ipse.core.runtime.internal.stats;x-friends:=\"org.eclipse.core.runtime\r\n" + " \",org.eclipse.osgi.baseadaptor;x-internal:=true,org.eclipse.osgi.base\r\n" + " adaptor.bundlefile;x-internal:=true,org.eclipse.osgi.baseadaptor.hook\r\n" + " s;x-internal:=true,org.eclipse.osgi.baseadaptor.loader;x-internal:=tr\r\n" + " ue,org.eclipse.osgi.framework.adaptor;x-internal:=true,org.eclipse.os\r\n" + " gi.framework.debug;x-internal:=true,org.eclipse.osgi.framework.intern\r\n" + " al.core;x-internal:=true,org.eclipse.osgi.framework.internal.protocol\r\n" + " ;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.bundle\r\n" + " entry;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.b\r\n"
@@ -666,7 +666,7 @@ public class EngineTest extends AbstractProvisioningTest {
description.setId("org.eclipse.osgi.bad");
description.setVersion(Version.create("3.3.1.R33x_v20070828"));
description.setTouchpointType(AbstractProvisioningTest.TOUCHPOINT_OSGI);
- Map touchpointData = new HashMap();
+ Map<String, Object> touchpointData = new HashMap<>();
String manifest = "Manifest-Version: 1.0\r\n" + "Bundle-Activator: org.eclipse.osgi.framework.internal.core.SystemBundl\r\n" + " eActivator\r\n" + "Bundle-RequiredExecutionEnvironment: J2SE-1.4,OSGi/Minimum-1.0\r\n" + "Export-Package: org.eclipse.osgi.event;version=\"1.0\",org.eclipse.osgi.\r\n" + " framework.console;version=\"1.0\",org.eclipse.osgi.framework.eventmgr;v\r\n" + " ersion=\"1.0\",org.eclipse.osgi.framework.log;version=\"1.0\",org.eclipse\r\n" + " .osgi.service.datalocation;version=\"1.0\",org.eclipse.osgi.service.deb\r\n" + " ug;version=\"1.0\",org.eclipse.osgi.service.environment;version=\"1.0\",o\r\n" + " rg.eclipse.osgi.service.localization;version=\"1.0\",org.eclipse.osgi.s\r\n" + " ervice.pluginconversion;version=\"1.0\",org.eclipse.osgi.service.resolv\r\n"
+ " er;version=\"1.1\",org.eclipse.osgi.service.runnable;version=\"1.0\",org.\r\n" + " eclipse.osgi.service.urlconversion;version=\"1.0\",org.eclipse.osgi.sto\r\n" + " ragemanager;version=\"1.0\",org.eclipse.osgi.util;version=\"1.0\",org.osg\r\n" + " i.framework;version=\"1.3\",org.osgi.service.condpermadmin;version=\"1.0\r\n" + " \",org.osgi.service.packageadmin;version=\"1.2\",org.osgi.service.permis\r\n" + " sionadmin;version=\"1.2\",org.osgi.service.startlevel;version=\"1.0\",org\r\n" + " .osgi.service.url;version=\"1.0\",org.osgi.util.tracker;version=\"1.3.2\"\r\n" + " ,org.eclipse.core.runtime.adaptor;x-friends:=\"org.eclipse.core.runtim\r\n" + " e\",org.eclipse.core.runtime.internal.adaptor;x-internal:=true,org.ecl\r\n"
+ " ipse.core.runtime.internal.stats;x-friends:=\"org.eclipse.core.runtime\r\n" + " \",org.eclipse.osgi.baseadaptor;x-internal:=true,org.eclipse.osgi.base\r\n" + " adaptor.bundlefile;x-internal:=true,org.eclipse.osgi.baseadaptor.hook\r\n" + " s;x-internal:=true,org.eclipse.osgi.baseadaptor.loader;x-internal:=tr\r\n" + " ue,org.eclipse.osgi.framework.adaptor;x-internal:=true,org.eclipse.os\r\n" + " gi.framework.debug;x-internal:=true,org.eclipse.osgi.framework.intern\r\n" + " al.core;x-internal:=true,org.eclipse.osgi.framework.internal.protocol\r\n" + " ;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.bundle\r\n" + " entry;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.b\r\n"
@@ -692,7 +692,7 @@ public class EngineTest extends AbstractProvisioningTest {
description.setId("org.eclipse.osgi.bad");
description.setVersion(Version.create("3.3.1.R33x_v20070828"));
description.setTouchpointType(AbstractProvisioningTest.TOUCHPOINT_OSGI);
- Map touchpointData = new HashMap();
+ Map<String, Object> touchpointData = new HashMap<>();
String manifest = "Manifest-Version: 1.0\r\n" + "Bundle-Activator: org.eclipse.osgi.framework.internal.core.SystemBundl\r\n" + " eActivator\r\n" + "Bundle-RequiredExecutionEnvironment: J2SE-1.4,OSGi/Minimum-1.0\r\n" + "Export-Package: org.eclipse.osgi.event;version=\"1.0\",org.eclipse.osgi.\r\n" + " framework.console;version=\"1.0\",org.eclipse.osgi.framework.eventmgr;v\r\n" + " ersion=\"1.0\",org.eclipse.osgi.framework.log;version=\"1.0\",org.eclipse\r\n" + " .osgi.service.datalocation;version=\"1.0\",org.eclipse.osgi.service.deb\r\n" + " ug;version=\"1.0\",org.eclipse.osgi.service.environment;version=\"1.0\",o\r\n" + " rg.eclipse.osgi.service.localization;version=\"1.0\",org.eclipse.osgi.s\r\n" + " ervice.pluginconversion;version=\"1.0\",org.eclipse.osgi.service.resolv\r\n"
+ " er;version=\"1.1\",org.eclipse.osgi.service.runnable;version=\"1.0\",org.\r\n" + " eclipse.osgi.service.urlconversion;version=\"1.0\",org.eclipse.osgi.sto\r\n" + " ragemanager;version=\"1.0\",org.eclipse.osgi.util;version=\"1.0\",org.osg\r\n" + " i.framework;version=\"1.3\",org.osgi.service.condpermadmin;version=\"1.0\r\n" + " \",org.osgi.service.packageadmin;version=\"1.2\",org.osgi.service.permis\r\n" + " sionadmin;version=\"1.2\",org.osgi.service.startlevel;version=\"1.0\",org\r\n" + " .osgi.service.url;version=\"1.0\",org.osgi.util.tracker;version=\"1.3.2\"\r\n" + " ,org.eclipse.core.runtime.adaptor;x-friends:=\"org.eclipse.core.runtim\r\n" + " e\",org.eclipse.core.runtime.internal.adaptor;x-internal:=true,org.ecl\r\n"
+ " ipse.core.runtime.internal.stats;x-friends:=\"org.eclipse.core.runtime\r\n" + " \",org.eclipse.osgi.baseadaptor;x-internal:=true,org.eclipse.osgi.base\r\n" + " adaptor.bundlefile;x-internal:=true,org.eclipse.osgi.baseadaptor.hook\r\n" + " s;x-internal:=true,org.eclipse.osgi.baseadaptor.loader;x-internal:=tr\r\n" + " ue,org.eclipse.osgi.framework.adaptor;x-internal:=true,org.eclipse.os\r\n" + " gi.framework.debug;x-internal:=true,org.eclipse.osgi.framework.intern\r\n" + " al.core;x-internal:=true,org.eclipse.osgi.framework.internal.protocol\r\n" + " ;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.bundle\r\n" + " entry;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.b\r\n"
@@ -718,7 +718,7 @@ public class EngineTest extends AbstractProvisioningTest {
description.setId("org.eclipse.osgi.bad");
description.setVersion(Version.create("3.3.1.R33x_v20070828"));
description.setTouchpointType(AbstractProvisioningTest.TOUCHPOINT_OSGI);
- Map touchpointData = new HashMap();
+ Map<String, Object> touchpointData = new HashMap<>();
String manifest = "Manifest-Version: 1.0\r\n" + "Bundle-Activator: org.eclipse.osgi.framework.internal.core.SystemBundl\r\n" + " eActivator\r\n" + "Bundle-RequiredExecutionEnvironment: J2SE-1.4,OSGi/Minimum-1.0\r\n" + "Export-Package: org.eclipse.osgi.event;version=\"1.0\",org.eclipse.osgi.\r\n" + " framework.console;version=\"1.0\",org.eclipse.osgi.framework.eventmgr;v\r\n" + " ersion=\"1.0\",org.eclipse.osgi.framework.log;version=\"1.0\",org.eclipse\r\n" + " .osgi.service.datalocation;version=\"1.0\",org.eclipse.osgi.service.deb\r\n" + " ug;version=\"1.0\",org.eclipse.osgi.service.environment;version=\"1.0\",o\r\n" + " rg.eclipse.osgi.service.localization;version=\"1.0\",org.eclipse.osgi.s\r\n" + " ervice.pluginconversion;version=\"1.0\",org.eclipse.osgi.service.resolv\r\n"
+ " er;version=\"1.1\",org.eclipse.osgi.service.runnable;version=\"1.0\",org.\r\n" + " eclipse.osgi.service.urlconversion;version=\"1.0\",org.eclipse.osgi.sto\r\n" + " ragemanager;version=\"1.0\",org.eclipse.osgi.util;version=\"1.0\",org.osg\r\n" + " i.framework;version=\"1.3\",org.osgi.service.condpermadmin;version=\"1.0\r\n" + " \",org.osgi.service.packageadmin;version=\"1.2\",org.osgi.service.permis\r\n" + " sionadmin;version=\"1.2\",org.osgi.service.startlevel;version=\"1.0\",org\r\n" + " .osgi.service.url;version=\"1.0\",org.osgi.util.tracker;version=\"1.3.2\"\r\n" + " ,org.eclipse.core.runtime.adaptor;x-friends:=\"org.eclipse.core.runtim\r\n" + " e\",org.eclipse.core.runtime.internal.adaptor;x-internal:=true,org.ecl\r\n"
+ " ipse.core.runtime.internal.stats;x-friends:=\"org.eclipse.core.runtime\r\n" + " \",org.eclipse.osgi.baseadaptor;x-internal:=true,org.eclipse.osgi.base\r\n" + " adaptor.bundlefile;x-internal:=true,org.eclipse.osgi.baseadaptor.hook\r\n" + " s;x-internal:=true,org.eclipse.osgi.baseadaptor.loader;x-internal:=tr\r\n" + " ue,org.eclipse.osgi.framework.adaptor;x-internal:=true,org.eclipse.os\r\n" + " gi.framework.debug;x-internal:=true,org.eclipse.osgi.framework.intern\r\n" + " al.core;x-internal:=true,org.eclipse.osgi.framework.internal.protocol\r\n" + " ;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.bundle\r\n" + " entry;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.b\r\n"
@@ -744,7 +744,7 @@ public class EngineTest extends AbstractProvisioningTest {
description.setId("org.eclipse.osgi.bad");
description.setVersion(Version.create("3.3.1.R33x_v20070828"));
description.setTouchpointType(AbstractProvisioningTest.TOUCHPOINT_OSGI);
- Map touchpointData = new HashMap();
+ Map<String, Object> touchpointData = new HashMap<>();
String manifest = "Manifest-Version: 1.0\r\n" + "Bundle-Activator: org.eclipse.osgi.framework.internal.core.SystemBundl\r\n" + " eActivator\r\n" + "Bundle-RequiredExecutionEnvironment: J2SE-1.4,OSGi/Minimum-1.0\r\n" + "Export-Package: org.eclipse.osgi.event;version=\"1.0\",org.eclipse.osgi.\r\n" + " framework.console;version=\"1.0\",org.eclipse.osgi.framework.eventmgr;v\r\n" + " ersion=\"1.0\",org.eclipse.osgi.framework.log;version=\"1.0\",org.eclipse\r\n" + " .osgi.service.datalocation;version=\"1.0\",org.eclipse.osgi.service.deb\r\n" + " ug;version=\"1.0\",org.eclipse.osgi.service.environment;version=\"1.0\",o\r\n" + " rg.eclipse.osgi.service.localization;version=\"1.0\",org.eclipse.osgi.s\r\n" + " ervice.pluginconversion;version=\"1.0\",org.eclipse.osgi.service.resolv\r\n"
+ " er;version=\"1.1\",org.eclipse.osgi.service.runnable;version=\"1.0\",org.\r\n" + " eclipse.osgi.service.urlconversion;version=\"1.0\",org.eclipse.osgi.sto\r\n" + " ragemanager;version=\"1.0\",org.eclipse.osgi.util;version=\"1.0\",org.osg\r\n" + " i.framework;version=\"1.3\",org.osgi.service.condpermadmin;version=\"1.0\r\n" + " \",org.osgi.service.packageadmin;version=\"1.2\",org.osgi.service.permis\r\n" + " sionadmin;version=\"1.2\",org.osgi.service.startlevel;version=\"1.0\",org\r\n" + " .osgi.service.url;version=\"1.0\",org.osgi.util.tracker;version=\"1.3.2\"\r\n" + " ,org.eclipse.core.runtime.adaptor;x-friends:=\"org.eclipse.core.runtim\r\n" + " e\",org.eclipse.core.runtime.internal.adaptor;x-internal:=true,org.ecl\r\n"
+ " ipse.core.runtime.internal.stats;x-friends:=\"org.eclipse.core.runtime\r\n" + " \",org.eclipse.osgi.baseadaptor;x-internal:=true,org.eclipse.osgi.base\r\n" + " adaptor.bundlefile;x-internal:=true,org.eclipse.osgi.baseadaptor.hook\r\n" + " s;x-internal:=true,org.eclipse.osgi.baseadaptor.loader;x-internal:=tr\r\n" + " ue,org.eclipse.osgi.framework.adaptor;x-internal:=true,org.eclipse.os\r\n" + " gi.framework.debug;x-internal:=true,org.eclipse.osgi.framework.intern\r\n" + " al.core;x-internal:=true,org.eclipse.osgi.framework.internal.protocol\r\n" + " ;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.bundle\r\n" + " entry;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.b\r\n"
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java
index aec43669a..53ac2d07b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java
@@ -61,26 +61,26 @@ public class PhaseTest extends AbstractProvisioningTest {
}
@Override
- protected IStatus completeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus completeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
completeOperand = true;
return super.completeOperand(profile, operand, parameters, monitor);
}
@Override
- protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
parameters.put("TestPhase.initializeOperand", "true");
initializeOperand = true;
return super.initializeOperand(profile, operand, parameters, monitor);
}
@Override
- protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
completePhase = true;
return super.completePhase(monitor, profile, parameters);
}
@Override
- protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
parameters.put("TestPhase.initializePhase", "true");
initializePhase = true;
return super.initializePhase(monitor, profile, parameters);
@@ -173,7 +173,7 @@ public class PhaseTest extends AbstractProvisioningTest {
public void testInitCompletePhase() {
TestPhase phase = new TestPhase() {
@Override
- protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
assertFalse(parameters.containsKey("TestPhase.initializePhase"));
assertFalse(completePhase);
super.initializePhase(monitor, profile, parameters);
@@ -183,7 +183,7 @@ public class PhaseTest extends AbstractProvisioningTest {
}
@Override
- protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
assertTrue(parameters.containsKey("TestPhase.initializePhase"));
assertFalse(completePhase);
super.completePhase(monitor, profile, parameters);
@@ -205,7 +205,7 @@ public class PhaseTest extends AbstractProvisioningTest {
public void testInitCompleteOperand() {
TestPhase phase = new TestPhase() {
@Override
- protected IStatus completeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus completeOperand(IProfile profile, Operand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
assertTrue(parameters.containsKey("TestPhase.initializeOperand"));
assertFalse(completeOperand);
super.completeOperand(profile, operand, parameters, monitor);
@@ -215,7 +215,7 @@ public class PhaseTest extends AbstractProvisioningTest {
}
@Override
- protected IStatus initializeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) {
+ protected IStatus initializeOperand(IProfile profile, Operand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
assertFalse(parameters.containsKey("TestPhase.initializeOperand"));
assertFalse(completeOperand);
super.initializeOperand(profile, operand, parameters, monitor);
@@ -238,7 +238,7 @@ public class PhaseTest extends AbstractProvisioningTest {
public void testGetProfileDataArea() {
TestPhase phase = new TestPhase() {
@Override
- protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
File profileDataArea = (File) parameters.get("profileDataDirectory");
assertTrue(profileDataArea.isDirectory());
File test = new File(profileDataArea, "test");
@@ -253,7 +253,7 @@ public class PhaseTest extends AbstractProvisioningTest {
}
@Override
- protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) {
+ protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
File profileDataArea = (File) parameters.get("profileDataDirectory");
assertTrue(profileDataArea.isDirectory());
File test = new File(profileDataArea, "test");
@@ -277,18 +277,18 @@ public class PhaseTest extends AbstractProvisioningTest {
public static class TestAction extends ProvisioningAction {
@Override
- public IStatus execute(Map parameters) {
+ public IStatus execute(Map<String, Object> parameters) {
return null;
}
@Override
- public IStatus undo(Map parameters) {
+ public IStatus undo(Map<String, Object> parameters) {
return null;
}
}
public void testGetAction() {
- final ArrayList actionsList1 = new ArrayList();
+ final ArrayList<ProvisioningAction> actionsList1 = new ArrayList<>();
InstallableUnitPhase phase1 = new InstallableUnitPhase("test", 1) {
@Override
protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
@@ -297,7 +297,7 @@ public class PhaseTest extends AbstractProvisioningTest {
return actions;
}
};
- final ArrayList actionsList2 = new ArrayList();
+ final ArrayList<ProvisioningAction> actionsList2 = new ArrayList<>();
InstallableUnitPhase phase2 = new InstallableUnitPhase("test", 1) {
@Override
protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
@@ -310,7 +310,7 @@ public class PhaseTest extends AbstractProvisioningTest {
PhaseSet phaseSet = new TestPhaseSet(new Phase[] {phase1, phase2});
IProfile profile = createProfile("PhaseTest");
- Map instructions = new HashMap();
+ Map<String, Object> instructions = new HashMap<>();
instructions.put("test1", MetadataFactory.createTouchpointInstruction("test1.test()", null));
instructions.put("test2", MetadataFactory.createTouchpointInstruction("test2.test()", null));
ITouchpointData touchpointData = MetadataFactory.createTouchpointData(instructions);
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 69af5a8a7..1cc41bebe 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
@@ -25,7 +25,7 @@ public class VariableTest extends AbstractProvisioningTest {
InstallableUnitDescription description = new MetadataFactory.InstallableUnitDescription();
description.setId("artifactWithZip");
description.setVersion(Version.create("1.0.0"));
- Map touchpointData = new HashMap();
+ Map<String, Object> touchpointData = new HashMap<>();
touchpointData.put("install", "test.actionForVariableTesting( arg1: expectedValue ); test.actionForVariableTesting ( arg1: ${lastResult} ); test.actionForVariableTesting ( arg1: ${lastResult} )");
description.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
@@ -39,7 +39,7 @@ public class VariableTest extends AbstractProvisioningTest {
properties.put(IProfile.PROP_INSTALL_FOLDER, getTempFolder().getAbsolutePath());
IProfile profile = createProfile("testVariable1", properties);
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertFalse(ius.hasNext());
IProvisioningPlan plan = getEngine().createPlan(profile, null);
@@ -56,7 +56,7 @@ public class VariableTest extends AbstractProvisioningTest {
properties.put(IProfile.PROP_INSTALL_FOLDER, getTempFolder().getAbsolutePath());
IProfile profile = createProfile("testVariable2", properties);
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertFalse(ius.hasNext());
IProvisioningPlan plan = getEngine().createPlan(profile, null);
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 ddf6e0611..7e25f0d4b 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
@@ -25,7 +25,7 @@ public class VariableTest2 extends AbstractProvisioningTest {
InstallableUnitDescription description = new MetadataFactory.InstallableUnitDescription();
description.setId("artifactWithZip");
description.setVersion(Version.create("1.0.0"));
- Map touchpointData = new HashMap();
+ Map<String, Object> touchpointData = new HashMap<>();
touchpointData.put("install", "test.actionForVariableTesting2( arg1: expectedValue ); test.actionForVariableTesting2( arg1: ${lastResult} );");
description.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
@@ -39,7 +39,7 @@ public class VariableTest2 extends AbstractProvisioningTest {
properties.put(IProfile.PROP_INSTALL_FOLDER, getTempFolder().getAbsolutePath());
IProfile profile = createProfile(this.getName(), properties);
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertFalse(ius.hasNext());
IProvisioningPlan plan = getEngine().createPlan(profile, null);
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 7b1e70cf6..cdc37eb30 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
@@ -42,7 +42,7 @@ public class VariableTest3 extends AbstractProvisioningTest {
properties.put(IProfile.PROP_INSTALL_FOLDER, getTempFolder().getAbsolutePath());
IProfile profile = createProfile(this.getName(), properties);
- Iterator ius = getInstallableUnits(profile);
+ Iterator<IInstallableUnit> ius = getInstallableUnits(profile);
assertFalse(ius.hasNext());
IProvisioningPlan plan = getEngine().createPlan(profile, null);
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 9185a5e97..ed9c4daeb 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
@@ -62,7 +62,7 @@ public abstract class AbstractEnd2EndTest extends AbstractProvisioningTest {
throw new RuntimeException("Profile registry service not available");
}
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
properties.put(IProfile.PROP_INSTALL_FOLDER, installFolder);
EnvironmentInfo info = ServiceHelper.getService(TestActivator.getContext(), EnvironmentInfo.class);
if (info != null)
@@ -101,10 +101,10 @@ public abstract class AbstractEnd2EndTest extends AbstractProvisioningTest {
}
private void attemptToUninstallRCP(IProfile profile2, File installFolder) {
- IQueryResult collect = profile2.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> collect = profile2.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
assertEquals(1, queryResultSize(collect));
ProfileChangeRequest request = new ProfileChangeRequest(profile2);
- request.removeInstallableUnits(new IInstallableUnit[] {(IInstallableUnit) collect.iterator().next()});
+ request.removeInstallableUnits(new IInstallableUnit[] {collect.iterator().next()});
IStatus s = director.provision(request, null, new NullProgressMonitor());
assertOK("Can not uninstall RCP", s);
assertEquals(1, queryResultSize(profile2.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor())));
@@ -112,11 +112,11 @@ public abstract class AbstractEnd2EndTest extends AbstractProvisioningTest {
protected void uninstallPlatform(IProfile profile2, File installFolder) {
System.out.println("Uninstall the platform");
- IQueryResult collect = profile2.query(QueryUtil.createIUQuery(getPlatform().getId()), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> collect = profile2.query(QueryUtil.createIUQuery(getPlatform().getId()), new NullProgressMonitor());
assertEquals(1, queryResultSize(collect));
// Collector collect2 = profile2.query(new InstallableUnitQuery("org.eclipse.platform.source.feature.group"), new Collector(), new NullProgressMonitor());
ProfileChangeRequest request = new ProfileChangeRequest(profile2);
- request.removeInstallableUnits(new IInstallableUnit[] {(IInstallableUnit) collect.iterator().next()});//, (IInstallableUnit) collect2.iterator().next()});
+ request.removeInstallableUnits(new IInstallableUnit[] {collect.iterator().next()});//, (IInstallableUnit) collect2.iterator().next()});
IStatus s = director.provision(request, null, new NullProgressMonitor());
assertOK("Can not uninstall platform", s);
}
@@ -154,7 +154,7 @@ public abstract class AbstractEnd2EndTest extends AbstractProvisioningTest {
iud.setId("org.eclipse.equinox.p2.tests.bogusIU.end2end");
iud.setVersion(Version.create("1.0.0"));
iud.setCapabilities(new IProvidedCapability[] {MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.equinox.p2.tests.bogusIU.end2end", Version.create("1.0.0"))});
- Map data = new HashMap();
+ Map<String, Object> data = new HashMap<>();
data.put("install", "org.eclipse.equinox.p2.osgi.removeJvmArg(programArg:-XX:+UnlockDiagnosticVMOptions);");
iud.addTouchpointData(MetadataFactory.createTouchpointData(data));
IInstallableUnit bogusIU = MetadataFactory.createInstallableUnit(iud);
@@ -189,9 +189,9 @@ public abstract class AbstractEnd2EndTest extends AbstractProvisioningTest {
*/
public IInstallableUnit getIU(String id, Version v) {
final IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(id, v);
- Iterator it = metadataRepoManager.query(query, null).iterator();
+ Iterator<IInstallableUnit> it = metadataRepoManager.query(query, null).iterator();
if (it.hasNext())
- return (IInstallableUnit) it.next();
+ return it.next();
//try the repository location directly - retry because eclipse.org can be flaky
Exception failure = null;
for (int i = 0; i < 3; i++) {
@@ -199,7 +199,7 @@ public abstract class AbstractEnd2EndTest extends AbstractProvisioningTest {
IMetadataRepository repo = metadataRepoManager.loadRepository(getRepositoryLocation(), null);
it = repo.query(query, null).iterator();
if (it.hasNext())
- return (IInstallableUnit) it.next();
+ return it.next();
} catch (ProvisionException e) {
failure = e;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java
index 81055139a..466b20b2f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java
@@ -34,12 +34,12 @@ public class FragmentMethodTest extends TestCase {
iu3 = createIUFragment("iu.fragment");
iu1Caps = iu1.getProvidedCapabilities();
iu3Caps = iu3.getProvidedCapabilities();
- HashSet hash = new HashSet();
+ HashSet<IInstallableUnit> hash = new HashSet<>();
hash.add(iu1);
hash.add(iu3);
// Collection result = new ResolutionHelper(new Hashtable(), null).attachCUs(hash);
- for (Iterator iterator = hash.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ for (Iterator<IInstallableUnit> iterator = hash.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
if (iu.getId().equals(iu1.getId()))
iu1 = iu;
if (iu.getId().equals(iu3.getId()))
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
index b8fef411c..485be526c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
@@ -183,7 +183,7 @@ public class IUPersistenceTest extends AbstractProvisioningTest {
private static Version version = Version.create("3.1.200.v20070605");
- private Map propertyMap;
+ private Map<String, String> propertyMap;
private static String[][] addSelfCapability(IInstallableUnit iu, String[][] provideTuples) {
String[][] augmentedProvides = new String[provideTuples.length + 1][3];
@@ -195,7 +195,7 @@ public class IUPersistenceTest extends AbstractProvisioningTest {
return augmentedProvides;
}
- private static Map createProperties(String[][] keyValuePairs) {
+ private static Map<String, String> createProperties(String[][] keyValuePairs) {
OrderedProperties props = new OrderedProperties(keyValuePairs.length);
for (int i = 0; i < keyValuePairs.length; i++) {
String[] nextPair = keyValuePairs[i];
@@ -320,9 +320,9 @@ public class IUPersistenceTest extends AbstractProvisioningTest {
for (int i = 0; i < additionalProvides.length; i++) {
provides1[i + 1] = additionalProvides[i];
}
- for (Iterator iter = propertyMap.keySet().iterator(); iter.hasNext();) {
- String nextKey = (String) iter.next();
- String nextValue = (String) propertyMap.get(nextKey);
+ for (Iterator<String> iter = propertyMap.keySet().iterator(); iter.hasNext();) {
+ String nextKey = iter.next();
+ String nextValue = propertyMap.get(nextKey);
iu1.setProperty(nextKey, nextValue);
}
iu1.setCapabilities(provides1);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java
index 1e8935456..671d17d6b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.metadata;
-import java.util.Collection;
import java.util.Iterator;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.p2.metadata.*;
@@ -28,8 +27,6 @@ public class MultipleIUAndFragmentTest extends AbstractProvisioningTest {
IInstallableUnit iu2;
IInstallableUnit iu3;
- Collection result;
-
@Override
protected void tearDown() throws Exception {
super.tearDown();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistNegation.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistNegation.java
index 31ecdabb4..a98a347a5 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistNegation.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistNegation.java
@@ -30,10 +30,10 @@ public class PersistNegation extends AbstractProvisioningTest {
iud1.setVersion(Version.create("1.0.0"));
RequiredCapability req1 = new RequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.rap.rwt", new VersionRange("[1.0.0, 2.0.0)"), null, 0, 0, false, null);
- Collection requirements = new ArrayList();
+ Collection<IRequirement> requirements = new ArrayList<>();
requirements.add(req1);
iud1.addRequirements(requirements);
- Collection capabilities = new ArrayList();
+ Collection<IProvidedCapability> capabilities = new ArrayList<>();
capabilities.add(new ProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "NegateRWT", Version.create("1.0.0")));
iud1.addProvidedCapabilities(capabilities);
IInstallableUnit iu1 = MetadataFactory.createInstallableUnit(iud1);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/expression/FilterTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/expression/FilterTest.java
index 289babcaa..0d6895ac2 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/expression/FilterTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/expression/FilterTest.java
@@ -33,8 +33,8 @@ public class FilterTest extends TestCase {
List<String> keyList = new ArrayList<>(dictionary.size());
for (Iterator<String> e = dictionary.keySet().iterator(); e.hasNext();) {
String key = e.next();
- for (Iterator i = keyList.iterator(); i.hasNext();) {
- if (key.equalsIgnoreCase((String) i.next())) {
+ for (Iterator<String> i = keyList.iterator(); i.hasNext();) {
+ if (key.equalsIgnoreCase(i.next())) {
throw new IllegalArgumentException();
}
}
@@ -80,12 +80,12 @@ public class FilterTest extends TestCase {
}
@Override
- public Dictionary getProperties() {
- return new Hashtable(dictionary);
+ public Dictionary<String, Object> getProperties() {
+ return new Hashtable<>(dictionary);
}
}
- private static class SampleComparable implements Comparable {
+ private static class SampleComparable implements Comparable<SampleComparable> {
private int value = -1;
public SampleComparable(String value) {
@@ -98,8 +98,8 @@ public class FilterTest extends TestCase {
}
@Override
- public int compareTo(Object o) {
- return value - ((SampleComparable) o).value;
+ public int compareTo(SampleComparable o) {
+ return value - o.value;
}
@Override
@@ -150,7 +150,7 @@ public class FilterTest extends TestCase {
}
public void testFilter() {
- Properties props = new Properties();
+ Dictionary<String, Object> props = new Hashtable<>();
props.put("room", "bedroom"); //$NON-NLS-1$ //$NON-NLS-2$
props.put("channel", Integer.valueOf(34)); //$NON-NLS-1$
props.put("status", "(on\\)*"); //$NON-NLS-1$//$NON-NLS-2$
@@ -162,7 +162,7 @@ public class FilterTest extends TestCase {
props.put("doublevalue", Double.valueOf(2.01)); //$NON-NLS-1$
props.put("charvalue", Character.valueOf('A')); //$NON-NLS-1$
props.put("booleanvalue", Boolean.FALSE); //$NON-NLS-1$
- props.put("weirdvalue", new Hashtable()); //$NON-NLS-1$
+ props.put("weirdvalue", new Hashtable<>()); //$NON-NLS-1$
try {
props.put("bigintvalue", new BigInteger("4123456")); //$NON-NLS-1$ //$NON-NLS-2$
} catch (NoClassDefFoundError e) {
@@ -264,8 +264,8 @@ public class FilterTest extends TestCase {
}
- private void testFilter(String query, Dictionary<?, ?> props, int expect) {
- final ServiceReference ref = new DictionaryServiceReference((Map) props);
+ private void testFilter(String query, Dictionary<String, Object> props, int expect) {
+ final ServiceReference ref = new DictionaryServiceReference((Map<String, ? extends Object>) props);
Filter f1;
try {
f1 = ExpressionUtil.parseLDAP(query);
@@ -283,7 +283,7 @@ public class FilterTest extends TestCase {
// TODO Doing raw conversion here for simplicity; could convert to Dictionary<String, ?>
// but the filter impl must still handle cases where non String keys are used.
- boolean val = f1.match((Dictionary) props);
+ boolean val = f1.match(props);
assertEquals("wrong result", expect == ISTRUE, val); //$NON-NLS-1$
val = f1.match(ref);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java
index e62c7ba33..548ff366f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java
@@ -15,6 +15,7 @@ import java.text.MessageFormat;
import java.text.ParseException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.equinox.internal.p2.repository.Messages;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.core.UIServices;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
@@ -137,7 +138,7 @@ public class HttpStatusTest extends ServerBasedTestCase {
private static String getMessageForCode(int code) throws Exception {
// use reflection on Messages class to get the string in use
- Class c = org.eclipse.equinox.internal.p2.repository.Messages.class;
+ Class<Messages> c = org.eclipse.equinox.internal.p2.repository.Messages.class;
try {
Field field = c.getDeclaredField("TransportErrorTranslator_" + Integer.valueOf(code).toString());
return (String) field.get(null);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java
index 60f0ff351..5a4617019 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java
@@ -32,7 +32,7 @@ public class MetadataRepositoryManagerExceptionsTest extends AbstractProvisionin
/**
* Contains temp File handles that should be deleted at the end of the test.
*/
- private final List toDelete = new ArrayList();
+ private final List<File> toDelete = new ArrayList<>();
public static Test suite() {
return new TestSuite(MetadataRepositoryManagerExceptionsTest.class);
@@ -47,8 +47,8 @@ public class MetadataRepositoryManagerExceptionsTest extends AbstractProvisionin
@Override
protected void tearDown() throws Exception {
super.tearDown();
- for (Iterator it = toDelete.iterator(); it.hasNext();)
- delete((File) it.next());
+ for (Iterator<File> it = toDelete.iterator(); it.hasNext();)
+ delete(it.next());
toDelete.clear();
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
index 578575d2d..752e1606b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
@@ -836,7 +836,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
requiredCapabilityList.add(spiRequiredCapability);
iuDescription.addRequirements(requiredCapabilityList);
- Collection providedCapabilityList = new ArrayList();
+ Collection<IProvidedCapability> providedCapabilityList = new ArrayList<>();
providedCapabilityList.add(spiProvidedCapability);
iuDescription.addProvidedCapabilities(providedCapabilityList);
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 fa8016b36..f51596074 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
@@ -872,16 +872,16 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest {
fail("");
}
- IQueryResult keys = packedRepo.query(ArtifactKeyQuery.ALL_KEYS, null);
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- IArtifactKey key = (IArtifactKey) iterator.next();
+ IQueryResult<IArtifactKey> keys = packedRepo.query(ArtifactKeyQuery.ALL_KEYS, null);
+ for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
IArtifactDescriptor[] srcDescriptors = packedRepo.getArtifactDescriptors(key);
for (int j = 0; j < srcDescriptors.length; j++) {
if (!(srcDescriptors[j].getProperty(IArtifactDescriptor.FORMAT) == null) && srcDescriptors[j].getProperty(IArtifactDescriptor.FORMAT).equals(IArtifactDescriptor.FORMAT_PACKED)) {
//if we have a packed artifact
IArtifactDescriptor newDescriptor = new ArtifactDescriptor(key);
- Map properties = new OrderedProperties();
+ Map<String, String> properties = new OrderedProperties();
properties.putAll(srcDescriptors[j].getProperties());
properties.remove(IArtifactDescriptor.FORMAT);
((ArtifactDescriptor) newDescriptor).addProperties(properties);
@@ -989,7 +989,7 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest {
//Setup: create the destination
try {
String name = "Destination Name " + destRepoLocation;
- Map property = new HashMap();
+ Map<String, String> property = new HashMap<>();
property.put(IRepository.PROP_COMPRESSED, "true");
getArtifactRepositoryManager().createRepository(destRepoLocation.toURI(), name, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, property);
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java
index c0cbfde04..c4007a799 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java
@@ -49,9 +49,9 @@ public class EPPPackageInstallStability_bug323322 extends AbstractProvisioningTe
assertOK("plan is not ok", plan.getStatus());
//Extract all the unresolved IUs.
- Set tmp = plan.getAdditions().query(QueryUtil.ALL_UNITS, new NullProgressMonitor()).query(QueryUtil.ALL_UNITS, null).toSet();
- for (Iterator iterator = tmp.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ Set<IInstallableUnit> tmp = plan.getAdditions().query(QueryUtil.ALL_UNITS, new NullProgressMonitor()).query(QueryUtil.ALL_UNITS, null).toSet();
+ for (Iterator<IInstallableUnit> iterator = tmp.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
iusFromFirstResolution.add(iu.unresolved());
}
}
@@ -64,15 +64,15 @@ public class EPPPackageInstallStability_bug323322 extends AbstractProvisioningTe
ProvisioningContext pc = new ProvisioningContext(agent);
pc.setMetadataRepositories(new URI[0]);
pc.setArtifactRepositories(new URI[0]);
- pc.setExtraInstallableUnits(new ArrayList(iusFromFirstResolution));
+ pc.setExtraInstallableUnits(new ArrayList<>(iusFromFirstResolution));
IProvisioningPlan plan = planner.getProvisioningPlan(request, pc, new NullProgressMonitor());
assertOK("plan is not ok", plan.getStatus());
- Set tmp = plan.getAdditions().query(QueryUtil.ALL_UNITS, new NullProgressMonitor()).query(QueryUtil.ALL_UNITS, null).toSet();
+ Set<IInstallableUnit> tmp = plan.getAdditions().query(QueryUtil.ALL_UNITS, new NullProgressMonitor()).query(QueryUtil.ALL_UNITS, null).toSet();
Set<IInstallableUnit> iusFromSecondResolution = new HashSet<>();
- for (Iterator iterator = tmp.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ for (Iterator<IInstallableUnit> iterator = tmp.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
iusFromSecondResolution.add(iu.unresolved());
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationSeveralConflictingRoots.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationSeveralConflictingRoots.java
index 8ebb5c6c3..0067180f2 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationSeveralConflictingRoots.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationSeveralConflictingRoots.java
@@ -1,18 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 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 java.util.Set;
+import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan;
import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus;
import org.eclipse.equinox.p2.engine.IEngine;
@@ -58,7 +57,7 @@ public class ExplanationSeveralConflictingRoots extends AbstractProvisioningTest
pcr.addInstallableUnits(new IInstallableUnit[] {cdt, emf});
ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(pcr, null, null);
// System.out.println(plan.getRequestStatus().getExplanations());
- Set conflictRoots = ((PlannerStatus) plan.getStatus()).getRequestStatus().getConflictsWithInstalledRoots();
+ Set<IInstallableUnit> conflictRoots = ((PlannerStatus) plan.getStatus()).getRequestStatus().getConflictsWithInstalledRoots();
assertTrue(conflictRoots.contains(cdt) || conflictRoots.contains(emf));
// assertTrue(plan.getRequestStatus().getConflictsWithInstalledRoots().contains(emf));
@@ -84,7 +83,7 @@ public class ExplanationSeveralConflictingRoots extends AbstractProvisioningTest
pcr.addInstallableUnits(new IInstallableUnit[] {cdt, emf});
ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(pcr, null, null);
// System.out.println(plan.getRequestStatus().getExplanations());
- Set conflictRoots = ((PlannerStatus) plan.getStatus()).getRequestStatus().getConflictsWithInstalledRoots();
+ Set<IInstallableUnit> conflictRoots = ((PlannerStatus) plan.getStatus()).getRequestStatus().getConflictsWithInstalledRoots();
assertTrue(conflictRoots.contains(cdt) || conflictRoots.contains(emf));
// assertEquals(0, plan.getRequestStatus(cdt).getConflictsWithInstalledRoots().size());
@@ -108,7 +107,7 @@ public class ExplanationSeveralConflictingRoots extends AbstractProvisioningTest
pcr.addInstallableUnits(new IInstallableUnit[] {cdt, emf});
ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(pcr, null, null);
// System.out.println(plan.getRequestStatus().getExplanations());
- Set conflictRoots = ((PlannerStatus) plan.getStatus()).getRequestStatus().getConflictsWithInstalledRoots();
+ Set<IInstallableUnit> conflictRoots = ((PlannerStatus) plan.getStatus()).getRequestStatus().getConflictsWithInstalledRoots();
assertTrue(conflictRoots.contains(cdt) || conflictRoots.contains(emf));
// assertTrue(plan.getRequestStatus().getConflictsWithInstalledRoots().contains(cdt));
// assertTrue(plan.getRequestStatus().getConflictsWithInstalledRoots().contains(emf));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency.java
index fee90db21..3412c8aeb 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency.java
@@ -58,10 +58,10 @@ public class MissingDependency extends AbstractProvisioningTest {
ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(req, null, null);
assertEquals(IStatus.ERROR, plan.getStatus().getSeverity());
RequestStatus requestStatus = ((PlannerStatus) plan.getStatus()).getRequestStatus();
- Set explanation = requestStatus.getExplanations();
+ Set<Explanation> explanation = requestStatus.getExplanations();
// System.out.println(explanation);
assertEquals(2, explanation.size());
- Set rootConflictingIUs = requestStatus.getConflictsWithInstalledRoots();
+ Set<IInstallableUnit> rootConflictingIUs = requestStatus.getConflictsWithInstalledRoots();
// System.out.println(rootConflictingIUs);
assertEquals(1, rootConflictingIUs.size());
assertTrue(rootConflictingIUs.contains(b1));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement.java
index 1180d860e..b5a8d6159 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement.java
@@ -62,7 +62,7 @@ public class MissingNonGreedyRequirement extends AbstractProvisioningTest {
ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(req, null, null);
assertEquals(IStatus.ERROR, plan.getStatus().getSeverity());
RequestStatus requestStatus = ((PlannerStatus) plan.getStatus()).getRequestStatus();
- Set explanation = requestStatus.getExplanations();
+ Set<Explanation> explanation = requestStatus.getExplanations();
assertFalse(explanation.isEmpty());
assertTrue(requestStatus.getConflictsWithInstalledRoots().contains(a1));
assertEquals(Explanation.MISSING_REQUIREMENT, requestStatus.getShortExplanation());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement2.java
index 80365f54f..e56090f96 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement2.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement2.java
@@ -59,7 +59,7 @@ public class MissingNonGreedyRequirement2 extends AbstractProvisioningTest {
ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(req, null, null);
assertEquals(IStatus.ERROR, plan.getStatus().getSeverity());
RequestStatus requestStatus = ((PlannerStatus) plan.getStatus()).getRequestStatus();
- Set explanation = requestStatus.getExplanations();
+ Set<Explanation> explanation = requestStatus.getExplanations();
assertFalse(explanation.isEmpty());
assertTrue(requestStatus.getConflictsWithInstalledRoots().contains(a1));
assertEquals(Explanation.MISSING_REQUIREMENT, requestStatus.getShortExplanation());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java
index 97ca52d4f..85128e30a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java
@@ -151,7 +151,7 @@ public class MultipleSingleton extends AbstractProvisioningTest {
ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(req, null, null);
assertEquals(IStatus.ERROR, plan.getStatus().getSeverity());
final RequestStatus requestStatus = ((PlannerStatus) plan.getStatus()).getRequestStatus();
- Set explanation = requestStatus.getExplanations();
+ Set<Explanation> explanation = requestStatus.getExplanations();
// System.out.println(explanation);
assertFalse(explanation.isEmpty());
assertEquals(Explanation.VIOLATED_SINGLETON_CONSTRAINT, requestStatus.getShortExplanation());
@@ -180,7 +180,7 @@ public class MultipleSingleton extends AbstractProvisioningTest {
ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(req, null, null);
assertEquals(IStatus.ERROR, plan.getStatus().getSeverity());
final RequestStatus requestStatus = ((PlannerStatus) plan.getStatus()).getRequestStatus();
- Set explanation = requestStatus.getExplanations();
+ Set<Explanation> explanation = requestStatus.getExplanations();
// System.out.println(explanation);
assertFalse(explanation.isEmpty());
assertEquals(Explanation.VIOLATED_SINGLETON_CONSTRAINT, requestStatus.getShortExplanation());
@@ -215,7 +215,7 @@ public class MultipleSingleton extends AbstractProvisioningTest {
ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(req, null, null);
assertEquals(IStatus.ERROR, plan.getStatus().getSeverity());
final RequestStatus requestStatus = ((PlannerStatus) plan.getStatus()).getRequestStatus();
- Set explanation = requestStatus.getExplanations();
+ Set<Explanation> explanation = requestStatus.getExplanations();
assertFalse(explanation.isEmpty());
assertEquals(Explanation.VIOLATED_SINGLETON_CONSTRAINT, requestStatus.getShortExplanation());
assertTrue(requestStatus.getConflictsWithInstalledRoots().contains(u));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java
index 77f368277..3cec08a8d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java
@@ -32,7 +32,7 @@ public class NonMinimalState extends AbstractProvisioningTest {
IProfile profile = null;
IMetadataRepository repo = null;
private String searchedId;
- private Set visited = new HashSet();
+ private Set<IInstallableUnit> visited = new HashSet<>();
@Override
protected void setUp() throws Exception {
@@ -70,11 +70,11 @@ public class NonMinimalState extends AbstractProvisioningTest {
private void why(String id) {
System.out.println("=-=-=" + id + "=-=-=");
- visited = new HashSet();
- IQueryResult roots = profile.query(new IUProfilePropertyQuery("org.eclipse.equinox.p2.type.root", "true"), null);
+ visited = new HashSet<>();
+ IQueryResult<IInstallableUnit> roots = profile.query(new IUProfilePropertyQuery("org.eclipse.equinox.p2.type.root", "true"), null);
searchedId = id;
- for (Iterator iterator = roots.iterator(); iterator.hasNext();) {
- IInstallableUnit type = (IInstallableUnit) iterator.next();
+ for (Iterator<IInstallableUnit> iterator = roots.iterator(); iterator.hasNext();) {
+ IInstallableUnit type = iterator.next();
if (type instanceof IInstallableUnitFragment) {
visited.add(type);
continue;
@@ -102,9 +102,9 @@ public class NonMinimalState extends AbstractProvisioningTest {
}
private boolean expandRequirement(IInstallableUnit iu, IRequirement req) {
- IQueryResult matches = profile.query(QueryUtil.createMatchQuery(req.getMatches()), null);
- for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
- IInstallableUnit match = (IInstallableUnit) iterator.next();
+ IQueryResult<IInstallableUnit> matches = profile.query(QueryUtil.createMatchQuery(req.getMatches()), null);
+ for (Iterator<IInstallableUnit> iterator = matches.iterator(); iterator.hasNext();) {
+ IInstallableUnit match = iterator.next();
if (match.getId().equals(searchedId))
return true;
if (!visited.contains(match)) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ORTesting.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ORTesting.java
index 9831a76bd..cf2bf5af6 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ORTesting.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ORTesting.java
@@ -1,19 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2010 Sonatype, Inc.
+ * Copyright (c) 2010, 2017 Sonatype, 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:
* Sonatype, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.p2.tests.planner;
-import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
-
import java.util.ArrayList;
import java.util.Collection;
+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.*;
@@ -27,14 +26,14 @@ public class ORTesting extends AbstractProvisioningTest {
public void testOr() {
String orExpression = "providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'org.eclipse.mylyn34' || pc.name == 'org.eclipse.mylyn35'))";
IExpression expr = ExpressionUtil.parse(orExpression);
- IMatchExpression matchExpression = ExpressionUtil.getFactory().matchExpression(expr);
+ IMatchExpression<IInstallableUnit> matchExpression = ExpressionUtil.getFactory().matchExpression(expr);
IRequirement orRequirement = MetadataFactory.createRequirement(matchExpression, null, 0, 1, true);
InstallableUnitDescription iudA = new MetadataFactory.InstallableUnitDescription();
iudA.setId("A");
iudA.setVersion(Version.parseVersion("1.0.0"));
iudA.setCapabilities(new IProvidedCapability[] {MetadataFactory.createProvidedCapability("org.eclipse.equinox.p2.iu", "A", Version.parseVersion("1.0.0"))});
- Collection reqs = new ArrayList();
+ Collection<IRequirement> reqs = new ArrayList<>();
reqs.add(orRequirement);
iudA.addRequirements(reqs);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest12.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest12.java
index c2890fd11..0c54613ec 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest12.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest12.java
@@ -78,7 +78,7 @@ public class PatchTest12 extends AbstractProvisioningTest {
ProvisioningPlan plan3 = (ProvisioningPlan) planner.getProvisioningPlan(req3, null, null);
assertTrue(IStatus.ERROR == plan3.getStatus().getSeverity());
final RequestStatus requestStatus = ((PlannerStatus) plan3.getStatus()).getRequestStatus();
- Set conflictRootIUs = requestStatus.getConflictsWithInstalledRoots();
+ Set<IInstallableUnit> conflictRootIUs = requestStatus.getConflictsWithInstalledRoots();
assertTrue(conflictRootIUs.contains(p1));
assertEquals(Explanation.MISSING_REQUIREMENT, requestStatus.getShortExplanation());
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest2.java
index f015427ad..3fcc2a67e 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest2.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest2.java
@@ -104,7 +104,7 @@ public class PatchTest2 extends AbstractProvisioningTest {
final RequestStatus requestStatus = ((PlannerStatus) plan3.getStatus()).getRequestStatus();
assertEquals(Explanation.MISSING_REQUIREMENT, requestStatus.getShortExplanation());
// System.out.println(plan3.getRequestStatus().getExplanations());
- Set conflictingRoot = requestStatus.getConflictsWithInstalledRoots();
+ Set<IInstallableUnit> conflictingRoot = requestStatus.getConflictsWithInstalledRoots();
assertTrue(conflictingRoot.contains(a1));
assertEquals(1, conflictingRoot.size());
}
@@ -118,7 +118,7 @@ public class PatchTest2 extends AbstractProvisioningTest {
final RequestStatus requestStatus = ((PlannerStatus) plan5.getStatus()).getRequestStatus();
assertEquals(Explanation.MISSING_REQUIREMENT, requestStatus.getShortExplanation());
// System.out.println(plan5.getRequestStatus().getExplanations());
- Set conflictingRoot = requestStatus.getConflictsWithInstalledRoots();
+ Set<IInstallableUnit> conflictingRoot = requestStatus.getConflictsWithInstalledRoots();
assertTrue(conflictingRoot.contains(a1));
assertEquals(1, conflictingRoot.size());
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest6.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest6.java
index acb554983..e92aa109a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest6.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest6.java
@@ -109,7 +109,7 @@ public class PatchTest6 extends AbstractProvisioningTest {
assertEquals(IStatus.ERROR, plan1.getStatus().getSeverity());
final RequestStatus requestStatus = ((PlannerStatus) plan1.getStatus()).getRequestStatus();
assertEquals(Explanation.MISSING_REQUIREMENT, requestStatus.getShortExplanation());
- Set conflictingRoots = requestStatus.getConflictsWithInstalledRoots();
+ Set<IInstallableUnit> conflictingRoots = requestStatus.getConflictsWithInstalledRoots();
assertEquals(1, conflictingRoots.size());
assertTrue(conflictingRoots.contains(a1) || conflictingRoots.contains(c1));
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest9.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest9.java
index bbe4e809d..fcff06877 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest9.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest9.java
@@ -71,7 +71,7 @@ public class PatchTest9 extends AbstractProvisioningTest {
assertEquals(IStatus.ERROR, plan1.getStatus().getSeverity());
final RequestStatus requestStatus = ((PlannerStatus) plan1.getStatus()).getRequestStatus();
assertEquals(Explanation.MISSING_REQUIREMENT, requestStatus.getShortExplanation());
- Set conflictingRoots = requestStatus.getConflictsWithInstalledRoots();
+ Set<IInstallableUnit> conflictingRoots = requestStatus.getConflictsWithInstalledRoots();
assertEquals(1, conflictingRoots.size());
assertTrue(conflictingRoots.contains(p1));
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate.java
index 0e14307de..a0220fb7f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate.java
@@ -92,7 +92,7 @@ public class PatchTestUpdate extends AbstractProvisioningTest {
ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(req1, null, null);
assertEquals(IStatus.ERROR, plan.getStatus().getSeverity());
final RequestStatus requestStatus = ((PlannerStatus) plan.getStatus()).getRequestStatus();
- Set conflictingRoot = requestStatus.getConflictsWithInstalledRoots();
+ Set<IInstallableUnit> conflictingRoot = requestStatus.getConflictsWithInstalledRoots();
assertEquals(1, conflictingRoot.size());
assertTrue(conflictingRoot.contains(p2Feature20));
assertEquals(Explanation.VIOLATED_SINGLETON_CONSTRAINT, requestStatus.getShortExplanation());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest1.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest1.java
index fd7c12c8f..ee75e29da 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest1.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest1.java
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
public class SDKPatchingTest1 extends AbstractProvisioningTest {
IProfile profile = null;
- ArrayList newIUs = new ArrayList();
+ ArrayList<IInstallableUnit> newIUs = new ArrayList<>();
IInstallableUnit patchInstallingCommon = null;
@Override
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest2.java
index 9f678fe59..0237dcb40 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest2.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest2.java
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
public class SDKPatchingTest2 extends AbstractProvisioningTest {
IProfile profile = null;
- ArrayList newIUs = new ArrayList();
+ ArrayList<IInstallableUnit> newIUs = new ArrayList<>();
IInstallableUnit patchInstallingJDTLaunching = null;
IInstallableUnit patchInstallingDebugUI = null;
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 e3c1414a6..79b7c965a 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
@@ -39,7 +39,7 @@ public class TestFilteringOnAbsentProperty extends AbstractProvisioningTest {
MetadataFactory.InstallableUnitDescription desc_iuA = new MetadataFactory.InstallableUnitDescription();
desc_iuA.setId(N);
desc_iuA.setVersion(Version.create("1.0.0"));
- Collection capabilities = new ArrayList();
+ Collection<IProvidedCapability> capabilities = new ArrayList<>();
capabilities.add(MetadataFactory.createProvidedCapability(NS, N, Version.create("1.0.0")));
desc_iuA.addProvidedCapabilities(capabilities);
desc_iuA.setFilter("(&(osgi.os=macosx) (!(macosx-bundled=*)) )");
@@ -51,7 +51,7 @@ public class TestFilteringOnAbsentProperty extends AbstractProvisioningTest {
MetadataFactory.InstallableUnitDescription desc_iuA_bundled = new MetadataFactory.InstallableUnitDescription();
desc_iuA_bundled.setId("A-bundled");
desc_iuA_bundled.setVersion(Version.create("1.0.0"));
- Collection capabilities2 = new ArrayList();
+ Collection<IProvidedCapability> capabilities2 = new ArrayList<>();
capabilities2.add(MetadataFactory.createProvidedCapability(NS, "A-bundled", Version.create("1.0.0")));
capabilities2.add(MetadataFactory.createProvidedCapability(NS, N, Version.create("1.0.0")));
desc_iuA_bundled.addProvidedCapabilities(capabilities2);
@@ -64,7 +64,7 @@ public class TestFilteringOnAbsentProperty extends AbstractProvisioningTest {
MetadataFactory.InstallableUnitDescription desc_top = new MetadataFactory.InstallableUnitDescription();
desc_top.setId("Top");
desc_top.setVersion(Version.create("1.0.0"));
- Collection capabilitiesTop = new ArrayList();
+ Collection<IProvidedCapability> capabilitiesTop = new ArrayList<>();
capabilitiesTop.add(MetadataFactory.createProvidedCapability(NS, "Top", Version.create("1.0.0")));
desc_top.addProvidedCapabilities(capabilitiesTop);
desc_top.setRequirements(new IRequirement[] {MetadataFactory.createRequirement(NS, N, new VersionRange("[1.0.0, 2.0.0)"), null, false, false, true)});
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 89a5cf3be..5175de167 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
@@ -70,7 +70,7 @@ public abstract class ActionTest extends AbstractProvisioningTest {
}
protected void verifyRequiredCapability(Collection<IRequirement> requirement, String namespace, String name, VersionRange range, int min, int max, boolean greedy) {
- for (Iterator iterator = requirement.iterator(); iterator.hasNext();) {
+ for (Iterator<IRequirement> iterator = requirement.iterator(); iterator.hasNext();) {
IRequiredCapability required = (IRequiredCapability) iterator.next();
if (required.getName().equalsIgnoreCase(name) && required.getNamespace().equalsIgnoreCase(namespace) && required.getRange().equals(range)) {
String requirementDescr = "RequiredCapability " + name + " " + range.toString();
@@ -128,7 +128,7 @@ public abstract class ActionTest extends AbstractProvisioningTest {
protected void contains(Collection<IRequirement> capabilities, String namespace, String name, VersionRange range, String filterStr, boolean optional, boolean multiple) {
IMatchExpression<IInstallableUnit> filter = InstallableUnit.parseFilter(filterStr);
- for (Iterator iterator = capabilities.iterator(); iterator.hasNext();) {
+ for (Iterator<IRequirement> iterator = capabilities.iterator(); iterator.hasNext();) {
IRequiredCapability capability = (IRequiredCapability) iterator.next();
if (filter == null) {
if (capability.getFilter() != null)
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
index 20a9bc7b2..420e88610 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
*******************************************************************************/
@@ -32,7 +32,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testAdviceVersion() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("advice.version", "1.0");
AdviceFileParser parser = new AdviceFileParser("id", Version.emptyVersion, map);
parser.parse();
@@ -48,7 +48,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testUpdateDescriptorAdvice() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("update.id", "testName");
map.put("update.severity", "10");
map.put("update.description", "Test Description");
@@ -68,7 +68,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testUpdateDescriptorAdviceDefaultBound() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("update.id", "testName");
map.put("update.severity", "10");
map.put("update.description", "Test Description");
@@ -88,7 +88,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testUpdateDescriptorWithMatch() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("update.matchExp", "providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'B' || pc.name == 'C'))");
map.put("update.severity", "10");
map.put("update.description", "Test Description");
@@ -110,7 +110,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testUpdateDescriptorAdviceDefaultBound2() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("update.id", "testName");
map.put("update.severity", "10");
map.put("update.description", "Test Description");
@@ -129,7 +129,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testUpdateDescriptorAdviceDefaultID() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("update.severity", "10");
map.put("update.description", "Test Description");
@@ -147,7 +147,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testUpdateDescriptorAdviceDefaults() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("update.id", "id");
AdviceFileParser parser = new AdviceFileParser("id", Version.parseVersion("9.10.11"), map);
@@ -164,7 +164,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testPropertyAdvice() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("properties.0.name", "testName1");
map.put("properties.0.value", "testValue1");
map.put("properties.1.name", "testName2");
@@ -177,7 +177,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testProvidesAdvice() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("provides.0.namespace", "testNamespace1");
map.put("provides.0.name", "testName1");
map.put("provides.0.version", "1.2.3.$qualifier$");
@@ -207,7 +207,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testRequiresAdvice() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("requires.0.namespace", "testNamespace1");
map.put("requires.0.name", "testName1");
map.put("requires.0.range", "[1.2.3.$qualifier$, 2)");
@@ -228,7 +228,7 @@ public class AdviceFileParserTest extends TestCase {
map.put("requires.1.range", "$version$");
map.put("requires.1.greedy", Boolean.FALSE.toString());
map.put("requires.1.optional", Boolean.FALSE.toString());
- //default
+ //default
// map.put("requires.1.multiple", Boolean.FALSE.toString());
parser = new AdviceFileParser("id", Version.emptyVersion, map);
@@ -248,7 +248,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testRequireWithExpression() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
String matchExp = "properties[abc] == 'def'";
map.put("requires.0.matchExp", matchExp);
map.put("requires.0.greedy", Boolean.TRUE.toString());
@@ -266,7 +266,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testRequireWithExpressionAndOptional() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
String matchExp = "properties[abc] == 'def'";
map.put("requires.0.matchExp", matchExp);
map.put("requires.0.greedy", Boolean.TRUE.toString());
@@ -285,7 +285,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testMetaRequiresAdvice() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("metaRequirements.0.namespace", "testNamespace1");
map.put("metaRequirements.0.name", "testName1");
map.put("metaRequirements.0.range", "[1.2.3.$qualifier$, 2)");
@@ -306,7 +306,7 @@ public class AdviceFileParserTest extends TestCase {
map.put("metaRequirements.1.range", "$version$");
map.put("metaRequirements.1.greedy", Boolean.FALSE.toString());
map.put("metaRequirements.1.optional", Boolean.FALSE.toString());
- //default
+ //default
// map.put("requires.1.multiple", Boolean.FALSE.toString());
parser = new AdviceFileParser("id", Version.emptyVersion, map);
@@ -326,7 +326,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testInstructionsAdvice() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("instructions.configure", "addProgramArg(programArg:-startup); addProgramArg(programArg:@artifact);");
map.put("instructions.unconfigure", "removeProgramArg(programArg:-startup); removeProgramArg(programArg:@artifact);)");
@@ -344,7 +344,7 @@ public class AdviceFileParserTest extends TestCase {
}
public void testAdditionalInstallableUnitDescriptionsAdvice() {
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put("units.0.id", "testid0");
map.put("units.0.version", "1.2.3");
@@ -441,9 +441,9 @@ public class AdviceFileParserTest extends TestCase {
assertEquals(Version.create("1.2.4"), iu1.getVersion());
assertTrue(iu1.isSingleton());
assertEquals(2, iu1.getArtifacts().size());
- Iterator it = iu1.getArtifacts().iterator();
- IArtifactKey key0 = (IArtifactKey) it.next();
- IArtifactKey key1 = (IArtifactKey) it.next();
+ Iterator<IArtifactKey> it = iu1.getArtifacts().iterator();
+ IArtifactKey key0 = it.next();
+ IArtifactKey key1 = it.next();
assertEquals("testArtifact1", key0.getId());
assertEquals(Version.create("1.2.6"), key0.getVersion());
assertEquals("testClassifier1", key0.getClassifier());
@@ -459,9 +459,9 @@ public class AdviceFileParserTest extends TestCase {
assertEquals("testValue2", iu1.getProperty("testName2"));
Collection<IRequirement> reqs = iu1.getRequirements();
- Iterator it2 = reqs.iterator();
- IRequirement req0 = (IRequirement) it2.next();
- IRequirement req1 = (IRequirement) it2.next();
+ Iterator<IRequirement> it2 = reqs.iterator();
+ IRequirement req0 = it2.next();
+ IRequirement req1 = it2.next();
assertEquals(2, reqs.size());
assertEquals("testNamespace1", RequiredCapability.extractNamespace(req0.getMatches()));
assertEquals("testName1", RequiredCapability.extractName(req0.getMatches()));
@@ -488,9 +488,9 @@ public class AdviceFileParserTest extends TestCase {
Collection<IRequirement> metarequirements = iu1.getMetaRequirements();
assertEquals(2, metarequirements.size());
- Iterator it3 = metarequirements.iterator();
- IRequirement metaReq0 = (IRequirement) it3.next();
- IRequirement metaReq1 = (IRequirement) it3.next();
+ Iterator<IRequirement> it3 = metarequirements.iterator();
+ IRequirement metaReq0 = it3.next();
+ IRequirement metaReq1 = it3.next();
assertEquals("testNamespace1", RequiredCapability.extractNamespace(metaReq0.getMatches()));
assertEquals("testName1", RequiredCapability.extractName(metaReq0.getMatches()));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
index 2c907a827..ddd7d48bd 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
@@ -103,20 +103,20 @@ public class EquinoxExecutableActionTest extends ActionTest {
}
private void verifyResults(String idBase, String confSpec) {
- ArrayList iuList = new ArrayList(publisherResult.getIUs(null, IPublisherResult.ROOT));
+ ArrayList<IInstallableUnit> iuList = new ArrayList<>(publisherResult.getIUs(null, IPublisherResult.ROOT));
verifyEclipseIU(iuList, idBase, confSpec);
verifyCU(iuList, idBase, confSpec);
verifyExecIU(iuList, idBase, confSpec);
assertTrue(iuList.size() == 3);
}
- private void verifyCU(ArrayList iuList, String idBase, String confSpec) {
+ private void verifyCU(ArrayList<IInstallableUnit> iuList, String idBase, String confSpec) {
String[] config = AbstractPublisherAction.parseConfigSpec(confSpec);
String _ws = config[0];
String _os = config[1];
String _arch = config[2];
for (int i = 0; i < iuList.size(); i++) {
- IInstallableUnit possibleEclipse = (IInstallableUnit) iuList.get(i);
+ IInstallableUnit possibleEclipse = iuList.get(i);
if (possibleEclipse.getId().equals(flavorArg + idBase + ".executable." + confSpec)) {//$NON-NLS-1$
IInstallableUnitFragment fragment = (IInstallableUnitFragment) iuList.get(i);
Collection<IProvidedCapability> providedCapability = fragment.getProvidedCapabilities();
@@ -136,9 +136,9 @@ public class EquinoxExecutableActionTest extends ActionTest {
fail();
}
- private void verifyEclipseIU(ArrayList iuList, String idBase, String confSpec) {
+ private void verifyEclipseIU(ArrayList<IInstallableUnit> iuList, String idBase, String confSpec) {
for (int i = 0; i < iuList.size(); i++) {
- IInstallableUnit possibleEclipse = (IInstallableUnit) iuList.get(i);
+ IInstallableUnit possibleEclipse = iuList.get(i);
if (possibleEclipse.getId().equals((idBase + ".executable." + confSpec + "." + EXECUTABLE_NAME))) { //$NON-NLS-1$//$NON-NLS-2$
assertTrue(possibleEclipse.getVersion().equals(version));
Collection<IProvidedCapability> providedCapability = possibleEclipse.getProvidedCapabilities();
@@ -152,13 +152,13 @@ public class EquinoxExecutableActionTest extends ActionTest {
fail();
}
- private void verifyExecIU(ArrayList iuList, String idBase, String confSpec) {
+ private void verifyExecIU(ArrayList<IInstallableUnit> iuList, String idBase, String confSpec) {
String[] config = AbstractPublisherAction.parseConfigSpec(confSpec);
String _ws = config[0];
String _os = config[1];
String _arch = config[2];
for (int i = 0; i < iuList.size(); i++) {
- IInstallableUnit possibleExec = (IInstallableUnit) iuList.get(i);
+ IInstallableUnit possibleExec = iuList.get(i);
if (possibleExec.getId().equals(idBase + ".executable." + confSpec)) { //$NON-NLS-1$
//keep checking
assertTrue(possibleExec.getFilter().equals(InstallableUnit.parseFilter("(& (osgi.ws=" + _ws + ")(osgi.os=" + _os + ")(osgi.arch=" + _arch + "))"))); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
@@ -258,7 +258,7 @@ public class EquinoxExecutableActionTest extends ActionTest {
setupArtifactRepository();
expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes();
expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_PUBLISH).anyTimes();
- expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), (Class) anyObject())).andReturn(brandingAdvice);
+ expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), (Class<IBrandingAdvice>) anyObject())).andReturn(brandingAdvice);
}
private void setupBrandingAdvice(final String osArg, final String config, final File exec, final File icon) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
index f06363cb7..2ae685445 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
@@ -199,9 +199,9 @@ public class FeaturesActionTest extends ActionTest {
private void verifyMetadata() {
//{foo.feature.jar=[foo.feature.jar 1.0.0], bar.feature.jar=[bar.feature.jar 1.1.1], foo.feature.group=[foo.feature.group 1.0.0], bar.feature.group=[bar.feature.group 1.1.1]}
- ArrayList fooIUs = new ArrayList(publisherResult.getIUs("foo.feature.jar", IPublisherResult.NON_ROOT)); //$NON-NLS-1$
+ ArrayList<IInstallableUnit> fooIUs = new ArrayList<>(publisherResult.getIUs("foo.feature.jar", IPublisherResult.NON_ROOT)); //$NON-NLS-1$
assertTrue(fooIUs.size() == 1);
- IInstallableUnit foo = (IInstallableUnit) fooIUs.get(0);
+ IInstallableUnit foo = fooIUs.get(0);
assertTrue(foo.getId().equalsIgnoreCase("foo.feature.jar")); //$NON-NLS-1$
assertTrue(foo.getVersion().equals(fooVersion));
assertEquals("Foo Feature", foo.getProperty(IInstallableUnit.PROP_NAME));
@@ -232,9 +232,9 @@ public class FeaturesActionTest extends ActionTest {
assertTrue(fooProvidedCapabilities.size() == 3);
//feature group IU for foo
- fooIUs = new ArrayList(publisherResult.getIUs("foo.feature.group", IPublisherResult.ROOT)); //$NON-NLS-1$
+ fooIUs = new ArrayList<>(publisherResult.getIUs("foo.feature.group", IPublisherResult.ROOT)); //$NON-NLS-1$
assertTrue(fooIUs.size() == 1);
- IInstallableUnit fooGroup = (IInstallableUnit) fooIUs.get(0);
+ IInstallableUnit fooGroup = fooIUs.get(0);
tpData = fooGroup.getTouchpointData();
assertEquals(1, tpData.size());
ITouchpointInstruction instruction = tpData.iterator().next().getInstruction("install");
@@ -243,9 +243,9 @@ public class FeaturesActionTest extends ActionTest {
assertNull(fooGroup.getFilter());
/*verify bar*/
- ArrayList barIUs = new ArrayList(publisherResult.getIUs("bar.feature.jar", IPublisherResult.NON_ROOT)); //$NON-NLS-1$
+ ArrayList<IInstallableUnit> barIUs = new ArrayList<>(publisherResult.getIUs("bar.feature.jar", IPublisherResult.NON_ROOT)); //$NON-NLS-1$
assertTrue(barIUs.size() == 1);
- IInstallableUnit bar = (IInstallableUnit) barIUs.get(0);
+ IInstallableUnit bar = barIUs.get(0);
assertTrue(bar.getId().equals("bar.feature.jar")); //$NON-NLS-1$
assertTrue(bar.getVersion().equals(barVersion));
assertTrue(bar.getProperty("key1").equals("value1")); //$NON-NLS-1$//$NON-NLS-2$
@@ -256,9 +256,9 @@ public class FeaturesActionTest extends ActionTest {
assertEquals(bar.getFilter().getParameters()[0], ExpressionUtil.parseLDAP("(org.eclipse.update.install.features=true)")); //$NON-NLS-1$
assertTrue(bar.isSingleton());
- barIUs = new ArrayList(publisherResult.getIUs("bar.feature.group", IPublisherResult.ROOT)); //$NON-NLS-1$
+ barIUs = new ArrayList<>(publisherResult.getIUs("bar.feature.group", IPublisherResult.ROOT)); //$NON-NLS-1$
assertTrue(fooIUs.size() == 1);
- IInstallableUnit barGroup = (IInstallableUnit) barIUs.get(0);
+ IInstallableUnit barGroup = barIUs.get(0);
Collection<IRequirement> barRequiredCapabilities = barGroup.getRequirements();
//contains(barRequiredCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar_root", new VersionRange(barVersion, true, barVersion, true), null, false /*multiple*/, false /*optional*/); //$NON-NLS-1$//$NON-NLS-2$
contains(barRequiredCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar.feature.jar", new VersionRange(barVersion, true, barVersion, true), "(org.eclipse.update.install.features=true)", false /*multiple*/, false /*optional*/); //$NON-NLS-1$//$NON-NLS-2$
@@ -286,10 +286,10 @@ public class FeaturesActionTest extends ActionTest {
private void verifyArtifacts() throws IOException {
ZipInputStream actualStream = artifactRepository.getZipInputStream(FOO_KEY);
- Map expected = getFileMap(new HashMap(), new File[] {new File(root, FOO)}, new Path(new File(root, FOO).getAbsolutePath()));
+ Map expected = getFileMap(new HashMap<>(), new File[] {new File(root, FOO)}, new Path(new File(root, FOO).getAbsolutePath()));
TestData.assertContains(expected, actualStream, true);
- expected = getFileMap(new HashMap(), new File[] {new File(root, BAR)}, new Path(new File(root, BAR).getAbsolutePath()));
+ expected = getFileMap(new HashMap<>(), new File[] {new File(root, BAR)}, new Path(new File(root, BAR).getAbsolutePath()));
actualStream = artifactRepository.getZipInputStream(BAR_KEY);
TestData.assertContains(expected, actualStream, true);
}
@@ -299,7 +299,7 @@ public class FeaturesActionTest extends ActionTest {
//setup metadataRepository with barIU
metadataRepository = new TestMetadataRepository(getAgent(), new IInstallableUnit[] {mockIU(BAR, null)});
- ArrayList adviceCollection = fillAdvice(new ArrayList());
+ ArrayList adviceCollection = fillAdvice(new ArrayList<>());
expect(publisherInfo.getAdvice(null, false, "bar.feature.jar", barVersion, IPropertyAdvice.class)).andReturn(adviceCollection).anyTimes();
expect(publisherInfo.getAdvice(null, false, "bar", barVersion, IPropertyAdvice.class)).andReturn(adviceCollection).anyTimes();
expect(publisherInfo.getAdvice(null, false, "bar", barVersion, IFeatureRootAdvice.class)).andReturn(Collections.EMPTY_LIST).anyTimes();
@@ -323,7 +323,7 @@ public class FeaturesActionTest extends ActionTest {
//capture any touchpoint advice, and return the captured advice when the action asks for it
publisherInfo.addAdvice(and(isA(ITouchpointAdvice.class), capture(tpAdvice)));
EasyMock.expectLastCall().anyTimes();
- expect(publisherInfo.getAdvice(null, false, "foo.feature.group", fooVersion, ITouchpointAdvice.class)).andReturn(new CaptureList(tpAdvice)).anyTimes();
+ expect(publisherInfo.getAdvice(null, false, "foo.feature.group", fooVersion, ITouchpointAdvice.class)).andReturn(new CaptureList<>(tpAdvice)).anyTimes();
}
private ArrayList fillAdvice(ArrayList adviceCollection) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java
index 6f0bd8f83..4f44183ad 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java
@@ -16,6 +16,7 @@ import java.util.*;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.updatesite.LocalUpdateSiteAction;
import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.publisher.IPublisherAdvice;
import org.eclipse.equinox.p2.publisher.IPublisherInfo;
import org.eclipse.equinox.p2.tests.TestData;
import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository;
@@ -36,7 +37,7 @@ public class LocalUpdateSiteActionTest extends ActionTest {
super.insertPublisherInfoBehavior();
expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes();
expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_INDEX | IPublisherInfo.A_OVERWRITE | IPublisherInfo.A_PUBLISH).anyTimes();
- expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), (Class) anyObject())).andReturn(Collections.EMPTY_LIST).anyTimes();
+ expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), (Class<IPublisherAdvice>) anyObject())).andReturn(Collections.EMPTY_LIST).anyTimes();
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java
index 93baee38a..1b8e83cd2 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.frameworkadmin.BundleInfo;
import org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile;
import org.eclipse.equinox.p2.metadata.Version;
+import org.eclipse.equinox.p2.publisher.IPublisherAdvice;
import org.eclipse.equinox.p2.publisher.IPublisherInfo;
import org.eclipse.equinox.p2.publisher.actions.RootIUAdvice;
import org.eclipse.equinox.p2.publisher.eclipse.*;
@@ -55,7 +56,7 @@ public class ProductActionCapturingTest extends ActionTest {
expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes();
expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_PUBLISH).anyTimes();
//Return an empty list every time getAdvice is called
- expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), (Class) anyObject())).andReturn(Collections.emptyList());
+ expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), (Class<IPublisherAdvice>) anyObject())).andReturn(Collections.emptyList());
expectLastCall().anyTimes();
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java
index ddc28b6a2..910c4a982 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java
@@ -22,8 +22,7 @@ import org.easymock.EasyMock;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile;
import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.publisher.AbstractPublisherAction;
-import org.eclipse.equinox.p2.publisher.IPublisherInfo;
+import org.eclipse.equinox.p2.publisher.*;
import org.eclipse.equinox.p2.publisher.actions.RootIUAdvice;
import org.eclipse.equinox.p2.publisher.eclipse.*;
import org.eclipse.equinox.p2.tests.TestData;
@@ -50,7 +49,7 @@ public class ProductActionTestMac extends ActionTest {
publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(RootIUAdvice.class), EasyMock.capture(rootIUAdviceCapture)));
publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(ProductFileAdvice.class), EasyMock.capture(productFileAdviceCapture)));
//Return an empty list every time getAdvice is called
- expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), (Class) anyObject())).andReturn(Collections.emptyList());
+ expect(publisherInfo.getAdvice((String) anyObject(), anyBoolean(), (String) anyObject(), (Version) anyObject(), (Class<IPublisherAdvice>) anyObject())).andReturn(Collections.emptyList());
expectLastCall().anyTimes();
}
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 e2eb29165..8a10fabd8 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
@@ -284,14 +284,14 @@ public class EvaluatorTest extends AbstractProvisioningTest {
IExpression everything = factory.variable("everything");
IExpression lambda = factory.lambda(item, cmp1);
- IContextExpression e3 = factory.contextExpression(factory.select(everything, lambda));
+ IContextExpression<Object> e3 = factory.contextExpression(factory.select(everything, lambda));
IContextExpression<Object> contextExpression = factory.contextExpression(parser.parseQuery(e3.toString()), "ian bull");
IQuery<Object> query = QueryUtil.createQuery(Object.class, contextExpression);
System.out.println(e3);
IQueryResult<Object> queryResult = query.perform(items.iterator());
- Iterator iterator = queryResult.iterator();
+ Iterator<Object> iterator = queryResult.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next());
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ConfigurationTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ConfigurationTests.java
index 5092581b1..32732fc74 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ConfigurationTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ConfigurationTests.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -21,7 +21,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
/*
* Tests related to the platform configuration before and after reconciliation.
- *
+ *
* Tests to add and regression tests to add:
* - ensure there is a platform:base: entry
* - 222505 - IUs in the dropins only rely on each other and not on things already in the install
@@ -384,8 +384,8 @@ public class ConfigurationTests extends AbstractReconcilerTest {
assertFalse("7.3", isInstalled("ccc", "1.0.0"));
assertFalse("7.4", isInstalled("bbb.feature.feature.group", "1.0.0"));
boolean found = false;
- for (Iterator iter = getConfiguration().getSites().iterator(); iter.hasNext();) {
- Site site = (Site) iter.next();
+ for (Iterator<Site> iter = getConfiguration().getSites().iterator(); iter.hasNext();) {
+ Site site = iter.next();
String link = site.getLinkFile();
if (link != null && link.contains("myLink"))
found = true;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/ChmodActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/ChmodActionTest.java
index b370d9a31..21176d3ca 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/ChmodActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/ChmodActionTest.java
@@ -54,7 +54,7 @@ public class ChmodActionTest extends AbstractProvisioningTest {
File zipTarget2 = new File(subDir, "a.zip");
copy("3.0", zipSource, zipTarget2);
- Map parameters = new HashMap();
+ Map<String, Object> parameters = new HashMap<>();
parameters.put(ActionConstants.PARM_AGENT, getAgent());
parameters.put(ActionConstants.PARM_PROFILE, profile);
EclipseTouchpoint touchpoint = new EclipseTouchpoint();
@@ -63,7 +63,7 @@ public class ChmodActionTest extends AbstractProvisioningTest {
parameters.put(ActionConstants.PARM_TARGET_DIR, installFolder.getAbsolutePath());
parameters.put(ActionConstants.PARM_TARGET_FILE, "a.zip");
parameters.put(ActionConstants.PARM_PERMISSIONS, "+x");
- Map xparameters = Collections.unmodifiableMap(parameters);
+ Map<String, Object> xparameters = Collections.unmodifiableMap(parameters);
// TODO: We need a way to verify
// one idea is to run an executable here (or chmod with -w, -r and then test that files are unreadable
@@ -125,7 +125,7 @@ public class ChmodActionTest extends AbstractProvisioningTest {
IInstallableUnit iu = createBundleIU(bundleDescription, dirBundleTarget.isDirectory(), key);
bundlePool.addDescriptor(descriptor, new NullProgressMonitor());
- Map parameters = new HashMap();
+ Map<String, Object> parameters = new HashMap<>();
parameters.put(ActionConstants.PARM_AGENT, getAgent());
parameters.put(ActionConstants.PARM_PROFILE, profile);
EclipseTouchpoint touchpoint = new EclipseTouchpoint();
@@ -138,7 +138,7 @@ public class ChmodActionTest extends AbstractProvisioningTest {
parameters.put(ActionConstants.PARM_TARGET_DIR, "@artifact");
parameters.put(ActionConstants.PARM_TARGET_FILE, "plugin.xml");
parameters.put(ActionConstants.PARM_PERMISSIONS, "+x");
- Map xparameters = Collections.unmodifiableMap(parameters);
+ Map<String, Object> xparameters = Collections.unmodifiableMap(parameters);
// TODO: We need a way to verify
// one idea is to run an executable here (or chmod with -w, -r and then test that files are unreadable
@@ -203,7 +203,7 @@ public class ChmodActionTest extends AbstractProvisioningTest {
IInstallableUnit iu = createBundleIU(bundleDescription, dirBundleTarget.isDirectory(), key);
bundlePool.addDescriptor(descriptor, new NullProgressMonitor());
- Map parameters = new HashMap();
+ Map<String, Object> parameters = new HashMap<>();
parameters.put(ActionConstants.PARM_AGENT, getAgent());
parameters.put(ActionConstants.PARM_PROFILE, profile);
EclipseTouchpoint touchpoint = new EclipseTouchpoint();
@@ -216,7 +216,7 @@ public class ChmodActionTest extends AbstractProvisioningTest {
parameters.put(ActionConstants.PARM_TARGET_DIR, parameters.get("artifact.location"));
parameters.put(ActionConstants.PARM_TARGET_FILE, "plugin.xml");
parameters.put(ActionConstants.PARM_PERMISSIONS, "+x");
- Map xparameters = Collections.unmodifiableMap(parameters);
+ Map<String, Object> xparameters = Collections.unmodifiableMap(parameters);
// TODO: We need a way to verify
// one idea is to run an executable here (or chmod with -w, -r and then test that files are unreadable
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java
index 0aa51a7e1..864e170f0 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java
@@ -46,7 +46,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest {
public void testInitializeCompletePhaseCommit() {
EclipseTouchpoint touchpoint = new EclipseTouchpoint();
- Map parameters = new HashMap();
+ Map<String, Object> parameters = new HashMap<>();
IProfile profile = createProfile("test");
parameters.put(ActionConstants.PARM_AGENT, getAgent());
@@ -91,7 +91,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest {
* Tests loading cache extensions from a profile whose install directory contains spaces
*/
public void testBug262073() throws MalformedURLException {
- Map properties = new HashMap();
+ Map<String, Object> properties = new HashMap<>();
File site = getTestData("Repository", "/testData/artifactRepo/simple with spaces/");
//use URL here so spaces are not encoded
URL spacesLocation = site.toURL();
@@ -101,13 +101,13 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest {
properties.put("org.eclipse.equinox.p2.cache.extensions", location.toString() + "|" + spacesLocation.toString());
IProfile profile = createProfile("testBug262073", properties);
AggregatedBundleRepository repo = (AggregatedBundleRepository) Util.getAggregatedBundleRepository(getAgent(), profile);
- Collection repos = repo.testGetBundleRepositories();
+ Collection<IFileArtifactRepository> repos = repo.testGetBundleRepositories();
assertEquals("1.0", 3, repos.size());
}
public void testInitializeCompleteOperand() {
EclipseTouchpoint touchpoint = new EclipseTouchpoint();
- Map parameters = new HashMap();
+ Map<String, Object> parameters = new HashMap<>();
IProfile profile = createProfile("test");
// need a partial iu test here
@@ -137,7 +137,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest {
Map<String, String> extraProperties = new HashMap<>();
extraProperties.put(IInstallableUnit.PROP_PARTIAL_IU, Boolean.TRUE.toString());
- Dictionary mockManifest = new Properties();
+ Dictionary<String, String> mockManifest = new Hashtable<>();
mockManifest.put("Manifest-Version", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
mockManifest.put("Bundle-ManifestVersion", "2"); //$NON-NLS-1$ //$NON-NLS-2$
mockManifest.put("Bundle-SymbolicName", key.getId()); //$NON-NLS-1$
@@ -175,7 +175,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest {
Map<String, String> extraProperties = new HashMap<>();
extraProperties.put(IInstallableUnit.PROP_PARTIAL_IU, Boolean.TRUE.toString());
- Dictionary mockManifest = new Properties();
+ Dictionary<String, String> mockManifest = new Hashtable<>();
mockManifest.put("Manifest-Version", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
mockManifest.put("Bundle-ManifestVersion", "2"); //$NON-NLS-1$ //$NON-NLS-2$
mockManifest.put("Bundle-SymbolicName", key.getId()); //$NON-NLS-1$
@@ -187,7 +187,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest {
IInstallableUnit iu = bundleIUs[0];
assertTrue(Boolean.parseBoolean(iu.getProperty(IInstallableUnit.PROP_PARTIAL_IU)));
- Iterator iterator = profile.query(QueryUtil.createIUQuery(iu.getId()), null).iterator();
+ Iterator<IInstallableUnit> iterator = profile.query(QueryUtil.createIUQuery(iu.getId()), null).iterator();
assertFalse(iterator.hasNext());
IEngine engine = getEngine();
@@ -200,7 +200,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest {
iterator = profile.query(QueryUtil.createIUQuery(iu.getId()), null).iterator();
assertTrue(iterator.hasNext());
- IInstallableUnit installedIU = (IInstallableUnit) iterator.next();
+ IInstallableUnit installedIU = iterator.next();
assertTrue(installedIU.getId().equals(iu.getId()));
assertFalse(Boolean.parseBoolean(installedIU.getProperty(IInstallableUnit.PROP_PARTIAL_IU)));
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java
index f0bcb5dc1..e9fddedce 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java
@@ -62,10 +62,10 @@ public class SiteXMLActionTest extends AbstractProvisioningTest {
}
public void testQualifier() {
- IQueryResult results = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
- Iterator iter = results.iterator();
+ IQueryResult<IInstallableUnit> results = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ Iterator<IInstallableUnit> iter = results.iterator();
while (iter.hasNext()) {
- IInstallableUnit unit = (IInstallableUnit) iter.next();
+ IInstallableUnit unit = iter.next();
String sitelocation = URIUtil.toUnencodedString(siteLocation);
assertTrue("1.0", unit.getId().startsWith(sitelocation));
assertEquals("2.0", "Test Category Label", unit.getProperty(IInstallableUnit.PROP_NAME));
@@ -81,11 +81,11 @@ public class SiteXMLActionTest extends AbstractProvisioningTest {
* Tests that associate sites are generated correctly.
*/
public void testAssociateSite() {
- Collection references = metadataRepository.getReferences();
+ Collection<IRepositoryReference> references = metadataRepository.getReferences();
assertEquals("1.0", 2, references.size());
boolean metadataFound = false, artifactFound = false;
- for (Iterator it = references.iterator(); it.hasNext();) {
- IRepositoryReference ref = (IRepositoryReference) it.next();
+ for (Iterator<IRepositoryReference> it = references.iterator(); it.hasNext();) {
+ IRepositoryReference ref = it.next();
assertEquals("1.1", "http://download.eclipse.org/eclipse/updates/3.5", ref.getLocation().toString());
assertEquals("1.2", IRepository.ENABLED, ref.getOptions());
assertEquals("1.3", "Eclipse Project Update Site", ref.getNickname());
@@ -105,10 +105,10 @@ public class SiteXMLActionTest extends AbstractProvisioningTest {
}
public void testBundleInCategory() {
- IQueryResult results = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
- Iterator iter = results.iterator();
+ IQueryResult<IInstallableUnit> results = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ Iterator<IInstallableUnit> iter = results.iterator();
- IInstallableUnit unit = (IInstallableUnit) iter.next();
+ IInstallableUnit unit = iter.next();
IQuery<IInstallableUnit> memberQuery = QueryUtil.createIUCategoryMemberQuery(unit);
IQueryResult<IInstallableUnit> categoryMembers = actionResult.query(memberQuery, new NullProgressMonitor());
Set<String> membersId = new HashSet<>();

Back to the top