From d87b664a2fbdf167443fef641a887a7168ba8854 Mon Sep 17 00:00:00 2001 From: Phillipus Date: Sun, 17 Nov 2024 15:11:36 +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 - Requires Mockito 5.14.0 or later which allows you to specify Mockito itself as an agent rather than ByteBuddy - Note - all test plug-ins need to declare a dependency on Mockito so that the mockito jar property ${org.mockito:mockito-core:jar} is always resolved for each test run - 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, it's simpler to add the following VM arguments: -Xshare:off -XX:+EnableDynamicAgentLoading --- .github/workflows/tests.yml | 2 +- com.archimatetool.editor.product/archi.target | 4 +-- tests/pom.xml | 30 ++++++++++++++++--- 3 files changed, 29 insertions(+), 7 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..02b8ff379 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/pom.xml b/tests/pom.xml index a07e68113..d0b1d5328 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/release/4.34.0 @@ -26,8 +34,8 @@ com.archimatetool.testsupport com.archimatetool.canvas.tests - com.archimatetool.csv.tests com.archimatetool.commandline.tests + com.archimatetool.csv.tests com.archimatetool.editor.tests com.archimatetool.export.svg.tests com.archimatetool.hammer.tests @@ -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}