Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Kapukaranov2012-10-28 18:55:01 -0400
committerBorislav Kapukaranov2012-10-28 18:55:01 -0400
commit0003be65df7c0099d2c87f2f27123af17832a852 (patch)
tree7588320328a84875987c7c1e8e27af9551e204a4
parent37a30157f37eb5f57212d3517af2184223591be2 (diff)
downloadorg.eclipse.virgo.kernel-0003be65df7c0099d2c87f2f27123af17832a852.tar.gz
org.eclipse.virgo.kernel-0003be65df7c0099d2c87f2f27123af17832a852.tar.xz
org.eclipse.virgo.kernel-0003be65df7c0099d2c87f2f27123af17832a852.zip
392986 - Removes the recovery monitor mbean and adopts the integration tests
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/ivy.xml1
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties1
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties1
-rw-r--r--org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties1
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardRecoveryMonitor.java100
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml10
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml16
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/management/RecoveryMonitorTests.java69
-rw-r--r--org.eclipse.virgo.kernel.test/ivy.xml1
-rw-r--r--org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties1
10 files changed, 16 insertions, 185 deletions
diff --git a/org.eclipse.virgo.kernel.deployer.test/ivy.xml b/org.eclipse.virgo.kernel.deployer.test/ivy.xml
index e9b2f262..48a51351 100644
--- a/org.eclipse.virgo.kernel.deployer.test/ivy.xml
+++ b/org.eclipse.virgo.kernel.deployer.test/ivy.xml
@@ -22,6 +22,7 @@
<dependency org="org.eclipse.virgo.util" name="org.eclipse.virgo.util.io" rev="${org.eclipse.virgo.util}" conf="test->compile"/>
<dependency org="org.eclipse.virgo.util" name="org.eclipse.virgo.util.math" rev="${org.eclipse.virgo.util}" conf="test->compile"/>
<dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.nano.core" rev="${org.eclipse.virgo.nano}" conf="test->compile"/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.nano.management" rev="${org.eclipse.virgo.nano}" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.model" rev="latest.integration" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.deployer" rev="latest.integration" conf="test->compile"/>
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties
index 20b05ae0..3dc672b2 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties
@@ -36,6 +36,7 @@ launcher.bundles =\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.core/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.core-${org.eclipse.virgo.nano}.jar@start,\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.api/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.deployer.api-${org.eclipse.virgo.nano}.jar,\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.hot/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.deployer.hot-${org.eclipse.virgo.nano}.jar,\
+ file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.management/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.management-${org.eclipse.virgo.nano}.jar@start,\
file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
file:${ivy.cache}/repository/org.eclipse.gemini/org.eclipse.gemini.blueprint.core/1.0.2.RELEASE/org.eclipse.gemini.blueprint.core-1.0.2.RELEASE.jar,\
file:${ivy.cache}/repository/org.eclipse.gemini/org.eclipse.gemini.blueprint.extender/1.0.2.RELEASE/org.eclipse.gemini.blueprint.extender-1.0.2.RELEASE.jar@start,\
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties
index 40f638ee..6067b8cf 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties
@@ -36,6 +36,7 @@ launcher.bundles =\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.core/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.core-${org.eclipse.virgo.nano}.jar@start,\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.api/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.deployer.api-${org.eclipse.virgo.nano}.jar,\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.hot/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.deployer.hot-${org.eclipse.virgo.nano}.jar,\
+ file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.management/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.management-${org.eclipse.virgo.nano}.jar@start,\
file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
file:${ivy.cache}/repository/org.eclipse.gemini/org.eclipse.gemini.blueprint.core/1.0.2.RELEASE/org.eclipse.gemini.blueprint.core-1.0.2.RELEASE.jar,\
file:${ivy.cache}/repository/org.eclipse.gemini/org.eclipse.gemini.blueprint.extender/1.0.2.RELEASE/org.eclipse.gemini.blueprint.extender-1.0.2.RELEASE.jar@start,\
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties
index 9988aa51..84c8399b 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties
@@ -36,6 +36,7 @@ launcher.bundles =\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.core/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.core-${org.eclipse.virgo.nano}.jar@start,\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.api/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.deployer.api-${org.eclipse.virgo.nano}.jar,\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.hot/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.deployer.hot-${org.eclipse.virgo.nano}.jar,\
+ file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.management/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.management-${org.eclipse.virgo.nano}.jar@start,\
file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
file:${ivy.cache}/repository/org.eclipse.gemini/org.eclipse.gemini.blueprint.core/1.0.2.RELEASE/org.eclipse.gemini.blueprint.core-1.0.2.RELEASE.jar,\
file:${ivy.cache}/repository/org.eclipse.gemini/org.eclipse.gemini.blueprint.extender/1.0.2.RELEASE/org.eclipse.gemini.blueprint.extender-1.0.2.RELEASE.jar@start,\
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardRecoveryMonitor.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardRecoveryMonitor.java
deleted file mode 100644
index d4bfffa2..00000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardRecoveryMonitor.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.deployer.management;
-
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanNotificationInfo;
-import javax.management.Notification;
-import javax.management.NotificationBroadcaster;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-
-import org.eclipse.virgo.nano.deployer.api.RecoveryMonitor;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventHandler;
-
-
-/**
- * Monitors the process of the deployer recovery process.
- * <p/>
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Threadsafe.
- *
- */
-class StandardRecoveryMonitor implements NotificationBroadcaster, RecoveryMonitor, EventHandler {
-
- private static final String TOPIC_RECOVERY_COMPLETED = "org/eclipse/virgo/kernel/deployer/recovery/COMPLETED";
-
- private final NotificationBroadcasterSupport broadcasterSupport = new NotificationBroadcasterSupport();
-
- private final Object monitor = new Object();
-
- private boolean recoveryComplete = false;
-
- /**
- * {@inheritDoc}
- */
- public boolean isRecoveryComplete() {
- synchronized (this.monitor) {
- return this.recoveryComplete;
- }
- }
-
- private void signalRecoveryComplete() {
- boolean sendNotification = false;
-
- synchronized (this.monitor) {
- if (!this.recoveryComplete) {
- this.recoveryComplete = true;
- sendNotification = true;
- }
- }
-
- if (sendNotification) {
- this.broadcasterSupport.sendNotification(new Notification(NOTIFICATION_TYPE, this, 1));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException {
- this.broadcasterSupport.addNotificationListener(listener, filter, handback);
- }
-
- /**
- * {@inheritDoc}
- */
- public MBeanNotificationInfo[] getNotificationInfo() {
- return new MBeanNotificationInfo[] { new MBeanNotificationInfo(new String[] { NOTIFICATION_TYPE }, Notification.class.getName(),
- "Deployer Recovery Complete Notification.") };
- }
-
- /**
- * {@inheritDoc}
- */
- public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException {
- this.broadcasterSupport.removeNotificationListener(listener);
- }
-
- /**
- * {@inheritDoc}
- */
- public void handleEvent(Event event) {
- if (TOPIC_RECOVERY_COMPLETED.equals(event.getTopic())) {
- signalRecoveryComplete();
- }
- }
-}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
index de0dd032..eb6780a3 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
+++ b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
@@ -84,15 +84,7 @@
interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
ref="importExpandingTransformer" ranking="5000" />
- <service id="recoveryMonitorService" ref="recoveryMonitor"
- interface="org.osgi.service.event.EventHandler">
- <service-properties>
- <beans:entry key="event.topics" value="org/eclipse/virgo/kernel/*" />
- </service-properties>
- </service>
-
- <beans:bean id="recoveryMonitor"
- class="org.eclipse.virgo.kernel.deployer.management.StandardRecoveryMonitor" />
+ <reference id="recoveryMonitor" interface="org.eclipse.virgo.nano.deployer.api.RecoveryMonitor" />
<service id="recoveryAgent" interface="org.osgi.service.event.EventHandler">
<service-properties>
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml
index 4b925270..4a9ad446 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml
+++ b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml
@@ -7,13 +7,13 @@
<!-- Deployer -->
<bean class="org.eclipse.virgo.kernel.management.ManagementExporter">
- <constructor-arg>
- <bean class="org.eclipse.virgo.kernel.deployer.management.StandardDeployer">
- <constructor-arg ref="pipelinedApplicationDeployer" />
- </bean>
- </constructor-arg>
- <constructor-arg
- value="#{kernelConfig.getProperty('domain')}:category=Control,type=Deployer" />
+ <constructor-arg>
+ <bean class="org.eclipse.virgo.kernel.deployer.management.StandardDeployer">
+ <constructor-arg ref="pipelinedApplicationDeployer" />
+ </bean>
+ </constructor-arg>
+ <constructor-arg
+ value="#{kernelConfig.getProperty('domain')}:category=Control,type=Deployer" />
</bean>
<!-- RecoveryMonitor -->
@@ -23,4 +23,6 @@
</bean>
<osgi:reference id="kernelConfig" interface="org.eclipse.virgo.nano.core.KernelConfig"/>
+
+ <osgi:reference id="recoveryMonitor" interface="org.eclipse.virgo.nano.deployer.api.RecoveryMonitor" />
</beans>
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/management/RecoveryMonitorTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/management/RecoveryMonitorTests.java
deleted file mode 100644
index 9ed9f347..00000000
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/management/RecoveryMonitorTests.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * 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:
- * VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.deployer.management;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.lang.management.ManagementFactory;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.service.event.Event;
-
-/**
- */
-public class RecoveryMonitorTests {
-
- private ObjectName objectName;
-
- private final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
-
- @Before public void before() throws Exception {
- this.objectName = ObjectName.getInstance("deployer:name=Recovery,env=Test");
- }
-
- public void after() throws Exception {
- if (this.server.isRegistered(this.objectName)) {
- this.server.unregisterMBean(this.objectName);
- }
- }
-
- @Test public void testRecoveryNotification() throws Exception {
- StandardRecoveryMonitor mbean = new StandardRecoveryMonitor();
- this.server.registerMBean(mbean, this.objectName);
- assertFalse(queryRecoveryComplete());
- final AtomicInteger counter = new AtomicInteger(0);
- this.server.addNotificationListener(this.objectName, new NotificationListener() {
-
- public void handleNotification(Notification notification, Object handback) {
- counter.incrementAndGet();
- }
-
- }, null, null);
- mbean.handleEvent(new Event("org/eclipse/virgo/kernel/deployer/recovery/COMPLETED", (Map<String, ?>)null));
- assertTrue(queryRecoveryComplete());
- assertEquals(1, counter.get());
- }
-
- private boolean queryRecoveryComplete() throws Exception {
- return (Boolean) this.server.getAttribute(this.objectName, "RecoveryComplete");
- }
-}
diff --git a/org.eclipse.virgo.kernel.test/ivy.xml b/org.eclipse.virgo.kernel.test/ivy.xml
index 722bd763..4a4c7c42 100644
--- a/org.eclipse.virgo.kernel.test/ivy.xml
+++ b/org.eclipse.virgo.kernel.test/ivy.xml
@@ -36,6 +36,7 @@
<dependency org="org.eclipse.virgo.mirrored" name="org.eclipse.equinox.console.ssh" rev="${org.eclipse.equinox.console.ssh}" conf="test->runtime" />
<dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.nano.core" rev="${org.eclipse.virgo.nano}" conf="test->compile"/>
+ <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.nano.management" rev="${org.eclipse.virgo.nano}" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.deployer" rev="latest.integration" conf="test->compile"/>
<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.shell.command" rev="latest.integration" conf="test->runtime"/>
diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties b/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties
index b9d91548..03b7e4f7 100644
--- a/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties
@@ -34,6 +34,7 @@ launcher.bundles =\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.core/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.core-${org.eclipse.virgo.nano}.jar@start,\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.api/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.deployer.api-${org.eclipse.virgo.nano}.jar,\
file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.hot/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.deployer.hot-${org.eclipse.virgo.nano}.jar,\
+ file:${ivy.cache}/repository/org.eclipse.virgo.nano/org.eclipse.virgo.nano.management/${org.eclipse.virgo.nano}/org.eclipse.virgo.nano.management-${org.eclipse.virgo.nano}.jar@start,\
file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
file:${ivy.cache}/repository/org.eclipse.gemini/org.eclipse.gemini.blueprint.core/1.0.2.RELEASE/org.eclipse.gemini.blueprint.core-1.0.2.RELEASE.jar,\
file:${ivy.cache}/repository/org.eclipse.gemini/org.eclipse.gemini.blueprint.extender/1.0.2.RELEASE/org.eclipse.gemini.blueprint.extender-1.0.2.RELEASE.jar@start,\

Back to the top