Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2011-04-28 05:06:12 -0400
committerChristopher Frost2011-04-28 05:06:12 -0400
commit032e769d3da3061535ba1061b2ffcd09444a69c7 (patch)
treea001696e8d1601bc4cc681897247ee2e3a564cf4 /org.eclipse.virgo.kernel.model
parentff472db97420fac46dd3e03c039df28d531a1f23 (diff)
downloadorg.eclipse.virgo.kernel-032e769d3da3061535ba1061b2ffcd09444a69c7.tar.gz
org.eclipse.virgo.kernel-032e769d3da3061535ba1061b2ffcd09444a69c7.tar.xz
org.eclipse.virgo.kernel-032e769d3da3061535ba1061b2ffcd09444a69c7.zip
Initial changes complete but some tests are still failing at this stage
Diffstat (limited to 'org.eclipse.virgo.kernel.model')
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/RuntimeArtifactRepository.java11
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/AbstractArtifact.java2
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/NotifyingRuntimeArtifactRepository.java37
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java26
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListener.java2
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/configurationadmin/ModelConfigurationListener.java4
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminer.java2
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListener.java12
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListenerInitializer.java4
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml1
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/StubArtifactRepository.java17
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java6
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java14
13 files changed, 90 insertions, 48 deletions
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/RuntimeArtifactRepository.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/RuntimeArtifactRepository.java
index 0f68bd44..fc74ea46 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/RuntimeArtifactRepository.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/RuntimeArtifactRepository.java
@@ -13,15 +13,12 @@ package org.eclipse.virgo.kernel.model;
import java.util.Set;
+import org.eclipse.virgo.kernel.osgi.region.Region;
import org.osgi.framework.Version;
/**
* A single in-memory repository with representations of all artifacts in the running system. Operations are generally
* executed against the artifacts themselves rather than the repository.
- * <p />
- * Bundle artifacts may reside in a number of {@link Region Regions}, but certain repository operations such as remove
- * and get operate only on bundle artifacts in the user region. This is to preserve backward compatibility with Virgo
- * 2.1.0 for the RuntimeArtifactRepository interface (and for JMX).
*
* <strong>Concurrent Semantics</strong><br />
*
@@ -46,9 +43,10 @@ public interface RuntimeArtifactRepository {
* @param type The type of the {@link Artifact} to remove
* @param name The name of the {@link Artifact} to remove
* @param version The {@link Version} of the {@link Artifact} to remove
+ * @param region The {@link Region} to remove the {@link Artifact} from
* @return <code>true</code> if this repository contained the specified {@link Artifact}
*/
- boolean remove(String type, String name, Version version);
+ boolean remove(String type, String name, Version version, Region region);
/**
* Returns the entire collection of {@link Artifact}s contained within this repository. The returned collection
@@ -66,8 +64,9 @@ public interface RuntimeArtifactRepository {
* @param type The type of the {@link Artifact} to get
* @param name The name of the {@link Artifact} to get
* @param version The {@link Version} of the {@link Artifact} to get
+ * @param region The {@link Region} to get the {@link Artifact} from
* @return The {@link Artifact} represented by this type, name, and version if it is in the repository, otherwise
* <code>null</code>
*/
- Artifact getArtifact(String type, String name, Version version);
+ Artifact getArtifact(String type, String name, Version version, Region region);
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/AbstractArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/AbstractArtifact.java
index 1e0f12f8..aa0b76da 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/AbstractArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/AbstractArtifact.java
@@ -52,7 +52,7 @@ public abstract class AbstractArtifact implements Artifact {
private final Version version;
- private final ServiceTracker dependencyDeterminerTracker;
+ private final ServiceTracker<DependencyDeterminer, DependencyDeterminer> dependencyDeterminerTracker;
private final Region region;
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/NotifyingRuntimeArtifactRepository.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/NotifyingRuntimeArtifactRepository.java
index 63665a2c..fdc43f6d 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/NotifyingRuntimeArtifactRepository.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/NotifyingRuntimeArtifactRepository.java
@@ -35,6 +35,8 @@ import org.slf4j.LoggerFactory;
* @see ArtifactRepositoryListener
*/
public final class NotifyingRuntimeArtifactRepository implements RuntimeArtifactRepository {
+
+ private static final String USER_REGION_NAME = "org.eclipse.virgo.region.user";
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -70,9 +72,9 @@ public final class NotifyingRuntimeArtifactRepository implements RuntimeArtifact
/**
* {@inheritDoc}
*/
- public boolean remove(String type, String name, Version version) {
+ public boolean remove(String type, String name, Version version, Region region) {
synchronized (this.monitor) {
- Artifact artifact = getArtifact(type, name, version);
+ Artifact artifact = getArtifact(type, name, version, region);
boolean result = this.artifacts.remove(artifact);
if (result) {
for (ArtifactRepositoryListener listener : listeners) {
@@ -99,18 +101,35 @@ public final class NotifyingRuntimeArtifactRepository implements RuntimeArtifact
/**
* {@inheritDoc}
*/
- public Artifact getArtifact(String type, String name, Version version) {
+ public Artifact getArtifact(String type, String name, Version version, Region region) {
synchronized (this.monitor) {
+ Artifact fallBack = null;
for (Artifact artifact : this.artifacts) {
- // Skip kernel artifacts.
- Region region = artifact.getRegion();
- if (region == null || !region.contains(0L)) {
- if (artifact.getType().equals(type) && artifact.getName().equals(name) && artifact.getVersion().equals(version)) {
- return artifact;
+ if (artifact.getType().equals(type) && artifact.getName().equals(name) && artifact.getVersion().equals(version)){
+ if(region == null){
+ //Look everywhere because there is still plenty of code that doesn't know about regions
+ if(artifact.getRegion() == null){
+ return artifact;
+ } else {
+ //They might mean this artifact but don't know to give a region so return it if we don't find a better match
+ String regionName = artifact.getRegion().getName();
+ if(USER_REGION_NAME.equals(regionName)){
+ //Give priority to the user region
+ fallBack = artifact;
+ } else if(fallBack == null) {
+ //and only set it to the other (kernel) region if nothing has been set already
+ fallBack = artifact;
+ }
+ }
+ } else {
+ //Otherwise only look in the requested region
+ if(artifact.getRegion() != null && artifact.getRegion().equals(region)){
+ return artifact;
+ }
}
}
}
- return null;
+ return fallBack;
}
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
index be497ca1..8a3c7a89 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
@@ -23,6 +23,7 @@ import org.eclipse.virgo.kernel.osgi.quasi.QuasiExportPackage;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiFramework;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiImportPackage;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
import org.eclipse.virgo.kernel.serviceability.NonNull;
/**
@@ -41,9 +42,12 @@ public final class BundleDependencyDeterminer implements DependencyDeterminer {
private final RuntimeArtifactRepository artifactRepository;
- public BundleDependencyDeterminer(@NonNull QuasiFrameworkFactory quasiFrameworkFactory, @NonNull RuntimeArtifactRepository artifactRepository) {
+ private final RegionDigraph regionDigraph;
+
+ public BundleDependencyDeterminer(@NonNull QuasiFrameworkFactory quasiFrameworkFactory, @NonNull RuntimeArtifactRepository artifactRepository, @NonNull RegionDigraph regionDigraph) {
this.quasiFrameworkFactory = quasiFrameworkFactory;
this.artifactRepository = artifactRepository;
+ this.regionDigraph = regionDigraph;
}
/**
@@ -61,16 +65,16 @@ public final class BundleDependencyDeterminer implements DependencyDeterminer {
QuasiExportPackage provider = importPackage.getProvider();
if (provider != null) {
QuasiBundle bundle = provider.getExportingBundle();
- Artifact artifact = artifactRepository.getArtifact(BundleArtifact.TYPE, bundle.getSymbolicName(), bundle.getVersion());
- if (artifact == null) {
- // If there is no matching artifact in the user region, try the kernel region.
- for (Artifact a : this.artifactRepository.getArtifacts()) {
- if (BundleArtifact.TYPE.equals(a.getType()) && bundle.getSymbolicName().equals(a.getName()) && bundle.getVersion().equals(a.getVersion())) {
- artifact = a;
- break;
- }
- }
- }
+ Artifact artifact = artifactRepository.getArtifact(BundleArtifact.TYPE, bundle.getSymbolicName(), bundle.getVersion(), this.regionDigraph.getRegion(bundle.getBundleId()));
+// if (artifact == null) {
+// // If there is no matching artifact in the user region, try the kernel region.
+// for (Artifact a : this.artifactRepository.getArtifacts()) {
+// if (BundleArtifact.TYPE.equals(a.getType()) && bundle.getSymbolicName().equals(a.getName()) && bundle.getVersion().equals(a.getVersion())) {
+// artifact = a;
+// break;
+// }
+// }
+// }
artifacts.add(artifact);
}
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListener.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListener.java
index 38acc1f4..8c3cd8c3 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListener.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListener.java
@@ -78,7 +78,7 @@ final class ModelBundleListener implements SynchronousBundleListener {
private void processUninstalled(BundleEvent event) {
Bundle bundle = event.getBundle();
logger.info("Processing uninstalled event for '{}:{}'", bundle.getSymbolicName(), bundle.getVersion().toString());
- this.artifactRepository.remove(BundleArtifact.TYPE, bundle.getSymbolicName(), bundle.getVersion());
+ this.artifactRepository.remove(BundleArtifact.TYPE, bundle.getSymbolicName(), bundle.getVersion(), this.regionDigraph.getRegion(bundle));
}
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/configurationadmin/ModelConfigurationListener.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/configurationadmin/ModelConfigurationListener.java
index 58ceb547..34612f34 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/configurationadmin/ModelConfigurationListener.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/configurationadmin/ModelConfigurationListener.java
@@ -70,9 +70,9 @@ final class ModelConfigurationListener implements ConfigurationListener {
private void processDelete(ConfigurationEvent event) {
logger.info("Processing delete event for '{}'", event.getPid());
- Artifact artifact = this.artifactRepository.getArtifact(ConfigurationArtifact.TYPE, event.getPid(), Version.emptyVersion);
+ Artifact artifact = this.artifactRepository.getArtifact(ConfigurationArtifact.TYPE, event.getPid(), Version.emptyVersion, null);
if (artifact instanceof ConfigurationArtifact) {
- this.artifactRepository.remove(ConfigurationArtifact.TYPE, event.getPid(), Version.emptyVersion);
+ this.artifactRepository.remove(ConfigurationArtifact.TYPE, event.getPid(), Version.emptyVersion, null);
}
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminer.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminer.java
index fab5009c..c4bd7ece 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminer.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminer.java
@@ -54,7 +54,7 @@ public final class DeployerCompositeArtifactDependencyDeterminer implements Depe
List<Tree<InstallArtifact>> children = ((DeployerCompositeArtifact) rootArtifact).getInstallArtifact().getTree().getChildren();
for (Tree<InstallArtifact> child : children) {
InstallArtifact artifact = child.getValue();
- dependents.add(artifactRepository.getArtifact(artifact.getType(), artifact.getName(), artifact.getVersion()));
+ dependents.add(artifactRepository.getArtifact(artifact.getType(), artifact.getName(), artifact.getVersion(), rootArtifact.getRegion()));
}
return dependents;
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListener.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListener.java
index 193faf2d..7d1e43e1 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListener.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListener.java
@@ -82,12 +82,10 @@ class ModelInstallArtifactLifecycleListener extends InstallArtifactLifecycleList
}
private void addOrReplaceBundle(BundleInstallArtifact bundleInstallArtifact) {
- Artifact existingBundleArtifact = this.artifactRepository.getArtifact(bundleInstallArtifact.getType(), bundleInstallArtifact.getName(),
- bundleInstallArtifact.getVersion());
+ Artifact existingBundleArtifact = this.artifactRepository.getArtifact(bundleInstallArtifact.getType(), bundleInstallArtifact.getName(), bundleInstallArtifact.getVersion(), this.regionDigraph.getRegion(USER_REGION_NAME));
if (!(existingBundleArtifact instanceof DeployerBundleArtifact)) {
remove(bundleInstallArtifact);
- this.artifactRepository.add(new DeployerBundleArtifact(this.bundleContext, bundleInstallArtifact,
- this.regionDigraph.getRegion(USER_REGION_NAME)));
+ this.artifactRepository.add(new DeployerBundleArtifact(this.bundleContext, bundleInstallArtifact, this.regionDigraph.getRegion(USER_REGION_NAME)));
}
}
@@ -119,7 +117,11 @@ class ModelInstallArtifactLifecycleListener extends InstallArtifactLifecycleList
}
private void remove(InstallArtifact installArtifact) {
- this.artifactRepository.remove(installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion());
+ if(installArtifact instanceof BundleInstallArtifact){
+ this.artifactRepository.remove(installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion(), this.regionDigraph.getRegion(((BundleInstallArtifact) installArtifact).getBundle()));
+ } else {
+ this.artifactRepository.remove(installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion(), null);
+ }
}
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListenerInitializer.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListenerInitializer.java
index 7c69d455..aa830b59 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListenerInitializer.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListenerInitializer.java
@@ -77,12 +77,12 @@ public final class ModelInstallArtifactLifecycleListenerInitializer {
if (installArtifact instanceof PlanInstallArtifact) {
this.artifactRepository.add(new DeployerCompositeArtifact(this.bundleContext, (PlanInstallArtifact) installArtifact));
} else if (installArtifact instanceof BundleInstallArtifact) {
- this.artifactRepository.remove(installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion());
+ this.artifactRepository.remove(installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion(), null);
BundleInstallArtifact bundleInstallArtifact = (BundleInstallArtifact) installArtifact;
this.artifactRepository.add(new DeployerBundleArtifact(this.bundleContext, bundleInstallArtifact,
this.regionDigraph.getRegion(bundleInstallArtifact.getBundle())));
} else {
- this.artifactRepository.remove(installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion());
+ this.artifactRepository.remove(installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion(), null);
this.artifactRepository.add(new DeployerArtifact(this.bundleContext, installArtifact));
}
} catch (Exception e) {
diff --git a/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml b/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml
index 99442c5e..1573b417 100644
--- a/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml
+++ b/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml
@@ -28,6 +28,7 @@
<bean id="bundleDependencyDeterminer" class="org.eclipse.virgo.kernel.model.internal.bundle.BundleDependencyDeterminer">
<constructor-arg ref="quasiFrameworkFactory"/>
<constructor-arg ref="artifactRepository"/>
+ <constructor-arg ref="regionDigraph"/>
</bean>
<bean id="deployerCompositeArtifactDependencyDeterminer"
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/StubArtifactRepository.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/StubArtifactRepository.java
index 6ffa70ae..87e0e896 100644
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/StubArtifactRepository.java
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/StubArtifactRepository.java
@@ -16,6 +16,7 @@ import java.util.Set;
import org.eclipse.virgo.kernel.model.Artifact;
import org.eclipse.virgo.kernel.model.RuntimeArtifactRepository;
+import org.eclipse.virgo.kernel.osgi.region.Region;
import org.osgi.framework.Version;
public class StubArtifactRepository implements RuntimeArtifactRepository {
@@ -26,18 +27,26 @@ public class StubArtifactRepository implements RuntimeArtifactRepository {
return this.artifacts.add(artifact);
}
- public boolean remove(String type, String name, Version version) {
- return this.artifacts.remove(getArtifact(type, name, version));
+ public boolean remove(String type, String name, Version version, Region region) {
+ return this.artifacts.remove(getArtifact(type, name, version, region));
}
public Set<Artifact> getArtifacts() {
return this.artifacts;
}
- public Artifact getArtifact(String type, String name, Version version) {
+ public Artifact getArtifact(String type, String name, Version version, Region region) {
for (Artifact artifact : this.artifacts) {
if (artifact.getType().equals(type) && artifact.getName().equals(name) && artifact.getVersion().equals(version)) {
- return artifact;
+ if(artifact.getRegion() == null){
+ if(region == null){
+ return artifact;
+ }
+ }else{
+ if(artifact.getRegion().equals(region)){
+ return artifact;
+ }
+ }
}
}
return null;
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java
index fd2e0208..21e1658b 100644
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java
@@ -38,8 +38,8 @@ public class NotifyingArtifactRepositoryTests {
public void remove() {
StubCompositeArtifact artifact = new StubCompositeArtifact();
assertTrue(this.artifactRepository.add(artifact));
- assertTrue(this.artifactRepository.remove(artifact.getType(), artifact.getName(), artifact.getVersion()));
- assertFalse(this.artifactRepository.remove(artifact.getType(), artifact.getName(), artifact.getVersion()));
+ assertTrue(this.artifactRepository.remove(artifact.getType(), artifact.getName(), artifact.getVersion(), artifact.getRegion()));
+ assertFalse(this.artifactRepository.remove(artifact.getType(), artifact.getName(), artifact.getVersion(), artifact.getRegion()));
}
@Test
@@ -49,7 +49,7 @@ public class NotifyingArtifactRepositoryTests {
NotifyingRuntimeArtifactRepository artifactRepository = new NotifyingRuntimeArtifactRepository(listener1, listener2);
StubCompositeArtifact artifact = new StubCompositeArtifact();
artifactRepository.add(artifact);
- artifactRepository.remove(artifact.getType(), artifact.getName(), artifact.getVersion());
+ artifactRepository.remove(artifact.getType(), artifact.getName(), artifact.getVersion(), artifact.getRegion());
assertTrue(listener1.getAdded());
assertTrue(listener2.getAdded());
assertTrue(listener1.getRemoved());
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java
index 164097b9..6f94a9f2 100644
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java
@@ -27,6 +27,7 @@ import org.eclipse.virgo.kernel.model.StubCompositeArtifact;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiFramework;
import org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
import org.eclipse.virgo.kernel.serviceability.Assert.FatalAssertionException;
import org.junit.Test;
@@ -36,16 +37,23 @@ public class BundleDependencyDeterminerTests {
private final RuntimeArtifactRepository artifactRepository = new StubArtifactRepository();
- private final BundleDependencyDeterminer determiner = new BundleDependencyDeterminer(quasiFrameworkFactory, artifactRepository);
+ private final RegionDigraph regionDigraph = createMock(RegionDigraph.class);
+
+ private final BundleDependencyDeterminer determiner = new BundleDependencyDeterminer(quasiFrameworkFactory, artifactRepository, regionDigraph);
@Test(expected = FatalAssertionException.class)
public void nullFactory() {
- new BundleDependencyDeterminer(null, artifactRepository);
+ new BundleDependencyDeterminer(null, artifactRepository, regionDigraph);
}
@Test(expected = FatalAssertionException.class)
public void nullRepository() {
- new BundleDependencyDeterminer(quasiFrameworkFactory, null);
+ new BundleDependencyDeterminer(quasiFrameworkFactory, null, regionDigraph);
+ }
+
+ @Test(expected = FatalAssertionException.class)
+ public void nullRegionDigraph() {
+ new BundleDependencyDeterminer(quasiFrameworkFactory, artifactRepository, null);
}
@Test

Back to the top