Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2011-05-17 06:21:33 -0400
committerChristopher Frost2011-05-17 06:21:33 -0400
commit02bd2467e23dfd494560b1049290125bd0f23947 (patch)
tree0a908940f525c9389ffe359e493394f59096602c /org.eclipse.virgo.kernel.model
parent94d9137e573c2f41bfa6076e9f3e752eaf9d08d8 (diff)
downloadorg.eclipse.virgo.kernel-02bd2467e23dfd494560b1049290125bd0f23947.tar.gz
org.eclipse.virgo.kernel-02bd2467e23dfd494560b1049290125bd0f23947.tar.xz
org.eclipse.virgo.kernel-02bd2467e23dfd494560b1049290125bd0f23947.zip
344672 Test improvements for the new ArtifactModel mBeans
Diffstat (limited to 'org.eclipse.virgo.kernel.model')
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableArtifact.java4
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableArtifactTests.java9
2 files changed, 9 insertions, 4 deletions
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableArtifact.java
index aa8f6e9e..edbbae49 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableArtifact.java
@@ -135,12 +135,12 @@ class DelegatingManageableArtifact implements ManageableArtifact {
* @param artifacts The {@link Artifact}s to convert
* @return The {@link ObjectName}s converted to
*/
- protected final ObjectName[] convertToObjectNames(Set<Artifact> artifacts) {
+ private final ObjectName[] convertToObjectNames(Set<Artifact> artifacts) {
Set<ObjectName> objectNames = new HashSet<ObjectName>(artifacts.size());
String regionName;
for (Artifact artifact : artifacts) {
regionName = artifact.getRegion().getName();
- if(newModel || (!USER_REGION_NAME.equals(regionName) && GLOBAL_REGION_NAME.equals(regionName)) ){
+ if(newModel || (!USER_REGION_NAME.equals(regionName) && !GLOBAL_REGION_NAME.equals(regionName)) ){
objectNames.add(artifactObjectNameCreator.createArtifactModel(artifact));
} else {
objectNames.add(artifactObjectNameCreator.createModel(artifact));
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableArtifactTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableArtifactTests.java
index 4ee9a4e2..9eb4d92a 100644
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableArtifactTests.java
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableArtifactTests.java
@@ -29,6 +29,7 @@ import javax.management.ObjectName;
import org.eclipse.virgo.kernel.model.Artifact;
import org.eclipse.virgo.kernel.model.ArtifactState;
import org.eclipse.virgo.kernel.model.StubCompositeArtifact;
+import org.eclipse.virgo.kernel.model.StubRegion;
import org.eclipse.virgo.kernel.model.management.RuntimeArtifactModelObjectNameCreator;
import org.eclipse.virgo.kernel.model.management.internal.DelegatingManageableArtifact;
import org.eclipse.virgo.kernel.serviceability.Assert.FatalAssertionException;
@@ -53,14 +54,16 @@ public class DelegatingManageableArtifactTests {
RuntimeArtifactModelObjectNameCreator creator = createMock(RuntimeArtifactModelObjectNameCreator.class);
Artifact artifact = createMock(Artifact.class);
- DelegatingManageableArtifact manageableArtifact = new DelegatingManageableArtifact(creator, artifact, true);
+ DelegatingManageableArtifact manageableArtifact = new DelegatingManageableArtifact(creator, artifact, false);
expect(artifact.getDependents()).andReturn(getArtifacts());
expect(creator.createArtifactModel(isA(Artifact.class))).andReturn(new ObjectName("domain:key=value1"));
expect(creator.createArtifactModel(isA(Artifact.class))).andReturn(new ObjectName("domain:key=value2"));
expect(creator.createArtifactModel(isA(Artifact.class))).andReturn(new ObjectName("domain:key=value3"));
+ expect(creator.createModel(isA(Artifact.class))).andReturn(new ObjectName("domain:key=value3,region=global"));
expect(artifact.getName()).andReturn("test-name");
expect(artifact.getState()).andReturn(ArtifactState.ACTIVE);
+ expect(artifact.getRegion()).andReturn(new StubRegion("test-region"));
expect(artifact.getType()).andReturn("test-type");
expect(artifact.getVersion()).andReturn(Version.emptyVersion);
expect(artifact.getProperties()).andReturn(Collections.<String, String> emptyMap());
@@ -70,9 +73,10 @@ public class DelegatingManageableArtifactTests {
artifact.uninstall();
replay(creator, artifact);
- assertEquals(3, manageableArtifact.getDependents().length);
+ assertEquals(4, manageableArtifact.getDependents().length);
manageableArtifact.getName();
assertEquals("ACTIVE", manageableArtifact.getState());
+ assertEquals("test-region", manageableArtifact.getRegion());
assertEquals("test-type", manageableArtifact.getType());
assertEquals("0.0.0", manageableArtifact.getVersion());
assertEquals(0, manageableArtifact.getProperties().size());
@@ -89,6 +93,7 @@ public class DelegatingManageableArtifactTests {
for (int i = 0; i < 3; i++) {
artifacts.add(new StubCompositeArtifact());
}
+ artifacts.add(new StubCompositeArtifact("foo", "bar", new StubRegion("global")));
return artifacts;
}
}

Back to the top