From de44b705b626ea3a6e7c753eb02a108d0f873a7d Mon Sep 17 00:00:00 2001
From: Phillipus
Date: Wed, 13 Nov 2024 16:01:43 +0000
Subject: [PATCH] Add support for Mockito/ByteBuddy requiring javaagent on Java
21
- See https://github.com/mockito/mockito/issues/3037
- See https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#0.3
- Need to add org.mockito dependency to the testsupport plugin so that the path to the mockito jar is always resolved when using ${org.mockito:mockito-core:jar}
- To run JUnit in Eclipse you need to add the following VM arguments (adjust path version as required):
-Xshare:off
-javaagent:${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.mockito.mockito-core_5.14.2.jar
- Or, for now, simpler to add the following VM arguments:
-Xshare:off
-XX:+EnableDynamicAgentLoading
---
.github/workflows/tests.yml | 2 +-
com.archimatetool.editor.product/archi.target | 4 +--
.../META-INF/MANIFEST.MF | 1 +
tests/pom.xml | 28 +++++++++++++++++--
4 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 5bf599c24..c064e0e0a 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -14,7 +14,7 @@ jobs:
- name: Set up Java
uses: actions/setup-java@v4
with:
- java-version: '17'
+ java-version: '21'
distribution: 'temurin'
cache: 'maven'
diff --git a/com.archimatetool.editor.product/archi.target b/com.archimatetool.editor.product/archi.target
index e301a7b4b..10970a539 100644
--- a/com.archimatetool.editor.product/archi.target
+++ b/com.archimatetool.editor.product/archi.target
@@ -10,8 +10,8 @@
-
-
+
+
\ No newline at end of file
diff --git a/tests/com.archimatetool.testsupport/META-INF/MANIFEST.MF b/tests/com.archimatetool.testsupport/META-INF/MANIFEST.MF
index 1b7782e4c..6eae81d60 100644
--- a/tests/com.archimatetool.testsupport/META-INF/MANIFEST.MF
+++ b/tests/com.archimatetool.testsupport/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@ Bundle-Vendor: Archi
Bundle-RequiredExecutionEnvironment: JavaSE-17
Eclipse-BundleShape: dir
Export-Package: com.archimatetool.tests
+Import-Package: org.mockito
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui
Bundle-ClassPath: .
diff --git a/tests/pom.xml b/tests/pom.xml
index a07e68113..8a103bc77 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -12,13 +12,21 @@
com.archimatetool.testing
pom
-
+
+
+
+ -Xshare:off -javaagent:${org.mockito:mockito-core:jar}
+
+
+ ${mockito.args}
+
+
Orbit
p2
- https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.32.0
+ https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-12
@@ -43,6 +51,20 @@
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.8.1
+
+
+
+ properties
+
+
+
+
+
org.eclipse.tycho
tycho-surefire-plugin
@@ -67,7 +89,7 @@
- -XstartOnFirstThread
+ -XstartOnFirstThread ${mockito.args}