Diagnose mockito downgrade better 09/105409/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 23 Feb 2023 16:33:16 +0000 (17:33 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 12 Apr 2023 09:36:21 +0000 (11:36 +0200)
Mockito is doing a very weird thing to get the inline MockMaker work,
which is known to not work with OSGi. Clean up the way we are
approaching byte-buddy and provide a pointer to the issue.

Change-Id: I87420710c5b6859e984fb72204826b91c7e4863a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 17a018384a969e748b79c1146b982f3b924c178d)

opendaylight/md-sal/mdsal-it-parent/pom.xml
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractIT.java

index fc76f8d3d1eeb78da440badf588711f3ec70fda1..005b019cd4b2a04e7186f601a0199798c832c74d 100644 (file)
@@ -93,20 +93,19 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
         <groupId>org.osgi</groupId>
         <artifactId>org.osgi.framework</artifactId>
     </dependency>
-    <dependency>
-        <groupId>junit</groupId>
-        <artifactId>junit</artifactId>
-    </dependency>
 
-    <!-- Testing Dependencies -->
+    <!--
+        Unfortunately default mockito-inline does not work in OSGi.
+        See https://github.com/mockito/mockito/issues/2203#issuecomment-926372053
+      -->
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
-      <!-- Seems to be broken with 5.1.1 -->
-      <version>4.11.0</version>      
+      <version>4.11.0</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
+
   <build>
     <plugins>
       <plugin>
@@ -177,20 +176,20 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
         <artifactId>maven-dependency-plugin</artifactId>
         <executions>
           <execution>
-           <id>unpack-karaf-resources</id>
-           <goals>
-            <goal>unpack-dependencies</goal>
-           </goals>
-           <phase>process-test-resources</phase>
-           <configuration>
-            <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
-            <groupId>org.opendaylight.controller</groupId>
-            <includeArtifactIds>mockito-core,objenesis,mdsal-it-base</includeArtifactIds>
-            <excludes>META-INF\/**</excludes>
-            <ignorePermissions>false</ignorePermissions>
-           </configuration>
+            <id>unpack-karaf-resources</id>
+            <goals>
+              <goal>unpack-dependencies</goal>
+            </goals>
+            <phase>process-test-resources</phase>
+            <configuration>
+              <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
+              <groupId>org.opendaylight.controller</groupId>
+              <includeArtifactIds>mockito-core,byte-buddy,objenesis,mdsal-it-base</includeArtifactIds>
+              <excludes>META-INF\/**</excludes>
+              <ignorePermissions>false</ignorePermissions>
+            </configuration>
           </execution>
-         </executions>
+        </executions>
       </plugin>
     </plugins>
   </build>
index 60b4865ee2aa7e7a043a14114fdc961d296f2fec..0996dae3b938a44d76314d3f7392128c28ffba6d 100644 (file)
@@ -33,7 +33,6 @@ public abstract class AbstractIT extends AbstractMdsalTestBase {
     protected Option[] getAdditionalOptions() {
         return new Option[] {
                 mavenBundle("org.opendaylight.controller", "sal-test-model").versionAsInProject(),
-                mavenBundle("net.bytebuddy", "byte-buddy").versionAsInProject(),
         };
     }
 }