From fb8e713a59cbadfdbb9203c0bc72b337584e1fbb Mon Sep 17 00:00:00 2001 From: stefanermens Date: Thu, 10 Oct 2024 12:59:54 +0200 Subject: [PATCH 01/15] Update cxf in protocol adapter to 4.0.5 Signed-off-by: stefanermens --- osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/pom.xml b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/pom.xml index 9dac6be6965..2a1226279b3 100644 --- a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/pom.xml +++ b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/pom.xml @@ -30,7 +30,7 @@ SPDX-License-Identifier: Apache-2.0 true 1.8.0 - 4.0.3 + 4.0.5 From 2677a8eec118a4870118b907bc158001abf25b5e Mon Sep 17 00:00:00 2001 From: stefanermens Date: Thu, 10 Oct 2024 14:59:22 +0200 Subject: [PATCH 02/15] Update cxf in simulator to 4.0.5 Signed-off-by: stefanermens --- osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/pom.xml b/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/pom.xml index b49e534e1a3..85a35971546 100644 --- a/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/pom.xml +++ b/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/pom.xml @@ -25,7 +25,7 @@ SPDX-License-Identifier: Apache-2.0 4.4 3.2.5 - 4.0.3 + 4.0.5 true From f721db7ec41d5c494bc5ae7afd92f3a68e87d63d Mon Sep 17 00:00:00 2001 From: stefanermens Date: Thu, 10 Oct 2024 16:26:42 +0200 Subject: [PATCH 03/15] Update cxf in integration tests to 4.0.5 Signed-off-by: stefanermens --- integration-tests/cucumber-tests-platform-smartmetering/pom.xml | 2 +- osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/cucumber-tests-platform-smartmetering/pom.xml b/integration-tests/cucumber-tests-platform-smartmetering/pom.xml index ce5d9b3b075..e090a3fe9d0 100644 --- a/integration-tests/cucumber-tests-platform-smartmetering/pom.xml +++ b/integration-tests/cucumber-tests-platform-smartmetering/pom.xml @@ -20,7 +20,7 @@ SPDX-License-Identifier: Apache-2.0 - 4.0.3 + 4.0.5 cucumber-tests-platform-smartmetering diff --git a/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/pom.xml b/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/pom.xml index 85a35971546..b49e534e1a3 100644 --- a/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/pom.xml +++ b/osgp/protocol-adapter-dlms/osgp-protocol-simulator-dlms/pom.xml @@ -25,7 +25,7 @@ SPDX-License-Identifier: Apache-2.0 4.4 3.2.5 - 4.0.5 + 4.0.3 true From 63375081f34a5e7d94aaea18d0d7530348d99d0b Mon Sep 17 00:00:00 2001 From: stefanermens Date: Fri, 11 Oct 2024 11:50:38 +0200 Subject: [PATCH 04/15] Remove bus-extensions.txt from test-jar-with-dependencies.xml Signed-off-by: stefanermens --- .../assembly/test-jar-with-dependencies.xml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/main/assembly/test-jar-with-dependencies.xml b/integration-tests/cucumber-tests-platform-smartmetering/src/main/assembly/test-jar-with-dependencies.xml index e033a48dfea..aeab79e9dfe 100644 --- a/integration-tests/cucumber-tests-platform-smartmetering/src/main/assembly/test-jar-with-dependencies.xml +++ b/integration-tests/cucumber-tests-platform-smartmetering/src/main/assembly/test-jar-with-dependencies.xml @@ -17,21 +17,21 @@ SPDX-License-Identifier: Apache-2.0 / true - - - META-INF/cxf/bus-extensions.txt - - + + + + + true true test - - - ${project.basedir}/src/main/resources/cxf/bus-extensions.txt - META-INF/cxf - - - \ No newline at end of file + + + + + + + From 39c4284e4dbc32264f321995ba12a215eab85921 Mon Sep 17 00:00:00 2001 From: stefanermens Date: Fri, 11 Oct 2024 15:08:19 +0200 Subject: [PATCH 05/15] Undo remove bus-extensions.txt from test-jar-with-dependencies.xml Signed-off-by: stefanermens --- .../assembly/test-jar-with-dependencies.xml | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/main/assembly/test-jar-with-dependencies.xml b/integration-tests/cucumber-tests-platform-smartmetering/src/main/assembly/test-jar-with-dependencies.xml index aeab79e9dfe..9c79e63d36f 100644 --- a/integration-tests/cucumber-tests-platform-smartmetering/src/main/assembly/test-jar-with-dependencies.xml +++ b/integration-tests/cucumber-tests-platform-smartmetering/src/main/assembly/test-jar-with-dependencies.xml @@ -17,21 +17,21 @@ SPDX-License-Identifier: Apache-2.0 / true - - - - - + + + META-INF/cxf/bus-extensions.txt + + true true test - - - - - - + + + ${project.basedir}/src/main/resources/cxf/bus-extensions.txt + META-INF/cxf + + From 0346d3c2f66af882404e277d3258931626d678f9 Mon Sep 17 00:00:00 2001 From: stefanermens Date: Mon, 28 Oct 2024 17:10:43 +0100 Subject: [PATCH 06/15] Add null certificate in SimulatorTriggerClient Signed-off-by: stefanermens --- .../dlms/simulator/trigger/SimulatorTriggerClient.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java index 9f6e46697cd..7af67f18220 100644 --- a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java +++ b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java @@ -12,6 +12,7 @@ import java.io.InputStream; import java.security.KeyStore; import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.List; @@ -105,7 +106,13 @@ private WebClient configureInsecureWebClient(final String baseAddress) { new X509TrustManager() { @Override public X509Certificate[] getAcceptedIssuers() { - return new X509Certificate[0]; + try { + return new X509Certificate[] { + (X509Certificate) CertificateFactory.getInstance("X509").generateCertificate(null) + }; + } catch (final CertificateException e) { + throw new RuntimeException(e); + } } @SuppressWarnings( From b1a7401ad7727ce8bacf83d200d913bd676b9868 Mon Sep 17 00:00:00 2001 From: stefanermens Date: Thu, 31 Oct 2024 09:48:52 +0100 Subject: [PATCH 07/15] Set default SSL context Signed-off-by: stefanermens --- .../trigger/SimulatorTriggerClient.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java index 7af67f18220..a8dce432643 100644 --- a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java +++ b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java @@ -12,10 +12,10 @@ import java.io.InputStream; import java.security.KeyStore; import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.List; +import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; @@ -106,13 +106,7 @@ private WebClient configureInsecureWebClient(final String baseAddress) { new X509TrustManager() { @Override public X509Certificate[] getAcceptedIssuers() { - try { - return new X509Certificate[] { - (X509Certificate) CertificateFactory.getInstance("X509").generateCertificate(null) - }; - } catch (final CertificateException e) { - throw new RuntimeException(e); - } + return new X509Certificate[0]; } @SuppressWarnings( @@ -137,6 +131,14 @@ public void checkClientTrusted(final X509Certificate[] chain, final String authT tlsParams.setSecureSocketProtocol("TLSv1.2"); + try { + final SSLContext sc = SSLContext.getDefault(); + tlsParams.setUseHttpsURLConnectionDefaultSslSocketFactory(false); + tlsParams.setSSLSocketFactory(sc.getSocketFactory()); + } catch (final Exception e) { + throw new RuntimeException(e); + } + conduit.setTlsClientParameters(tlsParams); return client; From 83d499f81c93f0fefabdfe7ea58c9aabeb3ab569 Mon Sep 17 00:00:00 2001 From: stefanermens Date: Thu, 31 Oct 2024 11:08:03 +0100 Subject: [PATCH 08/15] Resolve conflict Signed-off-by: stefanermens --- osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/pom.xml b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/pom.xml index 2a1226279b3..d0fed4e47ba 100644 --- a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/pom.xml +++ b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/pom.xml @@ -29,8 +29,6 @@ SPDX-License-Identifier: Apache-2.0 ${project.version} true 1.8.0 - - 4.0.5 From 563d1fe76ec1a376e1990755ab73003347ac8069 Mon Sep 17 00:00:00 2001 From: stefanermens Date: Thu, 7 Nov 2024 13:52:13 +0100 Subject: [PATCH 09/15] Use secure SimulatorTriggerClient Signed-off-by: stefanermens --- .../config/DlmsSimulatorConfig.java | 17 ++++++++++++----- ...mber-tests-platform-smartmetering.properties | 8 +++++++- .../cucumber-tests-platform.properties | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/config/DlmsSimulatorConfig.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/config/DlmsSimulatorConfig.java index c4f9eed2af8..ced7bf1a278 100644 --- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/config/DlmsSimulatorConfig.java +++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/config/DlmsSimulatorConfig.java @@ -14,14 +14,21 @@ @Configuration public class DlmsSimulatorConfig extends AbstractConfig { - public DlmsSimulatorConfig() {} + @Value("${web.service.truststore.location}") + private String truststoreLocation; - @Value("${dynamic.properties.base.url}") - private String dynamicPropertiesBaseUrl; + @Value("${web.service.truststore.password}") + private String truststorePassword; + + @Value("${web.service.truststore.type}") + private String truststoreType; + + @Value("${triggered.simulator.url}") + private String baseAddress; @Bean public SimulatorTriggerClient simulatorTriggerClient() throws SimulatorTriggerClientException { - - return new SimulatorTriggerClient(this.dynamicPropertiesBaseUrl); + return new SimulatorTriggerClient( + this.truststoreLocation, this.truststorePassword, this.truststoreType, this.baseAddress); } } diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties b/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties index a0e34c44f57..98655f91f78 100644 --- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties +++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties @@ -60,4 +60,10 @@ jre.encryption.key.resource=classpath:osgp-secret-management-jre.key simulator.max.logicalids.per.port=100 smartmetering.firmware.path=/etc/osp/firmwarefiles -smartmetering.firmware.imageidentifier.extention=imgid \ No newline at end of file +smartmetering.firmware.imageidentifier.extention=imgid + + +web.service.truststore.location=${certificate.basepath}/trust.jks +web.service.truststore.password=123456 +web.service.truststore.type=jks +triggered.simulator.url=https://localhost/osgp-simulator-dlms-triggered/wakeup diff --git a/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties b/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties index f92888cfe94..f6c6ed5af9a 100644 --- a/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties +++ b/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties @@ -58,3 +58,4 @@ web.service.truststore.type=jks #firmware file location for loading firmware files into the DB firmware.file.path=/var/www/html/firmware +triggered.simulator.url=https://localhost/osgp-simulator-dlms-triggered/wakeup From 00a825d0cabdcf39ee202145f1a5261a3430bf44 Mon Sep 17 00:00:00 2001 From: stefanermens Date: Mon, 11 Nov 2024 12:03:29 +0100 Subject: [PATCH 10/15] Change path to certificates Signed-off-by: stefanermens --- .../src/test/resources/cucumber-tests-platform.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties b/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties index f6c6ed5af9a..50d3b32ce40 100644 --- a/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties +++ b/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties @@ -11,7 +11,7 @@ server.psql.domain=${server}${psql}${domain} platform=${server.domain} serviceEndpoint=${server.domain} -certificate.basepath=../certificates +certificate.basepath=../shared/certs # Database Configuration db.username=osp_admin From 50460bb53b8624ebc9d2ab8095befd194ab8f5ac Mon Sep 17 00:00:00 2001 From: stefanermens Date: Mon, 11 Nov 2024 14:29:50 +0100 Subject: [PATCH 11/15] Revert path to certificates Signed-off-by: stefanermens --- .../src/test/resources/cucumber-tests-platform.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties b/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties index 50d3b32ce40..f6c6ed5af9a 100644 --- a/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties +++ b/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties @@ -11,7 +11,7 @@ server.psql.domain=${server}${psql}${domain} platform=${server.domain} serviceEndpoint=${server.domain} -certificate.basepath=../shared/certs +certificate.basepath=../certificates # Database Configuration db.username=osp_admin From a6b5f0afd3e4dec126615fd327d9a0243902166b Mon Sep 17 00:00:00 2001 From: stefanermens Date: Tue, 12 Nov 2024 11:08:05 +0100 Subject: [PATCH 12/15] Update certificate basepath Signed-off-by: stefanermens --- .../src/test/resources/cucumber-tests-platform.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties b/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties index f6c6ed5af9a..ede5cf3cc5d 100644 --- a/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties +++ b/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties @@ -11,7 +11,7 @@ server.psql.domain=${server}${psql}${domain} platform=${server.domain} serviceEndpoint=${server.domain} -certificate.basepath=../certificates +certificate.basepath=/etc/ssl/certs # Database Configuration db.username=osp_admin From 5307d71475ef2728477c8aefe287df97693b16e9 Mon Sep 17 00:00:00 2001 From: Marcel Jansen <34770714+Marcel-Jansen@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:50:31 +0100 Subject: [PATCH 13/15] archive /etc/ssl/certs Signed-off-by: Marcel Jansen <34770714+Marcel-Jansen@users.noreply.github.com> --- runTestsAtRemoteServer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runTestsAtRemoteServer.sh b/runTestsAtRemoteServer.sh index f002f431b8e..fa3efc5baa9 100755 --- a/runTestsAtRemoteServer.sh +++ b/runTestsAtRemoteServer.sh @@ -74,7 +74,7 @@ CMD="ssh -oStrictHostKeyChecking=no -oTCPKeepAlive=yes -oServerAliveInterval=50 ${CMD} echo '- Create zip file from files from server ...' -CMD="sudo tar zhcvf /tmp/${SERVER}-${PROJECT}.tgz /etc/osgp /etc/httpd/conf.d /usr/share/tomcat/conf /var/log/tomcat /var/log/osgp /var/lib/pgsql/9.6/data/pg_log --warning=no-file-changed || true" +CMD="sudo tar zhcvf /tmp/${SERVER}-${PROJECT}.tgz /etc/ssl/certs /etc/osgp /etc/httpd/conf.d /usr/share/tomcat/conf /var/log/tomcat /var/log/osgp /var/lib/pgsql/9.6/data/pg_log --warning=no-file-changed || true" echo " [${CMD}]" CMD="ssh -oStrictHostKeyChecking=no ${SSH_KEY_FILE} ${USER}@${SERVER} \"\"cd /data/software/${PROJECT} && ${CMD}\"\"" ${CMD} From dc94889bd16144e4f4269ce9947b94ac976c15db Mon Sep 17 00:00:00 2001 From: stefanermens Date: Mon, 18 Nov 2024 15:39:47 +0100 Subject: [PATCH 14/15] Change dynamic.properties.base.url Signed-off-by: stefanermens --- .../resources/cucumber-tests-platform-smartmetering.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties b/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties index 98655f91f78..fa4e06a319d 100644 --- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties +++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties @@ -13,7 +13,7 @@ alarm.notifications.host=${server.domain} alarm.notifications.port=9598 # Settings for rest service to dynamically set DLMS attribute values in a device simulator. -dynamic.properties.base.url=https://${server.domain}/osgp-simulator-dlms-triggered/wakeup +dynamic.properties.base.url=${base.uri}/osgp-simulator-dlms-triggered/wakeup # When waiting for a SmartMeter response notification for a correlation UID # retrieved earlier, what is the maximum duration in milliseconds after which From 466eaaa04b7796df259b01c5fa1f296190baa5f2 Mon Sep 17 00:00:00 2001 From: Harry Middelburg Date: Thu, 28 Nov 2024 10:04:26 +0100 Subject: [PATCH 15/15] Added test logging Signed-off-by: Harry Middelburg --- ...er-tests-platform-smartmetering.properties | 4 +-- .../cucumber-tests-platform.properties | 4 +-- .../trigger/SimulatorTriggerClient.java | 36 +++++++++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties b/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties index fa4e06a319d..1f8c79c34af 100644 --- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties +++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/resources/cucumber-tests-platform-smartmetering.properties @@ -13,7 +13,7 @@ alarm.notifications.host=${server.domain} alarm.notifications.port=9598 # Settings for rest service to dynamically set DLMS attribute values in a device simulator. -dynamic.properties.base.url=${base.uri}/osgp-simulator-dlms-triggered/wakeup +dynamic.properties.base.url=${base.uri}osgp-simulator-dlms-triggered/wakeup # When waiting for a SmartMeter response notification for a correlation UID # retrieved earlier, what is the maximum duration in milliseconds after which @@ -66,4 +66,4 @@ smartmetering.firmware.imageidentifier.extention=imgid web.service.truststore.location=${certificate.basepath}/trust.jks web.service.truststore.password=123456 web.service.truststore.type=jks -triggered.simulator.url=https://localhost/osgp-simulator-dlms-triggered/wakeup +triggered.simulator.url=${base.uri}osgp-simulator-dlms-triggered/wakeup diff --git a/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties b/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties index ede5cf3cc5d..e6e28269082 100644 --- a/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties +++ b/integration-tests/cucumber-tests-platform/src/test/resources/cucumber-tests-platform.properties @@ -11,7 +11,7 @@ server.psql.domain=${server}${psql}${domain} platform=${server.domain} serviceEndpoint=${server.domain} -certificate.basepath=/etc/ssl/certs +certificate.basepath=../certificates # Database Configuration db.username=osp_admin @@ -58,4 +58,4 @@ web.service.truststore.type=jks #firmware file location for loading firmware files into the DB firmware.file.path=/var/www/html/firmware -triggered.simulator.url=https://localhost/osgp-simulator-dlms-triggered/wakeup +#triggered.simulator.url=https://localhost/osgp-simulator-dlms-triggered/wakeup diff --git a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java index a8dce432643..5557ef716b1 100644 --- a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java +++ b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/simulator/trigger/SimulatorTriggerClient.java @@ -8,17 +8,22 @@ import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response.Status; +import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.security.KeyStore; +import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; import java.util.List; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; +import lombok.extern.slf4j.Slf4j; import org.apache.cxf.configuration.jsse.TLSClientParameters; import org.apache.cxf.jaxrs.client.ClientConfiguration; import org.apache.cxf.jaxrs.client.WebClient; @@ -28,6 +33,7 @@ import org.opensmartgridplatform.shared.usermanagement.AbstractClient; import org.opensmartgridplatform.shared.usermanagement.ResponseException; +@Slf4j public class SimulatorTriggerClient extends AbstractClient { private static final String CONSTRUCTION_FAILED = "SimulatorTriggerClient construction failed"; @@ -51,10 +57,40 @@ public SimulatorTriggerClient( final String baseAddress) throws SimulatorTriggerClientException { + // test + log.info("baseAddress: {}", baseAddress); + final File truststoreLocationFile = new File(truststoreLocation); + log.info("{} is parent", truststoreLocationFile.getParentFile()); + if (truststoreLocationFile.exists()) { + log.info("{} exists", truststoreLocation); + if (truststoreLocationFile.getParentFile().isDirectory()) { + log.info("{} is directoru", truststoreLocationFile.getParentFile()); + Arrays.stream(truststoreLocationFile.getParentFile().listFiles()) + .forEach(file -> log.info("== {}", file.getName())); + } + } + // end test try (final InputStream stream = new FileInputStream(truststoreLocation)) { // Create the KeyStore. final KeyStore truststore = KeyStore.getInstance(truststoreType.toUpperCase()); + // test + final Iterator iterator = truststore.aliases().asIterator(); + log.info("== aliases == "); + while (iterator.hasNext()) { + final String alias = iterator.next(); + log.info("alias: {}", alias); + final Certificate certificate = truststore.getCertificate(alias); + log.info("certificate: {}", certificate.toString()); + final Certificate[] certificateChain = truststore.getCertificateChain(alias); + Arrays.stream(certificateChain) + .forEach(cc -> log.info("certificate chain: {}", cc.toString())); + log.info("creationdate: {}", truststore.getCreationDate(alias)); + } + log.info("== end of aliases == "); + + // end test + truststore.load(stream, truststorePassword.toCharArray()); // Create TrustManagerFactory and initialize it using the KeyStore.