Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2011-05-13 13:23:08 -0400
committerChristopher Frost2011-05-13 13:23:08 -0400
commit551889d0bd85f1479e68409cb01f33dc7c5a1361 (patch)
tree6de01d133455c5f1544dbc53b853e8bf36f8f29d /org.eclipse.virgo.kernel.deployer.test/src/test/java
parentcd71143b0b786e34479cc0ce64628217de98a258 (diff)
downloadorg.eclipse.virgo.kernel-551889d0bd85f1479e68409cb01f33dc7c5a1361.tar.gz
org.eclipse.virgo.kernel-551889d0bd85f1479e68409cb01f33dc7c5a1361.tar.xz
org.eclipse.virgo.kernel-551889d0bd85f1479e68409cb01f33dc7c5a1361.zip
344672 Renaming the KernelModel to ArtifactModel and adding all artifacts to it without changing the existing Model beans
Diffstat (limited to 'org.eclipse.virgo.kernel.deployer.test/src/test/java')
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractRAMIntegrationTests.java9
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/OnStartedFailureTests.java2
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMBundleRefreshTests.java10
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMConfigurationRefreshTests.java6
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMParRefreshTests.java4
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMPlanRefreshTests.java4
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubRegion.java155
7 files changed, 171 insertions, 19 deletions
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractRAMIntegrationTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractRAMIntegrationTests.java
index cb73e82b..e076c6c8 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractRAMIntegrationTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractRAMIntegrationTests.java
@@ -17,6 +17,7 @@ import javax.management.JMX;
import javax.management.MBeanServer;
import javax.management.ObjectName;
+import org.eclipse.equinox.region.Region;
import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
import org.eclipse.virgo.kernel.model.management.ManageableArtifact;
import org.eclipse.virgo.kernel.model.management.RuntimeArtifactModelObjectNameCreator;
@@ -26,13 +27,13 @@ import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
public class AbstractRAMIntegrationTests extends AbstractDeployerIntegrationTest {
- public ManageableArtifact getManageableArtifact(DeploymentIdentity deploymentIdentity) {
- return getManageableArtifact(deploymentIdentity.getType(), deploymentIdentity.getSymbolicName(), new Version(deploymentIdentity.getVersion()));
+ public ManageableArtifact getManageableArtifact(DeploymentIdentity deploymentIdentity, Region region) {
+ return getManageableArtifact(deploymentIdentity.getType(), deploymentIdentity.getSymbolicName(), new Version(deploymentIdentity.getVersion()), region);
}
- public ManageableArtifact getManageableArtifact(String type, String name, Version version) {
+ public ManageableArtifact getManageableArtifact(String type, String name, Version version, Region region) {
RuntimeArtifactModelObjectNameCreator objectNameCreator = OsgiFrameworkUtils.getService(this.kernelContext, RuntimeArtifactModelObjectNameCreator.class).getService();
- ObjectName objectName = objectNameCreator.create(type, name, version);
+ ObjectName objectName = objectNameCreator.createArtifactModel(type, name, version, region);
return getManageableArtifact(objectName);
}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/OnStartedFailureTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/OnStartedFailureTests.java
index c538097e..92b0daab 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/OnStartedFailureTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/OnStartedFailureTests.java
@@ -75,7 +75,7 @@ public class OnStartedFailureTests extends AbstractRAMIntegrationTests {
registerListener();
try {
- ManageableArtifact manageableArtifact = getManageableArtifact(deployed);
+ ManageableArtifact manageableArtifact = getManageableArtifact(deployed, new StubRegion("org.eclipse.virgo.region.user"));
manageableArtifact.stop();
try {
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMBundleRefreshTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMBundleRefreshTests.java
index 06c72302..46460a76 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMBundleRefreshTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMBundleRefreshTests.java
@@ -57,7 +57,7 @@ public class RAMBundleRefreshTests extends AbstractRAMIntegrationTests {
copyToDeploy.delete(true);
refresh.copy(copyToDeploy, true);
- ManageableArtifact artifact = getManageableArtifact(deployed);
+ ManageableArtifact artifact = getManageableArtifact(deployed, new StubRegion("org.eclipse.virgo.region.user"));
assertTrue(artifact.refresh());
assertEquals("ACTIVE", artifact.getState());
@@ -113,7 +113,7 @@ public class RAMBundleRefreshTests extends AbstractRAMIntegrationTests {
copyToDeploy.delete(true);
refresh.copy(copyToDeploy, true);
- ManageableArtifact artifact = getManageableArtifact("bundle", "refresh", new Version(1,0,0));
+ ManageableArtifact artifact = getManageableArtifact("bundle", "refresh", new Version(1,0,0), new StubRegion("org.eclipse.virgo.region.user"));
assertTrue(artifact.refresh());
assertEquals("ACTIVE", artifact.getState());
@@ -151,7 +151,7 @@ public class RAMBundleRefreshTests extends AbstractRAMIntegrationTests {
refreshTarget.delete(true);
refreshSource.copy(refreshTarget, true);
- ManageableArtifact artifact = getManageableArtifact("bundle", "bundle-refresh-1-refresh", new Version(1,0,0));
+ ManageableArtifact artifact = getManageableArtifact("bundle", "bundle-refresh-1-refresh", new Version(1,0,0), new StubRegion("org.eclipse.virgo.region.user"));
assertTrue(artifact.refresh());
assertEquals("ACTIVE", artifact.getState());
@@ -176,7 +176,7 @@ public class RAMBundleRefreshTests extends AbstractRAMIntegrationTests {
assertEquals("no-bsn-no-version", deployed.getSymbolicName());
assertEquals("0.0.0", deployed.getVersion());
- ManageableArtifact artifact = getManageableArtifact(deployed);
+ ManageableArtifact artifact = getManageableArtifact(deployed, new StubRegion("org.eclipse.virgo.region.user"));
assertTrue(artifact.refresh());
assertEquals("ACTIVE", artifact.getState());
@@ -208,7 +208,7 @@ public class RAMBundleRefreshTests extends AbstractRAMIntegrationTests {
copyToDeploy.delete(true);
refresh.copy(copyToDeploy, true);
- ManageableArtifact artifact = getManageableArtifact("bundle", "bundle-refresh-1-refresh", new Version(1,0,0));
+ ManageableArtifact artifact = getManageableArtifact("bundle", "bundle-refresh-1-refresh", new Version(1,0,0), new StubRegion("org.eclipse.virgo.region.user"));
assertTrue(artifact.refresh());
assertEquals("ACTIVE", artifact.getState());
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMConfigurationRefreshTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMConfigurationRefreshTests.java
index 008cc97b..45702e18 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMConfigurationRefreshTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMConfigurationRefreshTests.java
@@ -57,7 +57,7 @@ public class RAMConfigurationRefreshTests extends AbstractRAMIntegrationTests {
copyToDeploy.delete();
refresh.copy(copyToDeploy);
- ManageableArtifact artifact = getManageableArtifact(deployed);
+ ManageableArtifact artifact = getManageableArtifact(deployed, new StubRegion("global"));
artifact.refresh();
configuration = getConfiguration("test");
@@ -86,7 +86,7 @@ public class RAMConfigurationRefreshTests extends AbstractRAMIntegrationTests {
propertiesToRefresh.delete();
refresh.copy(propertiesToRefresh);
- ManageableArtifact artifact = getManageableArtifact("configuration", "test", new Version(0,0,0));
+ ManageableArtifact artifact = getManageableArtifact("configuration", "test", new Version(0,0,0), new StubRegion("global"));
artifact.refresh();
configuration = getConfiguration("test");
@@ -125,7 +125,7 @@ public class RAMConfigurationRefreshTests extends AbstractRAMIntegrationTests {
configurationCopy.delete();
refresh.copy(configurationCopy);
- ManageableArtifact artifact = getManageableArtifact("configuration", "test", new Version(0,0,0));
+ ManageableArtifact artifact = getManageableArtifact("configuration", "test", new Version(0,0,0), new StubRegion("global"));
artifact.refresh();
configuration = getConfiguration("test");
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMParRefreshTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMParRefreshTests.java
index 23a944c2..8843d554 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMParRefreshTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMParRefreshTests.java
@@ -20,8 +20,6 @@ import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
import org.eclipse.virgo.kernel.model.management.ManageableArtifact;
import org.junit.Test;
-
-
/**
* Tests for refreshing a PAR via its entry in the runtime artifact model
*
@@ -37,7 +35,7 @@ public class RAMParRefreshTests extends AbstractRAMIntegrationTests {
@Test
public void refreshNotSupported() throws DeploymentException {
DeploymentIdentity deployed = this.deployer.deploy(new File("src/test/resources/ram-par-refresh/refresh.par").toURI());
- ManageableArtifact manageableArtifact = getManageableArtifact(deployed);
+ ManageableArtifact manageableArtifact = getManageableArtifact(deployed, new StubRegion("global"));
assertFalse(manageableArtifact.refresh());
}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMPlanRefreshTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMPlanRefreshTests.java
index 44e022d0..9828ccf4 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMPlanRefreshTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RAMPlanRefreshTests.java
@@ -20,8 +20,6 @@ import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
import org.eclipse.virgo.kernel.model.management.ManageableArtifact;
import org.junit.Test;
-
-
/**
* Tests for refreshing a plan via its entry in the runtime artifact model
*
@@ -37,7 +35,7 @@ public class RAMPlanRefreshTests extends AbstractRAMIntegrationTests {
@Test
public void refreshNotSupported() throws DeploymentException {
DeploymentIdentity deployed = this.deployer.deploy(new File("src/test/resources/ram-plan-refresh/test.plan").toURI());
- ManageableArtifact manageableArtifact = getManageableArtifact(deployed);
+ ManageableArtifact manageableArtifact = getManageableArtifact(deployed, new StubRegion("global"));
assertFalse(manageableArtifact.refresh());
}
}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubRegion.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubRegion.java
new file mode 100644
index 00000000..09fa04fb
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubRegion.java
@@ -0,0 +1,155 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 copyright_holder
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * cgfrost - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.deployer.test;
+
+import java.io.InputStream;
+import java.util.Set;
+
+import org.eclipse.equinox.region.Region;
+import org.eclipse.equinox.region.RegionDigraph;
+import org.eclipse.equinox.region.RegionDigraphVisitor;
+import org.eclipse.equinox.region.RegionFilter;
+import org.eclipse.equinox.region.RegionDigraph.FilteredRegion;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+
+/**
+ * StubRegion
+ */
+public class StubRegion implements Region {
+
+ private final String name;
+
+ public StubRegion(String name) {
+ this.name = name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addBundle(Bundle bundle) throws BundleException {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addBundle(long bundleId) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Bundle installBundle(String location, InputStream input) throws BundleException {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Bundle installBundle(String location) throws BundleException {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Long> getBundleIds() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean contains(Bundle bundle) {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean contains(long bundleId) {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Bundle getBundle(String symbolicName, Version version) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void connectRegion(Region headRegion, RegionFilter filter) throws BundleException {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public RegionDigraph getRegionDigraph() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeBundle(Bundle bundle) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void removeBundle(long bundleId) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<FilteredRegion> getEdges() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void visitSubgraph(RegionDigraphVisitor visitor) {
+ }
+
+}

Back to the top