From c43e03e5bc00ff3dbe5e204c19f4d0736e697e20 Mon Sep 17 00:00:00 2001 From: Robert Munteanu Date: Mon, 16 Dec 2024 17:10:40 +0100 Subject: [PATCH] ARIES-2160 - Simple MBeanServer based on the platform implementation Use the new MBeanServer Platform bundle in the ITs --- jmx/jmx-itests/pom.xml | 5 +++ .../aries/jmx/AbstractIntegrationTest.java | 11 +----- .../aries/jmx/test/MbeanServerActivator.java | 35 ------------------- 3 files changed, 6 insertions(+), 45 deletions(-) delete mode 100644 jmx/jmx-itests/src/test/java/org/apache/aries/jmx/test/MbeanServerActivator.java diff --git a/jmx/jmx-itests/pom.xml b/jmx/jmx-itests/pom.xml index b3bae890f5..0c27bbdcff 100644 --- a/jmx/jmx-itests/pom.xml +++ b/jmx/jmx-itests/pom.xml @@ -76,6 +76,11 @@ org.apache.aries.jmx.core.whiteboard 1.1.7-SNAPSHOT + + org.apache.aries.jmx + org.apache.aries.jmx.mbeanserver-platform + 0.0.1-SNAPSHOT + org.osgi org.osgi.compendium diff --git a/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/AbstractIntegrationTest.java b/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/AbstractIntegrationTest.java index dc27be19ca..250d5ddafa 100644 --- a/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/AbstractIntegrationTest.java +++ b/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/AbstractIntegrationTest.java @@ -40,11 +40,9 @@ import javax.management.MBeanServerInvocationHandler; import javax.management.ObjectName; -import org.apache.aries.jmx.test.MbeanServerActivator; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.options.MavenArtifactProvisionOption; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; import org.osgi.framework.Bundle; @@ -87,17 +85,10 @@ protected Option jmxRuntime() { mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.api").versionAsInProject(), mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.whiteboard").versionAsInProject(), mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit").versionAsInProject(), - mbeanServerBundle() + mavenBundle("org.apache.aries.jmx", "org.apache.aries.jmx.mbeanserver-platform").versionAsInProject() ); } - protected Option mbeanServerBundle() { - return provision(bundle() - .add(MbeanServerActivator.class) - .set(Constants.BUNDLE_ACTIVATOR, MbeanServerActivator.class.getName()) - .build(withBnd())); - } - protected Option bundlea() { return provision(bundle() .add(org.apache.aries.jmx.test.bundlea.Activator.class) diff --git a/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/test/MbeanServerActivator.java b/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/test/MbeanServerActivator.java deleted file mode 100644 index 3b07a222e9..0000000000 --- a/jmx/jmx-itests/src/test/java/org/apache/aries/jmx/test/MbeanServerActivator.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.aries.jmx.test; - -import javax.management.MBeanServer; -import javax.management.MBeanServerFactory; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class MbeanServerActivator implements BundleActivator { - - public void start(BundleContext context) throws Exception { - MBeanServer mBeanServer = MBeanServerFactory.createMBeanServer(); - context.registerService(MBeanServer.class, mBeanServer, null); - } - - public void stop(BundleContext context) throws Exception { - } - -}