diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 4b37d96..7561098 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -9,3 +9,7 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "daily"
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "weekly"
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 67cc23a..1049ba3 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -1,38 +1,50 @@
name: Build, test and deploy
-on: [push, pull_request]
+on:
+ push:
+ branches: [ '*' ]
+ pull_request:
+ branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
- java: [8, 11]
+ java: [17, 21]
name: Java ${{ matrix.java }}
- env:
- CC_TEST_REPORTER_ID: 47b239597faea3da257baa211d7438ff8ba9047319a2c687110f4f8e41bb07f1
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v4
- name: Set up Java ${{ matrix.java }}
- uses: actions/setup-java@v1
+ uses: actions/setup-java@v4
with:
+ distribution: 'temurin'
java-version: ${{ matrix.java }}
- - name: Build with Maven
- run: mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
+ - name: Cache Maven packages
+ uses: actions/cache@v4
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Build with Maven
+ run: ./mvnw install --no-transfer-progress -DskipTests=true -Dmaven.javadoc.skip=true -B -V
id: mvnInstall
- name: Run tests
- run: mvn test -B
+ run: ./mvnw test jacoco:report-aggregate -B
id: mvnTest
- - name: Record coverage
- run: |
- mvn clean cobertura:cobertura coveralls:report
-# if: startsWith(matrix.java, 8)
-# - name: Deploy to Github packages
-# env:
-# token: ${{ secrets.GITHUB_TOKEN }}
-# packagesUrl: https://maven.pkg.github.com/zapodot
-# run: |
-# mvn deploy -Dregistry=$packagesUrl -Dtoken=$token
-# id: deployGithubPackages
-# if: startsWith(matrix.java, 11)
-
+ - name: Coveralls Parallel
+ uses: coverallsapp/github-action@v2
+ with:
+ flag-name: run-${{ join(matrix.*, '-') }}
+ debug: true
+ compare-ref: master
+ parallel: true
+ finish:
+ needs: build
+ runs-on: ubuntu-latest
+ steps:
+ - name: Coveralls Finished
+ uses: coverallsapp/github-action@v2
+ with:
+ parallel-finished: true
+ carryforward: "run-17,run-21"
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000..d58dfb7
--- /dev/null
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,19 @@
+# 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.
+wrapperVersion=3.3.2
+distributionType=only-script
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
diff --git a/embedded-jms-core/pom.xml b/embedded-jms-core/pom.xml
index 828e780..888aa34 100644
--- a/embedded-jms-core/pom.xml
+++ b/embedded-jms-core/pom.xml
@@ -5,7 +5,7 @@
embedded-jms-parent
org.zapodot
- 0.3-SNAPSHOT
+ 1.0-SNAPSHOT
4.0.0
@@ -30,21 +30,22 @@
test
- org.mockito
- mockito-junit-jupiter
- ${mockito.version}
+ org.junit.jupiter
+ junit-jupiter
test
org.junit.jupiter
- junit-jupiter-api
+ junit-jupiter-engine
test
- org.junit.jupiter
- junit-jupiter-engine
+ org.mockito
+ mockito-junit-jupiter
+ ${mockito.version}
test
+
diff --git a/embedded-jms-junit/pom.xml b/embedded-jms-junit/pom.xml
index bcb9a8f..3d457bf 100644
--- a/embedded-jms-junit/pom.xml
+++ b/embedded-jms-junit/pom.xml
@@ -5,7 +5,7 @@
org.zapodot
embedded-jms-parent
- 0.3-SNAPSHOT
+ 1.0-SNAPSHOT
4.0.0
@@ -82,15 +82,6 @@
maven-javadoc-plugin
-
- org.eluder.coveralls
- coveralls-maven-plugin
-
-
- org.codehaus.mojo
- cobertura-maven-plugin
-
-
diff --git a/embedded-jms-junit5/pom.xml b/embedded-jms-junit5/pom.xml
index 7c21f1f..05766a8 100644
--- a/embedded-jms-junit5/pom.xml
+++ b/embedded-jms-junit5/pom.xml
@@ -5,7 +5,7 @@
org.zapodot
embedded-jms-parent
- 0.3-SNAPSHOT
+ 1.0-SNAPSHOT
4.0.0
@@ -84,14 +84,6 @@
maven-javadoc-plugin
-
- org.eluder.coveralls
- coveralls-maven-plugin
-
-
- org.codehaus.mojo
- cobertura-maven-plugin
-
diff --git a/embedded-jms-junit5/src/main/java/org/zapodot/junit5/jms/EmbeddedJmsBroker.java b/embedded-jms-junit5/src/main/java/org/zapodot/junit5/jms/EmbeddedJmsBroker.java
index 3055dc4..914ef55 100644
--- a/embedded-jms-junit5/src/main/java/org/zapodot/junit5/jms/EmbeddedJmsBroker.java
+++ b/embedded-jms-junit5/src/main/java/org/zapodot/junit5/jms/EmbeddedJmsBroker.java
@@ -2,12 +2,7 @@
import com.google.common.base.Strings;
import org.apache.activemq.ActiveMQConnectionFactory;
-import org.junit.jupiter.api.extension.AfterEachCallback;
-import org.junit.jupiter.api.extension.BeforeEachCallback;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.api.extension.ParameterContext;
-import org.junit.jupiter.api.extension.ParameterResolver;
-import org.junit.jupiter.api.extension.TestInstancePostProcessor;
+import org.junit.jupiter.api.extension.*;
import org.junit.platform.commons.util.AnnotationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,8 +30,6 @@ public class EmbeddedJmsBroker implements BeforeEachCallback, AfterEachCallback,
private static final ExtensionContext.Namespace EMBEDDED_JMS_EXT = ExtensionContext.Namespace
.create("org.zapodot.junit5.jms");
- private static final String TEST_INSTANCE = "TestInstance";
-
private static final String STORE_EMBEDDED_JMS_BROKER = "EmbeddedJmsBroker";
private static final String STORE_BROKER_CONFIGURATION = "BrokerConfiguration";
@@ -171,18 +164,11 @@ public void beforeEach(final ExtensionContext context) {
final EmbeddedJMSBrokerHolder embeddedJmsBrokerHolder = getOrCreateEmbeddedJMSBrokerHolder(context);
embeddedJmsBrokerHolder.start();
- Object testInstance = context.getStore(EMBEDDED_JMS_EXT).get(TEST_INSTANCE);
- if (testInstance == null) {
- testInstance = context.getTestInstance().orElse(null);
- }
- Optional.ofNullable(testInstance)
- .ifPresent(ti -> FieldInjector.injectToInstance(ti, embeddedJmsBrokerHolder));
+ context.getTestInstances().ifPresent(instance -> FieldInjector.injectToInstance(instance, embeddedJmsBrokerHolder));
}
@Override
public void postProcessTestInstance(final Object testInstance, final ExtensionContext context) {
- LOGGER.debug("postProcessTestInstance instance: \"{}\"", testInstance);
- context.getStore(EMBEDDED_JMS_EXT).put(TEST_INSTANCE, testInstance);
createBrokerConfigurationFromContext(context)
.ifPresent(c -> context.getStore(EMBEDDED_JMS_EXT).put(STORE_BROKER_CONFIGURATION, c));
diff --git a/embedded-jms-junit5/src/main/java/org/zapodot/junit5/jms/internal/FieldInjector.java b/embedded-jms-junit5/src/main/java/org/zapodot/junit5/jms/internal/FieldInjector.java
index 76115b7..5c5a16e 100644
--- a/embedded-jms-junit5/src/main/java/org/zapodot/junit5/jms/internal/FieldInjector.java
+++ b/embedded-jms-junit5/src/main/java/org/zapodot/junit5/jms/internal/FieldInjector.java
@@ -1,7 +1,7 @@
package org.zapodot.junit5.jms.internal;
import org.apache.activemq.ActiveMQConnectionFactory;
-import org.junit.platform.commons.util.ReflectionUtils;
+import org.junit.jupiter.api.extension.TestInstances;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zapodot.jms.common.EmbeddedJMSBrokerHolder;
@@ -9,7 +9,6 @@
import javax.jms.ConnectionFactory;
import java.lang.reflect.Field;
import java.net.URI;
-import java.util.Optional;
/**
* FieldInjector - part of the internal API. May be removed, moved or changed without prior deprecation
@@ -22,20 +21,11 @@ private FieldInjector() {
// Constructor added to avoid instantiation
}
- public static void injectToInstance(final Object instance, final EmbeddedJMSBrokerHolder embeddedJMSBrokerHolder) {
- if (instance.getClass().isMemberClass()) {
- tryToFindOuterInstance(instance)
- .ifPresent(i -> injectToInstance(i, embeddedJMSBrokerHolder));
- }
- InjectableFieldsAccessor.findInjectableFields(instance.getClass())
- .stream()
- .forEach(field -> injectConnectionFactoryOrURI(instance,
- field,
- embeddedJMSBrokerHolder));
- }
-
- private static Optional