This is an automated email from the ASF dual-hosted git repository.

alien11689 pushed a commit to branch fix-jmx-builds
in repository https://gitbox.apache.org/repos/asf/aries.git

commit 5d277a568671350774f4c6597f358a8e075f7519
Author: Dominik Przybysz <[email protected]>
AuthorDate: Mon Jan 13 23:31:49 2025 +0100

    [MAINTENANCE] Fix jmx-whiteboard tests
---
 jmx/jmx-whiteboard/pom.xml                         | 69 +++++++++-------------
 .../jmx/whiteboard/JmxWhiteboardSupportTest.java   | 39 ++++++------
 2 files changed, 47 insertions(+), 61 deletions(-)

diff --git a/jmx/jmx-whiteboard/pom.xml b/jmx/jmx-whiteboard/pom.xml
index 1103faacc..8a4985966 100644
--- a/jmx/jmx-whiteboard/pom.xml
+++ b/jmx/jmx-whiteboard/pom.xml
@@ -24,9 +24,9 @@
     <parent>
         <groupId>org.apache.aries</groupId>
         <artifactId>parent</artifactId>
-        <version>2.0.1</version>
+        <version>2.1.1</version>
         <relativePath>../../parent/pom.xml</relativePath>
-    </parent>  
+    </parent>
 
     <groupId>org.apache.aries.jmx</groupId>
     <artifactId>org.apache.aries.jmx.whiteboard</artifactId>
@@ -46,18 +46,18 @@
         <url>https://gitbox.apache.org/repos/asf?p=aries.git;a=summary</url>
     </scm>
 
-    <!-- A Note on Testing ================= This project contains two kinds 
-        of tests: regular unit tests running in the test phase and integration 
tests 
-        based on PAX Exam running in the integration-test phase. Basically the 
complete 
-        project is build using Java 1.3 source and target compatibility (as 
inherited 
-        from the parent pom). The exception are the unit tests in the 
"integration" 
-        packages. These have to be compiled with Java 5 source and target 
compatibility 
-        because the employ annotations and generics. For running the 
integration 
-        tests from the console using Maven nothing special has to be done as 
the 
-        tests run automatically. To run the tests in your IDE, the project has 
to 
-        be built to the "package" phase with the profile "ide" enabled: $ mvn 
-Pide 
-        clean package This creates the scr.jar file in the target folder, 
which is 
-        used by the integration tests when run from the IDE. Alternatively the 
"project.bundle.file" 
+    <!-- A Note on Testing ================= This project contains two kinds
+        of tests: regular unit tests running in the test phase and integration 
tests
+        based on PAX Exam running in the integration-test phase. Basically the 
complete
+        project is build using Java 1.3 source and target compatibility (as 
inherited
+        from the parent pom). The exception are the unit tests in the 
"integration"
+        packages. These have to be compiled with Java 5 source and target 
compatibility
+        because the employ annotations and generics. For running the 
integration
+        tests from the console using Maven nothing special has to be done as 
the
+        tests run automatically. To run the tests in your IDE, the project has 
to
+        be built to the "package" phase with the profile "ide" enabled: $ mvn 
-Pide
+        clean package This creates the scr.jar file in the target folder, 
which is
+        used by the integration tests when run from the IDE. Alternatively the 
"project.bundle.file"
         system property may be set to the bundle JAR in the IDE launcher. -->
     <properties>
         <bundle.build.name>
@@ -81,13 +81,15 @@
         </aries.osgi.import.service>
 
         <exam.version>3.4.0</exam.version>
-        <url.version>1.6.0</url.version>
+        <javax.inject.version>1</javax.inject.version>
+        <org.eclipse.osgi.version>3.11.3</org.eclipse.osgi.version>
+        <url.version>2.5.3</url.version>
     </properties>
 
     <build>
         <plugins>
-            <!-- Exclude Integration tests in (default) unit tests and 
conversely 
-                enable integration tests for integration testing only. Helper 
classes are 
+            <!-- Exclude Integration tests in (default) unit tests and 
conversely
+                enable integration tests for integration testing only. Helper 
classes are
                 completely excluded from testing. -->
             <plugin>
                 <artifactId>maven-surefire-plugin</artifactId>
@@ -129,7 +131,7 @@
             <artifactId>slf4j-api</artifactId>
             <scope>provided</scope>
         </dependency>
-        
+
         <dependency>
             <groupId>org.apache.aries.jmx</groupId>
             <artifactId>org.apache.aries.jmx.core</artifactId>
@@ -199,9 +201,15 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.eclipse</groupId>
+            <groupId>org.eclipse.platform</groupId>
             <artifactId>org.eclipse.osgi</artifactId>
-            <version>3.8.0.v20120529-1548</version>
+            <version>${org.eclipse.osgi.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
+            <version>${javax.inject.version}</version>
         </dependency>
     </dependencies>
 
@@ -247,25 +255,4 @@
             </build>
         </profile>
     </profiles>
-
-    <!-- repositories for Pax Exam and BND tool -->
-    <repositories>
-        <repository>
-            <id>ops4j</id>
-            <name>ops4j</name>
-            <url>http://repository.ops4j.org/maven2</url>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-        </repository>
-        <repository>
-            <id>aqute</id>
-            <name>aqute</name>
-            <url>http://www.aqute.biz/repo</url>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-        </repository>
-    </repositories>
-
 </project>
diff --git 
a/jmx/jmx-whiteboard/src/test/java/org/apache/aries/jmx/whiteboard/JmxWhiteboardSupportTest.java
 
b/jmx/jmx-whiteboard/src/test/java/org/apache/aries/jmx/whiteboard/JmxWhiteboardSupportTest.java
index c2c24e3f7..b4fbfa24d 100644
--- 
a/jmx/jmx-whiteboard/src/test/java/org/apache/aries/jmx/whiteboard/JmxWhiteboardSupportTest.java
+++ 
b/jmx/jmx-whiteboard/src/test/java/org/apache/aries/jmx/whiteboard/JmxWhiteboardSupportTest.java
@@ -18,9 +18,12 @@
  */
 package org.apache.aries.jmx.whiteboard;
 
-import java.lang.reflect.Field;
-import java.util.Dictionary;
-import java.util.Hashtable;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
 
 import javax.management.DynamicMBean;
 import javax.management.InstanceAlreadyExistsException;
@@ -29,13 +32,9 @@ import javax.management.MBeanServer;
 import javax.management.NotCompliantMBeanException;
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
+import java.lang.reflect.Field;
+import java.util.Dictionary;
+import java.util.Hashtable;
 
 public class JmxWhiteboardSupportTest {
     @Test
@@ -98,7 +97,7 @@ public class JmxWhiteboardSupportTest {
 
         MBeanServer ms = Mockito.mock(MBeanServer.class);
         Mockito.when(ms.registerMBean(Mockito.any(), Mockito.eq(new 
ObjectName("test:key=val")))).
-        thenThrow(new InstanceAlreadyExistsException());
+                thenThrow(new InstanceAlreadyExistsException());
 
         s.addMBeanServer(ms);
         Mockito.verify(ml, Mockito.never()).error(Mockito.anyString(), 
Mockito.isA(Throwable.class));
@@ -123,7 +122,7 @@ public class JmxWhiteboardSupportTest {
 
         final Dictionary<String, Object> props = new Hashtable<String, 
Object>();
         props.put("jmx.objectname", "test:key=val");
-        props.put("warning.exceptions", new String [] 
{InstanceAlreadyExistsException.class.getName(),
+        props.put("warning.exceptions", new 
String[]{InstanceAlreadyExistsException.class.getName(),
                 MBeanRegistrationException.class.getName()});
 
         ServiceReference<?> sref = Mockito.mock(ServiceReference.class);
@@ -136,7 +135,7 @@ public class JmxWhiteboardSupportTest {
 
         MBeanServer ms = Mockito.mock(MBeanServer.class);
         Mockito.when(ms.registerMBean(Mockito.any(), Mockito.eq(new 
ObjectName("test:key=val")))).
-        thenThrow(new InstanceAlreadyExistsException());
+                thenThrow(new InstanceAlreadyExistsException());
 
         s.addMBeanServer(ms);
         Mockito.verify(ml, Mockito.never()).error(Mockito.anyString(), 
Mockito.isA(Throwable.class));
@@ -150,13 +149,13 @@ public class JmxWhiteboardSupportTest {
             throws InstanceAlreadyExistsException, MBeanRegistrationException, 
NotCompliantMBeanException {
         MBeanServer ms = Mockito.mock(MBeanServer.class);
         Mockito.when(ms.registerMBean(Mockito.any(), 
Mockito.isA(ObjectName.class))).then(
-            new Answer<ObjectInstance>() {
-                @Override
-                public ObjectInstance answer(InvocationOnMock invocation) 
throws Throwable {
-                    Object[] args = invocation.getArguments();
-                    return new ObjectInstance(((ObjectName) 
args[1]).toString(), args[0].getClass().getName());
-                }
-        });
+                new Answer<ObjectInstance>() {
+                    @Override
+                    public ObjectInstance answer(InvocationOnMock invocation) 
throws Throwable {
+                        Object[] args = invocation.getArguments();
+                        return new ObjectInstance(((ObjectName) 
args[1]).toString(), args[0].getClass().getName());
+                    }
+                });
         return ms;
     }
 

Reply via email to