From 195da9a536fcc6bafeb53e380d787b450e7a1382 Mon Sep 17 00:00:00 2001 From: YukiInu Date: Wed, 12 Jun 2024 13:55:17 +0200 Subject: [PATCH 1/4] updatedependencies --- CHANGELOG.md | 29 ++ archetypes/pom.xml | 2 +- .../dvalin/cloud/aws/EC2ContextTest.java | 1 - cluster/hazelcast/pom.xml | 2 +- .../dvalin/daemon/AdditionalConfigTest.java | 6 +- .../taimos/dvalin/daemon/SpringLockTest.java | 30 +- .../dynamodb/marshal/EnumMarshallerTest.java | 20 +- .../i18n/AbstractResourceFrameworkTest.java | 28 +- .../i18n/ResourceFrameworkXmlAndYamlTest.java | 8 +- .../core/InterconnectConnectorBurstTest.java | 4 +- .../core/InterconnectConnectorITTest.java | 262 +++++++++--------- .../core/MessageConnectorITTest.java | 121 ++++---- .../interconnect/core/MessageConnector.java | 2 +- .../core/daemon/PagingController.java | 4 +- .../model/AbstractInterconnectModel.java | 2 +- .../model/maven/model/ModelTools.java | 2 +- .../maven/model/ivo/AbstractIVOModel.java | 2 +- .../maven/model/ivo/filter/FindIVOModel.java | 2 +- .../model/ivo/filter/FindInterfaceModel.java | 2 +- .../metamodel/memberdef/FilterableType.java | 2 +- .../model/DateTimeDeserializerWithTZ.java | 2 +- .../model/DateTimeKeyDeserializer.java | 6 +- .../model/ivo/util/GenericConverter.java | 2 +- .../model/InterconnectListTest.java | 10 +- .../model/common/FutureImplTest.java | 206 ++++++-------- .../model/common/MessageCryptoUtilTest.java | 11 +- .../common/daemon/ADaemonErrorNumberTest.java | 16 +- .../common/daemon/DaemonScannerTest.java | 194 +++++++------ .../model/ivo/daemon/DaemonErrorIVOTest.java | 10 +- .../model/ivo/daemon/PingIVOTest.java | 10 +- .../model/ivo/daemon/PongIVOTest.java | 11 +- .../model/ivo/daemon/VoidIVOTest.java | 11 +- jaxrs-jwtauth/pom.xml | 4 +- jaxrs-swagger/pom.xml | 2 +- jaxrs/pom.xml | 11 +- .../security/basicauth/BasicAuthFilter.java | 5 +- .../dvalin/jaxrs/StringTextProviderTest.java | 1 - .../jaxrs/annotationscanner/ScannerTest.java | 27 +- .../dvalin/jaxrs/security/HashTest.java | 2 - jpa/pom.xml | 2 +- .../de/taimos/dvalin/mongo/ABaseTest.java | 8 +- .../de/taimos/dvalin/mongo/LinkTester.java | 12 +- .../java/de/taimos/dvalin/mongo/Tester.java | 54 ++-- .../logging/ConsoleMetricSenderTest.java | 10 +- .../AmazonEndpointCreationExceptionTest.java | 25 +- .../dvalin/notification/push/Platform.java | 10 +- .../dvalin/orchestration/etcd/KeyTest.java | 16 +- pom.xml | 127 +++++++-- test/pom.xml | 7 +- .../test/inject/InjectionUtilsTest.java | 223 ++++++++------- 50 files changed, 824 insertions(+), 742 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4b0734f..6c6eee79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,33 @@ # current master +* Update dependencies + * Spring 5.3.36 + * AWS 1.12.739 + * Jetty 9.4.53.v20231009 + * Joda-Time 2.12.7 + * Log4J 2.23.1 + * ActiveMQ 5.16.7 + * Apache CXF 3.5.8 + * JSON Small and Fast Parser 2.5.1 + * Jackson 2.17.1 + * Guava 33.2.1-jre + * Hazelcast 5.3.7 + * Swagger 2.2.22 + * Liquibase 4.28.0 + * Mongo Java Driver 4.11.2 + * Mongock 5.4.2 + * Bouncycastle Provider 1.78.1 + * Nimbus JOSE+JWT 9.40 + * Commons Codec 1.17.0 + * Junit 5.10.2 + * Bson 2.15.1 + * Concordion 4.0.1 +* Removed (unused) cglib from dvalin-jaxrs +* Removed concordion-extensions +* Migrated all JUnit tests to Junit 5 syntax +* Breaking: Removed Junit 5 Vintage engine and Junit 4 (can be added in projects that need it) +* Fixed vulnerabilities: CVE-2023-52428(nimbus-jose-jwt), CVE-2024-29857,CVE-2024-30171,CVE-2024-30172,CVE-2024-34447 (bouncycastle), CVE-2024-28752 (Apache CXF) + +# 1.35 * Update dependencies * Spring 5.3.31 * AWS 1.12.641 diff --git a/archetypes/pom.xml b/archetypes/pom.xml index ee568d46..6d5f58b3 100644 --- a/archetypes/pom.xml +++ b/archetypes/pom.xml @@ -2,8 +2,8 @@ 4.0.0 pom - dvalin-parent de.taimos + dvalin-parent 1.36-SNAPSHOT dvalin-archetype-parent diff --git a/cloud/aws/src/test/java/de/taimos/dvalin/cloud/aws/EC2ContextTest.java b/cloud/aws/src/test/java/de/taimos/dvalin/cloud/aws/EC2ContextTest.java index 359dca6c..3c2c0a3b 100644 --- a/cloud/aws/src/test/java/de/taimos/dvalin/cloud/aws/EC2ContextTest.java +++ b/cloud/aws/src/test/java/de/taimos/dvalin/cloud/aws/EC2ContextTest.java @@ -43,7 +43,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.MockedStatic; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; diff --git a/cluster/hazelcast/pom.xml b/cluster/hazelcast/pom.xml index 94cfce6f..81c8bc4f 100644 --- a/cluster/hazelcast/pom.xml +++ b/cluster/hazelcast/pom.xml @@ -8,7 +8,7 @@ dvalin-cluster-hazelcast Dvalin Hazelcast support - 5.3.6 + 5.3.7 diff --git a/daemon/src/test/java/de/taimos/dvalin/daemon/AdditionalConfigTest.java b/daemon/src/test/java/de/taimos/dvalin/daemon/AdditionalConfigTest.java index e24258ba..7ef1ae58 100644 --- a/daemon/src/test/java/de/taimos/dvalin/daemon/AdditionalConfigTest.java +++ b/daemon/src/test/java/de/taimos/dvalin/daemon/AdditionalConfigTest.java @@ -4,12 +4,11 @@ import de.taimos.daemon.spring.AdditionalRunnerConfiguration; import de.taimos.daemon.spring.RunnerConfiguration; import de.taimos.daemon.spring.SpringDaemonExtension; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Value; -import static org.junit.Assert.assertEquals; - /** * Copyright 2023 Cinovo AG
*
@@ -29,8 +28,7 @@ public class AdditionalConfigTest { */ @Test public void testAdditionalConfiguration() { - assertEquals("The propery 'jwtauth.issuer' was not equals to the value of AdditionalTestConfig.TEST_VALUE", - AdditionalTestConfig.TEST_VALUE, this.jwtIssuer); + Assertions.assertEquals(AdditionalTestConfig.TEST_VALUE, this.jwtIssuer, "The propery 'jwtauth.issuer' was not equals to the value of AdditionalTestConfig.TEST_VALUE"); } } diff --git a/daemon/src/test/java/de/taimos/dvalin/daemon/SpringLockTest.java b/daemon/src/test/java/de/taimos/dvalin/daemon/SpringLockTest.java index f1d74dde..4c97bbb4 100644 --- a/daemon/src/test/java/de/taimos/dvalin/daemon/SpringLockTest.java +++ b/daemon/src/test/java/de/taimos/dvalin/daemon/SpringLockTest.java @@ -20,10 +20,10 @@ * #L% */ -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -public class SpringLockTest { +class SpringLockTest { @Test public void startContext() throws Exception { @@ -35,8 +35,8 @@ public void startContext() throws Exception { public void testCtx() throws Exception { TestAdapter adapter = new TestAdapter("good"); adapter.doStart(); - Assert.assertNotNull(adapter.getContext()); - Assert.assertNotNull(adapter.getContext().getId()); + Assertions.assertNotNull(adapter.getContext()); + Assertions.assertNotNull(adapter.getContext().getId()); adapter.doStop(); } @@ -45,16 +45,16 @@ public void testStopBad() { TestAdapter adapter = new TestAdapter("bad"); try { adapter.doStart(); - Assert.fail(); + Assertions.fail(); } catch (Exception e) { // should happen } - Assert.assertNull(adapter.getContext()); + Assertions.assertNull(adapter.getContext()); try { adapter.doStop(); - Assert.fail(); + Assertions.fail(); } catch (Exception e) { - Assert.assertEquals(RuntimeException.class, e.getClass()); + Assertions.assertEquals(RuntimeException.class, e.getClass()); } } @@ -62,12 +62,12 @@ public void testStopBad() { public void testDoubleStart() throws Exception { TestAdapter adapter = new TestAdapter("good"); adapter.doStart(); - Assert.assertNotNull(adapter.getContext()); + Assertions.assertNotNull(adapter.getContext()); try { adapter.doStart(); - Assert.fail(); + Assertions.fail(); } catch (Exception e) { - Assert.assertEquals(RuntimeException.class, e.getClass()); + Assertions.assertEquals(RuntimeException.class, e.getClass()); } adapter.doStop(); } @@ -76,13 +76,13 @@ public void testDoubleStart() throws Exception { public void testDoubleStop() throws Exception { TestAdapter adapter = new TestAdapter("good"); adapter.doStart(); - Assert.assertNotNull(adapter.getContext()); + Assertions.assertNotNull(adapter.getContext()); adapter.doStop(); try { adapter.doStop(); - Assert.fail(); + Assertions.fail(); } catch (Exception e) { - Assert.assertEquals(RuntimeException.class, e.getClass()); + Assertions.assertEquals(RuntimeException.class, e.getClass()); } } } diff --git a/dynamodb/src/test/java/de/taimos/dvalin/dynamodb/marshal/EnumMarshallerTest.java b/dynamodb/src/test/java/de/taimos/dvalin/dynamodb/marshal/EnumMarshallerTest.java index 509c1154..ba9d87ff 100644 --- a/dynamodb/src/test/java/de/taimos/dvalin/dynamodb/marshal/EnumMarshallerTest.java +++ b/dynamodb/src/test/java/de/taimos/dvalin/dynamodb/marshal/EnumMarshallerTest.java @@ -9,9 +9,9 @@ * 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. @@ -20,35 +20,35 @@ * #L% */ -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class EnumMarshallerTest { @Test public void marshall() throws Exception { EnumMarshaller m = new EnumMarshaller(); - Assert.assertEquals(TestEnum.EnumValue1.toString(), m.marshall(TestEnum.EnumValue1)); - Assert.assertEquals(TestEnum.ENUMVALUE2.toString(), m.marshall(TestEnum.ENUMVALUE2)); + Assertions.assertEquals(TestEnum.EnumValue1.toString(), m.marshall(TestEnum.EnumValue1)); + Assertions.assertEquals(TestEnum.ENUMVALUE2.toString(), m.marshall(TestEnum.ENUMVALUE2)); } @Test public void marshallNull() throws Exception { EnumMarshaller m = new EnumMarshaller(); - Assert.assertNull(m.marshall(null)); + Assertions.assertNull(m.marshall(null)); } @Test public void unmarshall() throws Exception { EnumMarshaller m = new EnumMarshaller(); - Assert.assertEquals(TestEnum.EnumValue1, m.unmarshall(TestEnum.class, TestEnum.EnumValue1.toString())); - Assert.assertEquals(TestEnum.ENUMVALUE2, m.unmarshall(TestEnum.class, TestEnum.ENUMVALUE2.toString())); + Assertions.assertEquals(TestEnum.EnumValue1, m.unmarshall(TestEnum.class, TestEnum.EnumValue1.toString())); + Assertions.assertEquals(TestEnum.ENUMVALUE2, m.unmarshall(TestEnum.class, TestEnum.ENUMVALUE2.toString())); } @Test public void unmarshallNull() throws Exception { EnumMarshaller m = new EnumMarshaller(); - Assert.assertNull(m.unmarshall(TestEnum.class, null)); + Assertions.assertNull(m.unmarshall(TestEnum.class, null)); } } diff --git a/i18n/src/test/java/de/taimos/dvalin/i18n/AbstractResourceFrameworkTest.java b/i18n/src/test/java/de/taimos/dvalin/i18n/AbstractResourceFrameworkTest.java index 3bd0c6cf..ac180ea4 100644 --- a/i18n/src/test/java/de/taimos/dvalin/i18n/AbstractResourceFrameworkTest.java +++ b/i18n/src/test/java/de/taimos/dvalin/i18n/AbstractResourceFrameworkTest.java @@ -6,9 +6,9 @@ import java.util.List; import java.util.Locale; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; @@ -69,7 +69,7 @@ private static void doInjection(Object bean, Object dependency, Field field) { protected abstract List getResourceHandler(); - @Before + @BeforeEach public void setUp() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { InjectionUtils.injectValue(this.resourceAccess, "DEFAULT_LOCALE_STRING", "de"); InjectionUtils.inject(this.resourceAccess, this.getResourceHandler()); @@ -82,7 +82,7 @@ public void setUp() throws NoSuchMethodException, InvocationTargetException, Ill @Test public void testNonExisting() { String notExisting = this.resourceAccess.getString("notExisting"); - Assert.assertEquals("!notExisting!", notExisting); + Assertions.assertEquals("!notExisting!", notExisting); } @Test @@ -90,19 +90,19 @@ public void testBasicLanguageGet() { { //default locale String text = this.resourceAccess.getString("textA"); - Assert.assertEquals("TextAGerman", text); + Assertions.assertEquals("TextAGerman", text); } { //fixed locale String text = this.resourceAccess.getString(Locale.ENGLISH, "textA"); - Assert.assertEquals("TextAEnglish", text); + Assertions.assertEquals("TextAEnglish", text); } { //nonexistant locale -> default to default language String text = this.resourceAccess.getString(Locale.ITALIAN, "textA"); - Assert.assertEquals("TextAGerman", text); + Assertions.assertEquals("TextAGerman", text); } } @@ -111,19 +111,19 @@ public void testGetWithReplaces() { { //default locale String text = this.resourceAccess.getString("textB", "aTest1", "aTest2", "aTest3"); - Assert.assertEquals("TextBGerman aTest1 aTest3", text); + Assertions.assertEquals("TextBGerman aTest1 aTest3", text); } { //fixed locale String text = this.resourceAccess.getString(Locale.ENGLISH, "textB", "aTest1", "aTest2", "aTest3"); - Assert.assertEquals("TextBEnglish aTest1 aTest3", text); + Assertions.assertEquals("TextBEnglish aTest1 aTest3", text); } { //nonexistant locale -> default to default language String text = this.resourceAccess.getString(Locale.ITALIAN, "textB", "aTest1", "aTest2", "aTest3"); - Assert.assertEquals("TextBGerman aTest1 aTest3", text); + Assertions.assertEquals("TextBGerman aTest1 aTest3", text); } } @@ -132,19 +132,19 @@ public void testGetEnums() { { //default locale String text = this.resourceAccess.getString(TestEnum.FIELD_A); - Assert.assertEquals("EnumFieldAGerman", text); + Assertions.assertEquals("EnumFieldAGerman", text); } { //fixed locale String text = this.resourceAccess.getString(Locale.ENGLISH, TestEnum.FIELD_A); - Assert.assertEquals("EnumFieldAEnglish", text); + Assertions.assertEquals("EnumFieldAEnglish", text); } { //nonexistant locale -> default to default language String text = this.resourceAccess.getString(Locale.ITALIAN, TestEnum.FIELD_B); - Assert.assertEquals("EnumFieldBGerman", text); + Assertions.assertEquals("EnumFieldBGerman", text); } } } diff --git a/i18n/src/test/java/de/taimos/dvalin/i18n/ResourceFrameworkXmlAndYamlTest.java b/i18n/src/test/java/de/taimos/dvalin/i18n/ResourceFrameworkXmlAndYamlTest.java index e420a1de..7121b054 100644 --- a/i18n/src/test/java/de/taimos/dvalin/i18n/ResourceFrameworkXmlAndYamlTest.java +++ b/i18n/src/test/java/de/taimos/dvalin/i18n/ResourceFrameworkXmlAndYamlTest.java @@ -2,8 +2,8 @@ import de.taimos.dvalin.i18n.xml.I18nXMLHandler; import de.taimos.dvalin.i18n.yaml.I18nYAMLHandler; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.springframework.core.io.Resource; import java.util.ArrayList; @@ -38,13 +38,13 @@ public void testXMLandYAMLFiles() { { //default locale String text = this.resourceAccess.getString("xmlOnly"); - Assert.assertEquals("nur in XML", text); + Assertions.assertEquals("nur in XML", text); } { //fixed locale String text = this.resourceAccess.getString(Locale.ENGLISH, "yamlOnly"); - Assert.assertEquals("only in YAML", text); + Assertions.assertEquals("only in YAML", text); } } } diff --git a/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/InterconnectConnectorBurstTest.java b/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/InterconnectConnectorBurstTest.java index 5d7d2ee9..6c74cb17 100644 --- a/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/InterconnectConnectorBurstTest.java +++ b/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/InterconnectConnectorBurstTest.java @@ -41,7 +41,7 @@ public final class InterconnectConnectorBurstTest implements Runnable { * @throws Exception If ... */ public static void main(String[] args) throws Exception { - TestHelper.initBrokerEnv("failover:tcp://localhost:61616"); + de.taimos.dvalin.interconnect.core.TestHelper.initBrokerEnv("failover:tcp://localhost:61616"); try { System.out.println("begin"); for (int i = 0; i < InterconnectConnectorBurstTest.THREADS; i++) { @@ -54,7 +54,7 @@ public static void main(String[] args) throws Exception { System.out.println("end"); System.out.println("duration: " + ((end - begin) / 1000L / 1000L) + " ms"); } finally { - TestHelper.closeBrokerEnv(); + de.taimos.dvalin.interconnect.core.TestHelper.closeBrokerEnv(); } } diff --git a/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/InterconnectConnectorITTest.java b/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/InterconnectConnectorITTest.java index e10a9f85..7cf988a2 100644 --- a/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/InterconnectConnectorITTest.java +++ b/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/InterconnectConnectorITTest.java @@ -9,9 +9,9 @@ * 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. @@ -20,17 +20,18 @@ * #L% */ +import java.time.Duration; import java.util.HashMap; import java.util.UUID; import javax.jms.TextMessage; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import de.taimos.dvalin.interconnect.core.InterconnectConnector.Response; import de.taimos.dvalin.interconnect.core.exceptions.TimeoutException; @@ -47,201 +48,188 @@ @SuppressWarnings("javadoc") public final class InterconnectConnectorITTest { - @BeforeClass + @BeforeAll public static void setUp() { System.setProperty(InterconnectConstants.PROPERTY_CRYPTO_AESKEY, "4b5c6acc6cedc3093d7ad49d195af14a"); System.setProperty(InterconnectConstants.PROPERTY_CRYPTO_SIGNATURE, "8602266778973c0edd198713985b9e56"); - TestHelper.initBrokerEnv("failover:tcp://localhost:61616"); + de.taimos.dvalin.interconnect.core.TestHelper.initBrokerEnv("failover:tcp://localhost:61616"); } - @AfterClass + @AfterAll public static void tearDown() { - TestHelper.closeBrokerEnv(); + de.taimos.dvalin.interconnect.core.TestHelper.closeBrokerEnv(); } private String queueName; - @Before + @BeforeEach public void init() { this.queueName = "test." + this.getClass().getSimpleName() + "." + UUID.randomUUID(); } - @After - public void close() throws Exception { + @AfterEach + public void close() { // } @Test - public void testSimpleRequest() throws Exception { + void testSimpleRequest() throws Exception { final String q = this.queueName; - new Thread(new Runnable() { - - @Override - public void run() { - try { - final Response request = InterconnectConnector.receiveFromQueueEnhanced(q, "", 5000, false); - Assert.assertNotNull(request.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_REQUEST_UUID)); - Assert.assertNotNull(request.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); - Assert.assertEquals(VoidIVO.class, request.getICO().getClass()); - MessageConnector.sendToDestination(request.getJMSTextMessage().getJMSReplyTo(), InterconnectMapper.toJson(new VoidIVOBuilder().build()), new HashMap(), false, null, request.getJMSTextMessage().getJMSCorrelationID()); - } catch (final Exception e) { - Assert.fail("Exception"); - } - } - }).start(); + new Thread(() -> { + try { + final Response request = InterconnectConnector.receiveFromQueueEnhanced(q, "", 5000, false); + Assertions.assertNotNull(request.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_REQUEST_UUID)); + Assertions.assertNotNull(request.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); + Assertions.assertEquals(VoidIVO.class, request.getICO().getClass()); + MessageConnector.sendToDestination(request.getJMSTextMessage().getJMSReplyTo(), InterconnectMapper.toJson(new VoidIVOBuilder().build()), new HashMap(), false, null, request.getJMSTextMessage().getJMSCorrelationID()); + } catch (final Exception e) { + Assertions.fail("Exception"); + } + }).start(); final InterconnectObject res = InterconnectConnector.request(UUID.randomUUID(), q, new VoidIVOBuilder().build(), new HashMap()); - Assert.assertEquals(VoidIVO.class, res.getClass()); + Assertions.assertEquals(VoidIVO.class, res.getClass()); } @Test - public void testEncryptedRequest() throws Exception { + void testEncryptedRequest() throws Exception { final String q = this.queueName; - new Thread(new Runnable() { - - @Override - public void run() { - try { - final TextMessage tm = MessageConnector.receiveFromQueue(q, "", 5000, false); - final String json = InterconnectMapper.toJson(new VoidIVOBuilder().build()); - Assert.assertNotNull(tm.getStringProperty(InterconnectConnector.HEADER_REQUEST_UUID)); - Assert.assertNotNull(tm.getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); - Assert.assertNotEquals(json, tm.getText()); - MessageConnector.decryptMessage(tm); - Assert.assertEquals(json, tm.getText()); - MessageConnector.sendToDestination(tm.getJMSReplyTo(), json, new HashMap(), true, null, tm.getJMSCorrelationID()); - } catch (final Exception e) { - Assert.fail("Exception"); - } - } - }).start(); + new Thread(() -> { + try { + final TextMessage tm = MessageConnector.receiveFromQueue(q, "", 5000, false); + final String json = InterconnectMapper.toJson(new VoidIVOBuilder().build()); + Assertions.assertNotNull(tm.getStringProperty(InterconnectConnector.HEADER_REQUEST_UUID)); + Assertions.assertNotNull(tm.getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); + Assertions.assertNotEquals(json, tm.getText()); + MessageConnector.decryptMessage(tm); + Assertions.assertEquals(json, tm.getText()); + MessageConnector.sendToDestination(tm.getJMSReplyTo(), json, new HashMap(), true, null, tm.getJMSCorrelationID()); + } catch (final Exception e) { + Assertions.fail("Exception"); + } + }).start(); final InterconnectObject res = InterconnectConnector.request(UUID.randomUUID(), q, new VoidIVOBuilder().build(), new HashMap(), true, MessageConnector.REQUEST_TIMEOUT, MessageConnector.REQUEST_TIMEOUT, MessageConnector.MSGPRIORITY); - Assert.assertEquals(VoidIVO.class, res.getClass()); + Assertions.assertEquals(VoidIVO.class, res.getClass()); } - @Test(timeout = 11000, expected = TimeoutException.class) - public void testDefaultTimeoutRequest() throws Exception { - InterconnectConnector.request(UUID.randomUUID(), this.queueName, new VoidIVOBuilder().build(), new HashMap()); + @Test + void testDefaultTimeoutRequest() { + Assertions.assertThrows(TimeoutException.class, () -> { + Assertions.assertTimeout(Duration.ofMillis(11000), () -> InterconnectConnector.request(UUID.randomUUID(), this.queueName, new VoidIVOBuilder().build(), new HashMap()));}); } - @Test(timeout = 2000, expected = TimeoutException.class) - public void testCustomTimeoutRequest() throws Exception { - InterconnectConnector.request(UUID.randomUUID(), this.queueName, new VoidIVOBuilder().build(), new HashMap(), true, 1000, MessageConnector.REQUEST_TIMEOUT, MessageConnector.MSGPRIORITY); + @Test + void testCustomTimeoutRequest() { + Assertions.assertThrows(TimeoutException.class, () -> { + Assertions.assertTimeout(Duration.ofMillis(2000), () -> InterconnectConnector.request(UUID.randomUUID(), this.queueName, new VoidIVOBuilder().build(), new HashMap(), true, 1000, MessageConnector.REQUEST_TIMEOUT, MessageConnector.MSGPRIORITY)); + }); } @Test - public void testSendAndReceive() throws Exception { + void testSendAndReceive() throws Exception { InterconnectConnector.sendToQueue(this.queueName, new VoidIVOBuilder().build(), new HashMap()); final Response res = InterconnectConnector.receiveFromQueueEnhanced(this.queueName, null, 1000, false); - Assert.assertEquals(VoidIVO.class, res.getICO().getClass()); - Assert.assertNotNull(res.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); - Assert.assertNull(res.getJMSTextMessage().getJMSReplyTo()); - Assert.assertNull(res.getJMSTextMessage().getJMSCorrelationID()); + Assertions.assertEquals(VoidIVO.class, res.getICO().getClass()); + Assertions.assertNotNull(res.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); + Assertions.assertNull(res.getJMSTextMessage().getJMSReplyTo()); + Assertions.assertNull(res.getJMSTextMessage().getJMSCorrelationID()); } @Test - public void testSecureSendAndReceive() throws Exception { + void testSecureSendAndReceive() throws Exception { InterconnectConnector.sendToQueue(this.queueName, new VoidIVOBuilder().build(), new HashMap(), true); final Response res = InterconnectConnector.receiveFromQueueEnhanced(this.queueName, null, 1000, true); - Assert.assertEquals(VoidIVO.class, res.getICO().getClass()); - Assert.assertNotNull(res.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); - Assert.assertNull(res.getJMSTextMessage().getJMSReplyTo()); - Assert.assertNull(res.getJMSTextMessage().getJMSCorrelationID()); + Assertions.assertEquals(VoidIVO.class, res.getICO().getClass()); + Assertions.assertNotNull(res.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); + Assertions.assertNull(res.getJMSTextMessage().getJMSReplyTo()); + Assertions.assertNull(res.getJMSTextMessage().getJMSCorrelationID()); } @Test - public void testSecureSendAndReceiveWithReplyTo() throws Exception { + void testSecureSendAndReceiveWithReplyTo() throws Exception { InterconnectConnector.sendToQueue(this.queueName, new VoidIVOBuilder().build(), new HashMap(), "test", null); final Response res = InterconnectConnector.receiveFromQueueEnhanced(this.queueName, null, 1000, false); - Assert.assertEquals(VoidIVO.class, res.getICO().getClass()); - Assert.assertNotNull(res.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); - Assert.assertNotNull(res.getJMSTextMessage().getJMSReplyTo()); - Assert.assertEquals("queue://test", res.getJMSTextMessage().getJMSReplyTo().toString()); - Assert.assertNull(res.getJMSTextMessage().getJMSCorrelationID()); + Assertions.assertEquals(VoidIVO.class, res.getICO().getClass()); + Assertions.assertNotNull(res.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); + Assertions.assertNotNull(res.getJMSTextMessage().getJMSReplyTo()); + Assertions.assertEquals("queue://test", res.getJMSTextMessage().getJMSReplyTo().toString()); + Assertions.assertNull(res.getJMSTextMessage().getJMSCorrelationID()); } @Test - public void testSecureSendAndReceiveWithCorrelationId() throws Exception { + void testSecureSendAndReceiveWithCorrelationId() throws Exception { InterconnectConnector.sendToQueue(this.queueName, new VoidIVOBuilder().build(), new HashMap(), null, "test123"); final Response res = InterconnectConnector.receiveFromQueueEnhanced(this.queueName, null, 1000, false); - Assert.assertEquals(VoidIVO.class, res.getICO().getClass()); - Assert.assertNotNull(res.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); - Assert.assertNull(res.getJMSTextMessage().getJMSReplyTo()); - Assert.assertNotNull(res.getJMSTextMessage().getJMSCorrelationID()); - Assert.assertEquals("test123", res.getJMSTextMessage().getJMSCorrelationID()); + Assertions.assertEquals(VoidIVO.class, res.getICO().getClass()); + Assertions.assertNotNull(res.getJMSTextMessage().getStringProperty(InterconnectConnector.HEADER_ICO_CLASS)); + Assertions.assertNull(res.getJMSTextMessage().getJMSReplyTo()); + Assertions.assertNotNull(res.getJMSTextMessage().getJMSCorrelationID()); + Assertions.assertEquals("test123", res.getJMSTextMessage().getJMSCorrelationID()); } @Test - public void testReceiveBulkFromQueue5of5() throws Exception { + void testReceiveBulkFromQueue5of5() throws Exception { final String q = this.queueName; - new Thread(new Runnable() { - - @Override - public void run() { - try { - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - } catch (final Exception e) { - Assert.fail("Exception"); - } - } - }).start(); - Assert.assertEquals(5, InterconnectConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); + new Thread(() -> { + try { + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + } catch (final Exception e) { + Assertions.fail("Exception"); + } + }).start(); + Assertions.assertEquals(5, InterconnectConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); } @Test - public void testReceiveBulkFromQueue1of5() throws Exception { + void testReceiveBulkFromQueue1of5() throws Exception { final String q = this.queueName; - new Thread(new Runnable() { - - @Override - public void run() { - try { - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - } catch (final Exception e) { - Assert.fail("Exception"); - } - } - }).start(); - Assert.assertEquals(1, InterconnectConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); + new Thread(() -> { + try { + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + } catch (final Exception e) { + Assertions.fail("Exception"); + } + }).start(); + Assertions.assertEquals(1, InterconnectConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); } @Test - public void testReceiveBulkFromQueue5of6() throws Exception { + void testReceiveBulkFromQueue5of6() throws Exception { final String q = this.queueName; - new Thread(new Runnable() { - - @Override - public void run() { - try { - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); - } catch (final Exception e) { - Assert.fail("Exception"); - } - } - }).start(); - Assert.assertEquals(5, InterconnectConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); - Assert.assertEquals(1, InterconnectConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); - } - - @Test(expected = TimeoutException.class, timeout = 2000) - public void testReceiveBulkFromQueue0of5() throws Exception { + new Thread(() -> { + try { + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + InterconnectConnector.sendToQueue(InterconnectConnectorITTest.this.queueName, new VoidIVOBuilder().build(), null); + } catch (final Exception e) { + Assertions.fail("Exception"); + } + }).start(); + Assertions.assertEquals(5, InterconnectConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); + Assertions.assertEquals(1, InterconnectConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); + } + + @Test + void testReceiveBulkFromQueue0of5() { final String q = this.queueName; - InterconnectConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size(); + Assertions.assertThrows(TimeoutException.class, () -> { + Assertions.assertTimeout(Duration.ofMillis(2000), () ->InterconnectConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); + }); } - @Test(expected = TimeoutException.class, timeout = 2000) - public void testReceiveBulkFromTopic0of5() throws Exception { + @Test + void testReceiveBulkFromTopic0of5() { final String q = this.queueName; - InterconnectConnector.receiveBulkFromTopic(q, null, 5, 1000, false).size(); + Assertions.assertThrows(TimeoutException.class, () -> { + Assertions.assertTimeout(Duration.ofMillis(2000), () ->InterconnectConnector.receiveBulkFromTopic(q, null, 5, 1000, false).size()); + }); } } diff --git a/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/MessageConnectorITTest.java b/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/MessageConnectorITTest.java index d2c9d033..f85859b4 100644 --- a/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/MessageConnectorITTest.java +++ b/interconnect/core/src/it/java/de/taimos/dvalin/interconnect/core/MessageConnectorITTest.java @@ -9,9 +9,9 @@ * 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. @@ -20,16 +20,17 @@ * #L% */ +import java.time.Duration; import java.util.HashMap; import java.util.UUID; import javax.jms.TextMessage; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import de.taimos.dvalin.interconnect.core.exceptions.TimeoutException; import de.taimos.dvalin.interconnect.model.InterconnectConstants; @@ -41,23 +42,23 @@ @SuppressWarnings("javadoc") public final class MessageConnectorITTest { - @BeforeClass + @BeforeAll public static void setUp() { System.setProperty(InterconnectConstants.PROPERTY_CRYPTO_AESKEY, "4b5c6acc6cedc3093d7ad49d195af14a"); System.setProperty(InterconnectConstants.PROPERTY_CRYPTO_SIGNATURE, "8602266778973c0edd198713985b9e56"); - TestHelper.initBrokerEnv("failover:tcp://localhost:61616"); + de.taimos.dvalin.interconnect.core.TestHelper.initBrokerEnv("failover:tcp://localhost:61616"); } - @AfterClass + @AfterAll public static void tearDown() { - TestHelper.closeBrokerEnv(); + de.taimos.dvalin.interconnect.core.TestHelper.closeBrokerEnv(); } private String queueName; - @Before + @BeforeEach public void init() { this.queueName = "test." + this.getClass().getSimpleName() + "." + UUID.randomUUID(); } @@ -71,15 +72,15 @@ public void testSimpleRequest() throws Exception { public void run() { try { final TextMessage tm = MessageConnector.receiveFromQueue(q, "", 5000, false); - Assert.assertEquals("ping", tm.getText()); - MessageConnector.sendToDestination(tm.getJMSReplyTo(), "pong", new HashMap(), false, null, tm.getJMSCorrelationID()); + Assertions.assertEquals("ping", tm.getText()); + MessageConnector.sendToDestination(tm.getJMSReplyTo(), "pong", new HashMap<>(), false, null, tm.getJMSCorrelationID()); } catch (final Exception e) { - Assert.fail("Exception"); + Assertions.fail("Exception"); } } }).start(); - final TextMessage res = MessageConnector.request(q, "ping", new HashMap()); - Assert.assertEquals("pong", res.getText()); + final TextMessage res = MessageConnector.request(q, "ping", new HashMap<>()); + Assertions.assertEquals("pong", res.getText()); } @Test @@ -91,67 +92,69 @@ public void testEncryptedRequest() throws Exception { public void run() { try { final TextMessage tm = MessageConnector.receiveFromQueue(q, "", 5000, false); - Assert.assertNotEquals("ping", tm.getText()); + Assertions.assertNotEquals("ping", tm.getText()); MessageConnector.decryptMessage(tm); - Assert.assertEquals("ping", tm.getText()); - MessageConnector.sendToDestination(tm.getJMSReplyTo(), "pong", new HashMap(), true, null, tm.getJMSCorrelationID()); + Assertions.assertEquals("ping", tm.getText()); + MessageConnector.sendToDestination(tm.getJMSReplyTo(), "pong", new HashMap<>(), true, null, tm.getJMSCorrelationID()); } catch (final Exception e) { - Assert.fail("Exception"); + Assertions.fail("Exception"); } } }).start(); - final TextMessage res = MessageConnector.request(q, "ping", new HashMap(), true, MessageConnector.REQUEST_TIMEOUT, MessageConnector.REQUEST_TIMEOUT, MessageConnector.MSGPRIORITY); - Assert.assertEquals("pong", res.getText()); + final TextMessage res = MessageConnector.request(q, "ping", new HashMap<>(), true, MessageConnector.REQUEST_TIMEOUT, MessageConnector.REQUEST_TIMEOUT, MessageConnector.MSGPRIORITY); + Assertions.assertEquals("pong", res.getText()); } - @Test(timeout = 11000, expected = TimeoutException.class) + @Test public void testDefaultTimeoutRequest() throws Exception { - MessageConnector.request(this.queueName, "ping", new HashMap()); + Assertions.assertThrows(TimeoutException.class, () -> Assertions.assertTimeout(Duration.ofMillis(11000), () -> + MessageConnector.request(this.queueName, "ping", new HashMap<>()))); } - @Test(timeout = 2000, expected = TimeoutException.class) + @Test public void testCustomTimeoutRequest() throws Exception { - MessageConnector.request(this.queueName, "ping", new HashMap(), true, 1000, MessageConnector.REQUEST_TIMEOUT, MessageConnector.MSGPRIORITY); + Assertions.assertThrows(TimeoutException.class, () -> Assertions.assertTimeout(Duration.ofMillis(2000), () -> + MessageConnector.request(this.queueName, "ping", new HashMap<>(), true, 1000, MessageConnector.REQUEST_TIMEOUT, MessageConnector.MSGPRIORITY))); } @Test public void testSendAndReceive() throws Exception { - MessageConnector.sendToQueue(this.queueName, "ping", new HashMap()); + MessageConnector.sendToQueue(this.queueName, "ping", new HashMap<>()); final TextMessage res = MessageConnector.receiveFromQueue(this.queueName, null, 1000, false); - Assert.assertEquals("ping", res.getText()); - Assert.assertNull(res.getJMSReplyTo()); - Assert.assertNull(res.getJMSCorrelationID()); + Assertions.assertEquals("ping", res.getText()); + Assertions.assertNull(res.getJMSReplyTo()); + Assertions.assertNull(res.getJMSCorrelationID()); } @Test public void testSecureSendAndReceive() throws Exception { - MessageConnector.sendToQueue(this.queueName, "ping", new HashMap(), true); + MessageConnector.sendToQueue(this.queueName, "ping", new HashMap<>(), true); final TextMessage res = MessageConnector.receiveFromQueue(this.queueName, null, 1000, false); - Assert.assertNotEquals("ping", res.getText()); + Assertions.assertNotEquals("ping", res.getText()); MessageConnector.decryptMessage(res); - Assert.assertEquals("ping", res.getText()); - Assert.assertNull(res.getJMSReplyTo()); - Assert.assertNull(res.getJMSCorrelationID()); + Assertions.assertEquals("ping", res.getText()); + Assertions.assertNull(res.getJMSReplyTo()); + Assertions.assertNull(res.getJMSCorrelationID()); } @Test public void testSecureSendAndReceiveWithReplyTo() throws Exception { - MessageConnector.sendToQueue(this.queueName, "ping", new HashMap(), "test", null); + MessageConnector.sendToQueue(this.queueName, "ping", new HashMap<>(), "test", null); final TextMessage res = MessageConnector.receiveFromQueue(this.queueName, null, 1000, false); - Assert.assertEquals("ping", res.getText()); - Assert.assertNotNull(res.getJMSReplyTo()); - Assert.assertEquals("queue://test", res.getJMSReplyTo().toString()); - Assert.assertNull(res.getJMSCorrelationID()); + Assertions.assertEquals("ping", res.getText()); + Assertions.assertNotNull(res.getJMSReplyTo()); + Assertions.assertEquals("queue://test", res.getJMSReplyTo().toString()); + Assertions.assertNull(res.getJMSCorrelationID()); } @Test public void testSecureSendAndReceiveWithCorrelationId() throws Exception { - MessageConnector.sendToQueue(this.queueName, "ping", new HashMap(), null, "test123"); + MessageConnector.sendToQueue(this.queueName, "ping", new HashMap<>(), null, "test123"); final TextMessage res = MessageConnector.receiveFromQueue(this.queueName, null, 1000, false); - Assert.assertEquals("ping", res.getText()); - Assert.assertNull(res.getJMSReplyTo()); - Assert.assertNotNull(res.getJMSCorrelationID()); - Assert.assertEquals("test123", res.getJMSCorrelationID()); + Assertions.assertEquals("ping", res.getText()); + Assertions.assertNull(res.getJMSReplyTo()); + Assertions.assertNotNull(res.getJMSCorrelationID()); + Assertions.assertEquals("test123", res.getJMSCorrelationID()); } @Test @@ -168,11 +171,11 @@ public void run() { MessageConnector.sendToQueue(MessageConnectorITTest.this.queueName, "pong", null); MessageConnector.sendToQueue(MessageConnectorITTest.this.queueName, "pong", null); } catch (final Exception e) { - Assert.fail("Exception"); + Assertions.fail("Exception"); } } }).start(); - Assert.assertEquals(5, MessageConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); + Assertions.assertEquals(5, MessageConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); } @Test @@ -185,11 +188,11 @@ public void run() { try { MessageConnector.sendToQueue(MessageConnectorITTest.this.queueName, "pong", null); } catch (final Exception e) { - Assert.fail("Exception"); + Assertions.fail("Exception"); } } }).start(); - Assert.assertEquals(1, MessageConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); + Assertions.assertEquals(1, MessageConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); } @Test @@ -207,23 +210,27 @@ public void run() { MessageConnector.sendToQueue(MessageConnectorITTest.this.queueName, "pong", null); MessageConnector.sendToQueue(MessageConnectorITTest.this.queueName, "pong", null); } catch (final Exception e) { - Assert.fail("Exception"); + Assertions.fail("Exception"); } } }).start(); - Assert.assertEquals(5, MessageConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); - Assert.assertEquals(1, MessageConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); + Assertions.assertEquals(5, MessageConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); + Assertions.assertEquals(1, MessageConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); } - @Test(expected = TimeoutException.class, timeout = 2000) + @Test public void testReceiveBulkFromQueue0of5() throws Exception { final String q = this.queueName; - MessageConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size(); + Assertions.assertThrows(TimeoutException.class, () -> { + Assertions.assertTimeout(Duration.ofMillis(2000), () ->MessageConnector.receiveBulkFromQueue(q, null, 5, 1000, false).size()); + }); } - @Test(expected = TimeoutException.class, timeout = 2000) + @Test public void testReceiveBulkFromTopic0of5() throws Exception { final String q = this.queueName; - MessageConnector.receiveBulkFromTopic(q, null, 5, 1000, false).size(); + Assertions.assertThrows(TimeoutException.class, () -> { + Assertions.assertTimeout(Duration.ofMillis(2000), () -> MessageConnector.receiveBulkFromTopic(q, null, 5, 1000, false).size()); + }); } } diff --git a/interconnect/core/src/main/java/de/taimos/dvalin/interconnect/core/MessageConnector.java b/interconnect/core/src/main/java/de/taimos/dvalin/interconnect/core/MessageConnector.java index 6de2f5d8..d0847a31 100644 --- a/interconnect/core/src/main/java/de/taimos/dvalin/interconnect/core/MessageConnector.java +++ b/interconnect/core/src/main/java/de/taimos/dvalin/interconnect/core/MessageConnector.java @@ -443,7 +443,7 @@ private static List receiveBulkFromDestination(final GetDestination throw new InfrastructureException(MessageConnector.RECEIVE_FAILED, e); } if (response == null) { - if (messages.size() == 0) { + if (messages.isEmpty()) { // first read timed out, so we throw a TimeoutException throw new TimeoutException(timeout); } diff --git a/interconnect/core/src/main/java/de/taimos/dvalin/interconnect/core/daemon/PagingController.java b/interconnect/core/src/main/java/de/taimos/dvalin/interconnect/core/daemon/PagingController.java index 7351940c..059a9ee4 100644 --- a/interconnect/core/src/main/java/de/taimos/dvalin/interconnect/core/daemon/PagingController.java +++ b/interconnect/core/src/main/java/de/taimos/dvalin/interconnect/core/daemon/PagingController.java @@ -120,7 +120,7 @@ private Method extractProxyMethod(final IDaemon proxy) { @Override public boolean hasNext() { - if ((this.batch != null) && (this.batch.size() == 0)) { // we are at the end of the query because we have an empty result + if ((this.batch != null) && (this.batch.isEmpty())) { // we are at the end of the query because we have an empty result return false; } final int nextBatchIndex = this.batchIndex + 1; @@ -156,7 +156,7 @@ public boolean hasNext() { this.batch = list.getElements(); // check if we are at the end of the query - return this.batch.size() != 0; + return !this.batch.isEmpty(); } return true; } diff --git a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/AbstractInterconnectModel.java b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/AbstractInterconnectModel.java index 3a3efe74..a506697d 100644 --- a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/AbstractInterconnectModel.java +++ b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/AbstractInterconnectModel.java @@ -229,7 +229,7 @@ public String getInterfaceImplements() { builder.append(", "); builder.append(i.getName()); } - if (builder.toString().trim().length() < 1) { + if (builder.toString().trim().isEmpty()) { return ""; } return "extends " + builder.substring(2); diff --git a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ModelTools.java b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ModelTools.java index a3be42e8..9ee96101 100644 --- a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ModelTools.java +++ b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ModelTools.java @@ -13,7 +13,7 @@ public String upperCaseFirst(String buffer) { if(buffer == null) { return ""; } - return buffer.length() > 0 ? buffer.substring(0, 1).toUpperCase() + buffer.substring(1) : ""; + return !buffer.isEmpty() ? buffer.substring(0, 1).toUpperCase() + buffer.substring(1) : ""; } } diff --git a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/AbstractIVOModel.java b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/AbstractIVOModel.java index c14942bc..9a1ad9b6 100644 --- a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/AbstractIVOModel.java +++ b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/AbstractIVOModel.java @@ -62,7 +62,7 @@ public String getInterfaceImplements() { builder.append(", "); builder.append(i.getName()); } - if (builder.toString().trim().length() < 1) { + if (builder.toString().trim().isEmpty()) { return ""; } return "extends " + builder.substring(2); diff --git a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/filter/FindIVOModel.java b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/filter/FindIVOModel.java index abe208b7..1e2d4657 100644 --- a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/filter/FindIVOModel.java +++ b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/filter/FindIVOModel.java @@ -111,7 +111,7 @@ public String getInterfaceImplements() { .filter(i -> Boolean.FALSE.equals(i.getSkipOnFilter()))// .map(ImplementsDef::getName).collect(Collectors.joining(", ")); - if (interfaces.length() < 1) { + if (interfaces.isEmpty()) { return ""; } diff --git a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/filter/FindInterfaceModel.java b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/filter/FindInterfaceModel.java index 0ad321ee..d729c4d7 100644 --- a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/filter/FindInterfaceModel.java +++ b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/model/ivo/filter/FindInterfaceModel.java @@ -109,7 +109,7 @@ public String getInterfaceImplements() { .filter(i -> Boolean.FALSE.equals(i.getSkipOnFilter()))// .map(ImplementsDef::getName).collect(Collectors.joining(", ")); - if (interfaces.length() < 1) { + if (interfaces.isEmpty()) { return ""; } diff --git a/interconnect/metamodel/src/main/java/de/taimos/dvalin/interconnect/model/metamodel/memberdef/FilterableType.java b/interconnect/metamodel/src/main/java/de/taimos/dvalin/interconnect/model/metamodel/memberdef/FilterableType.java index bc4d0b18..a9145e87 100644 --- a/interconnect/metamodel/src/main/java/de/taimos/dvalin/interconnect/model/metamodel/memberdef/FilterableType.java +++ b/interconnect/metamodel/src/main/java/de/taimos/dvalin/interconnect/model/metamodel/memberdef/FilterableType.java @@ -43,5 +43,5 @@ public enum FilterableType { /** * filterable by collection of values */ - multi; + multi } diff --git a/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/DateTimeDeserializerWithTZ.java b/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/DateTimeDeserializerWithTZ.java index d5325f13..5180bf84 100644 --- a/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/DateTimeDeserializerWithTZ.java +++ b/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/DateTimeDeserializerWithTZ.java @@ -57,7 +57,7 @@ public DateTime deserialize(JsonParser jp, DeserializationContext ctxt) throws I } if (t == JsonToken.VALUE_STRING) { String str = jp.getText().trim(); - if (str.length() == 0) { // [JACKSON-360] + if (str.isEmpty()) { // [JACKSON-360] return null; } // catch serialized time zones diff --git a/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/DateTimeKeyDeserializer.java b/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/DateTimeKeyDeserializer.java index 08636106..a09ff8df 100644 --- a/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/DateTimeKeyDeserializer.java +++ b/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/DateTimeKeyDeserializer.java @@ -9,9 +9,9 @@ * 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. @@ -46,7 +46,7 @@ public DateTimeKeyDeserializer() { @Override protected Object _parse(String key, DeserializationContext ctxt) throws Exception { - if (key.length() == 0) { // [JACKSON-360] + if (key.isEmpty()) { // [JACKSON-360] return null; } return new DateTime(key, DateTimeZone.forTimeZone(ctxt.getTimeZone())); diff --git a/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/ivo/util/GenericConverter.java b/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/ivo/util/GenericConverter.java index ee1b24bc..b0651a59 100644 --- a/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/ivo/util/GenericConverter.java +++ b/interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/ivo/util/GenericConverter.java @@ -83,7 +83,7 @@ private static Destination copy(Origin origin, Destination private static Object getFieldValue(Object object, Field field) throws IllegalAccessException { try { String capitalizedFieldName = field.getName(); - if((capitalizedFieldName != null) && (capitalizedFieldName.length() > 0)) { + if((capitalizedFieldName != null) && (!capitalizedFieldName.isEmpty())) { capitalizedFieldName = capitalizedFieldName.substring(0, 1).toUpperCase(Locale.ENGLISH) + capitalizedFieldName.substring(1); } Method getter = object.getClass().getMethod("get" + capitalizedFieldName); diff --git a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/InterconnectListTest.java b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/InterconnectListTest.java index a8c825d5..4f272e09 100644 --- a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/InterconnectListTest.java +++ b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/InterconnectListTest.java @@ -9,9 +9,9 @@ * 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. @@ -23,8 +23,8 @@ import java.util.ArrayList; import java.util.List; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import de.taimos.dvalin.interconnect.model.ivo.daemon.DaemonErrorIVO; @@ -41,6 +41,6 @@ public void testSerialization() throws Exception { final String json = InterconnectMapper.toJson(icl); System.out.println(json); final InterconnectObject ico = InterconnectMapper.fromJson(json); - Assert.assertEquals(InterconnectList.class, ico.getClass()); + Assertions.assertEquals(InterconnectList.class, ico.getClass()); } } diff --git a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/FutureImplTest.java b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/FutureImplTest.java index 8bd2c0db..b0a4a7b0 100644 --- a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/FutureImplTest.java +++ b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/FutureImplTest.java @@ -20,6 +20,11 @@ * #L% */ +import de.taimos.dvalin.interconnect.model.FutureImpl; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.time.Duration; import java.util.UUID; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; @@ -27,175 +32,146 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicReference; -import org.junit.Assert; -import org.junit.Test; - -import de.taimos.dvalin.interconnect.model.FutureImpl; -import de.taimos.dvalin.interconnect.model.FutureImpl.CancelListener; - @SuppressWarnings("javadoc") -public final class FutureImplTest { +final class FutureImplTest { - @Test(timeout = 1000) - public void testGet() throws Exception { + @Test + void testGet() throws Exception { final FutureImpl f = new FutureImpl<>(); - new Thread(new Runnable() { - - @Override - public void run() { - f.set(1); - } - }).start(); + Assertions.assertTimeout(Duration.ofMillis(1000), () -> + new Thread(() -> f.set(1)).start()); final Integer i = f.get(); - Assert.assertEquals(Integer.valueOf(1), i); - Assert.assertFalse(f.isCancelled()); - Assert.assertTrue(f.isDone()); + Assertions.assertEquals(Integer.valueOf(1), i); + Assertions.assertFalse(f.isCancelled()); + Assertions.assertTrue(f.isDone()); } - @Test(timeout = 1000) - public void testGetNull() throws Exception { + @Test + void testGetNull() throws Exception { final FutureImpl f = new FutureImpl<>(); - new Thread(new Runnable() { - - @Override - public void run() { - f.set((Integer) null); - } - }).start(); + Assertions.assertTimeout(Duration.ofMillis(1000), () -> + new Thread(() -> f.set((Integer) null)).start()); final Integer i = f.get(); - Assert.assertNull(i); - Assert.assertFalse(f.isCancelled()); - Assert.assertTrue(f.isDone()); + Assertions.assertNull(i); + Assertions.assertFalse(f.isCancelled()); + Assertions.assertTrue(f.isDone()); } - @Test(timeout = 1000, expected = ExecutionException.class) - public void testGetWithException() throws Exception { - final FutureImpl f = new FutureImpl<>(); - new Thread(new Runnable() { - - @Override - public void run() { - f.set(new Exception("test")); - } - }).start(); - f.get(); + @Test + void testGetWithException() { + Assertions.assertThrows(ExecutionException.class, () -> { + final FutureImpl f = new FutureImpl<>(); + Assertions.assertTimeout(Duration.ofMillis(1000), () -> + new Thread(() -> f.set(new Exception("test"))).start()); + f.get(); + }); } - @Test(timeout = 1000) - public void testGetWithTimeout() throws Exception { + @Test + void testGetWithTimeout() throws Exception { final FutureImpl f = new FutureImpl<>(); - new Thread(new Runnable() { - - @Override - public void run() { - f.set(1); - } - }).start(); + Assertions.assertTimeout(Duration.ofMillis(1000), () -> + new Thread(() -> f.set(1)).start()); final Integer i = f.get(500, TimeUnit.MILLISECONDS); - Assert.assertEquals(Integer.valueOf(1), i); - Assert.assertFalse(f.isCancelled()); - Assert.assertTrue(f.isDone()); + Assertions.assertEquals(Integer.valueOf(1), i); + Assertions.assertFalse(f.isCancelled()); + Assertions.assertTrue(f.isDone()); } - @Test(timeout = 1000, expected = TimeoutException.class) - public void testGetWithTimeoutWithExpiry() throws Exception { - final FutureImpl f = new FutureImpl<>(); - f.get(500, TimeUnit.MILLISECONDS); + @Test + void testGetWithTimeoutWithExpiry() { + Assertions.assertThrows(TimeoutException.class, () -> { + final FutureImpl f = new FutureImpl<>(); + f.get(500, TimeUnit.MILLISECONDS); + }); } - @Test(timeout = 1000, expected = ExecutionException.class) - public void testGetWithTimeoutWithException() throws Exception { - final FutureImpl f = new FutureImpl<>(); - new Thread(new Runnable() { - - @Override - public void run() { - f.set(new Exception("test")); - } - }).start(); - f.get(500, TimeUnit.MILLISECONDS); + @Test + void testGetWithTimeoutWithException() { + Assertions.assertThrows(ExecutionException.class, () -> { + final FutureImpl f = new FutureImpl<>(); + Assertions.assertTimeout(Duration.ofMillis(1000), () -> + new Thread(new Runnable() { + + @Override + public void run() { + f.set(new Exception("test")); + } + }).start()); + f.get(500, TimeUnit.MILLISECONDS); + }); } @Test - public void testCancel() { + void testCancel() { final FutureImpl f = new FutureImpl<>(); - Assert.assertTrue(f.cancel(true)); - Assert.assertTrue(f.isCancelled()); - Assert.assertTrue(f.isDone()); + Assertions.assertTrue(f.cancel(true)); + Assertions.assertTrue(f.isCancelled()); + Assertions.assertTrue(f.isDone()); } @Test - public void testCancelCancelled() { + void testCancelCancelled() { final FutureImpl f = new FutureImpl<>(); - Assert.assertTrue(f.cancel(true)); - Assert.assertFalse(f.cancel(true)); - Assert.assertTrue(f.isCancelled()); - Assert.assertTrue(f.isDone()); + Assertions.assertTrue(f.cancel(true)); + Assertions.assertFalse(f.cancel(true)); + Assertions.assertTrue(f.isCancelled()); + Assertions.assertTrue(f.isDone()); } @Test - public void testCancelDone() { + void testCancelDone() { final FutureImpl f = new FutureImpl<>(); f.set(1); - Assert.assertFalse(f.cancel(true)); - Assert.assertFalse(f.isCancelled()); - Assert.assertTrue(f.isDone()); + Assertions.assertFalse(f.cancel(true)); + Assertions.assertFalse(f.isCancelled()); + Assertions.assertTrue(f.isDone()); } - @Test(expected = CancellationException.class) - public void testGetAfterCancel() throws Exception { - final FutureImpl f = new FutureImpl<>(); - Assert.assertTrue(f.cancel(true)); - Assert.assertTrue(f.isCancelled()); - Assert.assertTrue(f.isDone()); - f.get(); + @Test + void testGetAfterCancel() { + Assertions.assertThrows(CancellationException.class, () -> { + final FutureImpl f = new FutureImpl<>(); + Assertions.assertTrue(f.cancel(true)); + Assertions.assertTrue(f.isCancelled()); + Assertions.assertTrue(f.isDone()); + f.get(); + }); } @Test public void testSetValueAfterCancel() { final FutureImpl f = new FutureImpl<>(); - Assert.assertTrue(f.cancel(true)); - Assert.assertTrue(f.isCancelled()); - Assert.assertTrue(f.isDone()); + Assertions.assertTrue(f.cancel(true)); + Assertions.assertTrue(f.isCancelled()); + Assertions.assertTrue(f.isDone()); f.set(1); } @Test public void testSetExceptionAfterCancel() { final FutureImpl f = new FutureImpl<>(); - Assert.assertTrue(f.cancel(true)); - Assert.assertTrue(f.isCancelled()); - Assert.assertTrue(f.isDone()); + Assertions.assertTrue(f.cancel(true)); + Assertions.assertTrue(f.isCancelled()); + Assertions.assertTrue(f.isDone()); f.set(new Exception("test")); } @Test - public void testCancelListener() { + void testCancelListener() { final FutureImpl f = new FutureImpl<>(); final AtomicReference cancelledUUid = new AtomicReference<>(null); - f.addCancelListener(new CancelListener() { - - @Override - public void wasCancelled(final UUID id) { - cancelledUUid.compareAndSet(null, id); - } - }); - Assert.assertTrue(f.cancel(true)); - Assert.assertEquals(f.getId(), cancelledUUid.get()); + f.addCancelListener(id -> cancelledUUid.compareAndSet(null, id)); + Assertions.assertTrue(f.cancel(true)); + Assertions.assertEquals(f.getId(), cancelledUUid.get()); } @Test - public void testCancelListenerAfterCancel() { + void testCancelListenerAfterCancel() { final FutureImpl f = new FutureImpl<>(); final AtomicReference cancelledUUid = new AtomicReference<>(null); - Assert.assertTrue(f.cancel(true)); - f.addCancelListener(new CancelListener() { - - @Override - public void wasCancelled(final UUID id) { - cancelledUUid.compareAndSet(null, id); - } - }); - Assert.assertEquals(f.getId(), cancelledUUid.get()); + Assertions.assertTrue(f.cancel(true)); + f.addCancelListener(id -> cancelledUUid.compareAndSet(null, id)); + Assertions.assertEquals(f.getId(), cancelledUUid.get()); } } diff --git a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/MessageCryptoUtilTest.java b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/MessageCryptoUtilTest.java index 4270cb14..7d338144 100644 --- a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/MessageCryptoUtilTest.java +++ b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/MessageCryptoUtilTest.java @@ -23,20 +23,19 @@ * #L% */ -import org.junit.Assert; -import org.junit.Test; - import de.taimos.dvalin.interconnect.model.CryptoException; import de.taimos.dvalin.interconnect.model.InterconnectConstants; import de.taimos.dvalin.interconnect.model.MessageCryptoUtil; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -public class MessageCryptoUtilTest { +class MessageCryptoUtilTest { /** * @throws CryptoException - */ @Test - public void crypt() throws CryptoException { + void crypt() throws CryptoException { System.setProperty(InterconnectConstants.PROPERTY_CRYPTO_AESKEY, "4b5c6acc6cedc3093d7ad49d195af14a"); System.setProperty(InterconnectConstants.PROPERTY_CRYPTO_SIGNATURE, "8602266778973c0edd198713985b9e56"); @@ -46,6 +45,6 @@ public void crypt() throws CryptoException { String data = "hallali li li li li"; String crypt = MessageCryptoUtil.crypt(data); String decrypt = MessageCryptoUtil.decrypt(crypt); - Assert.assertEquals(data, decrypt); + Assertions.assertEquals(data, decrypt); } } diff --git a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/daemon/ADaemonErrorNumberTest.java b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/daemon/ADaemonErrorNumberTest.java index d07e0d56..0ad8b44b 100644 --- a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/daemon/ADaemonErrorNumberTest.java +++ b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/daemon/ADaemonErrorNumberTest.java @@ -9,9 +9,9 @@ * 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. @@ -20,8 +20,8 @@ * #L% */ -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import de.taimos.dvalin.interconnect.model.service.ADaemonErrorNumber; import de.taimos.dvalin.interconnect.model.service.DaemonErrorNumber; @@ -43,23 +43,23 @@ public TestError(final int aNumber, final String aDaemon) { @Test public void testEquals1() { - Assert.assertEquals(new TestError(1, "test"), new TestError(1, "test")); + Assertions.assertEquals(new TestError(1, "test"), new TestError(1, "test")); } @Test public void testEquals2() { final DaemonErrorNumber den = new TestError(1, "test"); - Assert.assertEquals(den, den); + Assertions.assertEquals(den, den); } @Test public void testNotEquals1() { - Assert.assertNotEquals(new TestError(1, "test"), new TestError(2, "test")); + Assertions.assertNotEquals(new TestError(1, "test"), new TestError(2, "test")); } @Test public void testNotEquals2() { - Assert.assertNotEquals(new TestError(1, "test1"), new TestError(1, "test2")); + Assertions.assertNotEquals(new TestError(1, "test1"), new TestError(1, "test2")); } } diff --git a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/daemon/DaemonScannerTest.java b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/daemon/DaemonScannerTest.java index 01dc11a4..757db72f 100644 --- a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/daemon/DaemonScannerTest.java +++ b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/common/daemon/DaemonScannerTest.java @@ -31,9 +31,9 @@ import de.taimos.dvalin.interconnect.model.service.DaemonScanner; import de.taimos.dvalin.interconnect.model.service.IDaemon; import de.taimos.dvalin.interconnect.model.service.IDaemonHandler; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.omg.CORBA.SystemException; import java.util.Collection; @@ -46,7 +46,7 @@ @SuppressWarnings({"javadoc", "unused"}) public class DaemonScannerTest { - @BeforeClass + @BeforeAll public static void setUp() { Logger.getGlobal().setLevel(Level.INFO); Logger.getGlobal().addHandler(new ConsoleHandler()); @@ -65,18 +65,18 @@ public interface ITestWrongMultiExceptionTypes extends IDaemon, IDaemonHandler { void testVoid(final VoidIVO ivo) throws DaemonError, SystemException; } - @Test(expected = IllegalStateException.class) - public void testMissingExceptionInInterface() { - DaemonScanner.scan(ITestMissingException.class); + @Test + void testMissingExceptionInInterface() { + Assertions.assertThrows(IllegalStateException.class, () -> DaemonScanner.scan(ITestMissingException.class)); } - @Test(expected = IllegalStateException.class) - public void testWrongExceptionInInterface() { - DaemonScanner.scan(ITestWrongMultiExceptionTypes.class); + @Test + void testWrongExceptionInInterface() { + Assertions.assertThrows(IllegalStateException.class, () -> DaemonScanner.scan(ITestWrongMultiExceptionTypes.class)); } @Test - public void testMisingExceptionInImplementingClass() { + void testMisingExceptionInImplementingClass() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -87,48 +87,50 @@ public void testVoid(final VoidIVO ivo) { DaemonScanner.scan(rh.getClass()); } - @Test(expected = IllegalStateException.class) - public void testMisingRequestIVO() { - final TestRequestHandler rh = new TestRequestHandler() { + @Test + void testMisingRequestIVO() { + Assertions.assertThrows(IllegalStateException.class, () -> { + final TestRequestHandler rh = new TestRequestHandler() { - @DaemonRequestMethod(idempotent = false) - public void testVoid() throws DaemonError { - // nothing to do here - } - }; - DaemonScanner.scan(rh.getClass()); + @DaemonRequestMethod(idempotent = false) + public void testVoid() throws DaemonError { + // nothing to do here + } + }; + DaemonScanner.scan(rh.getClass()); + }); } - @Test(expected = IllegalStateException.class) - public void testMisingRequestIVOAndExceprion() { - final TestRequestHandler rh = new TestRequestHandler() { + @Test + void testMisingRequestIVOAndExceprion() { + final TestRequestHandler rh = new TestRequestHandler() { - @DaemonRequestMethod(idempotent = false) - public void testVoid() { - // nothing to do here - } - }; - DaemonScanner.scan(rh.getClass()); + @DaemonRequestMethod(idempotent = false) + public void testVoid() { + // nothing to do here + } + }; + Assertions.assertThrows(IllegalStateException.class, () -> DaemonScanner.scan(rh.getClass())); } @Test - public void testVoidResult() { + void testVoidResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) - public void testVoid(final VoidIVO ivo) throws DaemonError { + public void testVoid(final VoidIVO ivo) { // nothing to do here } }; - Assert.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); + Assertions.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); } @Test - public void testIVOResult() { + void testIVOResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) - public VoidIVO testVoid(final VoidIVO ivo) throws DaemonError { + public VoidIVO testVoid(final VoidIVO ivo) { return null; } }; @@ -136,7 +138,7 @@ public VoidIVO testVoid(final VoidIVO ivo) throws DaemonError { } @Test - public void testDeprecatedInterconnectObjectResult() { + void testDeprecatedInterconnectObjectResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -147,8 +149,8 @@ public InterconnectObject testVoid(final VoidIVO ivo) throws DaemonError { DaemonScanner.scan(rh.getClass()); } - @Test(expected = IllegalStateException.class) - public void testInterfaceIVOResult() { + @Test + void testInterfaceIVOResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -156,11 +158,13 @@ public VoidIVO testVoid(final InterfaceIVO ivo) throws DaemonError { return null; } }; - DaemonScanner.scan(rh.getClass()); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaemonScanner.scan(rh.getClass()); + }); } - @Test(expected = IllegalStateException.class) - public void testDuplicate() { + @Test + void testDuplicate() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -173,11 +177,13 @@ public VoidIVO testVoid2(final VoidIVO ivo) throws DaemonError { return null; } }; - DaemonScanner.scan(rh.getClass()); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaemonScanner.scan(rh.getClass()); + }); } @Test - public void testIVOResultAndNoise() { + void testIVOResultAndNoise() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -193,7 +199,7 @@ public VoidIVO testAnotherPublicMethod() { } @Test - public void testIVOListResult() { + void testIVOListResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -201,11 +207,11 @@ public List testVoid(final VoidIVO ivo) throws DaemonError { return null; } }; - Assert.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); + Assertions.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); } @Test - public void testDeprecatedInterconnectObjectListResult() { + void testDeprecatedInterconnectObjectListResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -213,11 +219,11 @@ public List testVoid(final VoidIVO ivo) throws DaemonError { return null; } }; - Assert.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); + Assertions.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); } - @Test(expected = IllegalStateException.class) - public void testIVOSetResult() { + @Test + void testIVOSetResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -225,11 +231,13 @@ public Set testVoid(final VoidIVO ivo) throws DaemonError { return null; } }; - Assert.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); + Assertions.assertThrows(IllegalStateException.class, () -> { + Assertions.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); + }); } - @Test(expected = IllegalStateException.class) - public void testIVOCollectionResult() { + @Test + void testIVOCollectionResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -237,11 +245,13 @@ public Collection testVoid(final VoidIVO ivo) throws DaemonError { return null; } }; - DaemonScanner.scan(rh.getClass()); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaemonScanner.scan(rh.getClass()); + }); } @Test - public void testIVOArrayResult() { + void testIVOArrayResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -253,7 +263,7 @@ public VoidIVO[] testVoid(final VoidIVO ivo) throws DaemonError { } @Test - public void testDeprecatedInterconnectObjectArrayResult() { + void testDeprecatedInterconnectObjectArrayResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -264,8 +274,8 @@ public InterconnectObject[] testVoid(final VoidIVO ivo) throws DaemonError { DaemonScanner.scan(rh.getClass()); } - @Test(expected = IllegalStateException.class) - public void testListResult() { + @Test + void testListResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -273,11 +283,13 @@ public List testVoid(final VoidIVO ivo) throws DaemonError { return null; } }; - DaemonScanner.scan(rh.getClass()); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaemonScanner.scan(rh.getClass()); + }); } - @Test(expected = IllegalStateException.class) - public void testSetResult() { + @Test + void testSetResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -285,11 +297,13 @@ public Set testVoid(final VoidIVO ivo) throws DaemonError { return null; } }; - DaemonScanner.scan(rh.getClass()); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaemonScanner.scan(rh.getClass()); + }); } - @Test(expected = IllegalStateException.class) - public void testCollectionResult() { + @Test + void testCollectionResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -297,11 +311,13 @@ public Collection testVoid(final VoidIVO ivo) throws DaemonError { return null; } }; - DaemonScanner.scan(rh.getClass()); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaemonScanner.scan(rh.getClass()); + }); } - @Test(expected = IllegalStateException.class) - public void testArrayResult() { + @Test + void testArrayResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -309,11 +325,13 @@ public Long[] testVoid(final VoidIVO ivo) throws DaemonError { return null; } }; - DaemonScanner.scan(rh.getClass()); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaemonScanner.scan(rh.getClass()); + }); } - @Test(expected = IllegalStateException.class) - public void testPrimitiveArrayResult() { + @Test + void testPrimitiveArrayResult() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonRequestMethod(idempotent = false) @@ -321,11 +339,13 @@ public long[] testVoid(final VoidIVO ivo) throws DaemonError { return null; } }; - DaemonScanner.scan(rh.getClass()); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaemonScanner.scan(rh.getClass()); + }); } @Test - public void testReceiver() { + void testReceiver() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonReceiverMethod(idempotent = false) @@ -333,11 +353,11 @@ public void testVoid(final VoidIVO ivo) { // nothing to do here } }; - Assert.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); + Assertions.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); } @Test - public void testDeprecatedReceiver() { + void testDeprecatedReceiver() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonReceiverMethod(idempotent = false) @@ -345,11 +365,11 @@ public void testVoid(final InterconnectList ivo) { // nothing to do here } }; - Assert.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); + Assertions.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); } - @Test(expected = IllegalStateException.class) - public void testReceiverWithException() { + @Test + void testReceiverWithException() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonReceiverMethod(idempotent = false) @@ -357,11 +377,13 @@ public void testVoid(final VoidIVO ivo) throws DaemonError { // nothing to do here } }; - DaemonScanner.scan(rh.getClass()); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaemonScanner.scan(rh.getClass()); + }); } - @Test(expected = IllegalStateException.class) - public void testReceiverWithReturn() { + @Test + void testReceiverWithReturn() { final TestRequestHandler rh = new TestRequestHandler() { @DaemonReceiverMethod(idempotent = false) @@ -369,25 +391,27 @@ public VoidIVO testVoid(final VoidIVO ivo) { return null; } }; - DaemonScanner.scan(rh.getClass()); + Assertions.assertThrows(IllegalStateException.class, () -> { + DaemonScanner.scan(rh.getClass()); + }); } @Test - public void testInheritance() { + void testInheritance() { final TestTestRequestHandler rh = new TestTestRequestHandler() { // nothing }; - Assert.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); + Assertions.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); } @Test - public void testInheritance2() { + void testInheritance2() { final TestTestRequestHandler rh = new TestTestRequestHandler(); - Assert.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); + Assertions.assertEquals(2, DaemonScanner.scan(rh.getClass()).size()); } - private class TestTestRequestHandler extends TestRequestHandler implements ITest { + private static class TestTestRequestHandler extends TestRequestHandler implements ITest { @Override public void testVoid(final VoidIVO ivo) { @@ -402,7 +426,7 @@ private interface ITest extends IDaemon { void testVoid(final VoidIVO ivo); } - private abstract class TestRequestHandler extends ADaemonHandler { + private abstract static class TestRequestHandler extends ADaemonHandler { // } diff --git a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/DaemonErrorIVOTest.java b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/DaemonErrorIVOTest.java index 461f97ec..e25da868 100644 --- a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/DaemonErrorIVOTest.java +++ b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/DaemonErrorIVOTest.java @@ -9,9 +9,9 @@ * 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. @@ -20,8 +20,8 @@ * #L% */ -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import de.taimos.dvalin.interconnect.model.InterconnectMapper; import de.taimos.dvalin.interconnect.model.InterconnectObject; @@ -35,7 +35,7 @@ public void testICO() throws Exception { final DaemonErrorIVO in = new DaemonErrorIVO.DaemonErrorIVOBuilder().build(); final String json = InterconnectMapper.toJson(in); final InterconnectObject out = InterconnectMapper.fromJson(json); - Assert.assertEquals(in.getClass().getCanonicalName(), out.getClass().getCanonicalName()); + Assertions.assertEquals(in.getClass().getCanonicalName(), out.getClass().getCanonicalName()); } } diff --git a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/PingIVOTest.java b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/PingIVOTest.java index 7e20ea5e..b83a5ebb 100644 --- a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/PingIVOTest.java +++ b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/PingIVOTest.java @@ -9,9 +9,9 @@ * 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. @@ -20,8 +20,8 @@ * #L% */ -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import de.taimos.dvalin.interconnect.model.InterconnectMapper; import de.taimos.dvalin.interconnect.model.InterconnectObject; @@ -35,7 +35,7 @@ public void testICO() throws Exception { final PingIVO in = new PingIVO.PingIVOBuilder().build(); final String json = InterconnectMapper.toJson(in); final InterconnectObject out = InterconnectMapper.fromJson(json); - Assert.assertEquals(in.getClass().getCanonicalName(), out.getClass().getCanonicalName()); + Assertions.assertEquals(in.getClass().getCanonicalName(), out.getClass().getCanonicalName()); } } diff --git a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/PongIVOTest.java b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/PongIVOTest.java index 7b515cf7..950cff51 100644 --- a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/PongIVOTest.java +++ b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/PongIVOTest.java @@ -9,9 +9,9 @@ * 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. @@ -20,11 +20,10 @@ * #L% */ -import org.junit.Assert; -import org.junit.Test; - import de.taimos.dvalin.interconnect.model.InterconnectMapper; import de.taimos.dvalin.interconnect.model.InterconnectObject; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; @SuppressWarnings("javadoc") public final class PongIVOTest { @@ -34,7 +33,7 @@ public void testICO() throws Exception { final PongIVO in = new PongIVO.PongIVOBuilder().build(); final String json = InterconnectMapper.toJson(in); final InterconnectObject out = InterconnectMapper.fromJson(json); - Assert.assertEquals(in.getClass().getCanonicalName(), out.getClass().getCanonicalName()); + Assertions.assertEquals(in.getClass().getCanonicalName(), out.getClass().getCanonicalName()); } } diff --git a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/VoidIVOTest.java b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/VoidIVOTest.java index 0d510b32..71789708 100644 --- a/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/VoidIVOTest.java +++ b/interconnect/model/src/test/java/de/taimos/dvalin/interconnect/model/ivo/daemon/VoidIVOTest.java @@ -9,9 +9,9 @@ * 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. @@ -20,11 +20,10 @@ * #L% */ -import org.junit.Assert; -import org.junit.Test; - import de.taimos.dvalin.interconnect.model.InterconnectMapper; import de.taimos.dvalin.interconnect.model.InterconnectObject; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; @SuppressWarnings("javadoc") @@ -35,7 +34,7 @@ public void testICO() throws Exception { final VoidIVO in = new VoidIVO.VoidIVOBuilder().build(); final String json = InterconnectMapper.toJson(in); final InterconnectObject out = InterconnectMapper.fromJson(json); - Assert.assertEquals(in.getClass().getCanonicalName(), out.getClass().getCanonicalName()); + Assertions.assertEquals(in.getClass().getCanonicalName(), out.getClass().getCanonicalName()); } } diff --git a/jaxrs-jwtauth/pom.xml b/jaxrs-jwtauth/pom.xml index f92d6ea0..8999a44a 100644 --- a/jaxrs-jwtauth/pom.xml +++ b/jaxrs-jwtauth/pom.xml @@ -20,7 +20,7 @@ com.nimbusds nimbus-jose-jwt - 9.23 + 9.40 @@ -33,7 +33,7 @@ net.minidev json-smart - 2.5.0 + 2.5.1 compile
diff --git a/jaxrs-swagger/pom.xml b/jaxrs-swagger/pom.xml index c26add1b..c93c3d05 100644 --- a/jaxrs-swagger/pom.xml +++ b/jaxrs-swagger/pom.xml @@ -24,7 +24,7 @@ io.swagger.core.v3 swagger-jaxrs2 - 2.2.19 + 2.2.22 diff --git a/jaxrs/pom.xml b/jaxrs/pom.xml index 3630b25f..d3265903 100644 --- a/jaxrs/pom.xml +++ b/jaxrs/pom.xml @@ -25,13 +25,13 @@ org.bouncycastle bcprov-jdk18on - 1.74 + 1.78.1 io.swagger.core.v3 swagger-jaxrs2 - 2.2.19 + 2.2.22 @@ -153,12 +153,5 @@ spring-test test - - - cglib - cglib - 3.3.0 - jar - diff --git a/jaxrs/src/main/java/de/taimos/dvalin/jaxrs/security/basicauth/BasicAuthFilter.java b/jaxrs/src/main/java/de/taimos/dvalin/jaxrs/security/basicauth/BasicAuthFilter.java index 2f55d00d..b3bdef25 100644 --- a/jaxrs/src/main/java/de/taimos/dvalin/jaxrs/security/basicauth/BasicAuthFilter.java +++ b/jaxrs/src/main/java/de/taimos/dvalin/jaxrs/security/basicauth/BasicAuthFilter.java @@ -21,6 +21,7 @@ */ import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.HttpHeaders; @@ -48,8 +49,8 @@ protected boolean isAuthorizationMandatory() { @Override protected SecurityContext handleAuthHeader(ContainerRequestContext requestContext, Message msg, String type, String auth) { - if (auth != null && type.toLowerCase().equals("basic")) { - String decoded = new String(Base64.decodeBase64(auth), Charset.forName("UTF-8")); + if (auth != null && type.equalsIgnoreCase("basic")) { + String decoded = new String(Base64.decodeBase64(auth), StandardCharsets.UTF_8); if (!decoded.contains(":")) { return null; } diff --git a/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/StringTextProviderTest.java b/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/StringTextProviderTest.java index 6d01580c..1d4a7bfc 100644 --- a/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/StringTextProviderTest.java +++ b/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/StringTextProviderTest.java @@ -23,7 +23,6 @@ import javax.ws.rs.core.MediaType; import org.apache.cxf.jaxrs.provider.StringTextProvider; -import org.junit.Assert; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/annotationscanner/ScannerTest.java b/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/annotationscanner/ScannerTest.java index 568c098e..0fb7cd65 100644 --- a/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/annotationscanner/ScannerTest.java +++ b/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/annotationscanner/ScannerTest.java @@ -9,9 +9,9 @@ * 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. @@ -24,65 +24,64 @@ import javax.annotation.security.RolesAllowed; -import org.junit.Assert; -import org.junit.Test; - import de.taimos.dvalin.jaxrs.JaxRsAnnotationScanner; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class ScannerTest { @Test public void testFoobarAnno1() throws Exception { List list = JaxRsAnnotationScanner.searchForAnnotation(ApiImpl.class.getMethod("foobar"), Anno1.class); - Assert.assertEquals(1, list.size()); + Assertions.assertEquals(1, list.size()); } @Test public void testBarbazAnno1() throws Exception { List list = JaxRsAnnotationScanner.searchForAnnotation(ApiImpl.class.getMethod("barbaz"), Anno1.class); - Assert.assertEquals(2, list.size()); + Assertions.assertEquals(2, list.size()); } @Test public void testBlubbAnno1() throws Exception { List list = JaxRsAnnotationScanner.searchForAnnotation(ApiImpl.class.getMethod("blubb"), Anno1.class); - Assert.assertEquals(2, list.size()); + Assertions.assertEquals(2, list.size()); } @Test public void testFoobarAnno2() throws Exception { List list = JaxRsAnnotationScanner.searchForAnnotation(ApiImpl.class.getMethod("foobar"), Anno2.class); - Assert.assertEquals(2, list.size()); + Assertions.assertEquals(2, list.size()); } @Test public void testBarbazAnno2() throws Exception { List list = JaxRsAnnotationScanner.searchForAnnotation(ApiImpl.class.getMethod("barbaz"), Anno2.class); - Assert.assertEquals(1, list.size()); + Assertions.assertEquals(1, list.size()); } @Test public void testBlubbAnno2() throws Exception { List list = JaxRsAnnotationScanner.searchForAnnotation(ApiImpl.class.getMethod("blubb"), Anno2.class); - Assert.assertEquals(1, list.size()); + Assertions.assertEquals(1, list.size()); } @Test public void testNullMethod() throws Exception { List list = JaxRsAnnotationScanner.searchForAnnotation(null, Anno1.class); - Assert.assertEquals(0, list.size()); + Assertions.assertEquals(0, list.size()); } @Test public void testPresentAnno1() throws Exception { boolean present = JaxRsAnnotationScanner.hasAnnotation(ApiImpl.class.getMethod("foobar"), Anno1.class); - Assert.assertTrue(present); + Assertions.assertTrue(present); } @Test public void testNotPresentRolesAllowed() throws Exception { boolean present = JaxRsAnnotationScanner.hasAnnotation(ApiImpl.class.getMethod("foobar"), RolesAllowed.class); - Assert.assertFalse(present); + Assertions.assertFalse(present); } } diff --git a/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/security/HashTest.java b/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/security/HashTest.java index 7248d8fe..b5e275a2 100644 --- a/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/security/HashTest.java +++ b/jaxrs/src/test/java/de/taimos/dvalin/jaxrs/security/HashTest.java @@ -24,8 +24,6 @@ * #L% */ -import org.junit.Assert; - import com.google.common.base.Stopwatch; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/jpa/pom.xml b/jpa/pom.xml index 537f0afd..6d672ac0 100644 --- a/jpa/pom.xml +++ b/jpa/pom.xml @@ -34,7 +34,7 @@ org.liquibase liquibase-core - 4.25.0 + 4.28.0 com.mattbertolini diff --git a/mongodb/src/test/java/de/taimos/dvalin/mongo/ABaseTest.java b/mongodb/src/test/java/de/taimos/dvalin/mongo/ABaseTest.java index 7aa7f075..0d63e190 100644 --- a/mongodb/src/test/java/de/taimos/dvalin/mongo/ABaseTest.java +++ b/mongodb/src/test/java/de/taimos/dvalin/mongo/ABaseTest.java @@ -36,7 +36,7 @@ import de.bwaldvogel.mongo.backend.memory.MemoryBackend; import de.taimos.daemon.log4j.Log4jLoggingConfigurer; import org.jongo.Jongo; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; /** * Copyright 2015 Taimos GmbH
@@ -50,9 +50,9 @@ public class ABaseTest { private static final ServerAddress serverAddress = new ServerAddress(new MongoServer(new MemoryBackend().version(ServerVersion.MONGO_3_6)).bind()); public static final MongoClient mongo = MongoClients.create(new ConnectionString(String.format("mongodb://%s:%d", ABaseTest.serverAddress.getHost(), ABaseTest.serverAddress.getPort()))); - public static final com.mongodb.MongoClient oldMongo = new com.mongodb.MongoClient(new ServerAddress(new MongoServer(new MemoryBackend().version(ServerVersion.MONGO_3_6)).bind()));; + public static final com.mongodb.MongoClient oldMongo = new com.mongodb.MongoClient(new ServerAddress(new MongoServer(new MemoryBackend().version(ServerVersion.MONGO_3_6)).bind())); - public static final DB oldDB = ABaseTest.oldMongo.getDB(ABaseTest.dbName); + public static final DB oldDB = ABaseTest.oldMongo.getDB(ABaseTest.dbName); public static final Jongo jongo = JongoFactory.createDefault(ABaseTest.oldMongo.getDB(ABaseTest.dbName)); public static final MongoDatabase database = ABaseTest.mongo.getDatabase(ABaseTest.dbName); @@ -66,7 +66,7 @@ public class ABaseTest { protected static void assertEquals(BigDecimal bd1, BigDecimal bd2) { - Assert.assertEquals(bd1.doubleValue(), bd2.doubleValue(), 0); + Assertions.assertEquals(bd1.doubleValue(), bd2.doubleValue(), 0); } /** diff --git a/mongodb/src/test/java/de/taimos/dvalin/mongo/LinkTester.java b/mongodb/src/test/java/de/taimos/dvalin/mongo/LinkTester.java index 4d690d2a..e44e82fd 100644 --- a/mongodb/src/test/java/de/taimos/dvalin/mongo/LinkTester.java +++ b/mongodb/src/test/java/de/taimos/dvalin/mongo/LinkTester.java @@ -30,9 +30,9 @@ import de.taimos.dvalin.mongo.links.DLinkDAO; import io.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver; import io.mongock.runner.standalone.MongockStandalone; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; /** * Copyright 2015 Taimos GmbH
@@ -48,7 +48,7 @@ public class LinkTester { private static final DLinkDAO dlinkDAO = new DLinkDAO(ABaseTest.jongo); - @BeforeClass + @BeforeAll public static void init() { try { System.setProperty("mongodb.name", ABaseTest.dbName); @@ -85,10 +85,10 @@ public void testLinks() { lo.getLinks().add(lo2.asLink()); lo = LinkTester.dao.save(lo); - Assert.assertEquals(2, lo.getLinks().size()); + Assertions.assertEquals(2, lo.getLinks().size()); List list = LinkTester.dlinkDAO.resolve(lo.getLinks(), LinkedObject.class); - Assert.assertEquals(2, list.size()); + Assertions.assertEquals(2, list.size()); } } diff --git a/mongodb/src/test/java/de/taimos/dvalin/mongo/Tester.java b/mongodb/src/test/java/de/taimos/dvalin/mongo/Tester.java index 2f84a770..0fbb3e50 100644 --- a/mongodb/src/test/java/de/taimos/dvalin/mongo/Tester.java +++ b/mongodb/src/test/java/de/taimos/dvalin/mongo/Tester.java @@ -37,15 +37,15 @@ import org.jongo.Mapper; import org.jongo.marshall.jackson.JacksonMapper; import org.jongo.marshall.jackson.JacksonMapper.Builder; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class Tester extends ABaseTest { private static final TestDAO dao = new TestDAO(); - @BeforeClass + @BeforeAll public static void init() { try { Field mongoField = AbstractMongoDAO.class.getDeclaredField("mongo"); @@ -78,48 +78,48 @@ public void testUpdate() { TestObject o = new TestObject(); o.setName("bar"); o.setValue(new BigDecimal("5")); - Assert.assertEquals("bar", o.getName()); + Assertions.assertEquals("bar", o.getName()); String id = o.getId(); TestObject save = Tester.dao.save(o); - Assert.assertEquals("bar", save.getName()); + Assertions.assertEquals("bar", save.getName()); ABaseTest.assertEquals(new BigDecimal("5"), save.getValue()); - Assert.assertNotNull(save.getId()); - Assert.assertNotNull(save.getDt()); + Assertions.assertNotNull(save.getId()); + Assertions.assertNotNull(save.getDt()); TestObject find = Tester.dao.findById(id); - Assert.assertNotNull(find); - Assert.assertEquals("bar", find.getName()); + Assertions.assertNotNull(find); + Assertions.assertEquals("bar", find.getName()); ABaseTest.assertEquals(new BigDecimal("5"), find.getValue()); - Assert.assertEquals(id, find.getId()); - Assert.assertNotNull(find.getDt()); + Assertions.assertEquals(id, find.getId()); + Assertions.assertNotNull(find.getDt()); find.setName("blubb"); TestObject save2 = Tester.dao.save(find); - Assert.assertNotNull(save2); - Assert.assertEquals("blubb", save2.getName()); + Assertions.assertNotNull(save2); + Assertions.assertEquals("blubb", save2.getName()); ABaseTest.assertEquals(new BigDecimal("5"), save2.getValue()); - Assert.assertEquals(id, save2.getId()); - Assert.assertNotNull(save2.getDt()); + Assertions.assertEquals(id, save2.getId()); + Assertions.assertNotNull(save2.getDt()); TestObject find3 = Tester.dao.findByName("blubb"); - Assert.assertNotNull(find3); - Assert.assertEquals("blubb", find3.getName()); + Assertions.assertNotNull(find3); + Assertions.assertEquals("blubb", find3.getName()); ABaseTest.assertEquals(new BigDecimal("5"), find3.getValue()); - Assert.assertEquals(id, find3.getId()); - Assert.assertNotNull(find3.getDt()); + Assertions.assertEquals(id, find3.getId()); + Assertions.assertNotNull(find3.getDt()); long count = Tester.dao.dataAccess.count("{}"); - Assert.assertEquals(1, count); + Assertions.assertEquals(1, count); Tester.dao.delete(id); TestObject find2 = Tester.dao.findById(id); - Assert.assertNull(find2); + Assertions.assertNull(find2); count = Tester.dao.dataAccess.count("{}"); - Assert.assertEquals(0, count); + Assertions.assertEquals(0, count); ListIndexesIterable listIndexes = ABaseTest.mongo.getDatabase(ABaseTest.dbName).getCollection("TestObject").listIndexes(); for (Document index : listIndexes) { @@ -132,7 +132,7 @@ public void serialize() throws Exception { TestObject o = new TestObject(); o.setName("bar"); o.setValue(new BigDecimal("5")); - Assert.assertEquals("bar", o.getName()); + Assertions.assertEquals("bar", o.getName()); DBObject dbObject = this.createMapper().getMarshaller().marshall(o).toDBObject(); System.out.println(dbObject); @@ -141,9 +141,9 @@ public void serialize() throws Exception { Object parse = BasicDBObject.parse(json); System.out.println(parse); - Assert.assertEquals(BasicDBObject.class, parse.getClass()); - Assert.assertEquals(Double.class, ((DBObject) parse).get("value").getClass()); - Assert.assertEquals(5.0D, (double) ((DBObject) parse).get("value"), 0); + Assertions.assertEquals(BasicDBObject.class, parse.getClass()); + Assertions.assertEquals(Double.class, ((DBObject) parse).get("value").getClass()); + Assertions.assertEquals(5.0D, (double) ((DBObject) parse).get("value"), 0); } protected Mapper createMapper() { diff --git a/monitoring/logging/src/test/java/de/taimos/dvalin/monitoring/logging/ConsoleMetricSenderTest.java b/monitoring/logging/src/test/java/de/taimos/dvalin/monitoring/logging/ConsoleMetricSenderTest.java index 601b65a9..b49eca41 100644 --- a/monitoring/logging/src/test/java/de/taimos/dvalin/monitoring/logging/ConsoleMetricSenderTest.java +++ b/monitoring/logging/src/test/java/de/taimos/dvalin/monitoring/logging/ConsoleMetricSenderTest.java @@ -9,9 +9,9 @@ * 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. @@ -23,8 +23,8 @@ import java.lang.reflect.Field; import java.util.Random; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import de.taimos.daemon.log4j.Log4jLoggingConfigurer; @@ -36,7 +36,7 @@ public class ConsoleMetricSenderTest { private ConsoleMetricSender sender; private Logger targetLogger; - @Before + @BeforeEach public void setUp() throws Exception { new Log4jLoggingConfigurer().simpleLogging(); diff --git a/notification/aws/src/test/java/de/taimos/dvalin/notification/push/AmazonEndpointCreationExceptionTest.java b/notification/aws/src/test/java/de/taimos/dvalin/notification/push/AmazonEndpointCreationExceptionTest.java index 407f060c..d62a6c54 100644 --- a/notification/aws/src/test/java/de/taimos/dvalin/notification/push/AmazonEndpointCreationExceptionTest.java +++ b/notification/aws/src/test/java/de/taimos/dvalin/notification/push/AmazonEndpointCreationExceptionTest.java @@ -9,9 +9,9 @@ * 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. @@ -20,28 +20,27 @@ * #L% */ -import org.junit.Assert; -import org.junit.Test; - import com.amazonaws.services.sns.model.InvalidParameterException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class AmazonEndpointCreationExceptionTest { - + @Test public void shouldRethrow() throws Exception { InvalidParameterException ex = new InvalidParameterException("Invalid parameter: Some other reason"); AmazonEndpointCreationException aece = new AmazonEndpointCreationException(ex); - - Assert.assertFalse(aece.didAlreadyExist()); - Assert.assertNotNull(aece.getOriginalException()); + + Assertions.assertFalse(aece.didAlreadyExist()); + Assertions.assertNotNull(aece.getOriginalException()); } - + @Test public void shouldReturnExistingARN() throws Exception { InvalidParameterException ex = new InvalidParameterException("Invalid parameter: Token Reason: Endpoint arn:aws:sns:eu-central-1:292004443359:endpoint/GCM/CycleballEU/367b766c-62cc-358b-adf5-b0f8c587ebad already exists with the same Token, but different attributes. (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: 5d9a21dc-8f3c-57ca-ba6a-71a0c75ff128)"); AmazonEndpointCreationException aece = new AmazonEndpointCreationException(ex); - - Assert.assertTrue(aece.didAlreadyExist()); - Assert.assertEquals("arn:aws:sns:eu-central-1:292004443359:endpoint/GCM/CycleballEU/367b766c-62cc-358b-adf5-b0f8c587ebad",aece.getExistingARN()); + + Assertions.assertTrue(aece.didAlreadyExist()); + Assertions.assertEquals("arn:aws:sns:eu-central-1:292004443359:endpoint/GCM/CycleballEU/367b766c-62cc-358b-adf5-b0f8c587ebad", aece.getExistingARN()); } } diff --git a/notification/core/src/main/java/de/taimos/dvalin/notification/push/Platform.java b/notification/core/src/main/java/de/taimos/dvalin/notification/push/Platform.java index 2224dad9..bed89e01 100644 --- a/notification/core/src/main/java/de/taimos/dvalin/notification/push/Platform.java +++ b/notification/core/src/main/java/de/taimos/dvalin/notification/push/Platform.java @@ -9,9 +9,9 @@ * 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. @@ -21,7 +21,7 @@ */ public enum Platform { - - GCM, APNS, APNS_SANDBOX; - + + GCM, APNS, APNS_SANDBOX + } diff --git a/orchestration/etcd/src/test/java/de/taimos/dvalin/orchestration/etcd/KeyTest.java b/orchestration/etcd/src/test/java/de/taimos/dvalin/orchestration/etcd/KeyTest.java index c9bef192..e9802daf 100644 --- a/orchestration/etcd/src/test/java/de/taimos/dvalin/orchestration/etcd/KeyTest.java +++ b/orchestration/etcd/src/test/java/de/taimos/dvalin/orchestration/etcd/KeyTest.java @@ -9,9 +9,9 @@ * 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. @@ -23,17 +23,17 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class KeyTest { - + @Test public void shouldMatchPattern() throws Exception { Pattern keyPattern = Pattern.compile("/dvalin/discovery/testservice/([A-Fa-f0-9\\-]+)"); - + Matcher matcher = keyPattern.matcher("/dvalin/discovery/testservice/AE7AB5B7-E6FC-46E3-BF62-EC2D25908DF6"); - Assert.assertTrue(matcher.matches()); - Assert.assertEquals("AE7AB5B7-E6FC-46E3-BF62-EC2D25908DF6", matcher.group(1)); + Assertions.assertTrue(matcher.matches()); + Assertions.assertEquals("AE7AB5B7-E6FC-46E3-BF62-EC2D25908DF6", matcher.group(1)); } } diff --git a/pom.xml b/pom.xml index 09aaf7b2..9209fb9e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,15 +1,15 @@ 4.0.0 - - de.taimos - oss-parent - 6 - + de.taimos dvalin-parent 1.36-SNAPSHOT pom Taimos Microservices Framework 2015 + + Taimos GmbH + http://www.taimos.de + Apache License, Version 2.0 @@ -50,24 +50,25 @@ - 5.3.31 - 2.15.2 - 2.12.5 + UTF-8 + 5.3.36 + 2.17.1 + 2.12.7 1.7.36 - 2.22.0 - 5.10.1 - 1.12.641 + 2.23.1 + 5.10.2 + 1.12.739 5.16.7 - 3.5.7 - 9.4.53.v20231009 - 32.1.3-jre + 3.5.8 + 9.4.54.v20240208 + 33.2.1-jre 5.6.14.Final 2.2 2.3 - 2.15.0 + 2.15.1 1.5.1 - 4.11.1 - 5.3.5 + 4.11.2 + 5.4.2 1.43.0 2.0.4 4.11.0 @@ -82,6 +83,34 @@ GitHub https://github.com/taimos/dvalin/issues + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots + + false + + + true + + + + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + + sonatype-nexus-staging + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + 3.5.0 + @@ -94,15 +123,10 @@ joda-time ${joda.time.version} - - com.google.code.findbugs - jsr305 - 3.0.2 - commons-codec commons-codec - 1.16.0 + 1.17.0 de.taimos @@ -455,10 +479,6 @@ joda-time joda-time - - com.google.code.findbugs - jsr305 - org.slf4j @@ -469,7 +489,6 @@ junit-jupiter true - org.mockito mockito-core @@ -494,6 +513,28 @@ 1.8 + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + forked-path + false + v@{project.version} + deploy nexus-staging:release + -Ptaimos-oss-release + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + sonatype-nexus-staging + https://oss.sonatype.org/ + + org.apache.maven.plugins maven-javadoc-plugin @@ -514,12 +555,12 @@ verify sign - + --pinentry-mode loopback - + ${gpg.keyname} @@ -552,6 +593,32 @@ taimos-oss-release + + org.apache.maven.plugins + maven-source-plugin + 3.0.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + + attach-javadocs + + jar + + + + org.apache.maven.plugins maven-gpg-plugin diff --git a/test/pom.xml b/test/pom.xml index e0e68c13..b1791193 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -55,12 +55,7 @@ org.concordion concordion - 3.1.3 - - - org.concordion - concordion-extensions - 1.1.1 + 4.0.1 diff --git a/test/src/test/java/de/taimos/dvalin/test/inject/InjectionUtilsTest.java b/test/src/test/java/de/taimos/dvalin/test/inject/InjectionUtilsTest.java index cb0bc04f..327eebe7 100644 --- a/test/src/test/java/de/taimos/dvalin/test/inject/InjectionUtilsTest.java +++ b/test/src/test/java/de/taimos/dvalin/test/inject/InjectionUtilsTest.java @@ -13,9 +13,9 @@ * 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. @@ -24,192 +24,205 @@ * #L% */ -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import de.taimos.dvalin.test.AbstractMockitoTest; -public class InjectionUtilsTest extends AbstractMockitoTest { +class InjectionUtilsTest extends AbstractMockitoTest { @Test - public void injectSingle() throws Exception { + void injectSingle() { BeanA a = new BeanA(); BeanB b = new BeanB(); MyBean bean = new MyBean(); - Assert.assertNull(bean.getaField()); - Assert.assertNull(bean.getbField()); - Assert.assertNull(bean.getcField()); + Assertions.assertNull(bean.getaField()); + Assertions.assertNull(bean.getbField()); + Assertions.assertNull(bean.getcField()); InjectionUtils.inject(bean, a); - Assert.assertTrue(bean.getaField() == a); - Assert.assertNull(bean.getbField()); - Assert.assertNull(bean.getcField()); + Assertions.assertSame(bean.getaField(), a); + Assertions.assertNull(bean.getbField()); + Assertions.assertNull(bean.getcField()); InjectionUtils.inject(bean, b); - Assert.assertTrue(bean.getaField() == a); - Assert.assertTrue(bean.getbField() == b); - Assert.assertNull(bean.getcField()); + Assertions.assertSame(bean.getaField(), a); + Assertions.assertSame(bean.getbField(), b); + Assertions.assertNull(bean.getcField()); } @Test - public void injectMulti() throws Exception { + void injectMulti() { BeanA a = new BeanA(); BeanB b = new BeanB(); MyBean bean = new MyBean(); - Assert.assertNull(bean.getaField()); - Assert.assertNull(bean.getbField()); - Assert.assertNull(bean.getcField()); + Assertions.assertNull(bean.getaField()); + Assertions.assertNull(bean.getbField()); + Assertions.assertNull(bean.getcField()); InjectionUtils.inject(bean, a, b); - Assert.assertTrue(bean.getaField() == a); - Assert.assertTrue(bean.getbField() == b); - Assert.assertNull(bean.getcField()); + Assertions.assertSame(bean.getaField(), a); + Assertions.assertSame(bean.getbField(), b); + Assertions.assertNull(bean.getcField()); } @Test - public void injectAll() throws Exception { + void injectAll() { MyBean bean = new MyBean(); - Assert.assertNull(bean.getaField()); - Assert.assertNull(bean.getbField()); - Assert.assertNull(bean.getcField()); + Assertions.assertNull(bean.getaField()); + Assertions.assertNull(bean.getbField()); + Assertions.assertNull(bean.getcField()); InjectionMock mocks = InjectionUtils.injectMocks(bean); - Assert.assertNotNull(bean.getaField()); - Assert.assertNotNull(bean.getbField()); - Assert.assertNotNull(bean.getcField()); - Assert.assertNull(bean.getoField()); - Assert.assertNull(bean.getValue1()); - Assert.assertNull(bean.getValue2()); - Assert.assertNull(bean.getValue3()); - - Assert.assertSame(bean.getaField(), mocks.getMock("aField")); - Assert.assertSame(bean.getaField(), mocks.getMock(BeanA.class)); - Assert.assertSame(bean.getbField(), mocks.getMock("bField")); - Assert.assertSame(bean.getbField(), mocks.getMock(BeanB.class)); - Assert.assertSame(bean.getcField(), mocks.getMock("cField")); - Assert.assertSame(bean.getcField(), mocks.getMock(BeanC.class)); - Assert.assertSame(bean.getcField(), mocks.getMock(BeanC.class, "specialBean")); - Assert.assertNull(mocks.getMock(BeanC.class, "invalidQualifier")); - - Assert.assertNull(mocks.getMock(BeanA.class, "invalidQualifier")); - Assert.assertNull(mocks.getMock(Object.class)); - Assert.assertNull(mocks.getMock("oField")); - Assert.assertNull(mocks.getMock("nonExisting")); + Assertions.assertNotNull(bean.getaField()); + Assertions.assertNotNull(bean.getbField()); + Assertions.assertNotNull(bean.getcField()); + Assertions.assertNull(bean.getoField()); + Assertions.assertNull(bean.getValue1()); + Assertions.assertNull(bean.getValue2()); + Assertions.assertNull(bean.getValue3()); + + Assertions.assertSame(bean.getaField(), mocks.getMock("aField")); + Assertions.assertSame(bean.getaField(), mocks.getMock(BeanA.class)); + Assertions.assertSame(bean.getbField(), mocks.getMock("bField")); + Assertions.assertSame(bean.getbField(), mocks.getMock(BeanB.class)); + Assertions.assertSame(bean.getcField(), mocks.getMock("cField")); + Assertions.assertSame(bean.getcField(), mocks.getMock(BeanC.class)); + Assertions.assertSame(bean.getcField(), mocks.getMock(BeanC.class, "specialBean")); + Assertions.assertNull(mocks.getMock(BeanC.class, "invalidQualifier")); + + Assertions.assertNull(mocks.getMock(BeanA.class, "invalidQualifier")); + Assertions.assertNull(mocks.getMock(Object.class)); + Assertions.assertNull(mocks.getMock("oField")); + Assertions.assertNull(mocks.getMock("nonExisting")); } @Test - public void injectWithQualifier() throws Exception { + void injectWithQualifier() { BeanC c = new BeanC(); MyBean bean = new MyBean(); - Assert.assertNull(bean.getaField()); - Assert.assertNull(bean.getbField()); - Assert.assertNull(bean.getcField()); + Assertions.assertNull(bean.getaField()); + Assertions.assertNull(bean.getbField()); + Assertions.assertNull(bean.getcField()); InjectionUtils.inject(bean, "specialBean", c); - Assert.assertNull(bean.getaField()); - Assert.assertNull(bean.getbField()); - Assert.assertTrue(bean.getcField() == c); + Assertions.assertNull(bean.getaField()); + Assertions.assertNull(bean.getbField()); + Assertions.assertSame(bean.getcField(), c); } @Test - public void injectUnqualifiedFieldWithQualifier() throws Exception { + void injectUnqualifiedFieldWithQualifier() { BeanB b = new BeanB(); MyBean bean = new MyBean(); - Assert.assertNull(bean.getaField()); - Assert.assertNull(bean.getbField()); - Assert.assertNull(bean.getcField()); + Assertions.assertNull(bean.getaField()); + Assertions.assertNull(bean.getbField()); + Assertions.assertNull(bean.getcField()); InjectionUtils.inject(bean, "myQualifier", b); - Assert.assertNull(bean.getaField()); - Assert.assertTrue(bean.getbField() == b); - Assert.assertNull(bean.getcField()); + Assertions.assertNull(bean.getaField()); + Assertions.assertSame(bean.getbField(), b); + Assertions.assertNull(bean.getcField()); } - @Test(expected = RuntimeException.class) - public void injectWithWrongQualifier() throws Exception { + @Test + void injectWithWrongQualifier() { BeanC c = new BeanC(); MyBean bean = new MyBean(); - Assert.assertNull(bean.getaField()); - Assert.assertNull(bean.getbField()); - Assert.assertNull(bean.getcField()); - - InjectionUtils.inject(bean, "wrongQualifier", c); + Assertions.assertNull(bean.getaField()); + Assertions.assertNull(bean.getbField()); + Assertions.assertNull(bean.getcField()); + Assertions.assertThrows(RuntimeException.class, () -> { + InjectionUtils.inject(bean, "wrongQualifier", c); + }); } - @Test(expected = RuntimeException.class) - public void injectWithoutQualifier() throws Exception { + @Test + void injectWithoutQualifier() { BeanC c = new BeanC(); MyBean bean = new MyBean(); - Assert.assertNull(bean.getaField()); - Assert.assertNull(bean.getbField()); - Assert.assertNull(bean.getcField()); + Assertions.assertNull(bean.getaField()); + Assertions.assertNull(bean.getbField()); + Assertions.assertNull(bean.getcField()); - InjectionUtils.inject(bean, c); + Assertions.assertThrows(RuntimeException.class, () -> { + InjectionUtils.inject(bean, c); + }); } - @Test(expected = RuntimeException.class) - public void injectNonwiredDependency() throws Exception { + @Test + void injectNonwiredDependency() { Object o = new Object(); MyBean bean = new MyBean(); - Assert.assertNull(bean.getaField()); - Assert.assertNull(bean.getbField()); - Assert.assertNull(bean.getcField()); + Assertions.assertNull(bean.getaField()); + Assertions.assertNull(bean.getbField()); + Assertions.assertNull(bean.getcField()); - InjectionUtils.inject(bean, o); + Assertions.assertThrows(RuntimeException.class, () -> { + InjectionUtils.inject(bean, o); + }); } @Test - public void injectValue() throws Exception { + void injectValue() { MyBean bean = new MyBean(); - Assert.assertNull(bean.getValue1()); - Assert.assertNull(bean.getValue2()); + Assertions.assertNull(bean.getValue1()); + Assertions.assertNull(bean.getValue2()); InjectionUtils.injectValue(bean, "value2", "foobar"); - Assert.assertNull(bean.getValue1()); - Assert.assertEquals("foobar", bean.getValue2()); + Assertions.assertNull(bean.getValue1()); + Assertions.assertEquals("foobar", bean.getValue2()); } - @Test(expected = RuntimeException.class) - public void injectValueIntoNonannotatedField() throws Exception { + @Test + void injectValueIntoNonannotatedField() { MyBean bean = new MyBean(); - Assert.assertNull(bean.getValue1()); - Assert.assertNull(bean.getValue2()); + Assertions.assertNull(bean.getValue1()); + Assertions.assertNull(bean.getValue2()); - InjectionUtils.injectValue(bean, "value1", "foobar"); + Assertions.assertThrows(RuntimeException.class, () -> { + InjectionUtils.injectValue(bean, "value1", "foobar"); + }); } - @Test(expected = RuntimeException.class) - public void injectValueIntoNonStringField() throws Exception { + @Test + void injectValueIntoNonStringField() { MyBean bean = new MyBean(); - Assert.assertNull(bean.getValue1()); - Assert.assertNull(bean.getValue2()); + Assertions.assertNull(bean.getValue1()); + Assertions.assertNull(bean.getValue2()); - InjectionUtils.injectValue(bean, "oField", "foobar"); + Assertions.assertThrows(RuntimeException.class, () -> { + InjectionUtils.injectValue(bean, "oField", "foobar"); + }); } - @Test(expected = RuntimeException.class) - public void injectValueIntoNonStringField2() throws Exception { + @Test + void injectValueIntoNonStringField2() { MyBean bean = new MyBean(); - Assert.assertNull(bean.getValue1()); - Assert.assertNull(bean.getValue2()); + Assertions.assertNull(bean.getValue1()); + Assertions.assertNull(bean.getValue2()); - InjectionUtils.injectValue(bean, "value3", "foobar"); + Assertions.assertThrows(RuntimeException.class, () -> { + InjectionUtils.injectValue(bean, "value3", "foobar"); + }); } - @Test(expected = RuntimeException.class) - public void injectValueIntoNonExistingField() throws Exception { + @Test + void injectValueIntoNonExistingField() { MyBean bean = new MyBean(); - Assert.assertNull(bean.getValue1()); - Assert.assertNull(bean.getValue2()); + Assertions.assertNull(bean.getValue1()); + Assertions.assertNull(bean.getValue2()); - InjectionUtils.injectValue(bean, "nonExisting", "foobar"); + Assertions.assertThrows(RuntimeException.class, () -> { + InjectionUtils.injectValue(bean, "nonExisting", "foobar"); + }); } } From 10ab87423277d47917ddd67bc9c471043ffb4f43 Mon Sep 17 00:00:00 2001 From: Alexander Fischer Date: Wed, 12 Jun 2024 15:57:00 +0200 Subject: [PATCH 2/4] updated deprecated velocity properties --- .../dvalin/interconnect/model/maven/GeneratorHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/GeneratorHelper.java b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/GeneratorHelper.java index 8d13c513..ef8df8b9 100644 --- a/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/GeneratorHelper.java +++ b/interconnect/interconnect-maven-plugin/src/main/java/de/taimos/dvalin/interconnect/model/maven/GeneratorHelper.java @@ -93,8 +93,8 @@ private static Template prepareTemplate(Log log, GenerationContext generationCon */ public static Properties getVelocityDefaultProps() { Properties props = new Properties(); - props.put("resource.loader", "class"); - props.put("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + props.put("resource.loaders", "class"); + props.put("resource.loader.class.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); props.setProperty(RuntimeConstants.EVENTHANDLER_INCLUDE, IncludeRelativePath.class.getName()); return props; } From 2e26b8b1d842b81e7d64804a4dfe31b517f0377e Mon Sep 17 00:00:00 2001 From: YukiInu Date: Tue, 18 Jun 2024 13:34:39 +0200 Subject: [PATCH 3/4] migrate junit 4 tests to junit 5 --- CHANGELOG.md | 8 ++++---- .../java/de/taimos/dvalin/mongo/ABaseTest.java | 4 ++-- .../test/java/de/taimos/dvalin/mongo/LinkTest.java | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a188a376..44acf09d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ * Removed (unused) cglib from dvalin-jaxrs * Removed concordion-extensions * Migrated all JUnit tests to Junit 5 syntax +* Removed mongodb-driver-legacy from mongodb + * Deprecated mongo functionality was removed + * Complete overhaul for entity handling + * The old functionality is still available with the mongodb-legacy library * Breaking: Removed Junit 5 Vintage engine and Junit 4 (can be added in projects that need it) * Fixed vulnerabilities: CVE-2023-52428(nimbus-jose-jwt), CVE-2024-29857,CVE-2024-30171,CVE-2024-30172,CVE-2024-34447 (bouncycastle), CVE-2024-28752 (Apache CXF) @@ -50,10 +54,6 @@ * Migrated from JUnit 4 to JUnit 5 * Drop support for Powermock * Switch Mockito to Mockito Inline for usage in static mocks -* Removed mongodb-driver-legacy from mongodb - * Deprecated mongo functionality was removed - * Complete overhaul for entity handling - * The old functionality is still available with the mongodb-legacy library * Fixing an recurring ActiveMQ problem where messages can't be sent because ActiveMQ is to slow opening destination. We do a resend after configurable retry time. If problem does not occur, nothing hanges. * IVO generator: replaced old Apache BeanUtils with Spring beans BeanUtils diff --git a/mongodb-legacy/src/test/java/de/taimos/dvalin/mongo/ABaseTest.java b/mongodb-legacy/src/test/java/de/taimos/dvalin/mongo/ABaseTest.java index 7aa7f075..c488ae64 100644 --- a/mongodb-legacy/src/test/java/de/taimos/dvalin/mongo/ABaseTest.java +++ b/mongodb-legacy/src/test/java/de/taimos/dvalin/mongo/ABaseTest.java @@ -36,7 +36,7 @@ import de.bwaldvogel.mongo.backend.memory.MemoryBackend; import de.taimos.daemon.log4j.Log4jLoggingConfigurer; import org.jongo.Jongo; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; /** * Copyright 2015 Taimos GmbH
@@ -66,7 +66,7 @@ public class ABaseTest { protected static void assertEquals(BigDecimal bd1, BigDecimal bd2) { - Assert.assertEquals(bd1.doubleValue(), bd2.doubleValue(), 0); + Assertions.assertEquals(bd1.doubleValue(), bd2.doubleValue(), 0); } /** diff --git a/mongodb/src/test/java/de/taimos/dvalin/mongo/LinkTest.java b/mongodb/src/test/java/de/taimos/dvalin/mongo/LinkTest.java index ecc72844..4e071017 100644 --- a/mongodb/src/test/java/de/taimos/dvalin/mongo/LinkTest.java +++ b/mongodb/src/test/java/de/taimos/dvalin/mongo/LinkTest.java @@ -33,9 +33,9 @@ import de.taimos.dvalin.mongo.model.TestObject; import io.mongock.driver.mongodb.sync.v4.driver.MongoSync4Driver; import io.mongock.runner.standalone.MongockStandalone; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; /** * Copyright 2015 Taimos GmbH
@@ -51,7 +51,7 @@ public class LinkTest { private static final DLinkDAO dlinkDAO = new DLinkDAO(ABaseTest.mongo.getDatabase(ABaseTest.dbName)); - @BeforeClass + @BeforeAll public static void init() { try { System.setProperty("mongodb.name", ABaseTest.dbName); @@ -73,7 +73,7 @@ public static void init() { } @Test - public void testLinks() { + void testLinks() { LinkedObject lo1 = new LinkedObject(); lo1.setName("LinkedObject1"); lo1 = LinkTest.ldao.save(lo1); @@ -88,10 +88,10 @@ public void testLinks() { lo.getLinks().add(lo2.asLink()); lo = LinkTest.dao.save(lo); - Assert.assertEquals(2, lo.getLinks().size()); + Assertions.assertEquals(2, lo.getLinks().size()); List list = LinkTest.dlinkDAO.resolve(lo.getLinks(), LinkedObject.class); - Assert.assertEquals(2, list.size()); + Assertions.assertEquals(2, list.size()); } } From 6b5d68227a12069dfd0a498d564c513538076cfa Mon Sep 17 00:00:00 2001 From: Alexander Fischer Date: Tue, 18 Jun 2024 15:10:00 +0200 Subject: [PATCH 4/4] trying to fix test --- .../src/test/java/de/taimos/dvalin/mongo/Tester.java | 5 +++-- pom.xml | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mongodb-legacy/src/test/java/de/taimos/dvalin/mongo/Tester.java b/mongodb-legacy/src/test/java/de/taimos/dvalin/mongo/Tester.java index 5769cb37..f3bc7b28 100644 --- a/mongodb-legacy/src/test/java/de/taimos/dvalin/mongo/Tester.java +++ b/mongodb-legacy/src/test/java/de/taimos/dvalin/mongo/Tester.java @@ -71,12 +71,13 @@ public static void init() { .setTransactionEnabled(false).setEnabled(true).buildRunner().execute(); Tester.dao.init(); } catch (Exception e) { + System.out.println("Initialization failure"); e.printStackTrace(); } } @Test - public void testUpdate() { + void testUpdate() { TestObject o = new TestObject(); o.setName("bar"); o.setValue(new BigDecimal("5")); @@ -131,7 +132,7 @@ public void testUpdate() { } @Test - public void serialize() throws Exception { + void serialize() { TestObject o = new TestObject(); o.setName("bar"); o.setValue(new BigDecimal("5")); diff --git a/pom.xml b/pom.xml index a4b57cd8..6e2ef47f 100644 --- a/pom.xml +++ b/pom.xml @@ -541,6 +541,10 @@ maven-resources-plugin 3.3.1 + + org.apache.maven.plugins + maven-surefire-plugin + 3.3.0 org.apache.maven.plugins maven-gpg-plugin