Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2011-02-25 10:48:33 +0000
committerGlyn Normington2011-02-25 10:48:33 +0000
commita01b16df7cb7b9b4f5bec065988f50c54ec1d25a (patch)
treed947b72cabb8fb3e4977a438f1884e25b3c4834e
parent06e1ac345dc2d49d033dbf0211bd61a45c218321 (diff)
downloadorg.eclipse.virgo.kernel-a01b16df7cb7b9b4f5bec065988f50c54ec1d25a.tar.gz
org.eclipse.virgo.kernel-a01b16df7cb7b9b4f5bec065988f50c54ec1d25a.tar.xz
org.eclipse.virgo.kernel-a01b16df7cb7b9b4f5bec065988f50c54ec1d25a.zip
bug 338194: upgrade OSGi API usage
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHook.java64
-rw-r--r--org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookTests.java101
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/BundleDescriptionComparatorTests.java16
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBaseDescription.java14
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleDescription.java26
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleSpecification.java8
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubExportPackageDescription.java6
-rw-r--r--org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubImportPackageSpecification.java6
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicyTests.java4
9 files changed, 152 insertions, 93 deletions
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHook.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHook.java
index 7cb24a29..f75ef508 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHook.java
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHook.java
@@ -25,8 +25,9 @@ import org.eclipse.virgo.kernel.osgi.region.RegionPackageImportPolicy;
import org.eclipse.virgo.kernel.serviceability.Assert;
import org.osgi.framework.Bundle;
import org.osgi.framework.hooks.resolver.ResolverHook;
+import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleRevision;
-import org.osgi.framework.wiring.Capability;
/**
* {@link RegionResolverHook} manages the visibility of bundles across regions according to the {@link RegionDigraph}.
@@ -48,7 +49,8 @@ final class RegionResolverHook implements ResolverHook {
}
@Override
- public void filterMatches(BundleRevision requirer, Collection<Capability> candidates) {
+ public void filterMatches(BundleRequirement requirement, Collection<BundleCapability> candidates) {
+ BundleRevision requirer = requirement.getRevision();
try {
if (DEBUG) {
debugEntry(requirer, candidates);
@@ -64,7 +66,7 @@ final class RegionResolverHook implements ResolverHook {
return;
}
- Set<Capability> allowed = getAllowed(requirerRegion, candidates, new HashSet<Region>());
+ Set<BundleCapability> allowed = getAllowed(requirerRegion, candidates, new HashSet<Region>());
candidates.retainAll(allowed);
} finally {
@@ -101,8 +103,8 @@ final class RegionResolverHook implements ResolverHook {
return INVALID_BUNDLE_ID;
}
- private Set<Capability> getAllowed(Region r, Collection<Capability> candidates, Set<Region> path) {
- Set<Capability> allowed = new HashSet<Capability>();
+ private Set<BundleCapability> getAllowed(Region r, Collection<BundleCapability> candidates, Set<Region> path) {
+ Set<BundleCapability> allowed = new HashSet<BundleCapability>();
if (!path.contains(r)) {
allowPackagesInRegion(allowed, r, candidates);
@@ -112,17 +114,17 @@ final class RegionResolverHook implements ResolverHook {
return allowed;
}
- private void allowImportedPackages(Set<Capability> allowed, Region r, Collection<Capability> candidates, Set<Region> path) {
+ private void allowImportedPackages(Set<BundleCapability> allowed, Region r, Collection<BundleCapability> candidates, Set<Region> path) {
for (FilteredRegion fr : this.regionDigraph.getEdges(r)) {
- Set<Capability> a = getAllowed(fr.getRegion(), candidates, extendPath(r, path));
+ Set<BundleCapability> a = getAllowed(fr.getRegion(), candidates, extendPath(r, path));
filter(a, fr.getFilter());
allowed.addAll(a);
}
}
- private void allowPackagesInRegion(Set<Capability> allowed, Region r, Collection<Capability> candidates) {
- for (Capability b : candidates) {
- if (r.equals(getRegion(b.getProviderRevision()))) {
+ private void allowPackagesInRegion(Set<BundleCapability> allowed, Region r, Collection<BundleCapability> candidates) {
+ for (BundleCapability b : candidates) {
+ if (r.equals(getRegion(b.getRevision()))) {
allowed.add(b);
}
}
@@ -134,19 +136,19 @@ final class RegionResolverHook implements ResolverHook {
return newPath;
}
- private void filter(Set<Capability> capabilities, RegionFilter filter) {
+ private void filter(Set<BundleCapability> capabilities, RegionFilter filter) {
RegionPackageImportPolicy packageImportPolicy = filter.getPackageImportPolicy();
- Iterator<Capability> i = capabilities.iterator();
+ Iterator<BundleCapability> i = capabilities.iterator();
while (i.hasNext()) {
- Capability c = i.next();
+ BundleCapability c = i.next();
String namespace = c.getNamespace();
- if (Capability.PACKAGE_CAPABILITY.equals(namespace)) {
- if (!packageImportPolicy.isImported((String) c.getAttributes().get(Capability.PACKAGE_CAPABILITY), c.getAttributes(),
+ if (BundleRevision.PACKAGE_NAMESPACE.equals(namespace)) {
+ if (!packageImportPolicy.isImported((String) c.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE), c.getAttributes(),
c.getDirectives())) {
i.remove();
}
} else {
- BundleRevision providerRevision = c.getProviderRevision();
+ BundleRevision providerRevision = c.getRevision();
if (!filter.isBundleAllowed(providerRevision.getSymbolicName(), providerRevision.getVersion())) {
i.remove();
}
@@ -173,49 +175,49 @@ final class RegionResolverHook implements ResolverHook {
}
@Override
- public void filterSingletonCollisions(Capability singleton, Collection<Capability> collisionCandidates) {
+ public void filterSingletonCollisions(BundleCapability singleton, Collection<BundleCapability> collisionCandidates) {
collisionCandidates.clear(); //XXX temporary hack in lieu of Borislav's changes
}
- private void debugEntry(BundleRevision requirer, Collection<Capability> candidates) {
+ private void debugEntry(BundleRevision requirer, Collection<BundleCapability> candidates) {
System.out.println("Requirer: " + requirer.getSymbolicName() + "_" + requirer.getVersion() + "[" + getBundleId(requirer) + "]");
System.out.println(" Candidates: ");
- Iterator<Capability> i = candidates.iterator();
+ Iterator<BundleCapability> i = candidates.iterator();
while (i.hasNext()) {
- Capability c = i.next();
+ BundleCapability c = i.next();
String namespace = c.getNamespace();
- if (Capability.PACKAGE_CAPABILITY.equals(namespace)) {
- BundleRevision providerRevision = c.getProviderRevision();
- String pkg = (String) c.getAttributes().get(Capability.PACKAGE_CAPABILITY);
+ if (BundleRevision.PACKAGE_NAMESPACE.equals(namespace)) {
+ BundleRevision providerRevision = c.getRevision();
+ String pkg = (String) c.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE);
System.out.println(" Package " + pkg + " from provider " + providerRevision.getSymbolicName() + "_"
+ providerRevision.getVersion() + "[" + getBundleId(providerRevision) + "]");
if (pkg.equals("slow")) {
System.out.println(">>> put breakpoint here <<<");
}
} else {
- BundleRevision providerRevision = c.getProviderRevision();
+ BundleRevision providerRevision = c.getRevision();
System.out.println(" Bundle from provider " + providerRevision.getSymbolicName() + "_" + providerRevision.getVersion() + "["
+ getBundleId(providerRevision) + "]");
}
}
}
- private void debugExit(BundleRevision requirer, Collection<Capability> candidates) {
+ private void debugExit(BundleRevision requirer, Collection<BundleCapability> candidates) {
System.out.println(" Filtered candidates: ");
- Iterator<Capability> i = candidates.iterator();
+ Iterator<BundleCapability> i = candidates.iterator();
while (i.hasNext()) {
- Capability c = i.next();
+ BundleCapability c = i.next();
String namespace = c.getNamespace();
- if (Capability.PACKAGE_CAPABILITY.equals(namespace)) {
- BundleRevision providerRevision = c.getProviderRevision();
- String pkg = (String) c.getAttributes().get(Capability.PACKAGE_CAPABILITY);
+ if (BundleRevision.PACKAGE_NAMESPACE.equals(namespace)) {
+ BundleRevision providerRevision = c.getRevision();
+ String pkg = (String) c.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE);
System.out.println(" Package " + pkg + " from provider " + providerRevision.getSymbolicName() + "_"
+ providerRevision.getVersion() + "[" + getBundleId(providerRevision) + "]");
if (pkg.equals("slow")) {
System.out.println(">>> put breakpoint here <<<");
}
} else {
- BundleRevision providerRevision = c.getProviderRevision();
+ BundleRevision providerRevision = c.getRevision();
System.out.println(" Bundle from provider " + providerRevision.getSymbolicName() + "_" + providerRevision.getVersion() + "["
+ getBundleId(providerRevision) + "]");
}
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookTests.java b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookTests.java
index d903a6a7..0e1d5dbd 100644
--- a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookTests.java
+++ b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookTests.java
@@ -36,8 +36,10 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;
import org.osgi.framework.hooks.resolver.ResolverHook;
+import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleRevision;
-import org.osgi.framework.wiring.Capability;
+import org.osgi.framework.wiring.BundleWiring;
public class RegionResolverHookTests {
@@ -81,7 +83,7 @@ public class RegionResolverHookTests {
private Map<String, Bundle> bundles;
- private Collection<Capability> candidates;
+ private Collection<BundleCapability> candidates;
private ThreadLocal<Region> threadLocal;
@@ -96,7 +98,7 @@ public class RegionResolverHookTests {
stubBundleContext.addInstalledBundle(stubSystemBundle);
this.digraph = new StandardRegionDigraph(stubBundleContext, this.threadLocal);
this.resolverHook = new RegionResolverHook(this.digraph);
- this.candidates = new HashSet<Capability>();
+ this.candidates = new HashSet<BundleCapability>();
// Create regions A, B, C, D containing bundles A, B, C, D, respectively.
createRegion(REGION_A, BUNDLE_A);
@@ -115,14 +117,14 @@ public class RegionResolverHookTests {
@Test
public void testResolveInSameRegion() {
this.candidates.add(packageCapability(BUNDLE_A, PACKAGE_A));
- this.resolverHook.filterMatches(bundleRevision(BUNDLE_A), this.candidates);
+ this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
assertTrue(this.candidates.contains(packageCapability(BUNDLE_A, PACKAGE_A)));
}
@Test
public void testResolveInDisconnectedRegion() {
this.candidates.add(packageCapability(BUNDLE_B, PACKAGE_B));
- this.resolverHook.filterMatches(bundleRevision(BUNDLE_A), this.candidates);
+ this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
assertFalse(this.candidates.contains(packageCapability(BUNDLE_B, PACKAGE_B)));
}
@@ -132,7 +134,7 @@ public class RegionResolverHookTests {
region(REGION_A).connectRegion(region(REGION_B), filter);
this.candidates.add(packageCapability(BUNDLE_B, PACKAGE_B));
- this.resolverHook.filterMatches(bundleRevision(BUNDLE_A), this.candidates);
+ this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
assertTrue(this.candidates.contains(packageCapability(BUNDLE_B, PACKAGE_B)));
}
@@ -142,7 +144,7 @@ public class RegionResolverHookTests {
region(REGION_A).connectRegion(region(REGION_B), filter);
this.candidates.add(bundleCapability(BUNDLE_B));
- this.resolverHook.filterMatches(bundleRevision(BUNDLE_A), this.candidates);
+ this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
assertTrue(this.candidates.contains(bundleCapability(BUNDLE_B)));
}
@@ -154,7 +156,7 @@ public class RegionResolverHookTests {
this.candidates.add(packageCapability(BUNDLE_B, PACKAGE_B));
this.candidates.add(packageCapability(BUNDLE_X, PACKAGE_X));
- this.resolverHook.filterMatches(bundleRevision(BUNDLE_A), this.candidates);
+ this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
assertTrue(this.candidates.contains(packageCapability(BUNDLE_B, PACKAGE_B)));
assertFalse(this.candidates.contains(packageCapability(BUNDLE_X, PACKAGE_X)));
}
@@ -168,7 +170,7 @@ public class RegionResolverHookTests {
this.candidates.add(bundleCapability(BUNDLE_B));
this.candidates.add(bundleCapability(BUNDLE_X));
- this.resolverHook.filterMatches(bundleRevision(BUNDLE_A), this.candidates);
+ this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
assertTrue(this.candidates.contains(bundleCapability(BUNDLE_B)));
assertFalse(this.candidates.contains(bundleCapability(BUNDLE_X)));
}
@@ -182,7 +184,7 @@ public class RegionResolverHookTests {
this.candidates.add(packageCapability(BUNDLE_B, PACKAGE_B));
this.candidates.add(packageCapability(BUNDLE_C, PACKAGE_C));
this.candidates.add(packageCapability(BUNDLE_X, PACKAGE_X));
- this.resolverHook.filterMatches(bundleRevision(BUNDLE_A), this.candidates);
+ this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
assertTrue(this.candidates.contains(packageCapability(BUNDLE_C, PACKAGE_C)));
assertFalse(this.candidates.contains(packageCapability(BUNDLE_B, PACKAGE_B)));
assertFalse(this.candidates.contains(packageCapability(BUNDLE_X, PACKAGE_X)));
@@ -217,7 +219,7 @@ public class RegionResolverHookTests {
this.candidates.add(packageCapability(BUNDLE_D, PACKAGE_D));
this.candidates.add(packageCapability(BUNDLE_X, PACKAGE_X));
- this.resolverHook.filterMatches(bundleRevision(BUNDLE_A), this.candidates);
+ this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
assertEquals(2, this.candidates.size());
assertTrue(this.candidates.contains(packageCapability(BUNDLE_D, PACKAGE_D)));
assertTrue(this.candidates.contains(packageCapability(BUNDLE_X, PACKAGE_X)));
@@ -228,7 +230,7 @@ public class RegionResolverHookTests {
this.candidates.add(packageCapability(BUNDLE_D, PACKAGE_D));
this.candidates.add(packageCapability(BUNDLE_X, PACKAGE_X));
- this.resolverHook.filterMatches(bundleRevision(BUNDLE_B), this.candidates);
+ this.resolverHook.filterMatches(bundleRequirement(BUNDLE_B), this.candidates);
assertEquals(3, this.candidates.size());
assertTrue(this.candidates.contains(packageCapability(BUNDLE_B, PACKAGE_B)));
assertTrue(this.candidates.contains(packageCapability(BUNDLE_D, PACKAGE_D)));
@@ -240,7 +242,7 @@ public class RegionResolverHookTests {
this.candidates.add(packageCapability(BUNDLE_A, PACKAGE_A));
Bundle stubBundle = new StubBundle(0L, "sys", BUNDLE_VERSION, "");
- this.resolverHook.filterMatches(new StubBundleRevision(stubBundle), this.candidates);
+ this.resolverHook.filterMatches(new StubBundleRequirement(stubBundle), this.candidates);
assertEquals(1, this.candidates.size());
assertTrue(this.candidates.contains(packageCapability(BUNDLE_A, PACKAGE_A)));
}
@@ -250,7 +252,7 @@ public class RegionResolverHookTests {
this.candidates.add(packageCapability(BUNDLE_A, PACKAGE_A));
Bundle stranger = createBundle("stranger");
- this.resolverHook.filterMatches(new StubBundleRevision(stranger), this.candidates);
+ this.resolverHook.filterMatches(new StubBundleRequirement(stranger), this.candidates);
assertEquals(0, this.candidates.size());
}
@@ -260,11 +262,11 @@ public class RegionResolverHookTests {
this.resolverHook.end();
}
- private Capability packageCapability(final String bundleSymbolicName, String packageName) {
+ private BundleCapability packageCapability(final String bundleSymbolicName, String packageName) {
return new StubPackageCapability(bundleSymbolicName, packageName);
}
- private Capability bundleCapability(String bundleSymbolicName) {
+ private BundleCapability bundleCapability(String bundleSymbolicName) {
return new StubBundleCapability(bundleSymbolicName);
}
@@ -310,9 +312,9 @@ public class RegionResolverHookTests {
this.bundles.put(bundleSymbolicName, stubBundle);
return stubBundle;
}
-
- private BundleRevision bundleRevision(String bundleSymbolicName) {
- return new StubBundleRevision(bundle(bundleSymbolicName));
+
+ private BundleRequirement bundleRequirement(String bundleSymbolicName) {
+ return new StubBundleRequirement(bundle(bundleSymbolicName));
}
private Bundle bundle(String bundleSymbolicName) {
@@ -320,7 +322,7 @@ public class RegionResolverHookTests {
return bundleA;
}
- private final class StubPackageCapability implements Capability {
+ private final class StubPackageCapability implements BundleCapability {
private final String bundleSymbolicName;
@@ -333,7 +335,7 @@ public class RegionResolverHookTests {
@Override
public String getNamespace() {
- return Capability.PACKAGE_CAPABILITY;
+ return BundleRevision.PACKAGE_NAMESPACE;
}
@Override
@@ -344,12 +346,12 @@ public class RegionResolverHookTests {
@Override
public Map<String, Object> getAttributes() {
HashMap<String, Object> attributes = new HashMap<String, Object>();
- attributes.put(Capability.PACKAGE_CAPABILITY, this.packageName);
+ attributes.put(BundleRevision.PACKAGE_NAMESPACE, this.packageName);
return attributes;
}
@Override
- public BundleRevision getProviderRevision() {
+ public BundleRevision getRevision() {
return new StubBundleRevision(bundle(this.bundleSymbolicName));
}
@@ -401,7 +403,7 @@ public class RegionResolverHookTests {
}
- private final class StubBundleCapability implements Capability {
+ private final class StubBundleCapability implements BundleCapability {
private final String bundleSymbolicName;
@@ -411,7 +413,7 @@ public class RegionResolverHookTests {
@Override
public String getNamespace() {
- return Capability.BUNDLE_CAPABILITY;
+ return BundleRevision.BUNDLE_NAMESPACE;
}
@Override
@@ -426,7 +428,7 @@ public class RegionResolverHookTests {
}
@Override
- public BundleRevision getProviderRevision() {
+ public BundleRevision getRevision() {
return new StubBundleRevision(bundle(this.bundleSymbolicName));
}
@@ -463,6 +465,41 @@ public class RegionResolverHookTests {
}
}
+
+ private final class StubBundleRequirement implements BundleRequirement {
+
+ private final StubBundleRevision bundleRevision;
+
+ private StubBundleRequirement(Bundle bundle) {
+ this.bundleRevision = new StubBundleRevision(bundle);
+ }
+
+ @Override
+ public String getNamespace() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Map<String, String> getDirectives() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Map<String, Object> getAttributes() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public BundleRevision getRevision() {
+ return this.bundleRevision;
+ }
+
+ @Override
+ public boolean matches(BundleCapability capability) {
+ throw new UnsupportedOperationException();
+ }
+
+ }
private final class StubBundleRevision implements BundleRevision {
@@ -488,7 +525,7 @@ public class RegionResolverHookTests {
}
@Override
- public List<Capability> getDeclaredCapabilities(String namespace) {
+ public List<BundleCapability> getDeclaredCapabilities(String namespace) {
throw new UnsupportedOperationException();
}
@@ -497,6 +534,16 @@ public class RegionResolverHookTests {
throw new UnsupportedOperationException();
}
+ @Override
+ public List<BundleRequirement> getDeclaredRequirements(String namespace) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public BundleWiring getWiring() {
+ throw new UnsupportedOperationException();
+ }
+
}
}
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/BundleDescriptionComparatorTests.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/BundleDescriptionComparatorTests.java
index 369cacf4..299aa087 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/BundleDescriptionComparatorTests.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/BundleDescriptionComparatorTests.java
@@ -30,8 +30,9 @@ import org.eclipse.osgi.service.resolver.State;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
+import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleWiring;
-import org.osgi.framework.wiring.Capability;
+import org.osgi.framework.wiring.BundleCapability;
public class BundleDescriptionComparatorTests {
@@ -251,7 +252,7 @@ public class BundleDescriptionComparatorTests {
}
@Override
- public List<Capability> getDeclaredCapabilities(String namespace) {
+ public List<BundleCapability> getDeclaredCapabilities(String namespace) {
throw new UnsupportedOperationException();
}
@@ -281,17 +282,22 @@ public class BundleDescriptionComparatorTests {
}
@Override
- public BundleWiring getBundleWiring() {
+ public BundleCapability getCapability() {
throw new UnsupportedOperationException();
}
@Override
- public Capability getCapability() {
+ public Map<String, Object> getAttributes() {
throw new UnsupportedOperationException();
}
@Override
- public Map<String, Object> getAttributes() {
+ public List<BundleRequirement> getDeclaredRequirements(String namespace) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public BundleWiring getWiring() {
throw new UnsupportedOperationException();
}
}
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBaseDescription.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBaseDescription.java
index df63701e..0b186229 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBaseDescription.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBaseDescription.java
@@ -16,18 +16,8 @@ import java.util.Map;
import org.eclipse.osgi.service.resolver.BaseDescription;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.osgi.framework.Version;
-import org.osgi.framework.wiring.Capability;
+import org.osgi.framework.wiring.BundleCapability;
-
-/**
- * TODO Document StubBaseDescription
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * TODO Document concurrent semantics of StubBaseDescription
- *
- */
public class StubBaseDescription implements BaseDescription {
private BundleDescription supplier;
@@ -80,7 +70,7 @@ public class StubBaseDescription implements BaseDescription {
* {@inheritDoc}
*/
@Override
- public Capability getCapability() {
+ public BundleCapability getCapability() {
throw new UnsupportedOperationException();
}
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleDescription.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleDescription.java
index d347f4c9..e96e062d 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleDescription.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleDescription.java
@@ -28,11 +28,10 @@ import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.service.resolver.VersionRange;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
+import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleWiring;
-import org.osgi.framework.wiring.Capability;
+import org.osgi.framework.wiring.BundleCapability;
-/**
- */
public class StubBundleDescription implements BundleDescription {
private String bsn;
@@ -181,6 +180,11 @@ public class StubBundleDescription implements BundleDescription {
throw new UnsupportedOperationException();
}
+ @Override
+ public BundleRequirement getRequirement() {
+ throw new UnsupportedOperationException();
+ }
+
};
}
@@ -399,7 +403,7 @@ public class StubBundleDescription implements BundleDescription {
* {@inheritDoc}
*/
@Override
- public List<Capability> getDeclaredCapabilities(String namespace) {
+ public List<BundleCapability> getDeclaredCapabilities(String namespace) {
throw new UnsupportedOperationException();
}
@@ -447,7 +451,7 @@ public class StubBundleDescription implements BundleDescription {
* {@inheritDoc}
*/
@Override
- public BundleWiring getBundleWiring() {
+ public BundleCapability getCapability() {
throw new UnsupportedOperationException();
}
@@ -455,15 +459,17 @@ public class StubBundleDescription implements BundleDescription {
* {@inheritDoc}
*/
@Override
- public Capability getCapability() {
+ public Map<String, Object> getAttributes() {
throw new UnsupportedOperationException();
}
- /**
- * {@inheritDoc}
- */
@Override
- public Map<String, Object> getAttributes() {
+ public List<BundleRequirement> getDeclaredRequirements(String namespace) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public BundleWiring getWiring() {
throw new UnsupportedOperationException();
}
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleSpecification.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleSpecification.java
index 23aacf92..d8e5c346 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleSpecification.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleSpecification.java
@@ -15,9 +15,8 @@ import org.eclipse.osgi.service.resolver.BaseDescription;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.BundleSpecification;
import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.wiring.BundleRequirement;
-/**
- */
public class StubBundleSpecification implements BundleSpecification {
private String name;
@@ -100,4 +99,9 @@ public class StubBundleSpecification implements BundleSpecification {
this.supplier = supplier;
}
+ @Override
+ public BundleRequirement getRequirement() {
+ throw new UnsupportedOperationException();
+ }
+
}
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubExportPackageDescription.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubExportPackageDescription.java
index 8943f5c9..9e869c81 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubExportPackageDescription.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubExportPackageDescription.java
@@ -16,10 +16,8 @@ import java.util.Map;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.osgi.framework.Version;
-import org.osgi.framework.wiring.Capability;
+import org.osgi.framework.wiring.BundleCapability;
-/**
- */
public class StubExportPackageDescription extends StubParameterised implements ExportPackageDescription {
private String name;
@@ -100,7 +98,7 @@ public class StubExportPackageDescription extends StubParameterised implements E
* {@inheritDoc}
*/
@Override
- public Capability getCapability() {
+ public BundleCapability getCapability() {
throw new UnsupportedOperationException();
}
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubImportPackageSpecification.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubImportPackageSpecification.java
index bb1c3edc..75df7e4a 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubImportPackageSpecification.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubImportPackageSpecification.java
@@ -15,6 +15,7 @@ import org.eclipse.osgi.service.resolver.BaseDescription;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.wiring.BundleRequirement;
/**
*/
@@ -106,4 +107,9 @@ public class StubImportPackageSpecification extends StubParameterised implements
this.supplier = supplier;
}
+ @Override
+ public BundleRequirement getRequirement() {
+ throw new UnsupportedOperationException();
+ }
+
}
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicyTests.java b/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicyTests.java
index 3975dcb4..308470db 100644
--- a/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicyTests.java
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicyTests.java
@@ -20,7 +20,7 @@ import org.eclipse.virgo.kernel.osgi.region.RegionPackageImportPolicy;
import org.junit.Assert;
import org.junit.Test;
import org.osgi.framework.Version;
-import org.osgi.framework.wiring.Capability;
+import org.osgi.framework.wiring.BundleRevision;
public class UserRegionPackageImportPolicyTests {
@@ -65,7 +65,7 @@ public class UserRegionPackageImportPolicyTests {
private Map<String, Object> createAttributes(String packageName) {
Map<String, Object> attributes = new HashMap<String, Object>();
- attributes.put(Capability.PACKAGE_CAPABILITY, packageName);
+ attributes.put(BundleRevision.PACKAGE_NAMESPACE, packageName);
return attributes;
}

Back to the top