Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2011-01-21 13:01:27 -0500
committerGlyn Normington2011-01-21 13:01:27 -0500
commit50b87ab7f7174287c4dd3a794fb42ec65722dd49 (patch)
tree3807bba3c2f9e10496493f1fe1e4073da1406ff4 /org.eclipse.virgo.kernel.userregionfactory
parent717bda7afdee97dc2df716e6470843543c2901bc (diff)
downloadorg.eclipse.virgo.kernel-50b87ab7f7174287c4dd3a794fb42ec65722dd49.tar.gz
org.eclipse.virgo.kernel-50b87ab7f7174287c4dd3a794fb42ec65722dd49.tar.xz
org.eclipse.virgo.kernel-50b87ab7f7174287c4dd3a794fb42ec65722dd49.zip
bug 330776: digraph base resolver hook, tests to come
Diffstat (limited to 'org.eclipse.virgo.kernel.userregionfactory')
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicy.java7
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicyTests.java25
-rw-r--r--org.eclipse.virgo.kernel.userregionfactory/template.mf3
3 files changed, 15 insertions, 20 deletions
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicy.java b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicy.java
index 3ebe9ece..294f3ecd 100644
--- a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicy.java
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicy.java
@@ -78,7 +78,7 @@ class UserRegionPackageImportPolicy implements RegionPackageImportPolicy {
}
}
- private Region getUserRegion() {
+ public Region getUserRegion() {
synchronized (this.monitor) {
return this.userRegion;
}
@@ -88,10 +88,7 @@ class UserRegionPackageImportPolicy implements RegionPackageImportPolicy {
* {@inheritDoc}
*/
@Override
- public boolean isImported(Region providerRegion, String packageName, Map<String, Object> exportAttributes, Map<String, String> exportDirectives) {
- if (providerRegion == null || getUserRegion().equals(providerRegion)) {
- return true;
- }
+ public boolean isImported(String packageName, Map<String, Object> exportAttributes, Map<String, String> exportDirectives) {
ImportedPackage importedPackage = this.importedPackages.get(packageName);
if (importedPackage != null) {
Map<String, String> importAttributes = importedPackage.getAttributes();
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 3bad2df8..56b428e5 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
@@ -27,8 +27,6 @@ import org.osgi.framework.wiring.Capability;
public class UserRegionPackageImportPolicyTests {
- private Region mockKernelRegion;
-
private Region mockUserRegion;
/**
@@ -36,7 +34,6 @@ public class UserRegionPackageImportPolicyTests {
*/
@Before
public void setUp() throws Exception {
- mockKernelRegion = EasyMock.createMock(Region.class);
mockUserRegion = EasyMock.createMock(Region.class);
}
@@ -58,10 +55,10 @@ public class UserRegionPackageImportPolicyTests {
@Test
public void testPackageStringWithArbitraryAttribute() {
UserRegionPackageImportPolicy userRegionPackageImportPolicy = createUserRegionPackageImportPolicy("p;pa=pv,q");
- Assert.assertFalse(userRegionPackageImportPolicy.isImported(this.mockKernelRegion, "p", null, null));
+ Assert.assertFalse(userRegionPackageImportPolicy.isImported("p", null, null));
Map<String, Object> attributes = createAttributes("p");
attributes.put("pa", "pv");
- Assert.assertTrue(userRegionPackageImportPolicy.isImported(this.mockKernelRegion,"p", attributes, null));
+ Assert.assertTrue(userRegionPackageImportPolicy.isImported("p", attributes, null));
}
@@ -76,7 +73,7 @@ public class UserRegionPackageImportPolicyTests {
RegionPackageImportPolicy userRegionPackageImportPolicy = createUserRegionPackageImportPolicy("p,q");
Map<String, Object> attributes = createAttributes("p");
attributes.put("pa", "pv");
- Assert.assertTrue(userRegionPackageImportPolicy.isImported(this.mockKernelRegion,"p", attributes, null));
+ Assert.assertTrue(userRegionPackageImportPolicy.isImported("p", attributes, null));
}
@@ -89,11 +86,11 @@ public class UserRegionPackageImportPolicyTests {
@Test
public void testPackageStringWithMandatoryAttribute() {
RegionPackageImportPolicy userRegionPackageImportPolicy = createUserRegionPackageImportPolicy("p;pa=pv");
- Assert.assertFalse(userRegionPackageImportPolicy.isImported(this.mockKernelRegion,"p", null, null));
+ Assert.assertFalse(userRegionPackageImportPolicy.isImported("p", null, null));
Map<String, Object> attributes = createAttributes("p");
attributes.put("pa", "pv");
Map<String, String> directives = createMandatoryDirective("pa");
- Assert.assertTrue(userRegionPackageImportPolicy.isImported(this.mockKernelRegion,"p", attributes, directives));
+ Assert.assertTrue(userRegionPackageImportPolicy.isImported("p", attributes, directives));
}
@Test
@@ -102,7 +99,7 @@ public class UserRegionPackageImportPolicyTests {
Map<String, Object> attributes = createAttributes("p");
attributes.put("pa", "pv");
Map<String, String> directives = createMandatoryDirective("pa");
- Assert.assertFalse(userRegionPackageImportPolicy.isImported(this.mockKernelRegion,"p", attributes, directives));
+ Assert.assertFalse(userRegionPackageImportPolicy.isImported("p", attributes, directives));
}
private Map<String, String> createMandatoryDirective(String attributes) {
@@ -114,10 +111,10 @@ public class UserRegionPackageImportPolicyTests {
@Test
public void testPackageStringWithVersion() {
RegionPackageImportPolicy userRegionPackageImportPolicy = createUserRegionPackageImportPolicy("p;version=2,q");
- Assert.assertFalse(userRegionPackageImportPolicy.isImported(this.mockKernelRegion,"p", null, null));
+ Assert.assertFalse(userRegionPackageImportPolicy.isImported("p", null, null));
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("version", new Version("2.0.0"));
- Assert.assertTrue(userRegionPackageImportPolicy.isImported(this.mockKernelRegion,"p", attributes, null));
+ Assert.assertTrue(userRegionPackageImportPolicy.isImported("p", attributes, null));
}
@@ -125,9 +122,9 @@ public class UserRegionPackageImportPolicyTests {
@Test
public void testPackages() {
RegionPackageImportPolicy userRegionPackageImportPolicy = createUserRegionPackageImportPolicy("p,q");
- Assert.assertTrue(userRegionPackageImportPolicy.isImported(this.mockKernelRegion,"p", null, null));
- Assert.assertTrue(userRegionPackageImportPolicy.isImported(this.mockKernelRegion,"q", null, null));
- Assert.assertFalse(userRegionPackageImportPolicy.isImported(this.mockKernelRegion, "r", null, null));
+ Assert.assertTrue(userRegionPackageImportPolicy.isImported("p", null, null));
+ Assert.assertTrue(userRegionPackageImportPolicy.isImported("q", null, null));
+ Assert.assertFalse(userRegionPackageImportPolicy.isImported("r", null, null));
}
}
diff --git a/org.eclipse.virgo.kernel.userregionfactory/template.mf b/org.eclipse.virgo.kernel.userregionfactory/template.mf
index abd5d6f6..68a35591 100644
--- a/org.eclipse.virgo.kernel.userregionfactory/template.mf
+++ b/org.eclipse.virgo.kernel.userregionfactory/template.mf
@@ -13,5 +13,6 @@ Import-Template:
org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}"
Bundle-Activator: org.eclipse.virgo.kernel.userregionfactory.Activator
Excluded-Imports: org.easymock,
- org.eclipse.virgo.osgi.launcher.*
+ org.eclipse.virgo.osgi.launcher.*,
+ org.eclipse.virgo.teststubs.*
Excluded-Exports: *

Back to the top