Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2009-12-30 21:31:27 +0000
committerPascal Rapicault2009-12-30 21:31:27 +0000
commit989885c414f9023587441eb7be43c5daba820550 (patch)
tree7709990dbe2fff1d3c4fa70989a51e6bb0e4371a
parent49a32611e5aee368aae03a6a63b15110703b7b02 (diff)
downloadrt.equinox.p2-989885c414f9023587441eb7be43c5daba820550.tar.gz
rt.equinox.p2-989885c414f9023587441eb7be43c5daba820550.tar.xz
rt.equinox.p2-989885c414f9023587441eb7be43c5daba820550.zip
change provided capability to collection
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/IUPropertyUtils.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java50
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/p2/touchpoint/eclipse/query/OSGiBundleQuery.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationGroup.java7
27 files changed, 106 insertions, 128 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java
index fa82681d0..a7bfe9851 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/QueryableArray.java
@@ -83,10 +83,8 @@ public class QueryableArray implements IQueryable<IInstallableUnit> {
namedCapabilityIndex = new HashMap<String, List<IUCapability>>();
for (IInstallableUnit iu : dataSet) {
- List<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities();
- int top = providedCapabilities.size();
- for (int i = 0; i < top; i++) {
- IProvidedCapability pc = providedCapabilities.get(i);
+ Collection<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities();
+ for (IProvidedCapability pc : providedCapabilities) {
String name = pc.getName();
List<IUCapability> iuCapabilities = namedCapabilityIndex.get(name);
if (iuCapabilities == null) {
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
index 8393a1c5a..e177819c3 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java
@@ -105,16 +105,15 @@ public abstract class MetadataWriter extends XMLWriter implements XMLConstants {
}
}
- protected void writeProvidedCapabilities(List<IProvidedCapability> capabilities) {
+ protected void writeProvidedCapabilities(Collection<IProvidedCapability> capabilities) {
if (capabilities != null && capabilities.size() > 0) {
start(PROVIDED_CAPABILITIES_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, capabilities.size());
- for (int i = 0; i < capabilities.size(); i++) {
- IProvidedCapability pc = capabilities.get(i);
+ for (IProvidedCapability capability : capabilities) {
start(PROVIDED_CAPABILITY_ELEMENT);
- attribute(NAMESPACE_ATTRIBUTE, pc.getNamespace());
- attribute(NAME_ATTRIBUTE, pc.getName());
- attribute(VERSION_ATTRIBUTE, pc.getVersion());
+ attribute(NAMESPACE_ATTRIBUTE, capability.getNamespace());
+ attribute(NAME_ATTRIBUTE, capability.getName());
+ attribute(VERSION_ATTRIBUTE, capability.getVersion());
end(PROVIDED_CAPABILITY_ELEMENT);
}
end(PROVIDED_CAPABILITIES_ELEMENT);
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java
index c198f411b..c2646a291 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java
@@ -134,7 +134,7 @@ public class InstallableUnit implements IInstallableUnit {
return properties().getProperty(key);
}
- public List<IProvidedCapability> getProvidedCapabilities() {
+ public Collection<IProvidedCapability> getProvidedCapabilities() {
return CollectionUtils.unmodifiableList(providedCapabilities);
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
index 05f995693..96c53dc73 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java
@@ -70,8 +70,8 @@ public class ResolvedInstallableUnit implements IInstallableUnit {
return original.getProperty(key, locale);
}
- public List<IProvidedCapability> getProvidedCapabilities() {
- List<IProvidedCapability> originalCapabilities = original.getProvidedCapabilities();
+ public Collection<IProvidedCapability> getProvidedCapabilities() {
+ Collection<IProvidedCapability> originalCapabilities = original.getProvidedCapabilities();
if (fragments.length == 0)
return originalCapabilities;
@@ -185,11 +185,11 @@ public class ResolvedInstallableUnit implements IInstallableUnit {
}
public boolean satisfies(IRequirement candidate) {
- List<IProvidedCapability> provides = getProvidedCapabilities();
- int top = provides.size();
- for (int i = 0; i < top; i++)
- if (provides.get(i).satisfies(candidate))
+ Collection<IProvidedCapability> provides = getProvidedCapabilities();
+ for (IProvidedCapability capability : provides) {
+ if (capability.satisfies(candidate))
return true;
+ }
return false;
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
index a65d13749..e27c1e946 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/provisional/p2/metadata/MetadataFactory.java
@@ -64,7 +64,7 @@ public class MetadataFactory {
public void addProvidedCapabilities(Collection<IProvidedCapability> additional) {
if (additional == null || additional.size() == 0)
return;
- List<IProvidedCapability> current = unit().getProvidedCapabilities();
+ Collection<IProvidedCapability> current = unit().getProvidedCapabilities();
ArrayList<IProvidedCapability> all = new ArrayList<IProvidedCapability>(additional.size() + current.size());
all.addAll(current);
all.addAll(additional);
@@ -90,7 +90,7 @@ public class MetadataFactory {
return unit().getId();
}
- public List<IProvidedCapability> getProvidedCapabilities() {
+ public Collection<IProvidedCapability> getProvidedCapabilities() {
return unit().getProvidedCapabilities();
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java
index c6048dba3..bc6f614bf 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IInstallableUnit.java
@@ -148,7 +148,7 @@ public interface IInstallableUnit extends IVersionedId, Comparable<IInstallableU
*/
public String getProperty(String key, String locale);
- public List<IProvidedCapability> getProvidedCapabilities();
+ public Collection<IProvidedCapability> getProvidedCapabilities();
public Collection<IRequirement> getRequiredCapabilities();
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
index 70ee2844a..ed474c9cd 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherAction.java
@@ -359,10 +359,9 @@ public abstract class AbstractPublisherAction implements IPublisherAction {
//process provided capabilities
IProvidedCapability[] providedAdvice = entry.getProvidedCapabilities(iu);
if (providedAdvice != null) {
- List<IProvidedCapability> current = iu.getProvidedCapabilities();
+ Collection<IProvidedCapability> current = iu.getProvidedCapabilities();
Set<IProvidedCapability> resultProvidedCapabilities = new HashSet<IProvidedCapability>(current);
- for (int j = 0; j < current.size(); j++) {
- IProvidedCapability currentProvidedCapability = current.get(j);
+ for (IProvidedCapability currentProvidedCapability : resultProvidedCapabilities) {
for (int k = 0; k < providedAdvice.length; k++) {
IProvidedCapability providedCapability = providedAdvice[k];
if (providedCapability.getNamespace().equals(currentProvidedCapability.getNamespace()) && providedCapability.getName().equals(currentProvidedCapability.getName())) {
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 ce9b376b1..8d4430b2e 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
@@ -481,7 +481,7 @@ public abstract class AbstractProvisioningTest extends TestCase {
InstallableUnitDescription desc = new MetadataFactory.InstallableUnitDescription();
Collection<IArtifactKey> originalArtifacts = prototype.getArtifacts();
desc.setArtifacts(originalArtifacts.toArray(new IArtifactKey[originalArtifacts.size()]));
- List<IProvidedCapability> originalCapabilities = prototype.getProvidedCapabilities();
+ Collection<IProvidedCapability> originalCapabilities = prototype.getProvidedCapabilities();
desc.setCapabilities(originalCapabilities.toArray(new IProvidedCapability[originalCapabilities.size()]));
desc.setCopyright(prototype.getCopyright());
desc.setFilter(prototype.getFilter() == null ? null : ((LDAPQuery) prototype.getFilter()).getFilter());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/IUPropertyUtils.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/IUPropertyUtils.java
index fbfa8e7b7..3bbfebd38 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/IUPropertyUtils.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/IUPropertyUtils.java
@@ -182,9 +182,10 @@ public class IUPropertyUtils {
boolean haveLocale = false;
if (object instanceof IInstallableUnitFragment) {
IInstallableUnitFragment fragment = (IInstallableUnitFragment) object;
- List<IProvidedCapability> provides = fragment.getProvidedCapabilities();
- for (int j = 0; j < provides.size() && !haveLocale; j++) {
- IProvidedCapability nextProvide = provides.get(j);
+ Collection<IProvidedCapability> provides = fragment.getProvidedCapabilities();
+ Iterator<IProvidedCapability> it = provides.iterator();
+ while (it.hasNext() && !haveLocale) {
+ IProvidedCapability nextProvide = it.next();
if (NAMESPACE_IU_LOCALIZATION.equals(nextProvide.getNamespace())) {
String providedLocale = nextProvide.getName();
if (providedLocale != null) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java
index 896e029b4..0131f07ad 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java
@@ -26,8 +26,8 @@ public class FragmentMethodTest extends TestCase {
private static final String TEST_REQUIRED = "testRequired";
IInstallableUnit iu1;
IInstallableUnit iu3;
- List<IProvidedCapability> iu1Caps;
- List<IProvidedCapability> iu3Caps;
+ Collection<IProvidedCapability> iu1Caps;
+ Collection<IProvidedCapability> iu3Caps;
protected void setUp() throws Exception {
super.setUp();
@@ -57,26 +57,24 @@ public class FragmentMethodTest extends TestCase {
}
public void testCapabilities() {
- List<IProvidedCapability> iuCapabilities = iu1Caps;
- List<IProvidedCapability> initialFragmentCapabilities = iu3Caps;
-
- List<IProvidedCapability> mergedCapabilities = iu1.getProvidedCapabilities();
- for (int i = 0; i < iuCapabilities.size(); i++) {
- FragmentTest.assertContainsWithEquals(mergedCapabilities, iuCapabilities.get(i));
+ Collection<IProvidedCapability> mergedCapabilities = iu1.getProvidedCapabilities();
+ for (IProvidedCapability capability : mergedCapabilities) {
+ FragmentTest.assertContainsWithEquals(mergedCapabilities, capability);
}
//The fragment property is not set
assertNull(iu1.getProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT));
//The fragment does not contain iu namespace
- for (int i = 0; i < initialFragmentCapabilities.size(); i++) {
- if (initialFragmentCapabilities.get(i).getNamespace().equals(IInstallableUnit.NAMESPACE_IU_ID)) {
- assertDoesNotContain(mergedCapabilities, initialFragmentCapabilities.get(i));
+ Collection<IProvidedCapability> initialFragmentCapabilities = iu3Caps;
+ for (IProvidedCapability capability : initialFragmentCapabilities) {
+ if (capability.getNamespace().equals(IInstallableUnit.NAMESPACE_IU_ID)) {
+ assertDoesNotContain(mergedCapabilities, capability);
break;
}
}
- assertEquals("The fragment capabilities should not change", initialFragmentCapabilities, iu3.getProvidedCapabilities(), false);
+ assertEquals("The fragment capabilities should not change", initialFragmentCapabilities, iu3.getProvidedCapabilities());
}
protected void assertEquals(String message, Object[] expected, Object[] actual) {
@@ -90,13 +88,7 @@ public class FragmentMethodTest extends TestCase {
assertEquals(message, expected[i], actual[i]);
}
- protected void assertEquals(String message, List<? extends Object> expected, List<? extends Object> actual, boolean orderImportant) {
- // if the order in the array must match exactly, then call the other method
- if (orderImportant) {
- assertEquals(message, expected, actual);
- return;
- }
- // otherwise use this method and check that the arrays are equal in any order
+ protected void assertEquals(String message, Collection<? extends Object> expected, Collection<? extends Object> actual) {
if (expected == null && actual == null)
return;
if (expected == actual)
@@ -105,23 +97,13 @@ public class FragmentMethodTest extends TestCase {
assertTrue(message + ".1", false);
if (expected.size() != actual.size())
assertTrue(message + ".2", false);
- boolean[] found = new boolean[expected.size()];
- for (int i = 0; i < expected.size(); i++) {
- for (int j = 0; j < expected.size(); j++) {
- if (!found[j] && expected.get(i).equals(actual.get(j)))
- found[j] = true;
- }
- }
- for (int i = 0; i < found.length; i++)
- if (!found[i])
- assertTrue(message + ".3." + i, false);
+ if (!expected.containsAll(actual))
+ fail(message + ".3");
}
- public static void assertDoesNotContain(List<? extends Object> objects, Object searched) {
- for (int i = 0; i < objects.size(); i++) {
- if (objects.get(i).equals(searched))
- throw new AssertionFailedError("The array should not contain the searched element");
- }
+ public static void assertDoesNotContain(Collection<? extends Object> objects, Object searched) {
+ if (objects.contains(searched))
+ throw new AssertionFailedError("The array should not contain the searched element");
}
public void testProperties() {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java
index 57c66fbd6..5a6671347 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentTest.java
@@ -87,9 +87,8 @@ public class FragmentTest extends AbstractProvisioningTest {
public void testDefaultIUCapability() {
IInstallableUnit iu = createEclipseIU("ui.test1");
- List<IProvidedCapability> cap = iu.getProvidedCapabilities();
- for (int i = 0; i < cap.size(); i++) {
- IProvidedCapability c = cap.get(i);
+ Collection<IProvidedCapability> capabilities = iu.getProvidedCapabilities();
+ for (IProvidedCapability c : capabilities) {
if (c.getNamespace().equals(IInstallableUnit.NAMESPACE_IU_ID)) {
assertEquals(c.getNamespace(), IInstallableUnit.NAMESPACE_IU_ID);
assertEquals(c.getName(), iu.getId());
@@ -107,11 +106,10 @@ public class FragmentTest extends AbstractProvisioningTest {
throw new AssertionFailedError("The array does not contain the searched element");
}
- public static void assertContainsWithEquals(List<? extends Object> objects, Object searched) {
- for (int i = 0; i < objects.size(); i++) {
- if (objects.get(i).equals(searched))
- return;
- }
+ public static void assertContainsWithEquals(Collection<? extends Object> objects, Object searched) {
+ if (objects.contains(searched))
+ return;
+
throw new AssertionFailedError("The array does not contain the searched element");
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java
index e70c5e82b..3038db4ad 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java
@@ -344,11 +344,11 @@ public class IUPatchPersistenceTest extends AbstractProvisioningTest {
}
private static String[][] extractProvides(IInstallableUnit iu) {
- List<IProvidedCapability> provydes = iu.getProvidedCapabilities();
+ Collection<IProvidedCapability> provydes = iu.getProvidedCapabilities();
String[][] tuples = new String[provydes.size()][3];
- for (int i = 0; i < provydes.size(); i++) {
- IProvidedCapability next = provydes.get(i);
- tuples[i] = new String[] {next.getNamespace(), next.getName(), next.getVersion().toString()};
+ int i = 0;
+ for (IProvidedCapability capability : provydes) {
+ tuples[i++] = new String[] {capability.getNamespace(), capability.getName(), capability.getVersion().toString()};
}
return tuples;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
index 241eb1de0..8146a6703 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java
@@ -232,11 +232,11 @@ public class IUPersistenceTest extends AbstractProvisioningTest {
}
private static String[][] extractProvides(IInstallableUnit iu) {
- List<IProvidedCapability> provydes = iu.getProvidedCapabilities();
+ Collection<IProvidedCapability> provydes = iu.getProvidedCapabilities();
String[][] tuples = new String[provydes.size()][3];
- for (int i = 0; i < provydes.size(); i++) {
- IProvidedCapability next = provydes.get(i);
- tuples[i] = new String[] {next.getNamespace(), next.getName(), next.getVersion().toString()};
+ int i = 0;
+ for (IProvidedCapability capability : provydes) {
+ tuples[i++] = new String[] {capability.getNamespace(), capability.getName(), capability.getVersion().toString()};
}
return tuples;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
index 1ef4946ba..3078b2476 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
@@ -681,7 +681,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
IInstallableUnit spiUnit = (IInstallableUnit) queryResult.iterator().next();
assertTrue("Repo contains SPI IU)", spiUnit instanceof SPIInstallableUnit);
assertEquals(spiUnit.getProvidedCapabilities().size(), 1);
- assertTrue(spiUnit.getProvidedCapabilities().get(0) instanceof ProvidedCapability);
+ assertTrue(spiUnit.getProvidedCapabilities().iterator().next() instanceof ProvidedCapability);
repo = manager.refreshRepository(repoLocation.toURI(), null);
queryResult = repo.query(new AllAcceptingQuery(), new NullProgressMonitor());
@@ -691,7 +691,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
IInstallableUnit defaultUnit = (IInstallableUnit) queryResult.iterator().next();
assertTrue("Repo contains SPI IU)", defaultUnit instanceof InstallableUnit);
assertEquals(spiUnit.getProvidedCapabilities().size(), 1);
- assertTrue(spiUnit.getProvidedCapabilities().get(0) instanceof ProvidedCapability);
+ assertTrue(spiUnit.getProvidedCapabilities().iterator().next() instanceof ProvidedCapability);
}
/**
@@ -808,11 +808,11 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
assertEquals(((IRequiredCapability) unit.getRequiredCapabilities().iterator().next()).getName(), spiRequiredCapability.getName());
assertEquals(((IRequiredCapability) unit.getRequiredCapabilities().iterator().next()).getMin(), spiRequiredCapability.getMin());
assertEquals(((IRequiredCapability) unit.getRequiredCapabilities().iterator().next()).getMax(), spiRequiredCapability.getMax());
- assertEquals(unit.getProvidedCapabilities().get(0), spiProvidedCapability);
+ assertEquals(unit.getProvidedCapabilities().iterator().next(), spiProvidedCapability);
assertEquals(unit.getTouchpointData().get(0), spiTouchpointData);
assertEquals(unit.getTouchpointType(), spiTouchpointType);
assertEquals(unit.getLicenses().get(0), spiLicense);
- assertEquals(spiProvidedCapability, unit.getProvidedCapabilities().get(0));
+ assertEquals(spiProvidedCapability, unit.getProvidedCapabilities().iterator().next());
assertEquals(spiTouchpointData, unit.getTouchpointData().get(0));
assertEquals(spiTouchpointType, unit.getTouchpointType());
assertEquals(spiLicense, unit.getLicenses().get(0));
@@ -825,7 +825,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
// been refreshed, and re-parsed, thus using the default implementations.
assertFalse(spiTouchpointData == unit.getTouchpointData().get(0));
assertFalse(spiRequiredCapability == unit.getRequiredCapabilities().iterator().next());
- assertFalse(spiProvidedCapability == unit.getProvidedCapabilities().get(0));
+ assertFalse(spiProvidedCapability == unit.getProvidedCapabilities().iterator().next());
assertFalse(spiTouchpointType == unit.getTouchpointType());
assertFalse(spiLicense == unit.getLicenses().get(0));
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java
index 0f405cef4..68d26ac88 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java
@@ -89,7 +89,7 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
action.testProcessCapabilityAdvice(iu, info);
assertEquals("name1", ((IRequiredCapability) iu.getRequiredCapabilities().iterator().next()).getName());
- assertEquals("name2", iu.getProvidedCapabilities().get(0).getName());
+ assertEquals("name2", iu.getProvidedCapabilities().iterator().next().getName());
assertEquals("name3", ((IRequiredCapability) iu.getMetaRequiredCapabilities().iterator().next()).getName());
}
@@ -146,7 +146,7 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
iu.setCapabilities(new IProvidedCapability[] {MetadataFactory.createProvidedCapability("ns2", "name2", null)});
iu.setMetaRequiredCapabilities(createRequiredCapabilities("ns3", "name3", null, ""));
- assertNotSame(9, Version.toOSGiVersion(iu.getProvidedCapabilities().get(0).getVersion()).getMajor());
+ assertNotSame(9, Version.toOSGiVersion(iu.getProvidedCapabilities().iterator().next().getVersion()).getMajor());
assertTrue(iu.getRequiredCapabilities().iterator().next().isGreedy());
assertTrue(iu.getMetaRequiredCapabilities().iterator().next().isGreedy());
@@ -159,7 +159,7 @@ public class AbstractPublisherActionTest extends AbstractProvisioningTest {
TestAction action = new TestAction();
action.testProcessCapabilityAdvice(iu, info);
- assertEquals(9, Version.toOSGiVersion(iu.getProvidedCapabilities().get(0).getVersion()).getMajor());
+ assertEquals(9, Version.toOSGiVersion(iu.getProvidedCapabilities().iterator().next().getVersion()).getMajor());
assertFalse(iu.getRequiredCapabilities().iterator().next().isGreedy());
assertFalse(iu.getMetaRequiredCapabilities().iterator().next().isGreedy());
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java
index 1a2536666..104d2d261 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java
@@ -57,9 +57,8 @@ public abstract class ActionTest extends AbstractProvisioningTest {
return (String[]) result.toArray(new String[result.size()]);
}
- protected void verifyProvidedCapability(List<IProvidedCapability> prov, String namespace, String name, Version version) {
- for (int i = 0; i < prov.size(); i++) {
- IProvidedCapability pc = prov.get(i);
+ protected void verifyProvidedCapability(Collection<IProvidedCapability> prov, String namespace, String name, Version version) {
+ for (IProvidedCapability pc : prov) {
if (pc.getName().equalsIgnoreCase(name) && pc.getNamespace().equalsIgnoreCase(namespace) && pc.getVersion().equals(version))
return; // pass
}
@@ -110,9 +109,8 @@ public abstract class ActionTest extends AbstractProvisioningTest {
return map;
}
- protected void contains(List<IProvidedCapability> capabilities, String namespace, String name, Version version) {
- for (int i = 0; i < capabilities.size(); i++) {
- IProvidedCapability capability = capabilities.get(i);
+ protected void contains(Collection<IProvidedCapability> capabilities, String namespace, String name, Version version) {
+ for (IProvidedCapability capability : capabilities) {
if (capability.getNamespace().equals(namespace) && capability.getName().equals(name) && capability.getVersion().equals(version))
return;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
index 002f65d7d..8e72f9ee6 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceFileParserTest.java
@@ -321,14 +321,17 @@ public class AdviceFileParserTest extends TestCase {
assertEquals(false, req1.isGreedy());
assertEquals(1, req1.getMin());
- List<IProvidedCapability> provided = iu1.getProvidedCapabilities();
+ Collection<IProvidedCapability> provided = iu1.getProvidedCapabilities();
+ Iterator<IProvidedCapability> it4 = provided.iterator();
+ IProvidedCapability cap1 = it4.next();
+ IProvidedCapability cap2 = it4.next();
assertEquals(2, provided.size());
- assertEquals("testNamespace1", provided.get(0).getNamespace());
- assertEquals("testName1", provided.get(0).getName());
- assertEquals(Version.create("1.2.3"), provided.get(0).getVersion());
- assertEquals("testNamespace2", provided.get(1).getNamespace());
- assertEquals("testName2", provided.get(1).getName());
- assertEquals(Version.emptyVersion, provided.get(1).getVersion());
+ assertEquals("testNamespace1", cap1.getNamespace());
+ assertEquals("testName1", cap1.getName());
+ assertEquals(Version.create("1.2.3"), cap1.getVersion());
+ assertEquals("testNamespace2", cap2.getNamespace());
+ assertEquals("testName2", cap2.getName());
+ assertEquals(Version.emptyVersion, cap2.getVersion());
Collection<IRequirement> metarequirements = iu1.getMetaRequiredCapabilities();
assertEquals(2, metarequirements.size());
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 a18c134d2..8e7aadbc4 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
@@ -192,7 +192,7 @@ public class BundlesActionTest extends ActionTest {
assertEquals("2.0", 1, requiredCapability.size());
// check provided capabilities
- List<IProvidedCapability> providedCapabilities = bundle1IU.getProvidedCapabilities();
+ Collection<IProvidedCapability> providedCapabilities = bundle1IU.getProvidedCapabilities();
verifyProvidedCapability(providedCapabilities, PROVBUNDLE_NAMESPACE, TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION);
verifyProvidedCapability(providedCapabilities, OSGI, TEST1_PROVBUNDLE_NAME, BUNDLE1_VERSION);
verifyProvidedCapability(providedCapabilities, TEST1_PROVZ_NAMESPACE, TEST1_PROVZ_NAME, TEST2_PROVZ_VERSION);
@@ -229,7 +229,7 @@ public class BundlesActionTest extends ActionTest {
assertTrue(requiredCapabilities.size() == 3 /*number of tested elements*/);
// check provided capabilities
- List<IProvidedCapability> providedCapabilities = bundle2IU.getProvidedCapabilities();
+ Collection<IProvidedCapability> providedCapabilities = bundle2IU.getProvidedCapabilities();
verifyProvidedCapability(providedCapabilities, PROVBUNDLE_NAMESPACE, TEST2_PROVBUNDLE_NAME, PROVBUNDLE2_VERSION);
verifyProvidedCapability(providedCapabilities, OSGI, TEST2_PROVBUNDLE_NAME, BUNDLE2_VERSION);
verifyProvidedCapability(providedCapabilities, TEST2_PROVZ_NAMESPACE, TEST2_PROVZ_NAME, TEST2_PROVZ_VERSION);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java
index ac93d107d..fc3afa820 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java
@@ -13,8 +13,7 @@ package org.eclipse.equinox.p2.tests.publisher.actions;
import static org.easymock.EasyMock.expect;
import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
import org.easymock.EasyMock;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
@@ -60,7 +59,7 @@ public class ConfigCUsActionTest extends ActionTest {
assertTrue(iu.getId().equalsIgnoreCase(flavor + id + ".configuration")); //$NON-NLS-1$
//verify ProvidedCapabilities
- List<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities();
+ Collection<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities();
verifyProvidedCapability(providedCapabilities, "org.eclipse.equinox.p2.iu", iu.getId(), version); //$NON-NLS-1$
// verifyProvidedCapability(providedCapabilities, flavor + id, id + ".config", version); //$NON-NLS-1$
assertTrue(providedCapabilities.size() == 1);
@@ -85,7 +84,7 @@ public class ConfigCUsActionTest extends ActionTest {
assertTrue(((LDAPQuery) iu.getFilter()).getFilter().equals("(& (osgi.ws=win32)(osgi.os=win32)(osgi.arch=x86))")); //$NON-NLS-1$
assertTrue(iu.getVersion().equals(version));
assertFalse(iu.isSingleton());
- List<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities();
+ Collection<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities();
verifyProvidedCapability(providedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, flavor + id + "." + cuType + "." + configSpec, version); //$NON-NLS-1$//$NON-NLS-2$
verifyProvidedCapability(providedCapabilities, flavor + id, id + "." + cuType, version); //$NON-NLS-1$
assertTrue(providedCapabilities.size() == 2);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
index f532acd5c..e8b83ee5b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java
@@ -92,7 +92,7 @@ public class EquinoxExecutableActionTest extends ActionTest {
IInstallableUnit possibleEclipse = (IInstallableUnit) iuList.get(i);
if (possibleEclipse.getId().equals(flavorArg + idBase + ".executable." + configSpec)) {//$NON-NLS-1$
IInstallableUnitFragment fragment = (IInstallableUnitFragment) iuList.get(i);
- List<IProvidedCapability> providedCapability = fragment.getProvidedCapabilities();
+ Collection<IProvidedCapability> providedCapability = fragment.getProvidedCapabilities();
verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, flavorArg + idBase + ".executable." + configSpec, version); //$NON-NLS-1$
assertTrue(providedCapability.size() == 1);
Collection<IRequirement> requiredCapability = fragment.getRequiredCapabilities();
@@ -112,7 +112,7 @@ public class EquinoxExecutableActionTest extends ActionTest {
IInstallableUnit possibleEclipse = (IInstallableUnit) iuList.get(i);
if (possibleEclipse.getId().equals((idBase + ".executable." + configSpec + ".eclipse"))) { //$NON-NLS-1$//$NON-NLS-2$
assertTrue(possibleEclipse.getVersion().equals(version));
- List<IProvidedCapability> providedCapability = possibleEclipse.getProvidedCapabilities();
+ Collection<IProvidedCapability> providedCapability = possibleEclipse.getProvidedCapabilities();
verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + configSpec + ".eclipse", version); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(providedCapability.size() == 1);
Collection<IRequirement> req = possibleEclipse.getRequiredCapabilities();
@@ -138,7 +138,7 @@ public class EquinoxExecutableActionTest extends ActionTest {
assertTrue(eKey.getClassifier().equals("binary")); //$NON-NLS-1$
assertTrue(eKey.getId().equals(idBase + ".executable." + configSpec)); //$NON-NLS-1$
assertTrue(eKey.getVersion().equals(version));
- List<IProvidedCapability> providedCapabilities = possibleExec.getProvidedCapabilities();
+ Collection<IProvidedCapability> providedCapabilities = possibleExec.getProvidedCapabilities();
verifyProvidedCapability(providedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + configSpec, version); //$NON-NLS-1$
verifyProvidedCapability(providedCapabilities, flavorArg + idBase, idBase + ".executable", version); //$NON-NLS-1$
assertTrue(providedCapabilities.size() == 2);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java
index 60e70d7bb..fa89c54af 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java
@@ -67,7 +67,7 @@ public class EquinoxLauncherCUActionTest extends ActionTest {
verifyRequiredCapability(iu.getRequiredCapabilities(), PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "bundle", new VersionRange(Version.create("1.0.0"), true, Version.create("2.0.0"), false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
assertTrue(iu.getRequiredCapabilities().size() == 2);
- List<IProvidedCapability> cap = iu.getProvidedCapabilities();
+ Collection<IProvidedCapability> cap = iu.getProvidedCapabilities();
verifyProvidedCapability(cap, IInstallableUnit.NAMESPACE_IU_ID, flavorArg + "org.eclipse.equinox.launcher", Version.emptyVersion); //$NON-NLS-1$
verifyProvidedCapability(cap, "org.eclipse.equinox.p2.flavor", flavorArg, Version.create("1.0.0")); //$NON-NLS-1$//$NON-NLS-2$
assertTrue(cap.size() == 2);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
index 3c46548cd..bda2ea0e3 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java
@@ -102,7 +102,7 @@ public class FeaturesActionTest extends ActionTest {
Collection<IRequirement> fooRequiredCapabilities = foo.getRequiredCapabilities();
assertTrue(fooRequiredCapabilities.size() == 0);
- List<IProvidedCapability> fooProvidedCapabilities = foo.getProvidedCapabilities();
+ Collection<IProvidedCapability> fooProvidedCapabilities = foo.getProvidedCapabilities();
contains(fooProvidedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "foo.feature.jar", fooVersion); //$NON-NLS-1$
contains(fooProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", fooVersion); //$NON-NLS-1$
contains(fooProvidedCapabilities, "org.eclipse.update.feature", FOO, fooVersion); //$NON-NLS-1$
@@ -155,7 +155,7 @@ public class FeaturesActionTest extends ActionTest {
assertTrue(barRequiredCapabilities.size() == 0);
- List<IProvidedCapability> barProvidedCapabilities = bar.getProvidedCapabilities();
+ Collection<IProvidedCapability> barProvidedCapabilities = bar.getProvidedCapabilities();
contains(barProvidedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar.feature.jar", barVersion); //$NON-NLS-1$
contains(barProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", fooVersion); //$NON-NLS-1$
contains(barProvidedCapabilities, "org.eclipse.update.feature", BAR, barVersion); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java
index a32bc6a83..4abb0ff55 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java
@@ -81,7 +81,7 @@ public class JREActionTest extends ActionTest {
assertTrue(foo.getTouchpointType().getVersion().equals(Version.create("1.0.0"))); //$NON-NLS-1$
// check provided capabilities
- List<IProvidedCapability> fooProvidedCapabilities = foo.getProvidedCapabilities();
+ Collection<IProvidedCapability> fooProvidedCapabilities = foo.getProvidedCapabilities();
assertTrue(fooProvidedCapabilities.size() == numProvidedCapabilities);
ArrayList barIUs = new ArrayList(publisherResult.getIUs("config." + id, IPublisherResult.ROOT)); //$NON-NLS-1$
@@ -97,7 +97,7 @@ public class JREActionTest extends ActionTest {
verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, id, new VersionRange(JREVersion, true, Version.MAX_VERSION, true)); //$NON-NLS-1$
assertTrue(requiredCapability.size() == 1);
- List<IProvidedCapability> providedCapability = bar.getProvidedCapabilities();
+ Collection<IProvidedCapability> providedCapability = bar.getProvidedCapabilities();
verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, "config." + id, JREVersion); //$NON-NLS-1$
assertTrue(providedCapability.size() == 1);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java
index 4c68bbe7e..cfcb572dc 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java
@@ -12,7 +12,8 @@ package org.eclipse.equinox.p2.tests.updatesite;
import java.io.File;
import java.net.URI;
-import java.util.*;
+import java.util.Collection;
+import java.util.Iterator;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.updatesite.SiteXMLAction;
@@ -58,10 +59,10 @@ public class SiteXMLActionTest extends AbstractProvisioningTest {
assertTrue("1.0", unit.getId().startsWith(sitelocation));
assertEquals("2.0", "Test Category Label", unit.getProperty(IInstallableUnit.PROP_NAME));
- List<IProvidedCapability> provided = unit.getProvidedCapabilities();
+ Collection<IProvidedCapability> provided = unit.getProvidedCapabilities();
assertEquals(1, provided.size());
- assertTrue(provided.get(0).getName().startsWith(sitelocation));
- assertEquals(provided.get(0).getVersion(), unit.getVersion());
+ assertTrue(provided.iterator().next().getName().startsWith(sitelocation));
+ assertEquals(provided.iterator().next().getVersion(), unit.getVersion());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF
index 75ff28244..15193935b 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/META-INF/MANIFEST.MF
@@ -37,10 +37,10 @@ Import-Package: javax.xml.parsers,
org.osgi.util.tracker;version="1.3.0",
org.w3c.dom,
org.xml.sax
-Export-Package: org.eclipse.equinox.internal.p2.touchpoint.eclipse;x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.extensionlocation",
- org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;x-internal:=true,
- org.eclipse.equinox.internal.p2.update;x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.extensionlocation,org.eclipse.equinox.p2.directorywatcher",
- org.eclipse.equinox.p2.touchpoint.eclipse.query
+Export-Package: org.eclipse.equinox.internal.p2.touchpoint.eclipse;version="2.0.0";x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.extensionlocation",
+ org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions;version="2.0.0";x-internal:=true,
+ org.eclipse.equinox.internal.p2.update;version="2.0.0";x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.extensionlocation,org.eclipse.equinox.p2.directorywatcher",
+ org.eclipse.equinox.p2.touchpoint.eclipse.query;version="2.0.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
J2SE-1.4,
CDC-1.1/Foundation-1.1
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/p2/touchpoint/eclipse/query/OSGiBundleQuery.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/p2/touchpoint/eclipse/query/OSGiBundleQuery.java
index 6d1afa235..af14204d8 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/p2/touchpoint/eclipse/query/OSGiBundleQuery.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/p2/touchpoint/eclipse/query/OSGiBundleQuery.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.p2.touchpoint.eclipse.query;
-import java.util.List;
+import java.util.Collection;
import org.eclipse.equinox.internal.provisional.p2.metadata.IProvidedCapability;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.MatchQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -31,10 +31,9 @@ public class OSGiBundleQuery extends MatchQuery<IInstallableUnit> {
* @return <tt>true</tt> if the parameter describes an OSGi bundle.
*/
public static boolean isOSGiBundle(IInstallableUnit iu) {
- List<IProvidedCapability> provided = iu.getProvidedCapabilities();
- int sz = provided.size();
- for (int i = 0; i < sz; i++) {
- if (provided.get(i).getNamespace().equals("osgi.bundle")) { //$NON-NLS-1$
+ Collection<IProvidedCapability> provided = iu.getProvidedCapabilities();
+ for (IProvidedCapability capability : provided) {
+ if (capability.getNamespace().equals("osgi.bundle")) { //$NON-NLS-1$
return true;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationGroup.java b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationGroup.java
index 474f628ea..591c9d1ba 100644
--- a/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui.admin/src/org/eclipse/equinox/internal/p2/ui/admin/dialogs/IUImplementationGroup.java
@@ -169,10 +169,11 @@ public class IUImplementationGroup extends IUGroup {
items[j++] = req.toString();
}
requiredCapabilities.setItems(items);
- java.util.List<IProvidedCapability> prov = iu.getProvidedCapabilities();
+ Collection<IProvidedCapability> prov = iu.getProvidedCapabilities();
items = new String[prov.size()];
- for (int i = 0; i < prov.size(); i++) {
- items[i] = prov.get(i).toString();
+ int i = 0;
+ for (IProvidedCapability capability : prov) {
+ items[i++] = capability.toString();
}
providedCapabilities.setItems(items);
}

Back to the top