diff options
author | Todor Boev | 2017-10-02 16:06:00 +0000 |
---|---|---|
committer | Todor Boev | 2017-10-04 13:26:14 +0000 |
commit | 1c02b17b8348fc8a3e04a05db1240a28ecc352cf (patch) | |
tree | ed7666b5190cdd77cbb2d9859396b5a19a0c79a8 /bundles/org.eclipse.equinox.p2.tests | |
parent | 719079bb53131a19435e345b0e58228dedb75dbc (diff) | |
download | rt.equinox.p2-1c02b17b8348fc8a3e04a05db1240a28ecc352cf.tar.gz rt.equinox.p2-1c02b17b8348fc8a3e04a05db1240a28ecc352cf.tar.xz rt.equinox.p2-1c02b17b8348fc8a3e04a05db1240a28ecc352cf.zip |
Bug 313553 - Unentangle ProvidedCapability members and attributes
The members are the generic way for p2 queries to describe getters
on objects. The capability attributes then participate in queries
as the "attributes" member of a ProvidedCapability object.
Fixed the IProvidedCapability to follow the OSGi convention that the
attributes contain the name of the capability under a key equal to the
capability namespace. This is cleaner than to introduce a new "name"
attribute for the p2 name that can conflict with an incoming OSGi "name"
attribute.
Fixed the version of IProvidedCapability to follow the OSGi convention
that capabilities with a version have a "version" attribute with a value
of type an OSGi version object.
Change-Id: Ic9b77c2d103216141035dc3fb5861ca99a3ddccd
Signed-off-by: Todor Boev <rinsvind@gmail.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests')
2 files changed, 12 insertions, 14 deletions
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 752e1606b..6f067c02f 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 @@ -176,7 +176,6 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { } class SPIProvidedCapability implements IProvidedCapability { - String namespace; Map<String, Object> attributes; @@ -184,14 +183,12 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { this.namespace = namespace; this.attributes = new HashMap<>(); - attributes.put(ProvidedCapability.MEMBER_NAME, name); - attributes.put(ProvidedCapability.MEMBER_VERSION, version); + attributes.put(namespace, name); + attributes.put(ProvidedCapability.ATTRIBUTE_VERSION, version); } @Override public boolean equals(Object other) { - if (other == null) - return false; if (!(other instanceof IProvidedCapability)) return false; IProvidedCapability otherCapability = (IProvidedCapability) other; @@ -203,22 +200,23 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { } @Override + public String toString() { + return namespace + "; " + attributes; + } + + @Override public String getName() { - return (String) attributes.get(ProvidedCapability.MEMBER_NAME); + return (String) attributes.get(namespace); } @Override public String getNamespace() { - return this.namespace; + return namespace; } @Override public Version getVersion() { - return (Version) attributes.get(ProvidedCapability.MEMBER_VERSION); - } - - public boolean satisfies(IRequirement candidate) { - return false; + return (Version) attributes.get(ProvidedCapability.ATTRIBUTE_VERSION); } @Override 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 75eef92d0..f943a7862 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 @@ -42,8 +42,8 @@ public class BundlesActionTest extends ActionTest { private static final String OSGI = PublisherHelper.OSGI_BUNDLE_CLASSIFIER; private static final String OSGI_IDENTITY = "osgi.identity"; private static final String JAVA_PACKAGE = "java.package";//$NON-NLS-1$ - private static final String JAVA_EE_1_4_REQ = "providedCapabilities.exists(pc | pc ~= filter('(&(namespace=osgi.ee)(|(&(osgi.ee=JavaSE)(version=1.4))(&(osgi.ee=CDC/Foundation)(version=1.1))))'))"; - private static final String JAVA_EE_1_6_REQ = "providedCapabilities.exists(pc | pc ~= filter('(&(namespace=osgi.ee)(&(osgi.ee=JavaSE)(version=1.6)))'))"; + private static final String JAVA_EE_1_4_REQ = "providedCapabilities.exists(pc | pc.namespace == 'osgi.ee' && pc.attributes ~= filter('(|(&(osgi.ee=JavaSE)(version=1.4))(&(osgi.ee=CDC/Foundation)(version=1.1)))'))"; + private static final String JAVA_EE_1_6_REQ = "providedCapabilities.exists(pc | pc.namespace == 'osgi.ee' && pc.attributes ~= filter('(&(osgi.ee=JavaSE)(version=1.6))'))"; private static final String TEST1_IUD_NAME = "iud";//$NON-NLS-1$ private static final String TEST1_PROVZ_NAME = "iuz";//$NON-NLS-1$ |