From 0cbe341c1bb1043d7c55678b3623918196f02292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Suszy=C5=84ski?= Date: Tue, 18 Dec 2018 22:27:08 +0100 Subject: [PATCH 1/2] Support for Java 9 & 11 * Adding support for Java 9 and 11. * Configuring CI to build ok: JDK 6, 7, 8, 9, and 11 --- .circleci/config.yml | 73 +++++++++++++++++++ .editorconfig | 5 +- .travis.yml | 34 +++++---- pom.xml | 12 +-- .../exceptions/EidRuntimeExceptionTest.java | 19 +++-- .../eid/utils/EidPreconditionsTest.java | 3 +- src/test/resources/logback-test.xml | 32 ++++++++ src/test/resources/simplelogger.properties | 21 ------ 8 files changed, 144 insertions(+), 55 deletions(-) create mode 100644 .circleci/config.yml create mode 100644 src/test/resources/logback-test.xml delete mode 100644 src/test/resources/simplelogger.properties diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..a06a00f --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,73 @@ +# Java Maven CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-java/ for more details +# +version: 2 + +references: + build: &build + working_directory: ~/repo + + environment: + # Customize the JVM maximum heap limit + MAVEN_OPTS: -Xmx2048m + JACOCO: true + + steps: + - checkout + + # Download and cache dependencies + - restore_cache: + keys: + - v2-dependencies-{{ checksum "pom.xml" }} + # fallback to using the latest cache if no exact match is found + - v2-dependencies- + + - run: + name: Go Offline with Maven + command: mvn verify -DskipTests + + - save_cache: + paths: + - ~/.m2 + key: v2-dependencies-{{ checksum "pom.xml" }} + + # run tests! + - run: + name: Run integration tests + command: mvn verify + +workflows: + version: 2 + integration-tests: + jobs: + - zulu-6 + - zulu-7 + - zulu-8 + - zulu-9 + - zulu-11 + +jobs: + zulu-6: + docker: + - image: wavesoftware/circleci-zulujdk:6 + <<: *build + zulu-7: + docker: + - image: wavesoftware/circleci-zulujdk:7 + <<: *build + zulu-8: + docker: + - image: wavesoftware/circleci-zulujdk:8 + <<: *build + zulu-9: + docker: + - image: wavesoftware/circleci-zulujdk:9 + <<: *build + zulu-11: + docker: + - image: wavesoftware/circleci-zulujdk:11 + <<: *build + + + diff --git a/.editorconfig b/.editorconfig index 0f8ba0c..eb6626d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,4 +9,7 @@ end_of_line = lf insert_final_newline = true charset = utf-8 indent_style = space -indent_size = 4 \ No newline at end of file +indent_size = 4 + +[*.yml] +indent_size = 2 diff --git a/.travis.yml b/.travis.yml index d4b6de4..f73d8c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,24 @@ language: java +dist: trusty +before_script: mvn dependency:go-offline script: mvn clean verify --fail-at-end notifications: email: - on_failure: true + on_failure: change matrix: include: - # Performance testing - - jdk: openjdk7 - env: JACOCO=false - - jdk: openjdk8 - env: JACOCO=false - # Quality testing - - jdk: openjdk7 - env: JACOCO=true - - jdk: openjdk8 - env: JACOCO=true COVERALLS=true - - jdk: oraclejdk8 - env: JACOCO=true - - jdk: openjdk8 - env: JACOCO=true SONAR=publish - script: mvn clean verify sonar:sonar --fail-at-end + # Quality testing + - jdk: oraclejdk8 + env: JACOCO=true COVERALLS=true + - jdk: oraclejdk8 + env: JACOCO=true SONAR=publish + script: mvn clean verify sonar:sonar --fail-at-end + # Performance testing + - jdk: openjdk7 + env: JACOCO=false + - jdk: openjdk8 + env: JACOCO=false + - jdk: oraclejdk9 + env: JACOCO=false + - jdk: oraclejdk11 + env: JACOCO=false diff --git a/pom.xml b/pom.xml index 38d988b..76ac141 100644 --- a/pom.xml +++ b/pom.xml @@ -126,19 +126,19 @@ org.openjdk.jmh jmh-core - 1.11.3 + 1.16 test org.openjdk.jmh jmh-generator-annprocess - 1.11.3 + 1.16 test - org.slf4j - slf4j-simple - 1.7.20 + ch.qos.logback + logback-classic + 1.2.3 test @@ -207,7 +207,7 @@ -Werror - -Xlint:all + -Xlint:all,-options,-processing diff --git a/src/test/java/pl/wavesoftware/eid/exceptions/EidRuntimeExceptionTest.java b/src/test/java/pl/wavesoftware/eid/exceptions/EidRuntimeExceptionTest.java index 1d70a74..b54aaa7 100644 --- a/src/test/java/pl/wavesoftware/eid/exceptions/EidRuntimeExceptionTest.java +++ b/src/test/java/pl/wavesoftware/eid/exceptions/EidRuntimeExceptionTest.java @@ -21,7 +21,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; -import javax.xml.bind.JAXBException; +import javax.naming.NamingException; import java.util.UnknownFormatConversionException; import static org.hamcrest.CoreMatchers.containsString; @@ -32,7 +32,6 @@ * @author Krzysztof SuszyƄski * @since 2015-10-07 */ -@SuppressWarnings("ConstantConditions") public class EidRuntimeExceptionTest { @Rule @@ -42,19 +41,19 @@ public class EidRuntimeExceptionTest { public void testGetMessage() { // then thrown.expect(EidRuntimeException.class); - thrown.expectCause(CoreMatchers.instanceOf(JAXBException.class)); + thrown.expectCause(CoreMatchers.instanceOf(NamingException.class)); thrown.expectCause(hasMessage(is((String) null))); thrown.expectMessage(containsString("20151007:212217")); - thrown.expectMessage(containsString("javax.xml.bind.JAXBException\n - " + - "with linked exception:\n" + - "[java.util.UnknownFormatConversionException: " + - "Conversion = Invalid for unit test]")); + thrown.expectMessage(containsString( + "javax.naming.NamingException [Root exception is java.util" + + ".UnknownFormatConversionException: Conversion = Invalid for" + + " unit test]" + )); // given - String message = null; Throwable original = new UnknownFormatConversionException("Invalid for unit test"); - JAXBException cause = new JAXBException(message); - cause.setLinkedException(original); + NamingException cause = new NamingException(null); + cause.setRootCause(original); throw new EidRuntimeException("20151007:212217", cause); } diff --git a/src/test/java/pl/wavesoftware/eid/utils/EidPreconditionsTest.java b/src/test/java/pl/wavesoftware/eid/utils/EidPreconditionsTest.java index 9e58234..944d4c3 100644 --- a/src/test/java/pl/wavesoftware/eid/utils/EidPreconditionsTest.java +++ b/src/test/java/pl/wavesoftware/eid/utils/EidPreconditionsTest.java @@ -34,6 +34,7 @@ import javax.annotation.Nonnull; import java.lang.reflect.Constructor; +import java.lang.reflect.Modifier; import java.util.Locale; import static org.assertj.core.api.Assertions.assertThat; @@ -471,7 +472,7 @@ public void testCreate() throws NoSuchMethodException { // given Class cls = EidPreconditions.class; Constructor constructor = cls.getDeclaredConstructor(); - boolean access = constructor.isAccessible(); + boolean access = Modifier.isPublic(constructor.getModifiers()); // then assertThat(access).isFalse(); diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml new file mode 100644 index 0000000..fe834c9 --- /dev/null +++ b/src/test/resources/logback-test.xml @@ -0,0 +1,32 @@ + + + + + + + %highlight(%-5level) %magenta(%d{HH:mm:ss.SSS}) %cyan(%logger{36}) - %msg%n + + + + + + + diff --git a/src/test/resources/simplelogger.properties b/src/test/resources/simplelogger.properties deleted file mode 100644 index e508ef4..0000000 --- a/src/test/resources/simplelogger.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright (c) 2015 Wave Software -# -# Licensed 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. -# - -# SLF4J's SimpleLogger configuration file -org.slf4j.simpleLogger.defaultLogLevel=info -org.slf4j.simpleLogger.showThreadName=false -org.slf4j.simpleLogger.showLogName=false -org.slf4j.simpleLogger.showShortLogName=false From 2fa5dc18c62f25a5bb70cb943907de5ffb2ca75b Mon Sep 17 00:00:00 2001 From: Krzysztof Suszynski Date: Thu, 27 Dec 2018 13:22:48 +0100 Subject: [PATCH 2/2] Removing Jacoco from build --- .circleci/config.yml | 2 +- src/test/java/pl/wavesoftware/eid/EidIT.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a06a00f..d39a9a0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ references: environment: # Customize the JVM maximum heap limit MAVEN_OPTS: -Xmx2048m - JACOCO: true + JACOCO: false steps: - checkout diff --git a/src/test/java/pl/wavesoftware/eid/EidIT.java b/src/test/java/pl/wavesoftware/eid/EidIT.java index 3bc990c..a132ae4 100644 --- a/src/test/java/pl/wavesoftware/eid/EidIT.java +++ b/src/test/java/pl/wavesoftware/eid/EidIT.java @@ -56,7 +56,7 @@ public class EidIT { .around(JavaAgentSkip.ifActive()); @Test - public void doBenckmarking() throws Exception { + public void benchmark() throws Exception { Options opt = new OptionsBuilder() .include(this.getClass().getName() + ".*") .mode(Mode.Throughput)