Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-09-19 07:00:36 +0000
committerAlexander Kurtakov2017-09-19 07:00:36 +0000
commitf84a32193287c0a7f00c7537b159ddb0ec1804e5 (patch)
treed37b720d1f0afe80b3846d393050a55dfcbab823
parentfe8c916393dbce189c2f7dc0ce047a4b40d93f0a (diff)
downloadrt.equinox.p2-f84a32193287c0a7f00c7537b159ddb0ec1804e5.tar.gz
rt.equinox.p2-f84a32193287c0a7f00c7537b159ddb0ec1804e5.tar.xz
rt.equinox.p2-f84a32193287c0a7f00c7537b159ddb0ec1804e5.zip
Bug 522466 - Fix generification warnings in p2.tests
Generification of most IQuery* related warnings possible and surrounding other generic warnings. Change-Id: I8516236c712722d7c40ea15c7334d7ba87b7e6b4 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java71
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/CompositeRepositoryTaskTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java74
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/RepoTasksTests.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java52
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java6
-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/artifact/repository/SimpleArtifactRepositoryTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java58
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java96
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileMetadataRepositoryTest.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTestCurrent.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/RepoValidator.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/LatestIUTest.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java51
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbstractPlannerTest.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AddIUProperty.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252682.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271067.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug272251.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug301446.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582c.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug365124.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationLargeConflict.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUProperties.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUPropertyRemoval.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest2.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ProvisioningPlanQueryTest.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimulatedSharedInstallTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SlicerBug365124Test.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UpdateQueryTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/DefaultCUsActionTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java92
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java27
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/EvaluatorTest.java58
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CleanupzipActionTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryIUXMLActionTest.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryXMLActionTest.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/LocalUpdatesiteTest.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java20
65 files changed, 589 insertions, 601 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java
index 92355c4be..e22cef981 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java
@@ -183,12 +183,12 @@ public class AbstractAntProvisioningTest extends AbstractProvisioningTest {
writer.start(task.name);
// write properties
- for (Iterator iter = task.attributes.iterator(); iter.hasNext();)
- writer.attribute((String) iter.next(), (String) iter.next());
+ for (Iterator<String> iter = task.attributes.iterator(); iter.hasNext();)
+ writer.attribute(iter.next(), iter.next());
// write sub elements if applicable
- for (Iterator iter = task.elements.iterator(); iter.hasNext();)
- writeElement(writer, (AntTaskElement) iter.next());
+ for (Iterator<AntTaskElement> iter = task.elements.iterator(); iter.hasNext();)
+ writeElement(writer, iter.next());
// close tag
writer.end();
@@ -197,8 +197,8 @@ public class AbstractAntProvisioningTest extends AbstractProvisioningTest {
// Class which can be used to represent elements in a task
protected class AntTaskElement {
public String name;
- public List attributes = new ArrayList();
- public List elements = new ArrayList();
+ public List<String> attributes = new ArrayList<>();
+ public List<AntTaskElement> elements = new ArrayList<>();
public AntTaskElement(String name) {
this.name = name;
@@ -255,11 +255,11 @@ public class AbstractAntProvisioningTest extends AbstractProvisioningTest {
assertContains(message, destination, source);
}
- protected void assertArtifactKeyContentEquals(String message, IQueryResult ius, URI artifactRepositoryLocation) {
+ protected void assertArtifactKeyContentEquals(String message, IQueryResult<IInstallableUnit> ius, URI artifactRepositoryLocation) {
try {
IArtifactRepository repo = getArtifactRepositoryManager().loadRepository(artifactRepositoryLocation, null);
- List fromIUs = getArtifactKeys(ius);
- Iterator fromRepo = repo.query(ArtifactKeyQuery.ALL_KEYS, null).iterator();
+ List<IArtifactKey> fromIUs = getArtifactKeys(ius);
+ Iterator<IArtifactKey> fromRepo = repo.query(ArtifactKeyQuery.ALL_KEYS, null).iterator();
assertContains(message, fromIUs, fromRepo);
assertContains(message, fromRepo, fromIUs);
} catch (ProvisionException e) {
@@ -268,7 +268,7 @@ public class AbstractAntProvisioningTest extends AbstractProvisioningTest {
}
- protected static List getArtifactKeys(IQueryResult<IInstallableUnit> ius) {
+ protected static List<IArtifactKey> getArtifactKeys(IQueryResult<IInstallableUnit> ius) {
List<IArtifactKey> keys = new ArrayList<>();
for (Iterator<IInstallableUnit> iter = ius.iterator(); iter.hasNext();)
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 0d0bd0b35..8379d733b 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
@@ -16,6 +16,7 @@ import java.lang.reflect.Field;
import java.net.URI;
import java.net.URL;
import java.util.*;
+import java.util.Map.Entry;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import junit.framework.AssertionFailedError;
@@ -95,12 +96,12 @@ public abstract class AbstractProvisioningTest extends TestCase {
fail("The profile should be empty,profileId=" + profile);
}
- protected static void assertNotIUs(IInstallableUnit[] ius, Iterator installableUnits) {
- Set notexpected = new HashSet();
+ protected static void assertNotIUs(IInstallableUnit[] ius, Iterator<IInstallableUnit> installableUnits) {
+ Set<IInstallableUnit> notexpected = new HashSet<>();
notexpected.addAll(Arrays.asList(ius));
while (installableUnits.hasNext()) {
- IInstallableUnit next = (IInstallableUnit) installableUnits.next();
+ IInstallableUnit next = installableUnits.next();
if (notexpected.contains(next)) {
fail("not expected [" + next + "]");
}
@@ -138,9 +139,9 @@ public abstract class AbstractProvisioningTest extends TestCase {
* Asserts that the given profile contains *only* the given IUs.
*/
protected static void assertProfileContains(String message, IProfile profile, IInstallableUnit[] expectedUnits) {
- HashSet expected = new HashSet(Arrays.asList(expectedUnits));
- for (Iterator it = getInstallableUnits(profile); it.hasNext();) {
- IInstallableUnit actual = (IInstallableUnit) it.next();
+ HashSet<IInstallableUnit> expected = new HashSet<>(Arrays.asList(expectedUnits));
+ for (Iterator<IInstallableUnit> it = getInstallableUnits(profile); it.hasNext();) {
+ IInstallableUnit actual = it.next();
if (!expected.remove(actual))
fail(message + " profile " + profile.getProfileId() + " contained an unexpected unit: " + actual);
}
@@ -152,9 +153,9 @@ public abstract class AbstractProvisioningTest extends TestCase {
* Asserts that the given profile contains all the given IUs.
*/
protected static void assertProfileContainsAll(String message, IProfile profile2, IInstallableUnit[] expectedUnits) {
- HashSet expected = new HashSet(Arrays.asList(expectedUnits));
- for (Iterator it = getInstallableUnits(profile2); it.hasNext();) {
- IInstallableUnit actual = (IInstallableUnit) it.next();
+ HashSet<IInstallableUnit> expected = new HashSet<>(Arrays.asList(expectedUnits));
+ for (Iterator<IInstallableUnit> it = getInstallableUnits(profile2); it.hasNext();) {
+ IInstallableUnit actual = it.next();
expected.remove(actual);
}
if (!expected.isEmpty())
@@ -433,8 +434,8 @@ public abstract class AbstractProvisioningTest extends TestCase {
for (int i = 0; i < additionalProvides.length; i++) {
provides[i + 1] = additionalProvides[i];
}
- for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) {
- String nextKey = (String) iter.next();
+ for (Iterator<String> iter = properties.keySet().iterator(); iter.hasNext();) {
+ String nextKey = iter.next();
String nextValue = (String) properties.get(nextKey);
iu.setProperty(nextKey, nextValue);
}
@@ -462,8 +463,8 @@ public abstract class AbstractProvisioningTest extends TestCase {
for (int i = 0; i < additionalProvides.length; i++) {
provides[i + 1] = additionalProvides[i];
}
- for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) {
- String nextKey = (String) iter.next();
+ for (Iterator<String> iter = properties.keySet().iterator(); iter.hasNext();) {
+ String nextKey = iter.next();
String nextValue = (String) properties.get(nextKey);
iu.setProperty(nextKey, nextValue);
}
@@ -510,7 +511,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
public static void changeVersion(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription desc, Version newVersion) {
- List<IProvidedCapability> capabilities = new ArrayList(desc.getProvidedCapabilities());
+ List<IProvidedCapability> capabilities = new ArrayList<>(desc.getProvidedCapabilities());
for (int i = 0; i < capabilities.size(); i++) {
IProvidedCapability pc = capabilities.get(i);
if (desc.getVersion().equals(pc.getVersion()))
@@ -539,11 +540,11 @@ public abstract class AbstractProvisioningTest extends TestCase {
desc.setTouchpointType(MetadataFactory.createTouchpointType(prototype.getTouchpointType().getId(), prototype.getTouchpointType().getVersion()));
desc.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(prototype.getUpdateDescriptor().getIUsBeingUpdated(), prototype.getUpdateDescriptor().getSeverity(), prototype.getUpdateDescriptor().getDescription(), null));
desc.setVersion(prototype.getVersion());
- Map prototypeProperties = prototype.getProperties();
- Set entries = prototypeProperties.entrySet();
- for (Iterator iterator = entries.iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- desc.setProperty((String) entry.getKey(), (String) entry.getValue());
+ Map<String, String> prototypeProperties = prototype.getProperties();
+ Set<Entry<String, String>> entries = prototypeProperties.entrySet();
+ for (Iterator<Entry<String, String>> iterator = entries.iterator(); iterator.hasNext();) {
+ Entry<String, String> entry = iterator.next();
+ desc.setProperty(entry.getKey(), entry.getValue());
}
return desc;
}
@@ -647,7 +648,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
fail(message);
}
- public static Iterator getInstallableUnits(IProfile profile2) {
+ public static Iterator<IInstallableUnit> getInstallableUnits(IProfile profile2) {
return profile2.query(QueryUtil.createIUAnyQuery(), null).iterator();
}
@@ -1251,9 +1252,9 @@ public abstract class AbstractProvisioningTest extends TestCase {
* Note: NOT BICONDITIONAL! assertContains(A, B) is NOT the same as assertContains(B, A)
*/
protected static void assertContains(String message, IArtifactRepository sourceRepo, IArtifactRepository destinationRepo) {
- IQueryResult sourceKeys = sourceRepo.query(ArtifactKeyQuery.ALL_KEYS, null);
- for (Iterator iterator = sourceKeys.iterator(); iterator.hasNext();) {
- IArtifactKey key = (IArtifactKey) iterator.next();
+ IQueryResult<IArtifactKey> sourceKeys = sourceRepo.query(ArtifactKeyQuery.ALL_KEYS, null);
+ for (Iterator<IArtifactKey> iterator = sourceKeys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
IArtifactDescriptor[] destinationDescriptors = destinationRepo.getArtifactDescriptors(key);
if (destinationDescriptors == null || destinationDescriptors.length == 0)
fail(message + ": unmatched key: " + key.toString());
@@ -1279,14 +1280,14 @@ public abstract class AbstractProvisioningTest extends TestCase {
* Note: NOT BICONDITIONAL! assertContains(A, B) is NOT the same as assertContains(B, A)
*/
protected static void assertContains(String message, IMetadataRepository sourceRepo, IMetadataRepository destinationRepo) {
- IQueryResult sourceCollector = sourceRepo.query(QueryUtil.createIUAnyQuery(), null);
- Iterator it = sourceCollector.iterator();
+ IQueryResult<IInstallableUnit> sourceCollector = sourceRepo.query(QueryUtil.createIUAnyQuery(), null);
+ Iterator<IInstallableUnit> it = sourceCollector.iterator();
while (it.hasNext()) {
- IInstallableUnit sourceIU = (IInstallableUnit) it.next();
- IQueryResult destinationCollector = destinationRepo.query(QueryUtil.createIUQuery(sourceIU), null);
+ IInstallableUnit sourceIU = it.next();
+ IQueryResult<IInstallableUnit> destinationCollector = destinationRepo.query(QueryUtil.createIUQuery(sourceIU), null);
assertEquals(message, 1, queryResultSize(destinationCollector));
- assertEquals(message, sourceIU, (IInstallableUnit) destinationCollector.iterator().next());
+ assertEquals(message, sourceIU, destinationCollector.iterator().next());
}
}
@@ -1300,11 +1301,11 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
public static void assertContains(String message, IQueryable source, IQueryable destination) {
- IQueryResult sourceCollector = source.query(QueryUtil.createIUAnyQuery(), null);
- Iterator it = sourceCollector.iterator();
+ IQueryResult<IInstallableUnit> sourceCollector = source.query(QueryUtil.createIUAnyQuery(), null);
+ Iterator<IInstallableUnit> it = sourceCollector.iterator();
while (it.hasNext()) {
- IInstallableUnit sourceIU = (IInstallableUnit) it.next();
+ IInstallableUnit sourceIU = it.next();
IQueryResult destinationCollector = destination.query(QueryUtil.createIUQuery(sourceIU), null);
assertEquals(message, 1, queryResultSize(destinationCollector));
assertTrue(message, sourceIU.equals(destinationCollector.iterator().next()));
@@ -1510,7 +1511,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
int count = 0;
try {
IArtifactRepository repo = getArtifactRepositoryManager().loadRepository(location, null);
- IQueryResult descriptors = repo.descriptorQueryable().query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
+ IQueryResult<IArtifactDescriptor> descriptors = repo.descriptorQueryable().query(ArtifactDescriptorQuery.ALL_DESCRIPTORS, null);
return queryResultSize(descriptors);
} catch (ProvisionException e) {
fail("Failed to load repository " + URIUtil.toUnencodedString(location) + " for ArtifactDescriptor count");
@@ -1616,9 +1617,9 @@ public abstract class AbstractProvisioningTest extends TestCase {
}
protected void assertEqualArtifacts(String message, SimpleArtifactRepository expected, SimpleArtifactRepository actual) {
- IQueryResult expectedKeys = expected.query(ArtifactKeyQuery.ALL_KEYS, null);
- for (Iterator iterator = expectedKeys.iterator(); iterator.hasNext();) {
- IArtifactKey key = (IArtifactKey) iterator.next();
+ IQueryResult<IArtifactKey> expectedKeys = expected.query(ArtifactKeyQuery.ALL_KEYS, null);
+ for (Iterator<IArtifactKey> iterator = expectedKeys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
IArtifactDescriptor[] expectedDescriptors = expected.getArtifactDescriptors(key);
IArtifactDescriptor[] actualDescriptors = actual.getArtifactDescriptors(key);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/CompositeRepositoryTaskTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/CompositeRepositoryTaskTest.java
index a44525970..39ea6ee8c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/CompositeRepositoryTaskTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/CompositeRepositoryTaskTest.java
@@ -299,7 +299,7 @@ public class CompositeRepositoryTaskTest extends AbstractAntProvisioningTest {
AntTaskElement createCompositeTask = createCompositeRepositoryTaskElement(TYPE_ARTIFACT);
addTask(createCompositeTask);
// Set the compressed attribute to false
- ((AntTaskElement) createCompositeTask.elements.get(0)).addAttributes(new String[] {"compressed", String.valueOf(false)});
+ createCompositeTask.elements.get(0).addAttributes(new String[] {"compressed", String.valueOf(false)});
runAntTask();
ICompositeRepository repo = getCompositeRepository(TYPE_ARTIFACT);
@@ -350,7 +350,7 @@ public class CompositeRepositoryTaskTest extends AbstractAntProvisioningTest {
AntTaskElement createCompositeTask = createCompositeRepositoryTaskElement(TYPE_ARTIFACT);
addTask(createCompositeTask);
// Set the repository name
- ((AntTaskElement) createCompositeTask.elements.get(0)).addAttributes(new String[] {"name", repoName});
+ createCompositeTask.elements.get(0).addAttributes(new String[] {"name", repoName});
runAntTask();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
index b78696f45..9037b2195 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
@@ -324,8 +324,8 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
} catch (ProvisionException e) {
fail("Loading repository failed", e);
}
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
AntTaskElement mirror = createMirrorTask(TYPE_METADATA);
mirror.addElement(createSourceElement(null, sliceRepo));
@@ -337,7 +337,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
Map<String, String> p = getSliceProperties();
p.put("org.eclipse.update.install.features", String.valueOf(true));
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, true, true, true, true, false);
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertEquals("Different number of IUs", queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())), getIUCount(destinationRepo));
try {
@@ -354,8 +354,8 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
} catch (ProvisionException e) {
fail("Loading repository failed", e);
}
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
AntTaskElement mirror = createMirrorTask(TYPE_METADATA);
mirror.addElement(createSourceElement(null, sliceRepo));
@@ -365,7 +365,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
runAntTask();
PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), true, false, true, false, false);
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertEquals("Different number of IUs", queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())), getIUCount(destinationRepo));
try {
@@ -382,8 +382,8 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
} catch (ProvisionException e) {
fail("Loading repository failed", e);
}
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
AntTaskElement mirror = createMirrorTask(TYPE_METADATA);
mirror.addElement(createSourceElement(null, sliceRepo));
@@ -395,7 +395,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
Map<String, String> p = getSliceProperties();
p.put("org.eclipse.update.install.features", String.valueOf(true));
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, false, true, true, false, false);
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertEquals("Different number of IUs", queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())), getIUCount(destinationRepo));
try {
assertIUContentEquals("IUs differ", result, getMetadataRepositoryManager().loadRepository(destinationRepo, null));
@@ -411,8 +411,8 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
} catch (ProvisionException e) {
fail("Loading repository failed", e);
}
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
AntTaskElement mirror = createMirrorTask(TYPE_METADATA);
mirror.addElement(createSourceElement(null, sliceRepo));
@@ -423,7 +423,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
Map<String, String> p = getSliceProperties();
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, true, true, true, false, false);
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertEquals("Different number of IUs", queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())), getIUCount(destinationRepo));
try {
assertIUContentEquals("IUs differ", result, getMetadataRepositoryManager().loadRepository(destinationRepo, null));
@@ -442,8 +442,8 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
} catch (ProvisionException e) {
fail("Loading repository failed", e);
}
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
AntTaskElement mirror = createMirrorTask(TYPE_METADATA);
mirror.addElement(createSourceElement(null, sliceRepo));
@@ -455,7 +455,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
Map<String, String> p = getSliceProperties();
p.put("org.eclipse.update.install.features", String.valueOf(true));
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, true, true, true, false, false);
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertEquals("Different number of IUs", queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())), getIUCount(destinationRepo));
try {
assertIUContentEquals("IUs differ", result, getMetadataRepositoryManager().loadRepository(destinationRepo, null));
@@ -474,8 +474,8 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
} catch (ProvisionException e) {
fail("Loading repository failed", e);
}
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
// Create task
AntTaskElement mirror = createMirrorTask(TYPE_METADATA);
@@ -487,7 +487,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
Map<String, String> p = getSliceProperties();
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, true, true, true, false, false);
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertEquals("Different number of IUs", queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())), getIUCount(destinationRepo));
try {
assertIUContentEquals("IUs differ", result, getMetadataRepositoryManager().loadRepository(destinationRepo, null));
@@ -506,8 +506,8 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
} catch (ProvisionException e) {
fail("Loading repository failed", e);
}
- IQueryResult c = repo.query(QueryUtil.createIUQuery("test.feature.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("test.feature.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
// Create task
AntTaskElement mirror = createMirrorTask(TYPE_BOTH);
@@ -519,7 +519,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
Map<String, String> p = getSliceProperties();
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, true, true, true, false, false);
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertEquals("Different number of IUs", queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())), getIUCount(destinationRepo));
assertEquals("Different number of ArtifactKeys", getArtifactKeyCount(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())), getArtifactKeyCount(destinationRepo));
@@ -542,8 +542,8 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
} catch (ProvisionException e) {
fail("Loading repository failed", e);
}
- IQueryResult c = repo.query(QueryUtil.createIUQuery("test.feature.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("test.feature.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
// Create task
AntTaskElement mirror = createMirrorTask(TYPE_ARTIFACT);
@@ -555,7 +555,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
Map<String, String> p = getSliceProperties();
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, true, true, true, false, false);
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertEquals("Different number of ArtifactKeys", getArtifactKeyCount(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())), getArtifactKeyCount(destinationRepo));
assertArtifactKeyContentEquals("Different ArtifactKeys", result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()), destinationRepo);
@@ -571,11 +571,11 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
} catch (ProvisionException e) {
fail("Loading repository failed", e);
}
- IQueryResult c = repo.query(QueryUtil.createIUQuery("test.feature.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("test.feature.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
c = repo.query(QueryUtil.createIUQuery("RCP_Browser_Example.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu2 = (IInstallableUnit) c.iterator().next();
+ IInstallableUnit iu2 = c.iterator().next();
// Create task
AntTaskElement mirror = createMirrorTask(TYPE_ARTIFACT);
@@ -588,7 +588,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
Map<String, String> p = getSliceProperties();
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, true, true, true, false, false);
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu, iu2}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu, iu2}, new NullProgressMonitor());
assertEquals("Different number of ArtifactKeys", getArtifactKeyCount(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())), getArtifactKeyCount(destinationRepo));
assertArtifactKeyContentEquals("Different ArtifactKeys", result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()), destinationRepo);
@@ -649,8 +649,8 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
} catch (ProvisionException e) {
fail("Loading repository failed", e);
}
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.ui.examples.readmetool"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.ui.examples.readmetool"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
// Create task
AntTaskElement mirror = createMirrorTask(TYPE_ARTIFACT);
@@ -659,7 +659,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
runAntTask();
- Collector collector = new Collector();
+ Collector<IInstallableUnit> collector = new Collector<>();
collector.accept(iu);
assertEquals("Different number of ArtifactKeys", getArtifactKeyCount(collector), getArtifactKeyCount(destinationRepo));
@@ -832,10 +832,10 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
/*
* Get the number of ArtifactKeys in a repository
*/
- protected int getArtifactKeyCount(IQueryResult ius) {
+ protected int getArtifactKeyCount(IQueryResult<IInstallableUnit> ius) {
int count = 0;
- for (Iterator iter = ius.iterator(); iter.hasNext();)
- count += ((InstallableUnit) iter.next()).getArtifacts().size();
+ for (Iterator<IInstallableUnit> iter = ius.iterator(); iter.hasNext();)
+ count += iter.next().getArtifacts().size();
return count;
}
@@ -855,10 +855,10 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
* Add all IUs to the parent element
*/
protected void addAllIUs(AntTaskElement parent, IMetadataRepository repo) {
- IQueryResult queryResult = repo.query(QueryUtil.createIUAnyQuery(), null);
+ IQueryResult<IInstallableUnit> queryResult = repo.query(QueryUtil.createIUAnyQuery(), null);
- for (Iterator iter = queryResult.iterator(); iter.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iter.next();
+ for (Iterator<IInstallableUnit> iter = queryResult.iterator(); iter.hasNext();) {
+ IInstallableUnit iu = iter.next();
parent.addElement(createIUElement(iu));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java
index 256e0fd97..fc053649f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java
@@ -79,9 +79,9 @@ public class Repo2RunnableTaskTests extends AbstractAntProvisioningTest {
IInstallableUnit iu = null;
try {
IMetadataRepository repo = getMetadataRepositoryManager().loadRepository(source, new NullProgressMonitor());
- IQueryResult ius = repo.query(QueryUtil.createIUQuery("helloworldfeature.feature.jar"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> ius = repo.query(QueryUtil.createIUQuery("helloworldfeature.feature.jar"), new NullProgressMonitor());
assertEquals("Expected number of IUs", 1, queryResultSize(ius));
- iu = (IInstallableUnit) ius.iterator().next();
+ iu = ius.iterator().next();
} catch (ProvisionException e) {
fail("Failed to obtain iu", e);
}
@@ -135,9 +135,9 @@ public class Repo2RunnableTaskTests extends AbstractAntProvisioningTest {
} catch (ProvisionException e) {
fail("Failed to load repository", e);
}
- IQueryResult keys = repo.query(ArtifactKeyQuery.ALL_KEYS, null);
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- IArtifactKey key = (IArtifactKey) iterator.next();
+ IQueryResult<IArtifactKey> keys = repo.query(ArtifactKeyQuery.ALL_KEYS, null);
+ for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
IArtifactDescriptor[] descriptors = repo.getArtifactDescriptors(key);
for (int n = 0; n < descriptors.length; n++) {
IArtifactDescriptor desc = descriptors[n];
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/RepoTasksTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/RepoTasksTests.java
index e4cc025d2..bda5e8c27 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/RepoTasksTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/RepoTasksTests.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.p2.tests.ant;
import java.io.File;
import java.net.URI;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery;
@@ -71,7 +72,7 @@ public class RepoTasksTests extends AbstractAntProvisioningTest {
assertNotNull(getIU(metadata, "anotherfeature.feature.group"));
IArtifactRepository artifacts = getArtifactRepositoryManager().loadRepository(destinationRepo, null);
- IQueryResult keys = artifacts.query(new ArtifactKeyQuery(null, "anotherplugin", null), null);
+ IQueryResult<IArtifactKey> keys = artifacts.query(new ArtifactKeyQuery(null, "anotherplugin", null), null);
assertTrue(keys.isEmpty());
assertFalse(new File(getTestFolder(getName()), "plugins/anotherplugin_1.0.0.jar").exists());
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java
index d6d6cd7bd..d0762d970 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java
@@ -61,8 +61,8 @@ public class Bug265577 extends AbstractProvisioningTest {
// Tests the response to a feature folder inside a jar
public void testZippedRepoWithFolderFeature() {
- IQueryResult queryResult = metadataRepo.query(QueryUtil.createIUQuery("Field_Assist_Example.feature.jar"), null);
- IInstallableUnit[] ius = (IInstallableUnit[]) queryResult.toArray(IInstallableUnit.class);
+ IQueryResult<IInstallableUnit> queryResult = metadataRepo.query(QueryUtil.createIUQuery("Field_Assist_Example.feature.jar"), null);
+ IInstallableUnit[] ius = queryResult.toArray(IInstallableUnit.class);
IArtifactKey key = (ius[0].getArtifacts()).iterator().next();
IArtifactDescriptor[] descriptors = artifactRepo.getArtifactDescriptors(key);
@@ -85,8 +85,8 @@ public class Bug265577 extends AbstractProvisioningTest {
// Test to retrieve a file from a zipped metadata & artifact repository
public void testZippedRepo() {
- IQueryResult queryResult = metadataRepo.query(QueryUtil.createIUQuery("valid.feature.jar"), null);
- IInstallableUnit[] ius = (IInstallableUnit[]) queryResult.toArray(IInstallableUnit.class);
+ IQueryResult<IInstallableUnit> queryResult = metadataRepo.query(QueryUtil.createIUQuery("valid.feature.jar"), null);
+ IInstallableUnit[] ius = queryResult.toArray(IInstallableUnit.class);
IArtifactKey key = (ius[0].getArtifacts()).iterator().next();
IArtifactDescriptor[] descriptors = artifactRepo.getArtifactDescriptors(key);
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 14de73715..2e53e8162 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
@@ -193,7 +193,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
} catch (ProvisionException e) {
fail("Cannot create repository: ", e);
}
- Map properties = repo.getProperties();
+ Map<String, String> properties = repo.getProperties();
//attempting to modify the properties should fail
try {
properties.put(TEST_KEY, TEST_VALUE);
@@ -370,11 +370,11 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
}
//get the keys
- IQueryResult keys = repo.query(ArtifactKeyQuery.ALL_KEYS, null);
+ IQueryResult<IArtifactKey> keys = repo.query(ArtifactKeyQuery.ALL_KEYS, null);
assertTrue("Error retreaiving artifact keys", !keys.isEmpty());
//test for existing key
- assertTrue("Asserting key is in composite repo", compRepo.contains((IArtifactKey) keys.iterator().next()));
+ assertTrue("Asserting key is in composite repo", compRepo.contains(keys.iterator().next()));
//Create a new key, not found in the composite repo
IArtifactKey key = PublisherHelper.createBinaryArtifactKey("testKeyId", Version.create("1.2.3"));
@@ -398,9 +398,9 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
}
//get the descriptors
- IQueryResult keys = repo.query(ArtifactKeyQuery.ALL_KEYS, null);
+ IQueryResult<IArtifactKey> keys = repo.query(ArtifactKeyQuery.ALL_KEYS, null);
assertTrue("Error retreaiving artifact keys", !keys.isEmpty());
- IArtifactDescriptor[] descriptors = repo.getArtifactDescriptors((IArtifactKey) keys.iterator().next());
+ IArtifactDescriptor[] descriptors = repo.getArtifactDescriptors(keys.iterator().next());
assertTrue("Error retreaiving artifact descriptors", descriptors.length > 0);
//test for existing descriptor
@@ -429,14 +429,14 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
fail("Error creating destination", e1);
}
- IQueryResult keys = compRepo.query(ArtifactKeyQuery.ALL_KEYS, null);
+ IQueryResult<IArtifactKey> keys = compRepo.query(ArtifactKeyQuery.ALL_KEYS, null);
assertTrue("Error retreaiving artifact keys", !keys.isEmpty());
- IArtifactKey key = (IArtifactKey) keys.iterator().next();
+ IArtifactKey key = keys.iterator().next();
IArtifactDescriptor[] descriptors = compRepo.getArtifactDescriptors(key);
assertTrue("Error retreaiving artifact descriptors", descriptors.length > 0);
IArtifactDescriptor newDescriptor = new ArtifactDescriptor(key);
- Map properties = new OrderedProperties();
+ Map<String, String> properties = new OrderedProperties();
properties.putAll(descriptors[0].getProperties());
properties.remove(IArtifactDescriptor.FORMAT);
((ArtifactDescriptor) newDescriptor).addProperties(properties);
@@ -507,14 +507,14 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
}
//create a request for a descriptor from repo1
- IQueryResult keys1 = repo1.query(ArtifactKeyQuery.ALL_KEYS, null);
- IArtifactKey key1 = (IArtifactKey) keys1.iterator().next();
+ IQueryResult<IArtifactKey> keys1 = repo1.query(ArtifactKeyQuery.ALL_KEYS, null);
+ IArtifactKey key1 = keys1.iterator().next();
assertTrue("Error retreaiving artifact keys", !keys1.isEmpty());
IArtifactDescriptor[] descriptors1 = repo1.getArtifactDescriptors(key1);
assertTrue("Error retreaiving artifact descriptors", descriptors1.length > 0);
assertTrue("Expected key not in composite repository", compRepo.contains(descriptors1[0]));
IArtifactDescriptor newDescriptor1 = new ArtifactDescriptor(key1);
- Map properties1 = new OrderedProperties();
+ Map<String, String> properties1 = new OrderedProperties();
properties1.putAll(descriptors1[0].getProperties());
properties1.remove(IArtifactDescriptor.FORMAT);
((ArtifactDescriptor) newDescriptor1).addProperties(properties1);
@@ -522,14 +522,14 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
IArtifactRequest request1 = ((ArtifactRepositoryManager) getArtifactRepositoryManager()).createMirrorRequest(key1, destinationRepo, null, null);
//create a request for a descriptor from repo2
- IQueryResult keys2 = repo2.query(ArtifactKeyQuery.ALL_KEYS, null);
- IArtifactKey key2 = (IArtifactKey) keys2.iterator().next();
+ IQueryResult<IArtifactKey> keys2 = repo2.query(ArtifactKeyQuery.ALL_KEYS, null);
+ IArtifactKey key2 = keys2.iterator().next();
assertTrue("Error retreaiving artifact keys", !keys2.isEmpty());
IArtifactDescriptor[] descriptors2 = repo2.getArtifactDescriptors(key2);
assertTrue("Error retreaiving artifact descriptors", descriptors2.length > 0);
assertTrue("Expected key not in composite repository", compRepo.contains(descriptors2[0]));
IArtifactDescriptor newDescriptor2 = new ArtifactDescriptor(key2);
- Map properties2 = new OrderedProperties();
+ Map<String, String> properties2 = new OrderedProperties();
properties2.putAll(descriptors2[0].getProperties());
properties2.remove(IArtifactDescriptor.FORMAT);
((ArtifactDescriptor) newDescriptor2).addProperties(properties2);
@@ -599,7 +599,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
System.setOut(out);
}
- List children = compRepo.getChildren();
+ List<URI> children = compRepo.getChildren();
try {
//ensure children are correct
@@ -614,12 +614,12 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
//ensure correct properties
assertEquals("2.0", "artifact name", compRepo.getName());
- Map properties = compRepo.getProperties();
+ Map<String, String> properties = compRepo.getProperties();
assertEquals("2.1", 3, properties.size());
- String timestamp = (String) properties.get(IRepository.PROP_TIMESTAMP);
+ String timestamp = properties.get(IRepository.PROP_TIMESTAMP);
assertNotNull("2.2", timestamp);
assertEquals("2.3", "1234", timestamp);
- String compressed = (String) properties.get(IRepository.PROP_COMPRESSED);
+ String compressed = properties.get(IRepository.PROP_COMPRESSED);
assertNotNull("2.4", compressed);
assertFalse("2.4", Boolean.parseBoolean(compressed));
}
@@ -634,7 +634,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
fail("0.99", e);
}
- List children = compRepo.getChildren();
+ List<URI> children = compRepo.getChildren();
//ensure children are correct
assertTrue("1.0", children.contains(URIUtil.append(compRepo.getLocation(), "one")));
@@ -643,12 +643,12 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
//ensure correct properties
assertEquals("2.0", "artifact name", compRepo.getName());
- Map properties = compRepo.getProperties();
+ Map<String, String> properties = compRepo.getProperties();
assertEquals("2.1", 2, properties.size());
- String timestamp = (String) properties.get(IRepository.PROP_TIMESTAMP);
+ String timestamp = properties.get(IRepository.PROP_TIMESTAMP);
assertNotNull("2.2", timestamp);
assertEquals("2.3", "1234", timestamp);
- String compressed = (String) properties.get(IRepository.PROP_COMPRESSED);
+ String compressed = properties.get(IRepository.PROP_COMPRESSED);
assertNotNull("2.4", compressed);
assertFalse("2.5", Boolean.parseBoolean(compressed));
}
@@ -849,7 +849,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
repositoryFile = new File(getTempFolder(), "CompositeArtifactRepositoryTest");
delete(repositoryFile);
repositoryURI = repositoryFile.toURI();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
properties.put(IRepository.PROP_COMPRESSED, compressed ? "true" : "false");
IArtifactRepository repo = null;
try {
@@ -915,7 +915,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
}
// query the number of artifacts
- List children = repository.getChildren();
+ List<URI> children = repository.getChildren();
assertEquals("2.0", 2, children.size());
assertEquals("2.1", 2, getArtifactKeyCount(repository));
@@ -941,10 +941,10 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
CompositeArtifactRepository repository = createRepository(location, "in memory test");
repository.addChild(one);
repository.addChild(two);
- List children = repository.getChildren();
+ List<URI> children = repository.getChildren();
assertEquals("1.0", 2, children.size());
// remove an absolute URI (child one should be first since order is important)
- repository.removeChild((URI) children.iterator().next());
+ repository.removeChild(children.iterator().next());
assertEquals("1.1", 1, repository.getChildren().size());
// remove a relative URI (child two)
repository.removeChild(two);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java
index 7a288e304..a40b9593d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java
@@ -88,10 +88,10 @@ public class FoldersRepositoryTest extends TestCase {
repo.addDescriptor(descriptor, monitor);
}
- IQueryResult keys = repo.query(ArtifactKeyQuery.ALL_KEYS, null);
+ IQueryResult<IArtifactKey> keys = repo.query(ArtifactKeyQuery.ALL_KEYS, null);
assertEquals(2, AbstractProvisioningTest.queryResultSize(keys));
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- IArtifactKey key = (IArtifactKey) iterator.next();
+ for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
repo.removeDescriptor(key, monitor);
}
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 3da9f866f..f06e62ced 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
@@ -124,7 +124,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest {
*/
public void testStatusFromFailover() {
StatusSequenceRepository source = null;
- LinkedList seq = new LinkedList();
+ LinkedList<IStatus> seq = new LinkedList<>();
try {
source = new StatusSequenceRepository(getArtifactRepositoryManager().loadRepository(pakedRepositoryLocation, new NullProgressMonitor()));
@@ -134,10 +134,10 @@ public class MirrorRequestTest extends AbstractProvisioningTest {
// Set status sequence, actual Statuses added later
source.setSequence(seq);
// Grab an ArtifactKey to mirror, doesn't matter which
- IQueryResult keys = source.query(ArtifactKeyQuery.ALL_KEYS, null);
+ IQueryResult<IArtifactKey> keys = source.query(ArtifactKeyQuery.ALL_KEYS, null);
assertTrue("Unable to obtain artifact keys", keys != null && !keys.isEmpty());
- IArtifactKey key = (IArtifactKey) keys.iterator().next();
+ IArtifactKey key = keys.iterator().next();
MirrorRequest req = new MirrorRequest(key, targetRepository, null, null, getTransport());
// Set Status sequence
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java
index 2a47d7054..41e1dad13 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java
@@ -159,7 +159,7 @@ public class SimpleArtifactRepositoryTest extends AbstractProvisioningTest {
factory.create(location, "test type", null, null);
try {
//bug 248951, ask for a modifiable repo
- IRepository repo = factory.load(location, IRepositoryManager.REPOSITORY_HINT_MODIFIABLE, new NullProgressMonitor());
+ IArtifactRepository repo = factory.load(location, IRepositoryManager.REPOSITORY_HINT_MODIFIABLE, new NullProgressMonitor());
assertNotNull(repo);
assertTrue(repo.isModifiable());
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java
index 7a0b61c2a..238b8eb2a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java
@@ -29,7 +29,7 @@ public class AggregateQueryTest extends TestCase {
}
public void testEmptyCompositeQuery() {
- IQuery query = QueryUtil.createPipeQuery(Collections.<IQuery<Object>> emptySet());
+ IQuery<Object> query = QueryUtil.createPipeQuery(Collections.<IQuery<Object>> emptySet());
query.perform(getABCDE().iterator());
// We should not throw an exception. No guarantee on what perform
// will return in this case
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java
index 3b8c5b112..19fdda204 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java
@@ -20,7 +20,7 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
*/
public class CollectorTest extends AbstractProvisioningTest {
public void testAccept() {
- Collector collector = new Collector();
+ Collector<Object> collector = new Collector<>();
String value = "value";
collector.accept(value);
Object[] result = collector.toArray(Object.class);
@@ -35,7 +35,7 @@ public class CollectorTest extends AbstractProvisioningTest {
}
public void testIsEmpty() {
- Collector collector = new Collector();
+ Collector<String> collector = new Collector<>();
assertEquals("1.0", true, collector.isEmpty());
collector.accept("value");
assertEquals("1.0", false, collector.isEmpty());
@@ -46,28 +46,28 @@ public class CollectorTest extends AbstractProvisioningTest {
*/
public void testCompositeCollectors() {
String[] s = new String[] {"A", "B", "C", "D", "E", "F", "G", "1", "2", "3", "4", "5", "6", "7"};
- List list = Arrays.asList(s);
- IQuery numeric = new MatchQuery() {
+ List<String> list = Arrays.asList(s);
+ IQuery<String> numeric = new MatchQuery<String>() {
@Override
- public boolean isMatch(Object candidate) {
- if (((String) candidate).compareTo("0") > 0 && ((String) candidate).compareTo("8") < 0) {
+ public boolean isMatch(String candidate) {
+ if (candidate.compareTo("0") > 0 && candidate.compareTo("8") < 0) {
return true;
}
return false;
}
};
- IQuery fourOrFiveOrABC = new MatchQuery() {
+ IQuery<String> fourOrFiveOrABC = new MatchQuery<String>() {
@Override
- public boolean isMatch(Object candidate) {
- if (((String) candidate).equals("4") || ((String) candidate).equals("5") || ((String) candidate).equals("A") || ((String) candidate).equals("B") || ((String) candidate).equals("C")) {
+ public boolean isMatch(String candidate) {
+ if (candidate.equals("4") || candidate.equals("5") || candidate.equals("A") || candidate.equals("B") || candidate.equals("C")) {
return true;
}
return false;
}
};
- IQueryResult queryResult = numeric.perform(list.iterator());
+ IQueryResult<String> queryResult = numeric.perform(list.iterator());
assertEquals("1.0", 7, queryResultSize(queryResult));
queryResult = queryResult.query(fourOrFiveOrABC, null);
@@ -78,33 +78,33 @@ public class CollectorTest extends AbstractProvisioningTest {
public void testSameCollector() {
String[] s = new String[] {"A", "B", "C", "D", "E", "F", "G", "1", "2", "3", "4", "5", "6", "7"};
- List list = Arrays.asList(s);
- IQuery numeric = new MatchQuery() {
+ List<String> list = Arrays.asList(s);
+ IQuery<String> numeric = new MatchQuery<String>() {
@Override
- public boolean isMatch(Object candidate) {
- if (((String) candidate).compareTo("0") > 0 && ((String) candidate).compareTo("8") < 0) {
+ public boolean isMatch(String candidate) {
+ if (candidate.compareTo("0") > 0 && candidate.compareTo("8") < 0) {
return true;
}
return false;
}
};
- IQuery fourOrFiveOrABC = new MatchQuery() {
+ IQuery<String> fourOrFiveOrABC = new MatchQuery<String>() {
@Override
- public boolean isMatch(Object candidate) {
- if (((String) candidate).equals("4") || ((String) candidate).equals("5") || ((String) candidate).equals("A") || ((String) candidate).equals("B") || ((String) candidate).equals("C")) {
+ public boolean isMatch(String candidate) {
+ if (candidate.equals("4") || candidate.equals("5") || candidate.equals("A") || candidate.equals("B") || candidate.equals("C")) {
return true;
}
return false;
}
};
- Collector collector = new Collector();
+ Collector<String> collector = new Collector<>();
collector.addAll(numeric.perform(list.iterator()));
assertEquals("1.0", 7, collector.toUnmodifiableSet().size());
collector.addAll(collector.query(fourOrFiveOrABC, null));
- Collection collection = collector.toUnmodifiableSet();
+ Collection<String> collection = collector.toUnmodifiableSet();
assertEquals("2.0", 7, collection.size());
}
@@ -113,28 +113,28 @@ public class CollectorTest extends AbstractProvisioningTest {
*/
public void testEmptyCompositeCollectors() {
String[] s = new String[] {"A", "B", "C", "D", "E", "F", "G", "1", "2", "3", "4", "5", "6", "7"};
- List list = Arrays.asList(s);
- IQuery eightOrNine = new MatchQuery() {
+ List<String> list = Arrays.asList(s);
+ IQuery<String> eightOrNine = new MatchQuery<String>() {
@Override
- public boolean isMatch(Object candidate) {
- if (((String) candidate).compareTo("8") > 0 && ((String) candidate).compareTo("9") < 0) {
+ public boolean isMatch(String candidate) {
+ if (candidate.compareTo("8") > 0 && candidate.compareTo("9") < 0) {
return true;
}
return false;
}
};
- IQuery fourOrFiveOrABC = new MatchQuery() {
+ IQuery<String> fourOrFiveOrABC = new MatchQuery<String>() {
@Override
- public boolean isMatch(Object candidate) {
- if (((String) candidate).equals("4") || ((String) candidate).equals("5") || ((String) candidate).equals("A") || ((String) candidate).equals("B") || ((String) candidate).equals("C")) {
+ public boolean isMatch(String candidate) {
+ if (candidate.equals("4") || candidate.equals("5") || candidate.equals("A") || candidate.equals("B") || candidate.equals("C")) {
return true;
}
return false;
}
};
- IQueryResult queryResult = eightOrNine.perform(list.iterator());
+ IQueryResult<String> queryResult = eightOrNine.perform(list.iterator());
assertTrue("1.0", queryResult.isEmpty());
queryResult = queryResult.query(fourOrFiveOrABC, null);
@@ -142,8 +142,8 @@ public class CollectorTest extends AbstractProvisioningTest {
}
public void testToCollection() {
- Collector collector = new Collector();
- Collection result = collector.toUnmodifiableSet();
+ Collector<String> collector = new Collector<>();
+ Collection<String> result = collector.toUnmodifiableSet();
assertEquals("1.0", 0, result.size());
//collection should be immutable
try {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
index de898fb31..6dd20fa33 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
@@ -54,7 +54,7 @@ public class CompoundQueryableTest extends TestCase {
}
}
- static Iterator createIterator(Object[] array) {
+ static Iterator<Integer> createIterator(Integer[] array) {
return Arrays.asList(array).iterator();
}
@@ -92,12 +92,12 @@ public class CompoundQueryableTest extends TestCase {
}
};
- IQueryable queryable3 = new IQueryable() {
+ IQueryable<Integer> queryable3 = new IQueryable<Integer>() {
Integer[] elements = new Integer[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
@Override
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
- IQueryResult collector;
+ public IQueryResult<Integer> query(IQuery<Integer> query, IProgressMonitor monitor) {
+ IQueryResult<Integer> collector;
try {
monitor.beginTask("", 10);
collector = query.perform(createIterator(elements));
@@ -109,39 +109,35 @@ public class CompoundQueryableTest extends TestCase {
}
};
- IQuery matchQuery = new MatchQuery() {
+ IQuery<Integer> matchQuery = new MatchQuery<Integer>() {
@Override
- public boolean isMatch(Object candidate) {
- if (candidate instanceof Integer) {
- int x = ((Integer) candidate).intValue();
- if (x % 2 == 0)
- return true;
- }
+ public boolean isMatch(Integer candidate) {
+ int x = candidate.intValue();
+ if (x % 2 == 0)
+ return true;
return false;
}
};
- IQuery matchMod4query = new MatchQuery() {
+ IQuery<Integer> matchMod4query = new MatchQuery<Integer>() {
@Override
- public boolean isMatch(Object candidate) {
- if (candidate instanceof Integer) {
- int x = ((Integer) candidate).intValue();
- if (x % 4 == 0)
- return true;
- }
+ public boolean isMatch(Integer candidate) {
+ int x = candidate.intValue();
+ if (x % 4 == 0)
+ return true;
return false;
}
};
- IQuery contextQuery = new ContextQuery() {
+ IQuery<Integer> contextQuery = new ContextQuery<Integer>() {
@Override
- public Collector perform(Iterator iterator) {
- Collector result = new Collector();
+ public Collector<Integer> perform(Iterator<Integer> iterator) {
+ Collector<Integer> result = new Collector<>();
while (iterator.hasNext()) {
- Object o = iterator.next();
- if (o instanceof Integer && ((Integer) o).intValue() % 2 == 0) {
+ Integer o = iterator.next();
+ if (o.intValue() % 2 == 0) {
result.accept(o);
}
}
@@ -150,13 +146,13 @@ public class CompoundQueryableTest extends TestCase {
};
- IQuery greatestNumberQuery = new ContextQuery() {
+ IQuery<Integer> greatestNumberQuery = new ContextQuery<Integer>() {
@Override
- public Collector perform(Iterator iterator) {
- Collector result = new Collector();
+ public Collector<Integer> perform(Iterator<Integer> iterator) {
+ Collector<Integer> result = new Collector<>();
int greatest = Integer.MIN_VALUE;
while (iterator.hasNext()) {
- int item = ((Integer) iterator.next()).intValue();
+ int item = iterator.next().intValue();
if (item > greatest)
greatest = item;
}
@@ -168,9 +164,9 @@ public class CompoundQueryableTest extends TestCase {
};
public void testMatchQuery() {
- IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(matchQuery, monitor);
+ IQueryResult<Integer> queryResult = cQueryable.query(matchQuery, monitor);
assertEquals("1.0", 6, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.1", queryResult, 2);
AbstractProvisioningTest.assertContains("1.2", queryResult, 4);
@@ -181,34 +177,34 @@ public class CompoundQueryableTest extends TestCase {
}
public void testSingleQueryable() {
- IQueryable cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(matchQuery, monitor);
+ IQueryResult<Integer> queryResult = cQueryable.query(matchQuery, monitor);
assertEquals("1.0", 2, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.1", queryResult, 2);
AbstractProvisioningTest.assertContains("1.2", queryResult, 4);
}
public void testSingleContextQuery() {
- IQueryable cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(greatestNumberQuery, monitor);
+ IQueryResult<Integer> queryResult = cQueryable.query(greatestNumberQuery, monitor);
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.1", queryResult, 5);
}
public void testMultipleContextQueries() {
- IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(greatestNumberQuery, monitor);
+ IQueryResult<Integer> queryResult = cQueryable.query(greatestNumberQuery, monitor);
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.1", queryResult, 12);
}
public void testCompoundMatchAndQuery() {
- IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(QueryUtil.createCompoundQuery(matchQuery, matchMod4query, true), monitor);
+ IQueryResult<Integer> queryResult = cQueryable.query(QueryUtil.createCompoundQuery(matchQuery, matchMod4query, true), monitor);
assertEquals("1.0", 3, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.2", queryResult, 4);
AbstractProvisioningTest.assertContains("1.4", queryResult, 8);
@@ -216,9 +212,9 @@ public class CompoundQueryableTest extends TestCase {
}
public void testCompoundMatchOrQuery() {
- IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(QueryUtil.createCompoundQuery(matchQuery, matchMod4query, false), monitor);
+ IQueryResult<Integer> queryResult = cQueryable.query(QueryUtil.createCompoundQuery(matchQuery, matchMod4query, false), monitor);
assertEquals("1.0", 6, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.2", queryResult, 2);
AbstractProvisioningTest.assertContains("1.2", queryResult, 4);
@@ -229,7 +225,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testMatchQueryProgressMonitor() {
- IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(matchQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -237,7 +233,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testSingleQueryableProgressMonitor() {
- IQueryable cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(matchQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -245,7 +241,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testSingleContextQueryProgressMonitor() {
- IQueryable cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(greatestNumberQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -253,7 +249,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testMultipleContextQueriesProgressMonitor() {
- IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(greatestNumberQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -261,17 +257,17 @@ public class CompoundQueryableTest extends TestCase {
}
public void testNullProgressMonitor() {
- IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
cQueryable.query(greatestNumberQuery, null);
// this is the same as above will null passed in, this should not throw any exceptions
}
public void testDoubleCompoundContextOrQuery() {
- IQueryable cQueryable1 = QueryUtil.compoundQueryable(queryable3, queryable2);
- IQueryable cQueryable = QueryUtil.compoundQueryable(cQueryable1, queryable1);
+ IQueryable<Integer> cQueryable1 = QueryUtil.compoundQueryable(queryable3, queryable2);
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(cQueryable1, queryable1);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(QueryUtil.createCompoundQuery(contextQuery, greatestNumberQuery, false), monitor);
+ IQueryResult<Integer> queryResult = cQueryable.query(QueryUtil.createCompoundQuery(contextQuery, greatestNumberQuery, false), monitor);
assertEquals("1.0", 7, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.2", queryResult, 2);
AbstractProvisioningTest.assertContains("1.2", queryResult, 4);
@@ -285,10 +281,10 @@ public class CompoundQueryableTest extends TestCase {
}
public void testDoubleCompositeQuery() {
- IQueryable cQueryable1 = QueryUtil.compoundQueryable(queryable3, queryable2);
- IQueryable cQueryable = QueryUtil.compoundQueryable(cQueryable1, queryable1);
+ IQueryable<Integer> cQueryable1 = QueryUtil.compoundQueryable(queryable3, queryable2);
+ IQueryable<Integer> cQueryable = QueryUtil.compoundQueryable(cQueryable1, queryable1);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(QueryUtil.createPipeQuery(contextQuery, greatestNumberQuery), monitor);
+ IQueryResult<Integer> queryResult = cQueryable.query(QueryUtil.createPipeQuery(contextQuery, greatestNumberQuery), monitor);
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.2", queryResult, 12);
assertTrue("1.0", monitor.isDone());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java
index 691fb6026..ed9030c0b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java
@@ -1,17 +1,15 @@
/*******************************************************************************
- * 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
*******************************************************************************/
package org.eclipse.equinox.p2.tests.core;
-import org.eclipse.equinox.p2.query.MatchQuery;
-
import java.util.Arrays;
import java.util.List;
import junit.framework.TestCase;
@@ -34,7 +32,7 @@ public class QueryTest extends TestCase {
* Tests a simple perform where all items match.
*/
public void testPerformSimple() {
- List items = Arrays.asList("red", "green", "blue");
+ List<String> items = Arrays.asList("red", "green", "blue");
IQuery query = new AnyStringQuery();
IQueryResult collector = query.perform(items.iterator());
assertEquals("1.0", 3, AbstractProvisioningTest.queryResultSize(collector));
@@ -47,7 +45,7 @@ public class QueryTest extends TestCase {
* Tests a perform where only some items match.
*/
public void testPerformSomeMatches() {
- List items = Arrays.asList(new Object(), "green", new Object());
+ List<Object> items = Arrays.asList(new Object(), "green", new Object());
IQuery query = new AnyStringQuery();
IQueryResult collector = query.perform(items.iterator());
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(collector));
@@ -55,7 +53,7 @@ public class QueryTest extends TestCase {
}
public void testLimitQuery() {
- List items = Arrays.asList("red", "green", "blue");
+ List<String> items = Arrays.asList("red", "green", "blue");
IQuery query = new AnyStringQuery();
IQuery limitQuery = QueryUtil.createLimitQuery(query, 1);
IQueryResult collector = limitQuery.perform(items.iterator());
@@ -64,7 +62,7 @@ public class QueryTest extends TestCase {
}
public void testLimitQuery2() {
- List items = Arrays.asList("red", "green", "blue");
+ List<String> items = Arrays.asList("red", "green", "blue");
IQuery query = new AnyStringQuery();
IQuery limitQuery = QueryUtil.createLimitQuery(query, 2);
IQueryResult collector = limitQuery.perform(items.iterator());
@@ -74,7 +72,7 @@ public class QueryTest extends TestCase {
}
public void testLimitQuery3() {
- List items = Arrays.asList("red", "green", "blue");
+ List<String> items = Arrays.asList("red", "green", "blue");
IQuery query = new AnyStringQuery();
IQuery limitQuery = QueryUtil.createLimitQuery(query, 3);
IQueryResult collector = limitQuery.perform(items.iterator());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java
index ca2bd3d1a..72edbdcbb 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java
@@ -110,7 +110,7 @@ public class RollbackTest extends AbstractProvisioningTest {
IStatus status = director.provision(request1, null, new NullProgressMonitor());
assertEquals("1.0", IStatus.OK, status.getCode());
- IQueryResult profileIUs = profile.query(QueryUtil.createIUAnyQuery(), null);
+ IQueryResult<IInstallableUnit> profileIUs = profile.query(QueryUtil.createIUAnyQuery(), null);
assertContains("2.0", profileIUs, a1);
assertContains("3.0", profileIUs, b1);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java
index 78a5440b7..883b57466 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java
@@ -67,8 +67,8 @@ class TestRepositoryWatcher extends DirectoryWatcher {
* Return the list of artifact keys known to this listener's repository.
*/
public IArtifactKey[] getArtifactKeys() {
- IQueryResult keys = listener.getArtifactRepository().query(ArtifactKeyQuery.ALL_KEYS, null);
- return (IArtifactKey[]) keys.toArray(IArtifactKey.class);
+ IQueryResult<IArtifactKey> keys = listener.getArtifactRepository().query(ArtifactKeyQuery.ALL_KEYS, null);
+ return keys.toArray(IArtifactKey.class);
}
/*
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileMetadataRepositoryTest.java
index eb995065d..5ce13ee34 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileMetadataRepositoryTest.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
*******************************************************************************/
@@ -15,6 +15,7 @@ import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifact
import org.eclipse.equinox.internal.p2.engine.*;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
@@ -55,7 +56,7 @@ public class ProfileMetadataRepositoryTest extends AbstractProvisioningTest {
IProfile profile = registry.getProfile("SDKPatchingTest");
assertNotNull("0.3", profile);
- IQueryResult profileCollector = profile.query(QueryUtil.createIUAnyQuery(), getMonitor());
+ IQueryResult<IInstallableUnit> profileCollector = profile.query(QueryUtil.createIUAnyQuery(), getMonitor());
assertFalse("0.4", profileCollector.isEmpty());
File simpleProfileFolder = new File(tempFolder, "SDKPatchingTest.profile");
@@ -70,7 +71,7 @@ public class ProfileMetadataRepositoryTest extends AbstractProvisioningTest {
fail("0.99", e1);
}
- IQueryResult repoCollector = repo.query(QueryUtil.createIUAnyQuery(), getMonitor());
+ IQueryResult<IInstallableUnit> repoCollector = repo.query(QueryUtil.createIUAnyQuery(), getMonitor());
assertFalse("1.0", repoCollector.isEmpty());
assertContains("1.1", repoCollector, profileCollector);
}
@@ -84,7 +85,7 @@ public class ProfileMetadataRepositoryTest extends AbstractProvisioningTest {
IProfile profile = registry.getProfile("SDKPatchingTest");
assertNotNull("0.3", profile);
- IQueryResult profileCollector = profile.query(QueryUtil.createIUAnyQuery(), getMonitor());
+ IQueryResult<IInstallableUnit> profileCollector = profile.query(QueryUtil.createIUAnyQuery(), getMonitor());
assertFalse("0.4", profileCollector.isEmpty());
File simpleProfileFolder = new File(tempFolder, "SDKPatchingTest.profile");
@@ -102,7 +103,7 @@ public class ProfileMetadataRepositoryTest extends AbstractProvisioningTest {
fail("0.99", e1);
}
- IQueryResult repoCollector = repo.query(QueryUtil.createIUAnyQuery(), getMonitor());
+ IQueryResult<IInstallableUnit> repoCollector = repo.query(QueryUtil.createIUAnyQuery(), getMonitor());
assertFalse("1.0", repoCollector.isEmpty());
assertContains("1.1", repoCollector, profileCollector);
}
@@ -124,7 +125,7 @@ public class ProfileMetadataRepositoryTest extends AbstractProvisioningTest {
IProfile profile = registry.getProfile("SDKPatchingTest");
assertNotNull("1.0", profile);
- IQueryResult profileCollector = profile.query(QueryUtil.createIUAnyQuery(), getMonitor());
+ IQueryResult<IInstallableUnit> profileCollector = profile.query(QueryUtil.createIUAnyQuery(), getMonitor());
assertFalse("1.1", profileCollector.isEmpty());
File simpleProfileFolder = new File(profileRegistryFolder, "SDKPatchingTest.profile");
@@ -146,7 +147,7 @@ public class ProfileMetadataRepositoryTest extends AbstractProvisioningTest {
fail("2.99", e1);
}
- IQueryResult repoCollector = repo.query(QueryUtil.createIUAnyQuery(), getMonitor());
+ IQueryResult<IInstallableUnit> repoCollector = repo.query(QueryUtil.createIUAnyQuery(), getMonitor());
assertFalse("3.0", repoCollector.isEmpty());
assertContains("3.1", repoCollector, profileCollector);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java
index 24a8ed409..40d9d7f2c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/DirectorTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 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
@@ -52,7 +52,7 @@ public class DirectorTest extends AbstractProvisioningTest {
}
String autoInstall = System.getProperty("eclipse.p2.autoInstall");
- IQueryResult allJobs = mgr.query(QueryUtil.createIUQuery(autoInstall, VersionRange.emptyRange), null);
+ IQueryResult<IInstallableUnit> allJobs = mgr.query(QueryUtil.createIUQuery(autoInstall, VersionRange.emptyRange), null);
String installFolder = System.getProperty(IProfile.PROP_INSTALL_FOLDER);
IProfileRegistry profileRegistry = getProfileRegistry();
@@ -68,7 +68,7 @@ public class DirectorTest extends AbstractProvisioningTest {
if (p == null)
throw new RuntimeException("Uninstalling from a nonexistent profile");
} else {
- 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)
@@ -80,7 +80,7 @@ public class DirectorTest extends AbstractProvisioningTest {
IInstallableUnit[] allRoots = new IInstallableUnit[1];
IStatus operationStatus = null;
if (!allJobs.isEmpty()) {
- allRoots[0] = (IInstallableUnit) allJobs.iterator().next();
+ allRoots[0] = allJobs.iterator().next();
ProfileChangeRequest request = new ProfileChangeRequest(p);
if (!doUninstall)
request.addInstallableUnits(allRoots);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTestCurrent.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTestCurrent.java
index bd94b405f..3c1b137e3 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTestCurrent.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTestCurrent.java
@@ -83,10 +83,10 @@ public class End2EndTestCurrent extends AbstractEnd2EndTest {
} catch (ProvisionException e) {
fail("Problem loading repository: " + getRepositoryLocation(), e);
}
- IQueryResult result = repo.query(QueryUtil.createIUQuery(id), getMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createIUQuery(id), getMonitor());
if (result.isEmpty())
fail("Unable to load iu: \'" + id + "\' from repository: " + getRepositoryLocation());
- return (IInstallableUnit) result.iterator().next();
+ return result.iterator().next();
}
@Override
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/RepoValidator.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/RepoValidator.java
index 76cacae2c..4086ea61c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/RepoValidator.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/RepoValidator.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 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
*******************************************************************************/
@@ -27,7 +27,7 @@ import org.eclipse.equinox.p2.tests.TestActivator;
import org.osgi.framework.BundleContext;
/*
- * Grabs some IUs (SDK, Platform) from the current repository and creates a plan to see if
+ * Grabs some IUs (SDK, Platform) from the current repository and creates a plan to see if
* they can be installed.
*/
public class RepoValidator extends AbstractProvisioningTest {
@@ -53,10 +53,10 @@ public class RepoValidator extends AbstractProvisioningTest {
// get the latest versions of the SDK and platform
String[] ius = new String[] {"org.eclipse.sdk.ide", "org.eclipse.platform.ide"};
for (String id : ius) {
- IQuery query = QueryUtil.createLatestQuery(QueryUtil.createIUQuery(id));
- IQueryResult result = repository.query(query, getMonitor());
+ IQuery<IInstallableUnit> query = QueryUtil.createLatestQuery(QueryUtil.createIUQuery(id));
+ IQueryResult<IInstallableUnit> result = repository.query(query, getMonitor());
assertFalse("SDK IU not found in repository: " + repositoryString, result.isEmpty());
- IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit iu = result.iterator().next();
ProvisioningContext provisioningContext = new ProvisioningContext(getAgent());
provisioningContext.setMetadataRepositories(new URI[] {repositoryLocation});
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/LatestIUTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/LatestIUTest.java
index 2d29b78f9..7fcca8540 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/LatestIUTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/LatestIUTest.java
@@ -1,5 +1,5 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This
+/*******************************************************************************
+* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -18,9 +18,6 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
import org.eclipse.equinox.p2.tests.TestData;
-/**
- *
- */
public class LatestIUTest extends AbstractProvisioningTest {
public void testLatestIUSingleRepo1() throws Exception {
@@ -34,9 +31,9 @@ public class LatestIUTest extends AbstractProvisioningTest {
IMetadataRepositoryManager metadataRepositoryManager = getMetadataRepositoryManager();
metadataRepositoryManager.addRepository(location);
- IQueryResult query = metadataRepositoryManager.query(QueryUtil.createLatestIUQuery(), null);
+ IQueryResult<IInstallableUnit> query = metadataRepositoryManager.query(QueryUtil.createLatestIUQuery(), null);
assertEquals("1.0", 1, queryResultSize(query));
- assertEquals("1.1", Version.createOSGi(2, 1, 0), ((IInstallableUnit) query.iterator().next()).getVersion());
+ assertEquals("1.1", Version.createOSGi(2, 1, 0), query.iterator().next().getVersion());
}
public void testLatestIUSingleRepo2() throws Exception {
@@ -50,9 +47,9 @@ public class LatestIUTest extends AbstractProvisioningTest {
IMetadataRepositoryManager metadataRepositoryManager = getMetadataRepositoryManager();
metadataRepositoryManager.addRepository(location);
- IQueryResult query = metadataRepositoryManager.query(QueryUtil.createLatestIUQuery(), null);
+ IQueryResult<IInstallableUnit> query = metadataRepositoryManager.query(QueryUtil.createLatestIUQuery(), null);
assertEquals("1.0", 1, queryResultSize(query));
- assertEquals("1.1", Version.createOSGi(3, 0, 0), ((IInstallableUnit) query.iterator().next()).getVersion());
+ assertEquals("1.1", Version.createOSGi(3, 0, 0), query.iterator().next().getVersion());
}
public void testLatestIUMultiRepo() throws Exception {
@@ -69,8 +66,8 @@ public class LatestIUTest extends AbstractProvisioningTest {
metadataRepositoryManager.addRepository(location1);
metadataRepositoryManager.addRepository(location2);
- IQueryResult queryResult = metadataRepositoryManager.query(QueryUtil.createLatestIUQuery(), null);
+ IQueryResult<IInstallableUnit> queryResult = metadataRepositoryManager.query(QueryUtil.createLatestIUQuery(), null);
assertEquals("1.0", 1, queryResultSize(queryResult));
- assertEquals("1.1", Version.createOSGi(3, 0, 0), ((IInstallableUnit) queryResult.iterator().next()).getVersion());
+ assertEquals("1.1", Version.createOSGi(3, 0, 0), queryResult.iterator().next().getVersion());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
index 362e47418..355b56491 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
@@ -115,7 +115,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
//Try to remove an InstallableUnit.
try {
- IQueryResult queryResult = compRepo.query(QueryUtil.createIUAnyQuery(), null);
+ IQueryResult<IInstallableUnit> queryResult = compRepo.query(QueryUtil.createIUAnyQuery(), null);
compRepo.removeInstallableUnits(queryResult.toSet());
fail("Should not be able to remove InstallableUnit");
} catch (UnsupportedOperationException e) {
@@ -144,7 +144,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
} catch (ProvisionException e) {
fail("Cannot create repository: ", e);
}
- Map properties = repo.getProperties();
+ Map<String, String> properties = repo.getProperties();
//attempting to modify the properties should fail
try {
properties.put(TEST_KEY, TEST_VALUE);
@@ -162,7 +162,7 @@ public class CompositeMetadataRepositoryTest 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);
@@ -318,7 +318,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
System.setOut(out);
}
- List children = compRepo.getChildren();
+ List<URI> children = compRepo.getChildren();
try {
//ensure children are correct
@@ -333,12 +333,12 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
//ensure correct properties
assertEquals("2.0", "metadata name", compRepo.getName());
- Map properties = compRepo.getProperties();
+ Map<String, String> properties = compRepo.getProperties();
assertEquals("2.1", 3, properties.size());
- String timestamp = (String) properties.get(IRepository.PROP_TIMESTAMP);
+ String timestamp = properties.get(IRepository.PROP_TIMESTAMP);
assertNotNull("2.2", timestamp);
assertEquals("2.3", "1234", timestamp);
- String compressed = (String) properties.get(IRepository.PROP_COMPRESSED);
+ String compressed = properties.get(IRepository.PROP_COMPRESSED);
assertNotNull("2.4", compressed);
assertFalse("2.5", Boolean.parseBoolean(compressed));
}
@@ -354,7 +354,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
fail("0.9", e);
}
- List children = compRepo.getChildren();
+ List<URI> children = compRepo.getChildren();
//ensure children are correct
URI child1 = URIUtil.append(compRepo.getLocation(), "one");
@@ -365,12 +365,12 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
//ensure correct properties
assertEquals("2.0", "metadata name", compRepo.getName());
- Map properties = compRepo.getProperties();
+ Map<String, String> properties = compRepo.getProperties();
assertEquals("2.1", 2, properties.size());
- String timestamp = (String) properties.get(IRepository.PROP_TIMESTAMP);
+ String timestamp = properties.get(IRepository.PROP_TIMESTAMP);
assertNotNull("2.2", timestamp);
assertEquals("2.3", "1234", timestamp);
- String compressed = (String) properties.get(IRepository.PROP_COMPRESSED);
+ String compressed = properties.get(IRepository.PROP_COMPRESSED);
assertNotNull("2.4", compressed);
assertFalse("2.5", Boolean.parseBoolean(compressed));
}
@@ -463,9 +463,9 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
CompositeMetadataRepository compositeRepo = createRepo(false);
compositeRepo.addChild(location1);
compositeRepo.addChild(location2);
- IQueryResult queryResult = compositeRepo.query(QueryUtil.createLatestIUQuery(), monitor);
+ IQueryResult<IInstallableUnit> queryResult = compositeRepo.query(QueryUtil.createLatestIUQuery(), monitor);
assertEquals("1.0", 1, queryResultSize(queryResult));
- assertEquals("1.1", Version.createOSGi(3, 0, 0), ((IInstallableUnit) queryResult.iterator().next()).getVersion());
+ assertEquals("1.1", Version.createOSGi(3, 0, 0), queryResult.iterator().next().getVersion());
assertTrue("1.2", monitor.isDone());
assertTrue("1.3", monitor.isWorkDone());
}
@@ -484,20 +484,17 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
CompositeMetadataRepository compositeRepo = createRepo(false);
compositeRepo.addChild(location1);
compositeRepo.addChild(location2);
- IQuery cQuery = QueryUtil.createLatestQuery(new MatchQuery() {
+ IQuery<IInstallableUnit> cQuery = QueryUtil.createLatestQuery(new MatchQuery<IInstallableUnit>() {
@Override
- public boolean isMatch(Object candidate) {
- if (candidate instanceof IInstallableUnit) {
- IInstallableUnit iInstallableUnit = (IInstallableUnit) candidate;
- if (iInstallableUnit.getVersion().compareTo(Version.createOSGi(3, 0, 0)) < 0)
- return true;
- }
+ public boolean isMatch(IInstallableUnit candidate) {
+ if (candidate.getVersion().compareTo(Version.createOSGi(3, 0, 0)) < 0)
+ return true;
return false;
}
});
- IQueryResult queryResult = compositeRepo.query(cQuery, monitor);
+ IQueryResult<IInstallableUnit> queryResult = compositeRepo.query(cQuery, monitor);
assertEquals("1.0", 1, queryResultSize(queryResult));
- assertEquals("1.1", Version.createOSGi(2, 2, 0), ((IInstallableUnit) queryResult.iterator().next()).getVersion());
+ assertEquals("1.1", Version.createOSGi(2, 2, 0), queryResult.iterator().next().getVersion());
assertTrue("1.2", monitor.isDone());
assertTrue("1.3", monitor.isWorkDone());
}
@@ -546,7 +543,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
private CompositeMetadataRepository createRepo(boolean compressed) {
IMetadataRepositoryManager metadataRepositoryManager = getMetadataRepositoryManager();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
properties.put(IRepository.PROP_COMPRESSED, compressed ? "true" : "false");
IMetadataRepository repo = null;
try {
@@ -641,9 +638,9 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
}
// query the number of IUs
- List children = repository.getChildren();
+ List<URI> children = repository.getChildren();
assertEquals("2.0", 2, children.size());
- IQueryResult queryResult = repository.query(QueryUtil.createIUAnyQuery(), getMonitor());
+ IQueryResult<IInstallableUnit> queryResult = repository.query(QueryUtil.createIUAnyQuery(), getMonitor());
assertEquals("2.1", 2, queryResultSize(queryResult));
// ensure the child URIs are stored as relative
@@ -668,10 +665,10 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
CompositeMetadataRepository repository = createRepository(location, "in memory test");
repository.addChild(one);
repository.addChild(two);
- List children = repository.getChildren();
+ List<URI> children = repository.getChildren();
assertEquals("1.0", 2, children.size());
// remove an absolute URI (child one should be first since order is important)
- repository.removeChild((URI) children.iterator().next());
+ repository.removeChild(children.iterator().next());
assertEquals("1.1", 1, repository.getChildren().size());
// remove a relative URI (child two)
repository.removeChild(two);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java
index 59171df6f..9ff3e27fb 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java
@@ -55,7 +55,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
public void testCompressedRepository() throws ProvisionException {
IMetadataRepositoryManager manager = getMetadataRepositoryManager();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
properties.put(IRepository.PROP_COMPRESSED, "true");
IMetadataRepository repo = manager.createRepository(repoLocation.toURI(), "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
@@ -88,7 +88,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
public void testGetProperties() throws ProvisionException {
IMetadataRepositoryManager manager = getMetadataRepositoryManager();
IMetadataRepository repo = manager.createRepository(repoLocation.toURI(), "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
- Map properties = repo.getProperties();
+ Map<String, String> properties = repo.getProperties();
//attempting to modify the properties should fail
try {
properties.put(TEST_KEY, TEST_VALUE);
@@ -101,7 +101,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
public void testSetProperty() throws ProvisionException {
IMetadataRepositoryManager manager = getMetadataRepositoryManager();
IMetadataRepository repo = manager.createRepository(repoLocation.toURI(), "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
- Map properties = repo.getProperties();
+ Map<String, String> properties = repo.getProperties();
assertTrue("1.0", !properties.containsKey(TEST_KEY));
repo.setProperty(TEST_KEY, TEST_VALUE);
@@ -126,7 +126,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
IMetadataRepository repo = manager.createRepository(repoLocation.toURI(), "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
IInstallableUnit iu = createIU("foo");
repo.addInstallableUnits(Arrays.asList(iu));
- IQueryResult result = repo.query(QueryUtil.createIUQuery((String) null), getMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createIUQuery((String) null), getMonitor());
assertEquals("1.0", 1, queryResultSize(result));
repo.removeAll();
result = repo.query(QueryUtil.createIUQuery((String) null), getMonitor());
@@ -139,7 +139,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
IInstallableUnit iu = createIU("foo");
IInstallableUnit iu2 = createIU("bar");
repo.addInstallableUnits(Arrays.asList(iu, iu2));
- IQueryResult result = repo.query(QueryUtil.createIUQuery((String) null), getMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createIUQuery((String) null), getMonitor());
assertEquals("1.0", 2, queryResultSize(result));
repo.removeInstallableUnits(Arrays.asList(iu));
result = repo.query(QueryUtil.createIUQuery((String) null), getMonitor());
@@ -152,7 +152,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
public void testUncompressedRepository() throws ProvisionException {
IMetadataRepositoryManager manager = getMetadataRepositoryManager();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
properties.put(IRepository.PROP_COMPRESSED, "false");
IMetadataRepository repo = manager.createRepository(repoLocation.toURI(), "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
@@ -183,7 +183,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
public void testLoadSelfReference() throws ProvisionException {
//setup a repository that has a reference to itself in disabled state
IMetadataRepositoryManager manager = getMetadataRepositoryManager();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
properties.put(IRepository.PROP_COMPRESSED, "false");
final URI repoURI = repoLocation.toURI();
IMetadataRepository repo = manager.createRepository(repoURI, "testLoadSelfReference", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
@@ -220,7 +220,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
public void testRefreshSelfReference() throws ProvisionException {
//setup a repository that has a reference to itself in disabled state
IMetadataRepositoryManager manager = getMetadataRepositoryManager();
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
properties.put(IRepository.PROP_COMPRESSED, "false");
final URI repoURL = repoLocation.toURI();
IMetadataRepository repo = manager.createRepository(repoURL, "testRefreshSelfReference", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
index 55231f765..615a8ef27 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
@@ -28,6 +28,7 @@ import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProv
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.IRepository;
@@ -45,7 +46,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest {
/**
* 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(MetadataRepositoryManagerTest.class);
@@ -62,8 +63,8 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest {
@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();
FailingMetadataRepositoryFactory.FAIL = false;
}
@@ -423,7 +424,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest {
URI location = site.toURI();
try {
IMetadataRepository repository = manager.loadRepository(location, getMonitor());
- IQueryResult result = repository.query(QueryUtil.createIUQuery("test.bundle"), getMonitor());
+ IQueryResult<IInstallableUnit> result = repository.query(QueryUtil.createIUQuery("test.bundle"), getMonitor());
assertEquals("1.0", 1, queryResultSize(result));
} catch (ProvisionException e) {
fail("=.99", e);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java
index 358da726b..1b5415fca 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java
@@ -104,16 +104,16 @@ public class MetadataMirrorApplicationTest extends AbstractProvisioningTest {
* Takes 2 QueryResults, compares them, and returns the number of unique keys
* Needed to verify that only the appropriate number of files have been transfered by the mirror application
*/
- private int getNumUnique(IQueryResult c1, IQueryResult c2) {
- Object[] repo1 = c1.toArray(IInstallableUnit.class);
- Object[] repo2 = c2.toArray(IInstallableUnit.class);
+ private int getNumUnique(IQueryResult<IInstallableUnit> c1, IQueryResult<IInstallableUnit> c2) {
+ IInstallableUnit[] repo1 = c1.toArray(IInstallableUnit.class);
+ IInstallableUnit[] repo2 = c2.toArray(IInstallableUnit.class);
//initialize to the size of both query results
int numKeys = repo1.length + repo2.length;
for (int i = 0; i < repo1.length; i++) {
for (int j = 0; j < repo2.length; j++) {
- if (isEqual((IInstallableUnit) repo1[i], (IInstallableUnit) repo2[j]))
+ if (isEqual(repo1[i], repo2[j]))
numKeys--;
//identical keys has bee found, therefore the number of unique keys is one less than previously thought
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbstractPlannerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbstractPlannerTest.java
index 08f77590a..33dbbe7aa 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbstractPlannerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbstractPlannerTest.java
@@ -49,7 +49,7 @@ public abstract class AbstractPlannerTest extends AbstractProvisioningTest {
* Take the given plan and compress additons/removals so they look like updates.
* Good for viewing while debugging.
*/
- protected Collection compress(IProvisioningPlan plan) {
+ protected Collection<InstallableUnitOperand> compress(IProvisioningPlan plan) {
Map<String, InstallableUnitOperand> result = new HashMap<>();
Operand[] operands = ((ProvisioningPlan) plan).getOperands();
for (int i = 0; i < operands.length; i++) {
@@ -119,13 +119,13 @@ public abstract class AbstractPlannerTest extends AbstractProvisioningTest {
/*
* Create and return a new profile change request with the given additions and removals.
*/
- protected IProfileChangeRequest createProfileChangeRequest(Collection optionalAdds, Collection strictAdds, Collection toRemove) {
+ protected IProfileChangeRequest createProfileChangeRequest(Collection<IInstallableUnit> optionalAdds, Collection<IInstallableUnit> strictAdds, Collection<IInstallableUnit> toRemove) {
IProfileChangeRequest result = new ProfileChangeRequest(profile);
// add optional IUs
if (optionalAdds != null) {
- for (Iterator iter = optionalAdds.iterator(); iter.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iter.next();
+ for (Iterator<IInstallableUnit> iter = optionalAdds.iterator(); iter.hasNext();) {
+ IInstallableUnit iu = iter.next();
result.add(iu);
result.setInstallableUnitInclusionRules(iu, ProfileInclusionRules.createOptionalInclusionRule(iu));
result.setInstallableUnitProfileProperty(iu, "org.eclipse.equinox.p2.type.lock", "1");
@@ -135,8 +135,8 @@ public abstract class AbstractPlannerTest extends AbstractProvisioningTest {
// add strict IUs
if (strictAdds != null) {
- for (Iterator iter = strictAdds.iterator(); iter.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iter.next();
+ for (Iterator<IInstallableUnit> iter = strictAdds.iterator(); iter.hasNext();) {
+ IInstallableUnit iu = iter.next();
result.add(iu);
result.setInstallableUnitInclusionRules(iu, ProfileInclusionRules.createStrictInclusionRule(iu));
}
@@ -144,8 +144,8 @@ public abstract class AbstractPlannerTest extends AbstractProvisioningTest {
// include removals
if (toRemove != null) {
- for (Iterator iter = toRemove.iterator(); iter.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iter.next();
+ for (Iterator<IInstallableUnit> iter = toRemove.iterator(); iter.hasNext();) {
+ IInstallableUnit iu = iter.next();
result.remove(iu);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AddIUProperty.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AddIUProperty.java
index 81719c5a1..72d1604ad 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AddIUProperty.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AddIUProperty.java
@@ -67,7 +67,7 @@ public class AddIUProperty extends AbstractProvisioningTest {
assertEquals(IStatus.OK, plan.getStatus().getSeverity());
engine.perform(plan, null);
assertProfileContainsAll("A1 is missing", profile, new IInstallableUnit[] {a1});
- IQueryResult allProfileIUs = profile.query(QueryUtil.createIUAnyQuery(), null);
+ IQueryResult<IInstallableUnit> allProfileIUs = profile.query(QueryUtil.createIUAnyQuery(), null);
assertEquals(queryResultSize(allProfileIUs), 1);
//Add a2 with a1. This is an error
@@ -90,7 +90,7 @@ public class AddIUProperty extends AbstractProvisioningTest {
allProfileIUs = profile.query(QueryUtil.createIUAnyQuery(), null);
assertEquals(queryResultSize(allProfileIUs), 1);
- IQueryResult iuProfileProperties = profile.query(new IUProfilePropertyQuery(SimplePlanner.INCLUSION_RULES, IUProfilePropertyQuery.ANY), null);
+ IQueryResult<IInstallableUnit> iuProfileProperties = profile.query(new IUProfilePropertyQuery(SimplePlanner.INCLUSION_RULES, IUProfilePropertyQuery.ANY), null);
assertEquals(queryResultSize(iuProfileProperties), 1);
//Remove a1 optionality - should be a no-op
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java
index d3629cd41..0a6fab283 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java
@@ -42,10 +42,10 @@ public class AllOrbit extends AbstractProvisioningTest {
public void testInstallTwoVersionsOptionaly() {
ProfileChangeRequest req1 = new ProfileChangeRequest(profile1);
- IQueryResult allIUs = repo.query(QueryUtil.createIUAnyQuery(), null);
- req1.addInstallableUnits((IInstallableUnit[]) allIUs.toArray(IInstallableUnit.class));
- for (Iterator iterator = allIUs.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iterator.next();
+ IQueryResult<IInstallableUnit> allIUs = repo.query(QueryUtil.createIUAnyQuery(), null);
+ req1.addInstallableUnits(allIUs.toArray(IInstallableUnit.class));
+ for (Iterator<IInstallableUnit> iterator = allIUs.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
if (!iu.getId().equals("javax.wsdl"))
req1.setInstallableUnitInclusionRules(iu, ProfileInclusionRules.createOptionalInclusionRule(iu));
}
@@ -56,15 +56,15 @@ public class AllOrbit extends AbstractProvisioningTest {
public void test2() {
//Install everything except com.ibm.icu
ProfileChangeRequest req1 = new ProfileChangeRequest(profile1);
- IQueryResult allIUs = repo.query(QueryUtil.createIUAnyQuery(), null);
- ArrayList toInstall = new ArrayList();
- for (Iterator iterator = allIUs.iterator(); iterator.hasNext();) {
- IInstallableUnit toAdd = (IInstallableUnit) iterator.next();
+ IQueryResult<IInstallableUnit> allIUs = repo.query(QueryUtil.createIUAnyQuery(), null);
+ ArrayList<IInstallableUnit> toInstall = new ArrayList<>();
+ for (Iterator<IInstallableUnit> iterator = allIUs.iterator(); iterator.hasNext();) {
+ IInstallableUnit toAdd = iterator.next();
if (!toAdd.getId().equals("com.ibm.icu")) {
toInstall.add(toAdd);
}
}
- req1.addInstallableUnits((IInstallableUnit[]) toInstall.toArray(new IInstallableUnit[toInstall.size()]));
+ req1.addInstallableUnits(toInstall.toArray(new IInstallableUnit[toInstall.size()]));
IProvisioningPlan plan1 = planner.getProvisioningPlan(req1, null, null);
assertEquals(178, countPlanElements(plan1));
@@ -74,16 +74,16 @@ public class AllOrbit extends AbstractProvisioningTest {
public void test3() {
//Install everything optionaly (except com.ibm.icu that we don't install at all)
ProfileChangeRequest req1 = new ProfileChangeRequest(profile1);
- IQueryResult allIUs = repo.query(QueryUtil.createIUAnyQuery(), null);
- ArrayList toInstall = new ArrayList();
- for (Iterator iterator = allIUs.iterator(); iterator.hasNext();) {
- IInstallableUnit toAdd = (IInstallableUnit) iterator.next();
+ IQueryResult<IInstallableUnit> allIUs = repo.query(QueryUtil.createIUAnyQuery(), null);
+ ArrayList<IInstallableUnit> toInstall = new ArrayList<>();
+ for (Iterator<IInstallableUnit> iterator = allIUs.iterator(); iterator.hasNext();) {
+ IInstallableUnit toAdd = iterator.next();
if (!toAdd.getId().equals("com.ibm.icu")) {
toInstall.add(toAdd);
req1.setInstallableUnitInclusionRules(toAdd, ProfileInclusionRules.createOptionalInclusionRule(toAdd));
}
}
- req1.addInstallableUnits((IInstallableUnit[]) toInstall.toArray(new IInstallableUnit[toInstall.size()]));
+ req1.addInstallableUnits(toInstall.toArray(new IInstallableUnit[toInstall.size()]));
IProvisioningPlan plan1 = planner.getProvisioningPlan(req1, null, null);
assertEquals(178, countPlanElements(plan1));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252682.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252682.java
index 3fbe0e29b..54ee92510 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252682.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252682.java
@@ -25,7 +25,7 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
public class Bug252682 extends AbstractProvisioningTest {
IProfile profile = null;
- ArrayList newIUs = new ArrayList();
+ ArrayList<IInstallableUnit> newIUs = new ArrayList<>();
@Override
protected void setUp() throws Exception {
@@ -46,11 +46,11 @@ public class Bug252682 extends AbstractProvisioningTest {
public void testInstallFeaturePatch() {
IInstallableUnit p2Feature = profile.query(QueryUtil.createIUQuery("org.eclipse.equinox.p2.user.ui.feature.group"), new NullProgressMonitor()).iterator().next();
System.out.println(p2Feature);
- IQueryResult c = profile.query(QueryUtil.createIUQuery("org.eclipse.equinox.p2.core.patch"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = profile.query(QueryUtil.createIUQuery("org.eclipse.equinox.p2.core.patch"), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
ProvisioningContext ctx = new ProvisioningContext(getAgent());
ctx.setExtraInstallableUnits(newIUs);
- IInstallableUnit patch = (IInstallableUnit) c.iterator().next();
+ IInstallableUnit patch = c.iterator().next();
ProfileChangeRequest request = new ProfileChangeRequest(profile);
request.removeInstallableUnits(new IInstallableUnit[] {patch});
IPlanner planner = createPlanner();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java
index d91ec0dac..469937b39 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java
@@ -48,9 +48,9 @@ public class Bug254481dataSet1 extends AbstractProvisioningTest {
}
public void testInstallFeaturePatch() {
- IQueryResult c = repo.query(QueryUtil.createIUQuery("RPT_ARM_TEST.feature.group"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("RPT_ARM_TEST.feature.group"), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
- IInstallableUnit patch = (IInstallableUnit) c.iterator().next();
+ IInstallableUnit patch = c.iterator().next();
ProfileChangeRequest request = new ProfileChangeRequest(profile);
request.addInstallableUnits(new IInstallableUnit[] {patch});
request.setInstallableUnitInclusionRules(patch, ProfileInclusionRules.createOptionalInclusionRule(patch));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271067.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271067.java
index a569341f5..4e5f5787e 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271067.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271067.java
@@ -68,9 +68,9 @@ public class Bug271067 extends AbstractProvisioningTest {
}
IInstallableUnit getIU(IMetadataRepository source, String id, String version) {
- IQueryResult c = repo.query(QueryUtil.createIUQuery(id, Version.create(version)), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery(id, Version.create(version)), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
- return (IInstallableUnit) c.iterator().next();
+ return c.iterator().next();
}
public void testInstallFeaturePatch() {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java
index 48c52b0b2..fc8ad4288 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java
@@ -76,10 +76,10 @@ public class Bug271954 extends AbstractProvisioningTest {
}
public void testUninstallMyBundle() {
- IQueryResult c = profile.available(QueryUtil.createIUQuery("A"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = profile.available(QueryUtil.createIUQuery("A"), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
ProfileChangeRequest req = new ProfileChangeRequest(profile);
- req.removeInstallableUnits((IInstallableUnit[]) c.toArray(IInstallableUnit.class));
+ req.removeInstallableUnits(c.toArray(IInstallableUnit.class));
ProvisioningContext ctx = new ProvisioningContext(getAgent());
ctx.setMetadataRepositories(new URI[0]);
@@ -89,7 +89,7 @@ public class Bug271954 extends AbstractProvisioningTest {
assertNotNull(plan.getInstallerPlan().getFutureState());
assertEquals(0, queryResultSize(plan.getInstallerPlan().getAdditions().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
assertEquals(0, queryResultSize(plan.getInstallerPlan().getRemovals().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
- assertUninstallOperand(plan, (IInstallableUnit) c.iterator().next());
+ assertUninstallOperand(plan, c.iterator().next());
assertEquals(2, queryResultSize(plan.getRemovals().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
assertEquals(1, queryResultSize(plan.getRemovals().query(QueryUtil.createIUQuery("A", Version.createOSGi(1, 0, 0)), new NullProgressMonitor())));
assertEquals(1, queryResultSize(plan.getRemovals().query(QueryUtil.createIUQuery("Action1", Version.createOSGi(1, 0, 0)), new NullProgressMonitor())));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug272251.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug272251.java
index df5100c54..ad794d19a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug272251.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug272251.java
@@ -49,11 +49,11 @@ public class Bug272251 extends AbstractProvisioningTest {
}
public void testInstallFeaturePatch() {
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.wst.jsdt.feature.patch.feature.group", Version.create("3.0.4.v200904020304-1-8d7w311_15131415")), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.wst.jsdt.feature.patch.feature.group", Version.create("3.0.4.v200904020304-1-8d7w311_15131415")), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
- IQueryResult expectedIU = repo.query(QueryUtil.createIUQuery("org.eclipse.wst.jsdt.web.ui", Version.create("1.0.105.v200904020304")), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> expectedIU = repo.query(QueryUtil.createIUQuery("org.eclipse.wst.jsdt.web.ui", Version.create("1.0.105.v200904020304")), new NullProgressMonitor());
assertEquals(1, queryResultSize(expectedIU));
- IInstallableUnit patch = (IInstallableUnit) c.iterator().next();
+ IInstallableUnit patch = c.iterator().next();
ProfileChangeRequest request = new ProfileChangeRequest(profile);
request.addInstallableUnits(new IInstallableUnit[] {patch});
request.setInstallableUnitInclusionRules(patch, ProfileInclusionRules.createStrictInclusionRule(patch));
@@ -61,6 +61,6 @@ public class Bug272251 extends AbstractProvisioningTest {
IProvisioningPlan plan = planner.getProvisioningPlan(request, null, new NullProgressMonitor());
assertOK("Plan OK", plan.getStatus());
assertNoOperand(plan, patch);
- assertNoOperand(plan, (IInstallableUnit) expectedIU.iterator().next());
+ assertNoOperand(plan, expectedIU.iterator().next());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java
index 99c1d805a..d2e493eb1 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java
@@ -33,7 +33,7 @@ public class Bug278668 extends AbstractProvisioningTest {
profile = createProfile("test278668");
IEngine engine = createEngine();
IPlanner planner = createPlanner();
- ArrayList target = new ArrayList();
+ ArrayList<IInstallableUnit> target = new ArrayList<>();
target.add(createEclipseIU("com.borland.tg.modelrenaming"));
target.add(createEclipseIU("com.borland.tg.xmldesign"));
target.add(createEclipseIU("com.tssap.selena.dom"));
@@ -47,9 +47,9 @@ public class Bug278668 extends AbstractProvisioningTest {
target.add(createEclipseIU("com.tssap.selena.model.providers.resources", Version.create("8.1.2.v20090422-1800")));
target.add(createEclipseIU("com.tssap.selena.model", Version.create("8.1.5.v20090422-1800")));
target.add(createEclipseIUSingleton("com.tssap.selena.dom", Version.create("8.2.0.v20090326-1800")));
- createTestMetdataRepository((IInstallableUnit[]) target.toArray(new IInstallableUnit[target.size()]));
+ createTestMetdataRepository(target.toArray(new IInstallableUnit[target.size()]));
- ArrayList requirements = new ArrayList();
+ ArrayList<IRequirement> requirements = new ArrayList<>();
requirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "com.borland.tg.modelrenaming", new VersionRange("[1.0.0, 1.0.0]"), null, false, false));
requirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "com.borland.tg.xmldesign", new VersionRange("[1.0.0, 1.0.0]"), null, false, false));
requirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "com.tssap.selena.dom", new VersionRange("[1.0.0, 1.0.0]"), null, false, false));
@@ -57,7 +57,7 @@ public class Bug278668 extends AbstractProvisioningTest {
requirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "com.tssap.selena.model.providers.resources", new VersionRange("[1.0.0, 1.0.0]"), null, false, false));
requirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "com.tssap.selena.model", new VersionRange("[1.0.0, 1.0.0]"), null, false, false));
- IInstallableUnit group = createIU("com.borland.tg.modeling.feature.group", Version.create("8.2.0.v20081113-0500-_87S7nELRXmpf6G0dO3emm"), null, (IRequirement[]) requirements.toArray(new IRequirement[requirements.size()]), new IProvidedCapability[] {MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "com.borland.tg.modeling", Version.create("8.2.0.v20081113-0500-_87S7nELRXmpf6G0dO3emm"))}, new Properties(), null, null, true);
+ IInstallableUnit group = createIU("com.borland.tg.modeling.feature.group", Version.create("8.2.0.v20081113-0500-_87S7nELRXmpf6G0dO3emm"), null, requirements.toArray(new IRequirement[requirements.size()]), new IProvidedCapability[] {MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "com.borland.tg.modeling", Version.create("8.2.0.v20081113-0500-_87S7nELRXmpf6G0dO3emm"))}, new Properties(), null, null, true);
ProfileChangeRequest req = new ProfileChangeRequest(profile);
req.addInstallableUnits(new IInstallableUnit[] {group});
@@ -76,33 +76,33 @@ public class Bug278668 extends AbstractProvisioningTest {
}
public void testInstallFeaturePatch() {
- IQueryResult c = repo.query(QueryUtil.createIUQuery("com.borland.tg.modeling.8.2.0.hotfixexp.patch.feature.group"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("com.borland.tg.modeling.8.2.0.hotfixexp.patch.feature.group"), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
- IQueryResult c2 = repo.query(QueryUtil.createIUQuery("com.borland.tg.modeling.8.2.0.nl.patch.feature.group"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c2 = repo.query(QueryUtil.createIUQuery("com.borland.tg.modeling.8.2.0.nl.patch.feature.group"), new NullProgressMonitor());
assertEquals(1, queryResultSize(c2));
ProfileChangeRequest request = new ProfileChangeRequest(profile);
- request.addInstallableUnits(new IInstallableUnit[] {(IInstallableUnit) c.iterator().next()});
+ request.addInstallableUnits(new IInstallableUnit[] {c.iterator().next()});
IPlanner planner = createPlanner();
IProvisioningPlan plan = planner.getProvisioningPlan(request, null, new NullProgressMonitor());
assertOK("Plan OK", plan.getStatus());
ProfileChangeRequest request2 = new ProfileChangeRequest(profile);
- request2.addInstallableUnits(new IInstallableUnit[] {(IInstallableUnit) c2.iterator().next()});
+ request2.addInstallableUnits(new IInstallableUnit[] {c2.iterator().next()});
IPlanner planner2 = createPlanner();
IProvisioningPlan plan2 = planner2.getProvisioningPlan(request2, null, new NullProgressMonitor());
assertOK("Plan OK", plan2.getStatus());
ProfileChangeRequest request3 = new ProfileChangeRequest(profile);
- request3.addInstallableUnits(new IInstallableUnit[] {(IInstallableUnit) c.iterator().next(), (IInstallableUnit) c2.iterator().next()});
+ request3.addInstallableUnits(new IInstallableUnit[] {c.iterator().next(), c2.iterator().next()});
IPlanner planner3 = createPlanner();
IProvisioningPlan plan3 = planner3.getProvisioningPlan(request3, null, new NullProgressMonitor());
assertNotOK("Plan Not OK", plan3.getStatus());
ProfileChangeRequest request4 = new ProfileChangeRequest(profile);
- request4.addInstallableUnits(new IInstallableUnit[] {(IInstallableUnit) c.iterator().next(), (IInstallableUnit) c2.iterator().next()});
- request4.setInstallableUnitInclusionRules((IInstallableUnit) c.iterator().next(), ProfileInclusionRules.createOptionalInclusionRule((IInstallableUnit) c.iterator().next()));
- request4.setInstallableUnitInclusionRules((IInstallableUnit) c2.iterator().next(), ProfileInclusionRules.createOptionalInclusionRule((IInstallableUnit) c2.iterator().next()));
+ request4.addInstallableUnits(new IInstallableUnit[] {c.iterator().next(), c2.iterator().next()});
+ request4.setInstallableUnitInclusionRules(c.iterator().next(), ProfileInclusionRules.createOptionalInclusionRule(c.iterator().next()));
+ request4.setInstallableUnitInclusionRules(c2.iterator().next(), ProfileInclusionRules.createOptionalInclusionRule(c2.iterator().next()));
IPlanner planner4 = createPlanner();
IProvisioningPlan plan4 = planner4.getProvisioningPlan(request4, null, new NullProgressMonitor());
assertOK("Plan OK", plan4.getStatus());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java
index cfd7b2d4c..e9ff3c6ea 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java
@@ -44,9 +44,9 @@ public class Bug300104 extends AbstractProvisioningTest {
}
IInstallableUnit getIU(IMetadataRepository source, String id, String version) {
- IQueryResult c = repo.query(QueryUtil.createIUQuery(id, Version.create(version)), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery(id, Version.create(version)), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
- return (IInstallableUnit) c.iterator().next();
+ return c.iterator().next();
}
public void testInstallPatchesInOrder() throws ProvisionException {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug301446.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug301446.java
index cc656c55d..c3f20618a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug301446.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug301446.java
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.query.QueryUtil;
public class Bug301446 extends AbstractPlannerTest {
- static final Map EXPECTED_VERSIONS = new HashMap();
+ static final Map<String, Version> EXPECTED_VERSIONS = new HashMap<>();
static {
EXPECTED_VERSIONS.put("com.ibm.commerce.toolkit.internal.common", Version.create("7.0.0.1"));
EXPECTED_VERSIONS.put("com.ibm.commerce.toolkit.internal.dataaccess", Version.create("7.0.0.1"));
@@ -51,7 +51,7 @@ public class Bug301446 extends AbstractPlannerTest {
IPlanner planner = createPlanner();
// create the actual plan - install everything in the repo as optional (mimic the dropins folder)
- IQueryResult allIUs = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> allIUs = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
IProfileChangeRequest actualChangeRequest = createProfileChangeRequest(allIUs.toSet(), null, null);
// TODO: verify that we are going to try and install the highest version of everything
IProvisioningPlan actualPlan = planner.getProvisioningPlan(actualChangeRequest, null, new NullProgressMonitor());
@@ -66,7 +66,7 @@ public class Bug301446 extends AbstractPlannerTest {
if (iu == null) {
// we are un-installing an IU, is it interesting?
iu = ((InstallableUnitOperand) o).first();
- Version expected = (Version) EXPECTED_VERSIONS.get(iu.getId());
+ Version expected = EXPECTED_VERSIONS.get(iu.getId());
if (expected == null)
continue;
Version actual = iu.getVersion();
@@ -74,7 +74,7 @@ public class Bug301446 extends AbstractPlannerTest {
continue;
}
// we are installing an IU
- Version expected = (Version) EXPECTED_VERSIONS.get(iu.getId());
+ Version expected = EXPECTED_VERSIONS.get(iu.getId());
if (expected == null)
continue;
Version actual = iu.getVersion();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582.java
index 6ca7a6488..2c0c4d549 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.p2.tests.planner;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
@@ -36,12 +37,12 @@ public class Bug302582 extends AbstractPlannerTest {
IPlanner planner = createPlanner();
// create the actual plan - install everything in the repo as optional (mimic the dropins folder)
- IQueryResult allIUs = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> allIUs = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
IProfileChangeRequest actualChangeRequest = createProfileChangeRequest(allIUs.toSet(), null, null);
IProvisioningPlan actualPlan = planner.getProvisioningPlan(actualChangeRequest, null, new NullProgressMonitor());
// this is the plan that we expect - highest version only
- IQueryResult queryResult = repo.query(QueryUtil.createIUQuery("com.dcns.rsm.hello", Version.createOSGi(1, 0, 2, "v20100103")), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> queryResult = repo.query(QueryUtil.createIUQuery("com.dcns.rsm.hello", Version.createOSGi(1, 0, 2, "v20100103")), new NullProgressMonitor());
IProfileChangeRequest expectedChangeRequest = createProfileChangeRequest(queryResult.toSet(), null, null);
IProvisioningPlan expectedPlan = planner.getProvisioningPlan(expectedChangeRequest, null, new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582c.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582c.java
index 2d1688acd..dab9971d8 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582c.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582c.java
@@ -12,6 +12,7 @@ package org.eclipse.equinox.p2.tests.planner;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
@@ -41,14 +42,14 @@ public class Bug302582c extends Bug302582 {
IPlanner planner = createPlanner();
// create the actual plan - install everything in the repo as optional (mimic the dropins folder)
- IQueryResult allIUs = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> allIUs = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
// IQueryResult allIUs = repo.query(new InstallableUnitQuery("aaa", new VersionRange("[1.0.2, 1.0.3]")), new NullProgressMonitor());
IProfileChangeRequest actualChangeRequest = createProfileChangeRequest(allIUs.toSet(), null, null);
IProvisioningPlan actualPlan = planner.getProvisioningPlan(actualChangeRequest, null, new NullProgressMonitor());
// this is the plan that we expect - highest version only
- IQueryResult queryResult = repo.query(QueryUtil.createIUQuery("aaa", Version.createOSGi(1, 0, 3)), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> queryResult = repo.query(QueryUtil.createIUQuery("aaa", Version.createOSGi(1, 0, 3)), new NullProgressMonitor());
IProfileChangeRequest expectedChangeRequest = createProfileChangeRequest(queryResult.toSet(), null, null);
IProvisioningPlan expectedPlan = planner.getProvisioningPlan(expectedChangeRequest, null, new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java
index 99e5d0522..325baf027 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java
@@ -47,9 +47,9 @@ public class Bug302582d extends AbstractProvisioningTest {
}
IInstallableUnit getIU(IMetadataRepository source, String id, String version) {
- IQueryResult c = repo.query(QueryUtil.createIUQuery(id, Version.create(version)), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery(id, Version.create(version)), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
- return (IInstallableUnit) c.iterator().next();
+ return c.iterator().next();
}
public void testInstall() {
@@ -70,9 +70,9 @@ public class Bug302582d extends AbstractProvisioningTest {
private ProfileChangeRequest createFilteredRequest(IQueryResult<IInstallableUnit> ius) {
ProfileChangeRequest pcr = new ProfileChangeRequest(profileRegistry.getProfile(profileLoadedId));
- Iterator it = ius.iterator();
+ Iterator<IInstallableUnit> it = ius.iterator();
while (it.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) it.next();
+ IInstallableUnit iu = it.next();
if ((iu.getId().equals("com.dcns.rsm.rda") && iu.getVersion().equals(Version.create("5.1.0.v20100112"))) || (iu.getId().equals("com.dcns.rsm.profile.equipment") && iu.getVersion().equals(Version.create("1.2.2.v20100108"))) || (iu.getId().equals("com.dcns.rsm.profile.gemo") && iu.getVersion().equals(Version.create("3.7.2.v20100108"))) || (iu.getId().equals("com.dcns.rsm.profile.system") && iu.getVersion().equals(Version.create("4.2.2.v20100112")))) {
pcr.addInstallableUnits(new IInstallableUnit[] {iu});
}
@@ -84,9 +84,9 @@ public class Bug302582d extends AbstractProvisioningTest {
private ProfileChangeRequest createRequest(IQueryResult<IInstallableUnit> ius) {
ProfileChangeRequest pcr = new ProfileChangeRequest(profileRegistry.getProfile(profileLoadedId));
pcr.addInstallableUnits(ius.toArray(IInstallableUnit.class));
- Iterator it = ius.iterator();
+ Iterator<IInstallableUnit> it = ius.iterator();
while (it.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) it.next();
+ IInstallableUnit iu = it.next();
pcr.setInstallableUnitInclusionRules(iu, ProfileInclusionRules.createOptionalInclusionRule(iu));
}
return pcr;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java
index 79ff8e786..3ce93a50e 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java
@@ -13,6 +13,7 @@ package org.eclipse.equinox.p2.tests.planner;
import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -45,7 +46,7 @@ public class Bug362692 extends AbstractPlannerTest {
// this is the set of IUs we expect in the final result - highest version only
Set<IInstallableUnit> expected = new HashSet<>();
- IQueryResult queryResult = repo.query(QueryUtil.createIUQuery("PluginA", Version.createOSGi(1, 1, 1, null)), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> queryResult = repo.query(QueryUtil.createIUQuery("PluginA", Version.createOSGi(1, 1, 1, null)), new NullProgressMonitor());
expected.addAll(queryResult.toSet());
queryResult = repo.query(QueryUtil.createIUQuery("PluginB", Version.createOSGi(1, 1, 2, null)), new NullProgressMonitor());
expected.addAll(queryResult.toSet());
@@ -58,7 +59,7 @@ public class Bug362692 extends AbstractPlannerTest {
// create the actual plan - install everything in the repo as optional (mimic the dropins folder)
Set<IInstallableUnit> toAdd = new HashSet<>();
- IQueryResult allIUs = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> allIUs = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
// we don't want to re-install units which are already installed in the profile so remove them. (this is what the reconciler does)
boolean already = false;
for (Iterator<IInstallableUnit> iter = allIUs.iterator(); iter.hasNext();) {
@@ -84,13 +85,13 @@ public class Bug362692 extends AbstractPlannerTest {
repoURLs.add(repo.getLocation());
repoURLs.add(new Path(getTestDataPath()).append("shared").toFile().toURI());
ProvisioningContext context = getContext(repoURLs);
- context.setExtraInstallableUnits(new ArrayList(toAdd));
+ context.setExtraInstallableUnits(new ArrayList<>(toAdd));
IProfileChangeRequest actualChangeRequest = createProfileChangeRequest(toAdd, null, null);
IProvisioningPlan plan = planner.getProvisioningPlan(actualChangeRequest, context, new NullProgressMonitor());
- Collection compressedPlan = compress(plan);
+ Collection<InstallableUnitOperand> compressedPlan = compress(plan);
if (compressedPlan.isEmpty())
System.out.println("Plan: ...is empty!");
- for (Iterator iter = compressedPlan.iterator(); iter.hasNext();) {
+ for (Iterator<InstallableUnitOperand> iter = compressedPlan.iterator(); iter.hasNext();) {
System.out.println("Plan: " + iter.next());
}
validate(expected, plan);
@@ -103,9 +104,9 @@ public class Bug362692 extends AbstractPlannerTest {
private void validate(Collection<IInstallableUnit> expected, Collection<IInstallableUnit> toAdd) {
MultiStatus errors = new MultiStatus(TestActivator.PI_PROV_TESTS, IStatus.OK, "Errors while validating plan.", null);
for (IInstallableUnit unit : expected) {
- IQuery query = QueryUtil.createIUQuery(unit.getId(), unit.getVersion());
+ IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(unit.getId(), unit.getVersion());
// already in the profile?
- IQueryResult queryResult = getProfile().query(query, new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> queryResult = getProfile().query(query, new NullProgressMonitor());
if (queryResult.isEmpty()) {
// not in the profile, should be an incoming addition then
if (!toAdd.contains(unit)) {
@@ -125,9 +126,9 @@ public class Bug362692 extends AbstractPlannerTest {
private void validate(Collection<IInstallableUnit> expected, IProvisioningPlan plan) {
MultiStatus errors = new MultiStatus(TestActivator.PI_PROV_TESTS, IStatus.OK, "Errors while validating plan.", null);
for (IInstallableUnit unit : expected) {
- IQuery query = QueryUtil.createIUQuery(unit.getId(), unit.getVersion());
+ IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(unit.getId(), unit.getVersion());
// already in the profile?
- IQueryResult queryResult = getProfile().query(query, new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> queryResult = getProfile().query(query, new NullProgressMonitor());
if (queryResult.isEmpty()) {
// not in the profile, should be an incoming addition then
if (plan.getAdditions().query(query, new NullProgressMonitor()).isEmpty()) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug365124.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug365124.java
index 3ec71c893..426cfecbc 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug365124.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug365124.java
@@ -13,6 +13,7 @@ package org.eclipse.equinox.p2.tests.planner;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.engine.*;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
import org.eclipse.equinox.p2.query.IQueryResult;
@@ -35,7 +36,7 @@ public class Bug365124 extends AbstractPlannerTest {
public void testInstall() {
IPlanner planner = createPlanner();
- IQueryResult allIUs = repo.query(QueryUtil.createIUQuery("f1.feature.group"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> allIUs = repo.query(QueryUtil.createIUQuery("f1.feature.group"), new NullProgressMonitor());
IProfileChangeRequest actualChangeRequest = createProfileChangeRequest(null, allIUs.toSet(), null);
IProvisioningPlan plan = planner.getProvisioningPlan(actualChangeRequest, null, new NullProgressMonitor());
Operand[] operands = ((ProvisioningPlan) plan).getOperands();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationLargeConflict.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationLargeConflict.java
index c51903c58..961efbe64 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationLargeConflict.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationLargeConflict.java
@@ -49,13 +49,13 @@ public class ExplanationLargeConflict extends AbstractProvisioningTest {
long sTime = System.currentTimeMillis();
//Here we verify that two version of JDT can't be installed together. The SDKProfile is not used
IProfile profile = createProfile("TestProfile." + getName());
- IQueryResult c = repo1.query(QueryUtil.createIUQuery("org.eclipse.jdt.feature.group"), null);
+ IQueryResult<IInstallableUnit> c = repo1.query(QueryUtil.createIUQuery("org.eclipse.jdt.feature.group"), null);
assertEquals(1, queryResultSize(c));
- IInstallableUnit jdt1 = (IInstallableUnit) c.iterator().next();
+ IInstallableUnit jdt1 = c.iterator().next();
- IQueryResult c2 = repo2.query(QueryUtil.createIUQuery("org.eclipse.jdt.feature.group"), null);
+ IQueryResult<IInstallableUnit> c2 = repo2.query(QueryUtil.createIUQuery("org.eclipse.jdt.feature.group"), null);
assertEquals(1, queryResultSize(c2));
- IInstallableUnit jdt2 = (IInstallableUnit) c2.iterator().next();
+ IInstallableUnit jdt2 = c2.iterator().next();
assertNotSame(jdt1, jdt2);
@@ -101,9 +101,9 @@ public class ExplanationLargeConflict extends AbstractProvisioningTest {
public void testExplanationLargeConflictInSDK() {
long sTime = System.currentTimeMillis();
//Test large conflict. We are trying to install an inappropriate version of CVS over the already installed SDK
- IQueryResult c = repo2.query(QueryUtil.createIUQuery("org.eclipse.cvs.feature.group"), null);
+ IQueryResult<IInstallableUnit> c = repo2.query(QueryUtil.createIUQuery("org.eclipse.cvs.feature.group"), null);
assertEquals(1, queryResultSize(c));
- IInstallableUnit cvs = (IInstallableUnit) c.iterator().next();
+ IInstallableUnit cvs = c.iterator().next();
ProfileChangeRequest pcr = new ProfileChangeRequest(SDKprofile);
pcr.addInstallableUnits(new IInstallableUnit[] {cvs});
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUProperties.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUProperties.java
index d610ab1b4..3c9bccca7 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUProperties.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUProperties.java
@@ -59,7 +59,7 @@ public class IUProperties extends AbstractProvisioningTest {
IStatus s = engine.perform(pp1, null);
if (!s.isOK())
LogHelper.log(s);
- IQueryResult queryResult = getProfile(profileId).query(new IUProfilePropertyQuery("FOO", IUProfilePropertyQuery.ANY), null);
+ IQueryResult<IInstallableUnit> queryResult = getProfile(profileId).query(new IUProfilePropertyQuery("FOO", IUProfilePropertyQuery.ANY), null);
assertEquals(1, queryResultSize(queryResult));
ProfileChangeRequest req2 = new ProfileChangeRequest(profile);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUPropertyRemoval.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUPropertyRemoval.java
index 79093f966..32364f6d5 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUPropertyRemoval.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUPropertyRemoval.java
@@ -50,7 +50,7 @@ public class IUPropertyRemoval extends AbstractProvisioningTest {
IProvisioningPlan pp1 = planner.getProvisioningPlan(req1, null, null);
assertEquals(IStatus.OK, pp1.getStatus().getSeverity());
engine.perform(pp1, null);
- IQueryResult res = getProfile(profileId).query(new IUProfilePropertyQuery("FOO", IUProfilePropertyQuery.ANY), null);
+ IQueryResult<IInstallableUnit> res = getProfile(profileId).query(new IUProfilePropertyQuery("FOO", IUProfilePropertyQuery.ANY), null);
assertEquals(2, queryResultSize(res));
ProfileChangeRequest req2 = new ProfileChangeRequest(profile);
@@ -58,7 +58,7 @@ public class IUPropertyRemoval extends AbstractProvisioningTest {
ProvisioningPlan pp2 = (ProvisioningPlan) planner.getProvisioningPlan(req2, null, null);
assertEquals(1, pp2.getOperands().length);
engine.perform(pp2, null);
- IQueryResult res2 = getProfile(profileId).query(new IUProfilePropertyQuery("FOO", IUProfilePropertyQuery.ANY), null);
+ IQueryResult<IInstallableUnit> res2 = getProfile(profileId).query(new IUProfilePropertyQuery("FOO", IUProfilePropertyQuery.ANY), null);
assertEquals(1, queryResultSize(res2));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest2.java
index 4f4c815e1..f9100c68f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest2.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest2.java
@@ -53,7 +53,7 @@ public class InclusionRuleTest2 extends AbstractProvisioningTest {
IProfileRegistry profileRegistry = getProfileRegistry();
profile = profileRegistry.getProfile(profile.getProfileId());
- IQueryResult c = profile.query(new UserVisibleRootQuery(), null);
+ IQueryResult<IInstallableUnit> c = profile.query(new UserVisibleRootQuery(), null);
assertEquals(queryResultSize(c), 1);
System.gc();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java
index 277621522..29776048d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java
@@ -301,12 +301,12 @@ public class NegationTesting extends AbstractProvisioningTest {
// Verify that the slice includes iu3
Slicer slicer = new Slicer(repo, Collections.<String, String> emptyMap(), false);
- IQueryable slice = slicer.slice(new IInstallableUnit[] {iu1, iu4}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> slice = slicer.slice(new IInstallableUnit[] {iu1, iu4}, new NullProgressMonitor());
assertEquals(4, queryResultSize(slice.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
// Verify that the slice includes iu3
Slicer slicer2 = new Slicer(repo, Collections.<String, String> emptyMap(), false);
- IQueryable slice2 = slicer2.slice(new IInstallableUnit[] {iu4}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> slice2 = slicer2.slice(new IInstallableUnit[] {iu4}, new NullProgressMonitor());
assertEquals(2, queryResultSize(slice2.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
//Verify that the resolution succeeds and does not return iu3 since it is excluded by the requirement of iu1
@@ -337,7 +337,7 @@ public class NegationTesting extends AbstractProvisioningTest {
request.add(iu);
IRequirement req1 = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), new VersionRange(iu.getVersion(), true, iu.getVersion(), true), null, 0, 0, false, null);
- ArrayList<IRequirement> reqs = new ArrayList();
+ ArrayList<IRequirement> reqs = new ArrayList<>();
reqs.add(req1);
request.addExtraRequirements(reqs);
@@ -352,11 +352,11 @@ public class NegationTesting extends AbstractProvisioningTest {
iud1.setVersion(Version.create("1.0.0"));
RequiredCapability req1 = new RequiredCapability(NS, N, new VersionRange("[0.0.0, 1.1.1)"), null, 0, 0, false, null);
RequiredCapability req2 = new RequiredCapability(NS, N, new VersionRange(Version.create("1.1.1"), false, Version.MAX_VERSION, false), null, 0, 0, false, null);
- Collection requirements = new ArrayList();
+ Collection<IRequirement> requirements = new ArrayList<>();
requirements.add(req1);
requirements.add(req2);
iud1.addRequirements(requirements);
- Collection capabilities = new ArrayList();
+ Collection<IProvidedCapability> capabilities = new ArrayList<>();
capabilities.add(new ProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "TestNegation4", Version.create("1.0.0")));
capabilities.add(new ProvidedCapability(NS, N, Version.create("1.1.1")));
iud1.addProvidedCapabilities(capabilities);
@@ -373,7 +373,7 @@ public class NegationTesting extends AbstractProvisioningTest {
MetadataFactory.InstallableUnitDescription iud2 = new MetadataFactory.InstallableUnitDescription();
iud2.setId("ProviderOf1");
iud2.setVersion(Version.create("1.0.0"));
- Collection capabilities2 = new ArrayList();
+ Collection<IProvidedCapability> capabilities2 = new ArrayList<>();
capabilities2.add(MetadataFactory.createProvidedCapability(NS, N, Version.create("1.0.0")));
iud2.addProvidedCapabilities(capabilities2);
IInstallableUnit iu2 = MetadataFactory.createInstallableUnit(iud2);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java
index 0beb7d4a1..9026954d8 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java
@@ -31,9 +31,9 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest {
public void testSliceRCPOut() {
PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), true, false, true, false, false);
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertNotNull(result);
queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()));
assertEquals(66, queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
@@ -44,9 +44,9 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest {
//Test with and without optional pieces
public void testSliceRCPWithOptionalPieces() {
PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), false, false, true, false, false);
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertNotNull(result);
queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()));
assertEquals(64, queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
@@ -55,9 +55,9 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest {
public void testSliceRCPWithIgnoringGreed() {
PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), false, true, true, false, false);
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertNotNull(result);
queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()));
assertEquals(64, queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
@@ -70,9 +70,9 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest {
p.put("osgi.ws", "win32");
p.put("osgi.arch", "x86");
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, true, true, false, false, false);
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertNotNull(result);
queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()));
assertEquals(0, queryResultSize(result.query(QueryUtil.createIUQuery("org.eclipse.swt.motif.linux.x86"), new NullProgressMonitor())));
@@ -86,9 +86,9 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest {
p.put("osgi.ws", "win32");
p.put("osgi.arch", "x86");
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, true, false, false, true, false);
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertNotNull(result);
queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()));
assertEquals(0, queryResultSize(result.query(QueryUtil.createIUQuery("org.eclipse.ecf"), new NullProgressMonitor())));
@@ -98,9 +98,9 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest {
public void testExtractPlatformIndependentPieces() {
PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), true, false, false, false, false);
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
- IQueryable result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor());
assertNotNull(result);
queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()));
assertEquals(32, queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
@@ -116,7 +116,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest {
IInstallableUnit a = createIUWithMetaRequirement("A", DEFAULT_VERSION, true, NO_REQUIRES, metaReq);
PermissiveSlicer slicer = new PermissiveSlicer(createTestMetdataRepository(new IInstallableUnit[] {a, act1}), Collections.<String, String> emptyMap(), true, false, false, false, false);
- IQueryable result = slicer.slice(new IInstallableUnit[] {a}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {a}, new NullProgressMonitor());
assertEquals(1, queryResultSize(result.query(QueryUtil.createIUQuery("Action1"), null)));
}
@@ -126,8 +126,8 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest {
p.put("osgi.ws", "win32");
p.put("osgi.arch", "x86");
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, true, false, false, true, false);
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.swt.cocoa.macosx"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.swt.cocoa.macosx"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
assertNull(slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor()));
assertNotOK(slicer.getStatus());
}
@@ -136,7 +136,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest {
IRequirement[] req = createRequiredCapabilities("B", "B", new VersionRange("[0.0.0, 1.0.0]"));
IInstallableUnit iuA = createIU("A", DEFAULT_VERSION, null, req, NO_PROVIDES, NO_PROPERTIES, null, NO_TP_DATA, true);
PermissiveSlicer slicer = new PermissiveSlicer(createTestMetdataRepository(new IInstallableUnit[] {iuA}), Collections.<String, String> emptyMap(), true, false, false, false, false);
- IQueryable result = slicer.slice(new IInstallableUnit[] {iuA}, new NullProgressMonitor());
+ IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iuA}, new NullProgressMonitor());
assertNotNull(result);
assertNotOK(slicer.getStatus());
}
@@ -147,17 +147,17 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest {
p.put("osgi.ws", "win32");
p.put("osgi.arch", "x86");
PermissiveSlicer slicer = new PermissiveSlicer(repo, p, true, false, false, false, true);
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
- IQueryResult resultCollector = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor()).query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
+ IQueryResult<IInstallableUnit> resultCollector = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor()).query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
assertEquals(3, queryResultSize(resultCollector));
}
public void testExtractOnlyPlatformSpecific() {
PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), true, false, true, false, true);
- IQueryResult c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
- IInstallableUnit iu = (IInstallableUnit) c.iterator().next();
- IQueryResult resultCollector = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor()).query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor());
+ IInstallableUnit iu = c.iterator().next();
+ IQueryResult<IInstallableUnit> resultCollector = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor()).query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
assertEquals(35, queryResultSize(resultCollector));
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ProvisioningPlanQueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ProvisioningPlanQueryTest.java
index dfd796772..f0d75d190 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ProvisioningPlanQueryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ProvisioningPlanQueryTest.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * 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
*******************************************************************************/
@@ -13,6 +13,7 @@ package org.eclipse.equinox.p2.tests.planner;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.engine.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
@@ -22,27 +23,27 @@ public class ProvisioningPlanQueryTest extends AbstractProvisioningTest {
private static final String TESTPROFILE = "test";
public void testNull() {
- IQueryResult c = new ProvisioningPlan(Status.OK_STATUS, getProfile(TESTPROFILE), null, null).getAdditions().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = new ProvisioningPlan(Status.OK_STATUS, getProfile(TESTPROFILE), null, null).getAdditions().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
assertTrue(c.isEmpty());
}
public void testAddition() {
Operand[] ops = new Operand[] {new InstallableUnitOperand(null, createIU("A"))};
- IQueryResult c = new ProvisioningPlan(getProfile(TESTPROFILE), ops, null).getAdditions().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = new ProvisioningPlan(getProfile(TESTPROFILE), ops, null).getAdditions().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
assertTrue(new ProvisioningPlan(getProfile(TESTPROFILE), ops, null).getRemovals().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()).isEmpty());
}
public void testRemoval() {
Operand[] ops = new Operand[] {new InstallableUnitOperand(createIU("A"), null)};
- IQueryResult c = new ProvisioningPlan(getProfile(TESTPROFILE), ops, null).getRemovals().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = new ProvisioningPlan(getProfile(TESTPROFILE), ops, null).getRemovals().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
assertTrue(new ProvisioningPlan(getProfile(TESTPROFILE), ops, null).getAdditions().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()).isEmpty());
}
public void testUpdate() {
Operand[] ops = new Operand[] {new InstallableUnitOperand(createIU("A"), createIU("B"))};
- IQueryResult c = new ProvisioningPlan(getProfile(TESTPROFILE), ops, null).getRemovals().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = new ProvisioningPlan(getProfile(TESTPROFILE), ops, null).getRemovals().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
assertEquals(1, queryResultSize(c));
assertEquals(1, queryResultSize(new ProvisioningPlan(getProfile(TESTPROFILE), ops, null).getAdditions().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimulatedSharedInstallTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimulatedSharedInstallTest.java
index 64b418335..021a79408 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimulatedSharedInstallTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimulatedSharedInstallTest.java
@@ -75,11 +75,11 @@ public class SimulatedSharedInstallTest extends AbstractProvisioningTest {
IProfile availableWrapper = new IProfile() {
@Override
public IQueryResult<IInstallableUnit> available(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
- IQueryResult queryResult = profile.query(query, monitor);
- Collector collector = new Collector();
+ IQueryResult<IInstallableUnit> queryResult = profile.query(query, monitor);
+ Collector<IInstallableUnit> collector = new Collector<>();
collector.addAll(queryResult);
- Collection ius = new ArrayList();
+ Collection<IInstallableUnit> ius = new ArrayList<>();
ius.add(b1);
collector.addAll(query.perform(ius.iterator()));
return collector;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SlicerBug365124Test.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SlicerBug365124Test.java
index 2b4a4c34c..b6bdaeada 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SlicerBug365124Test.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SlicerBug365124Test.java
@@ -50,8 +50,8 @@ public class SlicerBug365124Test extends AbstractProvisioningTest {
public void testSlice() {
Slicer slicer = new Slicer(getProfile(IProfileRegistry.SELF), getProperties(), true);
- IQueryResult c = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
- slicer.slice((IInstallableUnit[]) c.toArray(IInstallableUnit.class), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor());
+ slicer.slice(c.toArray(IInstallableUnit.class), new NullProgressMonitor());
assertNotOK("1.0", slicer.getStatus());
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UpdateQueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UpdateQueryTest.java
index d4a7f486d..c259daf7d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UpdateQueryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UpdateQueryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 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
@@ -33,14 +33,14 @@ public class UpdateQueryTest extends AbstractProvisioningTest {
public void testUpdateWithDifferentId() {
IMetadataRepository repo = createTestMetdataRepository(new IInstallableUnit[] {a1, updateOfA});
- IQueryResult c = repo.query(new UpdateQuery(a1), null);
+ IQueryResult<IInstallableUnit> c = repo.query(new UpdateQuery(a1), null);
assertEquals(1, queryResultSize(c));
assertEquals(updateOfA, c.iterator().next());
}
public void testWithSuperiorVersion() {
IMetadataRepository repo2 = createTestMetdataRepository(new IInstallableUnit[] {a11, a1});
- IQueryResult c2 = repo2.query(new UpdateQuery(a1), null);
+ IQueryResult<IInstallableUnit> c2 = repo2.query(new UpdateQuery(a1), null);
assertEquals(1, queryResultSize(c2));
assertEquals(a11, c2.iterator().next());
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java
index 861565711..6b12e2e15 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java
@@ -30,7 +30,6 @@ import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.tests.*;
-@SuppressWarnings({"unchecked"})
public class ANYConfigCUsActionTest extends ActionTest {
private static final String BUNDLE_VERSION = "5.0.0"; //$NON-NLS-1$
private static final String ORG_ECLIPSE_CORE_COMMANDS = "org.eclipse.core.commands"; //$NON-NLS-1$
@@ -60,7 +59,7 @@ public class ANYConfigCUsActionTest extends ActionTest {
}
private void verifyAction() {
- ArrayList IUs = new ArrayList(publisherResult.getIUs(null, IPublisherResult.ROOT));
+ ArrayList<IInstallableUnit> IUs = new ArrayList<>(publisherResult.getIUs(null, IPublisherResult.ROOT));
assertTrue(IUs.size() == 1);
InstallableUnit iu = (InstallableUnit) IUs.get(0);
assertTrue(iu.getId().equalsIgnoreCase(flavor + id + ".configuration")); //$NON-NLS-1$
@@ -84,9 +83,9 @@ public class ANYConfigCUsActionTest extends ActionTest {
}
private void verifyFragment(String cuType) {
- ArrayList IUs = new ArrayList(publisherResult.getIUs(null, IPublisherResult.NON_ROOT));
+ ArrayList<IInstallableUnit> IUs = new ArrayList<>(publisherResult.getIUs(null, IPublisherResult.NON_ROOT));
for (int i = 0; i < IUs.size(); i++) {
- InstallableUnit iu = (InstallableUnit) IUs.get(i);
+ IInstallableUnit iu = IUs.get(i);
if (iu.getId().equals(flavor + id + "." + cuType + "." + configSpec)) { //$NON-NLS-1$ //$NON-NLS-2$
assertNull(iu.getFilter()); // no filter if config spec is ANY
@@ -115,7 +114,7 @@ public class ANYConfigCUsActionTest extends ActionTest {
private void verifyBundleCU() {
final String bundleCUId = flavor + configSpec + ORG_ECLIPSE_CORE_COMMANDS;
- IQueryResult queryResult = publisherResult.query(QueryUtil.createIUQuery(bundleCUId), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> queryResult = publisherResult.query(QueryUtil.createIUQuery(bundleCUId), new NullProgressMonitor());
assertEquals(1, queryResultSize(queryResult));
IInstallableUnitFragment fragment = (IInstallableUnitFragment) queryResult.iterator().next();
@@ -180,7 +179,7 @@ public class ANYConfigCUsActionTest extends ActionTest {
LauncherData launcherData = loader.getLauncherData();
LaunchingAdvice launchingAdvice = new LaunchingAdvice(launcherData, configSpec);
- ArrayList launchingList = new ArrayList();
+ ArrayList<IExecutableAdvice> launchingList = new ArrayList<>();
launchingList.add(launchingAdvice);
ProductFileAdvice productAdvice = null;
@@ -198,7 +197,7 @@ public class ANYConfigCUsActionTest extends ActionTest {
//configure IConfigAdvice
ConfigData configData = loader.getConfigData();
ConfigAdvice configAdvice = new ConfigAdvice(configData, configSpec);
- ArrayList configList = new ArrayList();
+ ArrayList<IConfigAdvice> configList = new ArrayList<>();
configList.add(configAdvice);
configList.add(productAdvice);
expect(publisherInfo.getAdvice(EasyMock.matches(configSpec), EasyMock.eq(false), (String) EasyMock.anyObject(), (Version) EasyMock.anyObject(), EasyMock.eq(IConfigAdvice.class))).andReturn(configList).anyTimes();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java
index 1c6913103..e47cb5268 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java
@@ -129,7 +129,7 @@ public class BundlesActionTest extends ActionTest {
PublisherResult results = new PublisherResult();
bundlesAction.perform(info, results, new NullProgressMonitor());
- Collection ius = results.getIUs(null, null);
+ Collection<IInstallableUnit> ius = results.getIUs(null, null);
assertEquals("1.0", 1, ius.size());
info = new PublisherInfo();
@@ -138,10 +138,10 @@ public class BundlesActionTest extends ActionTest {
bundlesAction.perform(info, results, new NullProgressMonitor());
ius = results.getIUs(null, null);
assertEquals("2.0", 1, ius.size());
- QueryableArray queryableArray = new QueryableArray((IInstallableUnit[]) ius.toArray(new IInstallableUnit[ius.size()]));
- IQueryResult result = queryableArray.query(QueryUtil.createIUQuery("foo"), null);
+ QueryableArray queryableArray = new QueryableArray(ius.toArray(new IInstallableUnit[ius.size()]));
+ IQueryResult<IInstallableUnit> result = queryableArray.query(QueryUtil.createIUQuery("foo"), null);
assertEquals("3.1", 1, queryResultSize(result));
- IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit iu = result.iterator().next();
TranslationSupport utils = new TranslationSupport();
utils.setTranslationSource(queryableArray);
assertEquals("3.2", "English Foo", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME));
@@ -150,10 +150,10 @@ public class BundlesActionTest extends ActionTest {
bundlesAction.perform(info, results, new NullProgressMonitor());
ius = results.getIUs(null, null);
assertEquals("2.0", 3, ius.size());
- queryableArray = new QueryableArray((IInstallableUnit[]) ius.toArray(new IInstallableUnit[ius.size()]));
+ queryableArray = new QueryableArray(ius.toArray(new IInstallableUnit[ius.size()]));
result = queryableArray.query(QueryUtil.createIUQuery("foo"), null);
assertEquals("2.1", 1, queryResultSize(result));
- iu = (IInstallableUnit) result.iterator().next();
+ iu = result.iterator().next();
utils.setTranslationSource(queryableArray);
assertEquals("2.2", "German Foo", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
}
@@ -261,7 +261,7 @@ public class BundlesActionTest extends ActionTest {
assertTrue(providedCapabilities.size() == 6 /*number of tested elements*/);
// check %bundle name is correct
- Map prop = bundle2IU.getProperties();
+ Map<String, String> prop = bundle2IU.getProperties();
assertTrue(prop.get("org.eclipse.equinox.p2.name").toString().equalsIgnoreCase("%bundleName"));//$NON-NLS-1$//$NON-NLS-2$
assertTrue(prop.get("org.eclipse.equinox.p2.provider").toString().equalsIgnoreCase("%providerName"));//$NON-NLS-1$//$NON-NLS-2$
@@ -356,7 +356,7 @@ public class BundlesActionTest extends ActionTest {
expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes();
expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_INDEX | IPublisherInfo.A_OVERWRITE | IPublisherInfo.A_PUBLISH).anyTimes();
- expect(publisherInfo.getAdvice(null, false, null, null, ICapabilityAdvice.class)).andReturn(new ArrayList()).anyTimes();
+ expect(publisherInfo.getAdvice(null, false, null, null, ICapabilityAdvice.class)).andReturn(new ArrayList<>()).anyTimes();
expectOtherAdviceQueries(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION);
expectPropertyAdviceQuery(TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION, sarProperties);
@@ -422,7 +422,7 @@ public class BundlesActionTest extends ActionTest {
}
private void expectPropertyAdviceQuery(String bundleName, Version bundleVersion, Map<String, String> answer) {
- List propertyAdvices;
+ List<IPropertyAdvice> propertyAdvices;
if (answer != null)
propertyAdvices = Collections.singletonList(createPropertyAdvice(answer));
else
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/DefaultCUsActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/DefaultCUsActionTest.java
index 20b101796..a5084cfb4 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/DefaultCUsActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/DefaultCUsActionTest.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This
+ * Copyright (c) 2008, 2017 Code 9 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:
+ *
+ * Contributors:
* Code 9 - initial API and implementation
* IBM - ongoing development
******************************************************************************/
@@ -18,7 +18,6 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.publisher.eclipse.DefaultCUsAction;
-@SuppressWarnings({"unchecked"})
public class DefaultCUsActionTest extends ActionTest {
private Version version = Version.create("1.0.0"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java
index 92f42d4e9..2e47923bb 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java
@@ -57,8 +57,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
BundlesAction action = new BundlesAction(new File[] {file});
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo German Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
@@ -68,8 +68,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
BundlesAction action = new BundlesAction(new File[] {file});
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo German Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
@@ -79,8 +79,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
BundlesAction action = new BundlesAction(new File[] {file});
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo German Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
@@ -90,8 +90,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
BundlesAction action = new BundlesAction(new File[] {file});
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo German Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
@@ -101,8 +101,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
BundlesAction action = new BundlesAction(new File[] {file});
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("barbundle"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("barbundle"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Bar German Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
assertEquals("1.1", "Bar German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
@@ -114,8 +114,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("barbundle2"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("barbundle2"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Bar German Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
assertEquals("1.1", "Bar German Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
@@ -127,8 +127,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("foobundle2"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("foobundle2"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo German Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
assertEquals("1.1", "Foo German Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
@@ -138,8 +138,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
BundlesAction action = new BundlesAction(new File[] {file});
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo English Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
@@ -149,8 +149,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
BundlesAction action = new BundlesAction(new File[] {file});
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo English Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
@@ -161,8 +161,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
BundlesAction action = new BundlesAction(new File[] {file});
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("foobundle"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo English Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
@@ -172,8 +172,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
BundlesAction action = new BundlesAction(new File[] {file});
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("barbundle"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("barbundle"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Bar English Bundle", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
assertEquals("1.1", "Bar English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
@@ -185,8 +185,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("barbundle2"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("barbundle2"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Bar English Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
assertEquals("1.1", "Bar English Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
@@ -198,8 +198,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("foobundle2"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("foobundle2"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo English Bundle - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
assertEquals("1.1", "Foo English Provider - Translated in the Fragment", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
@@ -209,8 +209,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
featuresAction.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.jar"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.jar"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo German Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
assertEquals("1.3", "Foo German Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.GERMAN.toString()));
@@ -223,8 +223,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
featuresAction.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.jar"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.jar"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME));
assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER));
assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION));
@@ -237,8 +237,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
featuresAction.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.jar"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.jar"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.ENGLISH.toString()));
@@ -251,8 +251,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
featuresAction.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.group"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.group"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo German Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
assertEquals("1.1", "Foo German Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
assertEquals("1.3", "Foo German Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.GERMAN.toString()));
@@ -265,8 +265,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
featuresAction.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.group"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.group"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME));
assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER));
assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION));
@@ -279,8 +279,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
FeaturesAction featuresAction = new FeaturesAction(new File[] {file});
featuresAction.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.group"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("fooFeature.feature.group"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "Foo English Feature", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
assertEquals("1.1", "Foo English Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
assertEquals("1.3", "Foo English Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.ENGLISH.toString()));
@@ -295,8 +295,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("barfragment2"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("barfragment2"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "German Fragment Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
assertEquals("1.1", "German Fragment Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.GERMAN.toString()));
}
@@ -308,8 +308,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
action.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("barfragment2"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("barfragment2"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "English Fragment Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
assertEquals("1.1", "English Fragment Provider", utils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER, Locale.ENGLISH.toString()));
}
@@ -324,8 +324,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
siteAction.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("foo.new_category_1"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("foo.new_category_1"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "German Category Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.GERMAN.toString()));
assertEquals("1.1", "German Category Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.GERMAN.toString()));
@@ -341,8 +341,8 @@ public class LocalizationTests extends AbstractProvisioningTest {
siteAction.perform(info, results, monitor);
TranslationSupport utils = getTranslationSupport();
- IQueryResult queryResult = results.query(QueryUtil.createIUQuery("foo.new_category_1"), monitor);
- IInstallableUnit iu = (IInstallableUnit) queryResult.iterator().next();
+ IQueryResult<IInstallableUnit> queryResult = results.query(QueryUtil.createIUQuery("foo.new_category_1"), monitor);
+ IInstallableUnit iu = queryResult.iterator().next();
assertEquals("1.0", "English Category Name", utils.getIUProperty(iu, IInstallableUnit.PROP_NAME, Locale.ENGLISH.toString()));
assertEquals("1.1", "English Category Description", utils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION, Locale.ENGLISH.toString()));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java
index a30ab6424..f7cd53df8 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java
@@ -36,7 +36,6 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.tests.TestData;
import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository;
-@SuppressWarnings({"unchecked"})
public class ProductActionTest extends ActionTest {
private static final String WIN_FILTER = "(& (osgi.ws=win32)(osgi.os=win32)(osgi.arch=x86))";
@@ -81,7 +80,7 @@ public class ProductActionTest extends ActionTest {
addContextIU("org.eclipse.platform.feature.group", "1.2.3");
performProductAction(productFile);
- Collection ius = publisherResult.getIUs("branded.product", IPublisherResult.NON_ROOT);
+ Collection<IInstallableUnit> ius = publisherResult.getIUs("branded.product", IPublisherResult.NON_ROOT);
assertEquals("1.0", 1, ius.size());
//TODO assert branding was done correctly
@@ -90,9 +89,9 @@ public class ProductActionTest extends ActionTest {
public void testLicense() throws Exception {
ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "productWithLicense.product").toString());
performProductAction(productFile);
- Collection ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
+ Collection<IInstallableUnit> ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
assertEquals("1.0", 1, ius.size());
- IInstallableUnit iu = (IInstallableUnit) ius.iterator().next();
+ IInstallableUnit iu = ius.iterator().next();
assertEquals("1.1", "http://www.example.com", iu.getLicenses().iterator().next().getLocation().toString());
assertEquals("1.2", "This is the liCenSE.", iu.getLicenses().iterator().next().getBody().trim());
}
@@ -100,9 +99,9 @@ public class ProductActionTest extends ActionTest {
public void testLicenseNoURL() throws Exception {
ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "licenseNoURL.product").toString());
performProductAction(productFile);
- Collection ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
+ Collection<IInstallableUnit> ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
assertEquals("1.0", 1, ius.size());
- IInstallableUnit iu = (IInstallableUnit) ius.iterator().next();
+ IInstallableUnit iu = ius.iterator().next();
assertEquals("1.1", "", iu.getLicenses().iterator().next().getLocation().toString());
assertEquals("1.2", "This is the liCenSE.", iu.getLicenses().iterator().next().getBody().trim());
}
@@ -110,9 +109,9 @@ public class ProductActionTest extends ActionTest {
public void testLicenseNoText() throws Exception {
ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "licenseNoText.product").toString());
performProductAction(productFile);
- Collection ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
+ Collection<IInstallableUnit> ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
assertEquals("1.0", 1, ius.size());
- IInstallableUnit iu = (IInstallableUnit) ius.iterator().next();
+ IInstallableUnit iu = ius.iterator().next();
assertEquals("1.1", "http://www.example.com", iu.getLicenses().iterator().next().getLocation().toString());
assertEquals("1.2", "", iu.getLicenses().iterator().next().getBody().trim());
}
@@ -120,9 +119,9 @@ public class ProductActionTest extends ActionTest {
public void testMissingLicense() throws Exception {
ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "productWithNoLicense.product").toString());
performProductAction(productFile);
- Collection ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
+ Collection<IInstallableUnit> ius = publisherResult.getIUs("licenseIU.product", IPublisherResult.NON_ROOT);
assertEquals("1.0", 1, ius.size());
- IInstallableUnit iu = (IInstallableUnit) ius.iterator().next();
+ IInstallableUnit iu = ius.iterator().next();
assertEquals(0, iu.getLicenses().size());
}
@@ -210,7 +209,7 @@ public class ProductActionTest extends ActionTest {
performProductAction(productFile);
- Collection advice = publisherInfo.getAdvice("carbon.macos.x86", false, null, null, IConfigAdvice.class);
+ Collection<IConfigAdvice> advice = publisherInfo.getAdvice("carbon.macos.x86", false, null, null, IConfigAdvice.class);
assertEquals("1.0", 1, advice.size());
}
@@ -264,13 +263,13 @@ public class ProductActionTest extends ActionTest {
IStatus status = testAction.perform(info, publisherResult, null);
assertThat(status, is(okStatus()));
- IQueryResult results = publisherResult.query(QueryUtil.createIUQuery("org.eclipse.platform.ide", Version.create("3.5.0.I20081118")), null);
+ IQueryResult<IInstallableUnit> results = publisherResult.query(QueryUtil.createIUQuery("org.eclipse.platform.ide", Version.create("3.5.0.I20081118")), null);
assertEquals("1.0", 1, queryResultSize(results));
- IInstallableUnit unit = (IInstallableUnit) results.iterator().next();
+ IInstallableUnit unit = results.iterator().next();
Collection<IRequirement> requiredCapabilities = unit.getRequirements();
IRequiredCapability capability = null;
- for (Iterator iterator = requiredCapabilities.iterator(); iterator.hasNext();) {
+ for (Iterator<IRequirement> iterator = requiredCapabilities.iterator(); iterator.hasNext();) {
IRequiredCapability req = (IRequiredCapability) iterator.next();
if (req.getName().equals("org.eclipse.platform.feature.group")) {
capability = req;
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 eb6b2b28e..e2eb29165 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2016 Cloudsmith Inc. and others.
+ * Copyright (c) 2009, 2017 Cloudsmith 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
@@ -67,20 +67,20 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testLatest() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/multipleversions1");
- IQueryResult result = repo.query(QueryUtil.createQuery("latest(x | x.id == $0)", "test.bundle"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createQuery("latest(x | x.id == $0)", "test.bundle"), new NullProgressMonitor());
assertTrue(queryResultSize(result) == 1);
}
public void testRange() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/multipleversions1");
- IQueryResult result = repo.query(QueryUtil.createMatchQuery("version ~= $0", new VersionRange("2.0.0")), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createMatchQuery("version ~= $0", new VersionRange("2.0.0")), new NullProgressMonitor());
assertEquals(queryResultSize(result), 2);
}
public void testProperty() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/multipleversions1");
- IQueryResult result = repo.query(QueryUtil.createMatchQuery("properties.exists(p | boolean(p.value))"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createMatchQuery("properties.exists(p | boolean(p.value))"), new NullProgressMonitor());
assertEquals(queryResultSize(result), 3);
result = repo.query(QueryUtil.createMatchQuery("boolean(properties['org.eclipse.equinox.p2.type.group'])"), new NullProgressMonitor());
@@ -96,7 +96,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
"parent.requirerements.unique(requirementsCache).select(rc | rc.filter == null || $2 ~= filter(rc.filter)), _, " + //
"{rcs, child | rcs.exists(rc | child ~= rc)})}).limit(10)";
- IContextExpression expr = factory.contextExpression(parser.parseQuery(exprString));
+ IContextExpression<Object> expr = factory.contextExpression(parser.parseQuery(exprString));
System.out.println(expr.toString());
assertEquals(exprString, expr.toString());
}
@@ -115,7 +115,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
// Create the query
IContextExpression<IInstallableUnit> e3 = factory.contextExpression(latest, "test.bundle", "org.eclipse.equinox.p2.type.group", "true");
IMetadataRepository repo = getMDR("/testData/metadataRepo/multipleversions1");
- IQueryResult result = repo.query(QueryUtil.createQuery(e3), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createQuery(e3), new NullProgressMonitor());
assertEquals(queryResultSize(result), 1);
}
@@ -127,20 +127,20 @@ public class EvaluatorTest extends AbstractProvisioningTest {
applicability[1][1] = MetadataFactory.createRequirement("org.eclipse.equinox.p2.flavor", "tooling", null, null, false, false);
IMetadataRepository repo = getMDR("/testData/metadataRepo/wsdlTestRepo");
- IQueryResult result = repo.query(QueryUtil.createMatchQuery("$0.exists(rcs | rcs.all(rc | this ~= rc))", (Object) applicability), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createMatchQuery("$0.exists(rcs | rcs.all(rc | this ~= rc))", (Object) applicability), new NullProgressMonitor());
assertEquals(queryResultSize(result), 3);
}
public void testPattern() throws Exception {
IProvidedCapability pc = MetadataFactory.createProvidedCapability("org.eclipse.equinox.p2.eclipse.type", "source", null);
IMetadataRepository repo = getMDR("/testData/metadataRepo/wsdlTestRepo");
- IQueryResult result = repo.query(QueryUtil.createMatchQuery("id ~= /tooling.*.default/", pc), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createMatchQuery("id ~= /tooling.*.default/", pc), new NullProgressMonitor());
assertEquals(queryResultSize(result), 3);
}
public void testLimit() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/wsdlTestRepo");
- IQueryResult result = repo.query(QueryUtil.createQuery("select(x | x.id ~= /tooling.*/).limit(1)"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createQuery("select(x | x.id ~= /tooling.*/).limit(1)"), new NullProgressMonitor());
assertEquals(queryResultSize(result), 1);
result = repo.query(QueryUtil.createQuery("select(x | x.id ~= /tooling.*/).limit($0)", Integer.valueOf(2)), new NullProgressMonitor());
@@ -149,7 +149,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testNot() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/wsdlTestRepo");
- IQueryResult result = repo.query(QueryUtil.createMatchQuery("!(id ~= /tooling.*/)"), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createMatchQuery("!(id ~= /tooling.*/)"), new NullProgressMonitor());
assertEquals(queryResultSize(result), 4);
}
@@ -175,7 +175,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testClassConstructor() throws Exception {
IMetadataRepository repo = getMDR("/testData/metadataRepo/wsdlTestRepo");
- IQueryResult result = repo.query(QueryUtil.createQuery(//
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createQuery(//
"select(x | x ~= class('org.eclipse.equinox.p2.metadata.IInstallableUnitFragment'))"), new NullProgressMonitor());
assertEquals(queryResultSize(result), 4);
repo = getMDR("/testData/galileoM7");
@@ -183,14 +183,14 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testTouchpoints() throws Exception {
IMetadataRepository repo = getMDR("/testData/galileoM7");
- IQueryResult result = repo.query(QueryUtil.createMatchQuery(//
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createMatchQuery(//
"touchpointType != null && touchpointType.id == 'org.eclipse.equinox.p2.osgi' && touchpointData.exists(t | t.instructions.exists(entry | entry.key == 'zipped'))"), new NullProgressMonitor());
assertEquals(queryResultSize(result), 616);
}
public void testTraverse() throws Exception {
IMetadataRepository repo = getMDR("/testData/galileoM7");
- IQueryResult result = repo.query(QueryUtil.createQuery(//
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createQuery(//
"select(x | x.id == $0 && x.version == $1).traverse(parent | parent.requirements.collect(rc | select(iu | iu ~= rc)).flatten())", //
"org.eclipse.sdk.feature.group", Version.create("3.5.0.v20090423-7Q7bA7DPR-wM38__Q4iRsmx9z0KOjbpx3AbyvXd-Uq7J2")), new NullProgressMonitor());
assertEquals(queryResultSize(result), 463);
@@ -198,7 +198,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testTraverseWithFilter() throws Exception {
// Add some filtering of requirements
- Map env = new Hashtable();
+ Map<String, String> env = new Hashtable<>();
env.put("osgi.os", "linux");
env.put("osgi.ws", "gtk");
env.put("osgi.arch", "x86");
@@ -237,15 +237,15 @@ public class EvaluatorTest extends AbstractProvisioningTest {
public void testMatchQueryInjectionInPredicate() throws Exception {
IMetadataRepository repo = getMDR("/testData/galileoM7");
- IMatchExpression<IInstallableUnit> expr = factory.matchExpression(parser.parse("iquery($0) || iquery($1)"), new MatchQuery() {
+ IMatchExpression<IInstallableUnit> expr = factory.matchExpression(parser.parse("iquery($0) || iquery($1)"), new MatchQuery<IInstallableUnit>() {
@Override
- public boolean isMatch(Object candidate) {
- return "true".equals(((IInstallableUnit) candidate).getProperty("org.eclipse.equinox.p2.type.category"));
+ public boolean isMatch(IInstallableUnit candidate) {
+ return "true".equals(candidate.getProperty("org.eclipse.equinox.p2.type.category"));
}
- }, new MatchQuery() {
+ }, new MatchQuery<IInstallableUnit>() {
@Override
- public boolean isMatch(Object candidate) {
- return "true".equals(((IInstallableUnit) candidate).getProperty("org.eclipse.equinox.p2.type.group"));
+ public boolean isMatch(IInstallableUnit candidate) {
+ return "true".equals(candidate.getProperty("org.eclipse.equinox.p2.type.group"));
}
});
IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createMatchQuery(expr), new NullProgressMonitor());
@@ -254,7 +254,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
static class MyObject {
String id;
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<>();
public MyObject(String id, String key, String value) {
this.id = id;
@@ -265,7 +265,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
return this.id;
}
- public Map getProperties() {
+ public Map<String, String> getProperties() {
return this.properties;
}
}
@@ -311,7 +311,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
return "true".equals(((IInstallableUnit) candidate).getProperty("org.eclipse.equinox.p2.type.group"));
}
});
- IQueryResult result = repo.query(QueryUtil.createQuery(expr), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createQuery(expr), new NullProgressMonitor());
assertEquals(queryResultSize(result), 497);
}
@@ -323,7 +323,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
PublisherResult results = new PublisherResult();
bundlesAction.perform(info, results, new NullProgressMonitor());
- Collection ius = results.getIUs(null, null);
+ Collection<IInstallableUnit> ius = results.getIUs(null, null);
assertEquals("1.0", 1, ius.size());
info = new PublisherInfo();
@@ -335,13 +335,13 @@ public class EvaluatorTest extends AbstractProvisioningTest {
bundlesAction.perform(info, results, new NullProgressMonitor());
ius = results.getIUs(null, null);
assertEquals("2.0", 3, ius.size());
- QueryableArray queryableArray = new QueryableArray((IInstallableUnit[]) ius.toArray(new IInstallableUnit[ius.size()]));
- IQueryResult result = queryableArray.query(QueryUtil.createIUQuery("foo"), null);
+ QueryableArray queryableArray = new QueryableArray(ius.toArray(new IInstallableUnit[ius.size()]));
+ IQueryResult<IInstallableUnit> result = queryableArray.query(QueryUtil.createIUQuery("foo"), null);
assertEquals("2.1", 1, queryResultSize(result));
IQuery<IInstallableUnit> lq = QueryUtil.createMatchQuery("translatedProperties[$0] ~= /German*/", new KeyWithLocale("org.eclipse.equinox.p2.name", Locale.GERMAN));
- Iterator itr = queryableArray.query(lq, new NullProgressMonitor()).iterator();
+ Iterator<IInstallableUnit> itr = queryableArray.query(lq, new NullProgressMonitor()).iterator();
assertTrue(itr.hasNext());
- assertEquals("2.8", "foo", ((IInstallableUnit) itr.next()).getId());
+ assertEquals("2.8", "foo", itr.next().getId());
assertFalse(itr.hasNext());
}
@@ -370,7 +370,7 @@ public class EvaluatorTest extends AbstractProvisioningTest {
* but it throws an unsupported operation exception
*/
// rt = rt.query(query2, null);
- Set set = rt.toSet();
+ Set<IInstallableUnit> set = rt.toSet();
set.addAll(rt1.toSet());
assertTrue("Query results are inconsistent.", set.size() == rt2.toSet().size());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java
index 73721be38..1418e754d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java
@@ -275,16 +275,16 @@ public class PerformanceTest extends AbstractProvisioningTest {
IMetadataRepository repo = getMDR("/testData/galileoM7");
IQueryResult<IInstallableUnit> r = repo.query(QueryUtil.createIUQuery("org.eclipse.sdk.feature.group", Version.create("3.5.0.v20090423-7Q7bA7DPR-wM38__Q4iRsmx9z0KOjbpx3AbyvXd-Uq7J2")), new NullProgressMonitor());
- Iterator itor = r.iterator();
+ Iterator<IInstallableUnit> itor = r.iterator();
assertTrue(itor.hasNext());
- IInstallableUnit[] roots = new IInstallableUnit[] {(IInstallableUnit) itor.next()};
+ IInstallableUnit[] roots = new IInstallableUnit[] {itor.next()};
- IQuery query = QueryUtil.createQuery( //
+ IQuery<IInstallableUnit> query = QueryUtil.createQuery( //
"$0.traverse(set(), _, { cache, parent | parent.requirements.unique(cache).select(rc | rc.filter == null || $1 ~= rc.filter).collect(rc | everything.select(iu | iu ~= rc)).flatten()})", roots, envIU);
long sliceTime = 0;
long traverseTime = 0;
- IQueryable slice = null;
+ IQueryable<IInstallableUnit> slice = null;
for (int idx = 0; idx < 100; ++idx) {
long startTime = System.currentTimeMillis();
r = repo.query(query, new NullProgressMonitor());
@@ -297,9 +297,9 @@ public class PerformanceTest extends AbstractProvisioningTest {
sliceTime += (System.currentTimeMillis() - startTime);
}
// Check the size of the last slice to verify that it's the same as the traverse size
- r = slice.query(new MatchQuery() {
+ r = slice.query(new MatchQuery<IInstallableUnit>() {
@Override
- public boolean isMatch(Object value) {
+ public boolean isMatch(IInstallableUnit value) {
return true;
}
}, new NullProgressMonitor());
@@ -325,12 +325,12 @@ public class PerformanceTest extends AbstractProvisioningTest {
IQueryResult<IInstallableUnit> r = repo.query(QueryUtil.createIUQuery("org.eclipse.sdk.ide"), new NullProgressMonitor());
IInstallableUnit[] roots = r.toArray(IInstallableUnit.class);
- IQuery query = QueryUtil.createQuery( //
+ IQuery<IInstallableUnit> query = QueryUtil.createQuery( //
"$0.traverse(set(), _, { cache, parent | parent.requirements.unique(cache).collect(rc | everything.select(iu | iu ~= rc)).flatten()})", roots, envIU);
long sliceTime = 0;
long traverseTime = 0;
- IQueryable slice = null;
+ IQueryable<IInstallableUnit> slice = null;
for (int idx = 0; idx < 10; ++idx) {
long startTime = System.currentTimeMillis();
r = repo.query(query, new NullProgressMonitor());
@@ -343,9 +343,9 @@ public class PerformanceTest extends AbstractProvisioningTest {
sliceTime += (System.currentTimeMillis() - startTime);
}
// Check the size of the last slice to verify that it's the same as the traverse size
- r = slice.query(new MatchQuery() {
+ r = slice.query(new MatchQuery<IInstallableUnit>() {
@Override
- public boolean isMatch(Object value) {
+ public boolean isMatch(IInstallableUnit value) {
return true;
}
}, new NullProgressMonitor());
@@ -367,7 +367,7 @@ public class PerformanceTest extends AbstractProvisioningTest {
return metadataManager.loadRepository(metadataRepo, new NullProgressMonitor());
}
- private IInstallableUnit[] gatherAvailableInstallableUnits(IQueryable queryable) {
+ private IInstallableUnit[] gatherAvailableInstallableUnits(IQueryable<IInstallableUnit> queryable) {
ArrayList<IInstallableUnit> list = new ArrayList<>();
IQueryResult<IInstallableUnit> matches = queryable.query(QueryUtil.createIUAnyQuery(), null);
for (Iterator<IInstallableUnit> it = matches.iterator(); it.hasNext();)
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
index d0a56fca9..2a1dfc8a9 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
@@ -39,7 +39,7 @@ import org.osgi.framework.Bundle;
public class AbstractReconcilerTest extends AbstractProvisioningTest {
public static final String VERIFIER_BUNDLE_ID = "org.eclipse.equinox.p2.tests.verifier";
protected static File output;
- protected static Set toRemove = new HashSet();
+ protected static Set<File> toRemove = new HashSet<>();
private static boolean initialized = false;
private static Properties archiveAndRepositoryProperties = null;
@@ -424,8 +424,8 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest {
boolean leaveDirty = Boolean.parseBoolean(TestActivator.getContext().getProperty("p2.tests.doNotClean"));
if (leaveDirty)
return;
- for (Iterator iter = toRemove.iterator(); iter.hasNext();) {
- File next = (File) iter.next();
+ for (Iterator<File> iter = toRemove.iterator(); iter.hasNext();) {
+ File next = iter.next();
delete(next);
}
output = null;
@@ -475,9 +475,9 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest {
*/
public boolean removeSite(Configuration configuration, String location) throws IOException, URISyntaxException {
File left = new File(new URI(location)).getCanonicalFile();
- List sites = configuration.getSites();
- for (Iterator iter = sites.iterator(); iter.hasNext();) {
- Site tempSite = (Site) iter.next();
+ List<Site> sites = configuration.getSites();
+ for (Iterator<Site> iter = sites.iterator(); iter.hasNext();) {
+ Site tempSite = iter.next();
String siteURL = tempSite.getUrl();
File right = new File(new URI(siteURL)).getCanonicalFile();
if (left.equals(right)) {
@@ -545,11 +545,11 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest {
* do.
*/
public void assertFeatureExists(String message, Configuration configuration, String id, String version) {
- List sites = configuration.getSites();
+ List<Site> sites = configuration.getSites();
assertNotNull(message, sites);
boolean found = false;
- for (Iterator iter = sites.iterator(); iter.hasNext();) {
- Site site = (Site) iter.next();
+ for (Iterator<Site> iter = sites.iterator(); iter.hasNext();) {
+ Site site = iter.next();
Feature[] features = site.getFeatures();
for (int i = 0; features != null && i < features.length; i++) {
if (id.equals(features[i].getId())) {
@@ -572,7 +572,7 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest {
SimpleProfileRegistry registry = new SimpleProfileRegistry(getAgent(), location, new SurrogateProfileHandler(getAgent()), false);
IProfile[] profiles = registry.getProfiles();
assertEquals("1.0 Should only be one profile in registry.", 1, profiles.length);
- IQueryResult queryResult = profiles[0].query(QueryUtil.createIUQuery(id, Version.create(version)), null);
+ IQueryResult<IInstallableUnit> queryResult = profiles[0].query(QueryUtil.createIUQuery(id, Version.create(version)), null);
return !queryResult.isEmpty();
}
@@ -581,9 +581,9 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest {
SimpleProfileRegistry registry = new SimpleProfileRegistry(getAgent(), location, new SurrogateProfileHandler(getAgent()), false);
IProfile[] profiles = registry.getProfiles();
assertEquals("1.0 Should only be one profile in registry.", 1, profiles.length);
- IQueryResult queryResult = profiles[0].query(QueryUtil.createIUQuery(id, Version.create(version)), null);
+ IQueryResult<IInstallableUnit> queryResult = profiles[0].query(QueryUtil.createIUQuery(id, Version.create(version)), null);
assertEquals("1.1 Should not have more than one IU wth the same ID and version.", 1, queryResultSize(queryResult));
- return (IInstallableUnit) queryResult.iterator().next();
+ return queryResult.iterator().next();
}
protected int runEclipse(String message, String[] args) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CleanupzipActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CleanupzipActionTest.java
index 1d5beacda..c54d25567 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CleanupzipActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CleanupzipActionTest.java
@@ -4,7 +4,7 @@
* 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
*******************************************************************************/
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryIUXMLActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryIUXMLActionTest.java
index 0c0e8a7d1..6142b7bf1 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryIUXMLActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryIUXMLActionTest.java
@@ -1,5 +1,5 @@
-/*******************************************************************************
-* Copyright (c) 2010 EclipseSource and others. All rights reserved. This
+/*******************************************************************************
+* Copyright (c) 2010, 2017 EclipseSource and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -20,9 +20,6 @@ import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.tests.*;
-/**
- *
- */
public class CategoryIUXMLActionTest extends AbstractProvisioningTest {
private TestMetadataRepository metadataRepository;
@@ -69,19 +66,19 @@ public class CategoryIUXMLActionTest extends AbstractProvisioningTest {
}
public void testIUCategoryCreation07() throws Exception {
- IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 1, queryResultSize(result));
}
private void doCategorySetTest() {
- IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 1, queryResultSize(result));
- IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit iu = result.iterator().next();
assertEquals("1.1", "Test Category Label", iu.getProperty(IInstallableUnit.PROP_NAME));
}
private void doCategoryNotSetTest() {
- IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 0, queryResultSize(result));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryXMLActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryXMLActionTest.java
index 1b069058f..1bbaaf17d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryXMLActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/CategoryXMLActionTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009, 2013 EclipseSource and others. All rights reserved. This
+* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -23,9 +23,6 @@ import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction;
import org.eclipse.equinox.p2.query.*;
import org.eclipse.equinox.p2.tests.*;
-/**
- *
- */
public class CategoryXMLActionTest extends AbstractProvisioningTest {
private TestMetadataRepository metadataRepository;
@@ -49,9 +46,9 @@ public class CategoryXMLActionTest extends AbstractProvisioningTest {
CategoryXMLAction action = new CategoryXMLAction(siteLocation, null);
action.perform(info, actionResult, getMonitor());
- IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 1, queryResultSize(result));
- IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit iu = result.iterator().next();
assertEquals("1.1", "Test Category Label", iu.getProperty(IInstallableUnit.PROP_NAME));
}
@@ -66,9 +63,9 @@ public class CategoryXMLActionTest extends AbstractProvisioningTest {
CategoryXMLAction action = new CategoryXMLAction(siteLocation, null);
action.perform(info, actionResult, getMonitor());
- IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 1, queryResultSize(result));
- IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit iu = result.iterator().next();
assertEquals("1.1", "Test Category Label", iu.getProperty(IInstallableUnit.PROP_NAME));
IQuery<IInstallableUnit> memberQuery = QueryUtil.createIUCategoryMemberQuery(iu);
@@ -87,9 +84,9 @@ public class CategoryXMLActionTest extends AbstractProvisioningTest {
CategoryXMLAction action = new CategoryXMLAction(siteLocation, null);
action.perform(info, actionResult, getMonitor());
- IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 1, queryResultSize(result));
- IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit iu = result.iterator().next();
assertEquals("1.1", "Test Category Label", iu.getProperty(IInstallableUnit.PROP_NAME));
IQuery<IInstallableUnit> memberQuery = QueryUtil.createIUCategoryMemberQuery(iu);
@@ -110,9 +107,9 @@ public class CategoryXMLActionTest extends AbstractProvisioningTest {
CategoryXMLAction action = new CategoryXMLAction(siteLocation, null);
action.perform(info, actionResult, getMonitor());
- IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 1, queryResultSize(result));
- IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit iu = result.iterator().next();
assertEquals("1.1", "Test Category Label", iu.getProperty(IInstallableUnit.PROP_NAME));
IQuery<IInstallableUnit> memberQuery = QueryUtil.createIUCategoryMemberQuery(iu);
@@ -135,9 +132,9 @@ public class CategoryXMLActionTest extends AbstractProvisioningTest {
CategoryXMLAction action = new CategoryXMLAction(siteLocation, null);
action.perform(info, actionResult, getMonitor());
- IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 1, queryResultSize(result));
- IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit iu = result.iterator().next();
assertEquals("1.1", "Uncategorized", iu.getProperty(IInstallableUnit.PROP_NAME));
IQuery<IInstallableUnit> memberQuery = QueryUtil.createIUCategoryMemberQuery(iu);
@@ -160,7 +157,7 @@ public class CategoryXMLActionTest extends AbstractProvisioningTest {
CategoryXMLAction action = new CategoryXMLAction(siteLocation, null);
action.perform(info, actionResult, getMonitor());
- IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 2, queryResultSize(result));
IInstallableUnit rootCategoryIu = null;
for (Object item : result) {
@@ -192,7 +189,7 @@ public class CategoryXMLActionTest extends AbstractProvisioningTest {
CategoryXMLAction action = new CategoryXMLAction(siteLocation, null);
action.perform(info, actionResult, getMonitor());
- IQueryResult result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> result = actionResult.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 4, queryResultSize(result));
IInstallableUnit rootCategoryIu = null;
for (Object item : result) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/LocalUpdatesiteTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/LocalUpdatesiteTest.java
index 8ff9991e6..51842901a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/LocalUpdatesiteTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/LocalUpdatesiteTest.java
@@ -49,11 +49,11 @@ public class LocalUpdatesiteTest extends AbstractProvisioningTest {
fail("0.99");
}
IMetadataRepository repository = getMetadataRepositoryManager().loadRepository(repoLocation.toURI(), new NullProgressMonitor());
- IQueryResult results = repository.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
+ IQueryResult<IInstallableUnit> results = repository.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
assertEquals("1.0", 1, queryResultSize(results));
- Iterator iter = results.iterator();
+ Iterator<IInstallableUnit> iter = results.iterator();
while (iter.hasNext()) {
- IInstallableUnit unit = (IInstallableUnit) iter.next();
+ IInstallableUnit unit = iter.next();
assertTrue("2.0", unit.getId().startsWith("fooQualifier"));
assertEquals("3.0", "Test Category Label", unit.getProperty(IInstallableUnit.PROP_NAME));
}
@@ -69,10 +69,10 @@ public class LocalUpdatesiteTest extends AbstractProvisioningTest {
}
IMetadataRepository repository = getMetadataRepositoryManager().loadRepository(repoLocation.toURI(), new NullProgressMonitor());
- IQueryResult results = repository.query(QueryUtil.createIUCategoryQuery(), new NullProgressMonitor());
- Iterator iter = results.iterator();
+ IQueryResult<IInstallableUnit> results = repository.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 = repository.query(memberQuery, new NullProgressMonitor());
Set<String> membersId = new HashSet<>();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
index 6bc17784c..5fddc9308 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
@@ -607,7 +607,7 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
}
assertTrue(buffer.toString().contains("Invalid site reference null in feature test.featurewithmissingupdateurl."));
IQuery<IInstallableUnit> query = QueryUtil.createIUQuery("test.featurewithmissingupdateurl.feature.group", Version.create("1.0.0"));
- IQueryResult result = metadataRepo.query(query, null);
+ IQueryResult<IInstallableUnit> result = metadataRepo.query(query, null);
assertEquals("1.0", 1, queryResultSize(result));
}
@@ -625,11 +625,11 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
fail("Can't load repository UpdateSite243422");
}
IQuery<IInstallableUnit> query = QueryUtil.createIUQuery("org.eclipse.jdt.astview.feature.feature.group", Version.create("1.0.1"));
- IQueryResult result = metadataRepo.query(query, null);
+ IQueryResult<IInstallableUnit> result = metadataRepo.query(query, null);
assertEquals("1.0", 1, queryResultSize(result));
- IInstallableUnit featureIU = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit featureIU = result.iterator().next();
Collection<IRequirement> required = featureIU.getRequirements();
- for (Iterator iterator = required.iterator(); iterator.hasNext();) {
+ for (Iterator<IRequirement> iterator = required.iterator(); iterator.hasNext();) {
IRequiredCapability req = (IRequiredCapability) iterator.next();
if (req.getName().equals("org.eclipse.ui.ide")) {
assertEquals("2.0", VersionRange.emptyRange, req.getRange());
@@ -647,9 +647,9 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
} catch (ProvisionException e) {
fail("Can't load repository UpdateSite240121");
}
- IQueryResult keys = artifactRepo.query(new ArtifactKeyQuery(null, "Plugin240121", null), null);
+ IQueryResult<IArtifactKey> keys = artifactRepo.query(new ArtifactKeyQuery(null, "Plugin240121", null), null);
assertEquals(1, queryResultSize(keys));
- IArtifactKey key = (IArtifactKey) keys.iterator().next();
+ IArtifactKey key = keys.iterator().next();
IStatus status = artifactRepo.getArtifact(artifactRepo.getArtifactDescriptors(key)[0], new ByteArrayOutputStream(500), new NullProgressMonitor());
if (!status.isOK())
fail("Can't get the expected artifact:" + key);
@@ -671,14 +671,14 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
fail("1.99", e);
return;
}
- IQueryResult result = repository.query(QueryUtil.createIUQuery("test.feature.feature.jar"), getMonitor());
+ IQueryResult<IInstallableUnit> result = repository.query(QueryUtil.createIUQuery("test.feature.feature.jar"), getMonitor());
assertTrue("1.0", !result.isEmpty());
- IInstallableUnit unit = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit unit = result.iterator().next();
Collection<ITouchpointData> data = unit.getTouchpointData();
assertEquals("1.1", 1, data.size());
- Map instructions = data.iterator().next().getInstructions();
+ Map<String, ITouchpointInstruction> instructions = data.iterator().next().getInstructions();
assertEquals("1.2", 1, instructions.size());
- assertEquals("1.3", "true", ((ITouchpointInstruction) instructions.get("zipped")).getBody());
+ assertEquals("1.3", "true", instructions.get("zipped").getBody());
}
/**

Back to the top