diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
new file mode 100644
index 00000000000..45a7d6204e5
--- /dev/null
+++ b/.github/workflows/dependency-review.yml
@@ -0,0 +1,18 @@
+name: Maven Dependency Tree Dependency Submission
+on:
+ schedule:
+ - cron: '0 0 * * *'
+ workflow_dispatch:
+
+permissions:
+ contents: write
+
+jobs:
+ dependency-detection-and-submission:
+ runs-on: ubuntu-latest
+ steps:
+ - name: 'Checkout Repository'
+ uses: actions/checkout@v4
+
+ - name: Submit Dependency Snapshot
+ uses: advanced-security/maven-dependency-submission-action@v3
diff --git a/integration-tests/cucumber-tests-core/pom.xml b/integration-tests/cucumber-tests-core/pom.xml
index 3984aae7d9f..729a31d3be1 100644
--- a/integration-tests/cucumber-tests-core/pom.xml
+++ b/integration-tests/cucumber-tests-core/pom.xml
@@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0
org.opensmartgridplatform
parent-integration-tests
- 5.45.0-SNAPSHOT
+ 5.49.0-SNAPSHOT
../parent-integration-tests/pom.xml
diff --git a/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/DateTimeHelper.java b/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/DateTimeHelper.java
index 39da0c6aa1b..e9f6b37afc6 100644
--- a/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/DateTimeHelper.java
+++ b/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/DateTimeHelper.java
@@ -7,16 +7,15 @@
import com.luckycatlabs.sunrisesunset.SunriseSunsetCalculator;
import com.luckycatlabs.sunrisesunset.dto.Location;
import java.time.Instant;
+import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
import java.util.Calendar;
-import java.util.TimeZone;
+import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
+import org.opensmartgridplatform.shared.utils.JavaTimeHelpers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -29,8 +28,8 @@ public class DateTimeHelper {
/**
* @return CET/CEST time zone based on ID {@value #CET_TIMEZONE}
*/
- public static DateTimeZone getCentralEuropeanTimeZone() {
- return DateTimeZone.forID(CET_TIMEZONE);
+ public static ZoneId getCentralEuropeanTimeZone() {
+ return ZoneId.of(CET_TIMEZONE);
}
/**
@@ -57,12 +56,12 @@ public static ZoneId getCentralEuropeanZoneId() {
*
now at midday + 1 week
*
*/
- public static DateTime getDateTime(final String dateString) {
+ public static ZonedDateTime getDateTime(final String dateString) {
if (dateString.isEmpty()) {
return null;
}
- DateTime retval = DateTime.now(getCentralEuropeanTimeZone());
+ ZonedDateTime retval = ZonedDateTime.now(getCentralEuropeanTimeZone());
final String pattern = "([a-z ]*)[ ]*([+-]?)[ ]*([0-9]*)[ ]*([a-z]*)";
final Pattern r = Pattern.compile(pattern);
@@ -105,18 +104,18 @@ public static DateTime getDateTime(final String dateString) {
}
// Normalize the seconds and milliseconds to zero
- retval = retval.withSecondOfMinute(0);
- retval = retval.withMillisOfSecond(0);
+ retval = retval.withSecond(0);
+ retval = retval.withNano(0);
if (whenMatcher.groupCount() > 1 && whenMatcher.group(2).equals("at")) {
switch (whenMatcher.group(3)) {
case "midday":
case "noon":
- retval = retval.withHourOfDay(12);
+ retval = retval.withHour(12);
break;
case "midnight":
- retval = retval.withHourOfDay(0);
+ retval = retval.withHour(0);
break;
default:
throw new IllegalArgumentException(
@@ -124,8 +123,8 @@ public static DateTime getDateTime(final String dateString) {
+ dateString
+ "], expected \"midday\", \"noon\" or \"midnight\"");
}
- retval = retval.withMinuteOfHour(0);
- retval = retval.withSecondOfMinute(0);
+ retval = retval.withMinute(0);
+ retval = retval.withSecond(0);
}
if (op.equals("+")) {
@@ -176,7 +175,7 @@ public static DateTime getDateTime(final String dateString) {
}
public static ZonedDateTime getZonedDateTime(final String dateString) {
- return dateTimeToZonedDateTime(getDateTime(dateString));
+ return getDateTime(dateString);
}
public static Instant getInstant(final String dateString) {
@@ -184,17 +183,17 @@ public static Instant getInstant(final String dateString) {
return dateTime.toInstant();
}
- public static DateTime getDateTime2(final String startDate, final DateTime defaultStartDate) {
+ public static ZonedDateTime getDateTime2(
+ final String startDate, final ZonedDateTime defaultStartDate) {
if (startDate == null) {
return defaultStartDate;
}
- DateTime dateTime;
+ ZonedDateTime dateTime;
try {
dateTime = getDateTime(startDate);
} catch (final IllegalArgumentException e) {
- LOGGER.debug(
- "The string {} could not be parsed by DateTimeHelper.getDateTime, lets org.joda.time.DateTime");
- dateTime = DateTime.parse(startDate);
+ LOGGER.debug("The string {} could not be parsed by DateTimeHelper.getDateTime");
+ dateTime = JavaTimeHelpers.parseToZonedDateTime(startDate);
}
if (dateTime == null) {
return defaultStartDate;
@@ -204,13 +203,12 @@ public static DateTime getDateTime2(final String startDate, final DateTime defau
public static ZonedDateTime getZonedDateTime2(
final String startDate, final ZonedDateTime defaultStartDate) {
- return dateTimeToZonedDateTime(
- getDateTime2(startDate, zonedDateTimeToDateTime(defaultStartDate)));
+ return getDateTime2(startDate, defaultStartDate);
}
/** Get time of sunrise/sunset */
- public static DateTime getSunriseSunsetTime(
- final String actionTimeType, final DateTime date, final Location location) {
+ public static ZonedDateTime getSunriseSunsetTime(
+ final String actionTimeType, final ZonedDateTime date, final Location location) {
final SunriseSunsetCalculator calculator = new SunriseSunsetCalculator(location, "UTC");
Calendar officialTransition = null;
@@ -218,10 +216,10 @@ public static DateTime getSunriseSunsetTime(
final Calendar calender = Calendar.getInstance();
if (actionTimeType.equalsIgnoreCase("SUNSET")) {
- calender.setTime(date.toDate());
+ calender.setTime(Date.from(date.toInstant()));
officialTransition = calculator.getOfficialSunsetCalendarForDate(calender);
} else if (actionTimeType.equalsIgnoreCase("SUNRISE")) {
- calender.setTime(date.plusDays(1).toDate());
+ calender.setTime(Date.from(date.plusDays(1).toInstant()));
officialTransition = calculator.getOfficialSunriseCalendarForDate(calender);
}
@@ -229,47 +227,13 @@ public static DateTime getSunriseSunsetTime(
return null;
}
- return new DateTime(officialTransition.getTimeInMillis());
+ return ZonedDateTime.ofInstant(
+ Instant.ofEpochMilli(officialTransition.getTimeInMillis()), ZoneId.systemDefault());
}
public static ZonedDateTime getSunriseSunsetZonedDateTime(
final String actionTimeType, final ZonedDateTime date, final Location location) {
- return dateTimeToZonedDateTime(
- getSunriseSunsetTime(actionTimeType, zonedDateTimeToDateTime(date), location));
- }
-
- /**
- * Shifts a DateTime from the system's timezone to UTC.
- *
- * @param dateTime The DateTime in local system's timezone.
- * @return shifted DateTime in UTC
- */
- public static final DateTime shiftSystemZoneToUtc(final DateTime dateTime) {
- return dateTime
- .plusSeconds(ZonedDateTime.now().getOffset().getTotalSeconds())
- .withZone(DateTimeZone.UTC);
- }
-
- /**
- * Shifts a time to from the system's timezone to CET. It assumes the time is for the current
- * date.
- *
- * @param time Time in system's timezone, formatted as HH:mm
- * @return Time in CET, formatted as HH:mm
- */
- public static String shiftSystemZoneToCET(final String time) {
- return DateTimeHelper.shiftTimeToOtherZone(time, true);
- }
-
- /**
- * Shifts a time to from CET to the system's timezone. It assumes the time is for the current
- * date.
- *
- * @param time Time in system's timezone, formatted as HH:mm
- * @return Time in CET, formatted as HH:mm
- */
- public static String shiftCETToSystemZone(final String time) {
- return DateTimeHelper.shiftTimeToOtherZone(time, false);
+ return getSunriseSunsetTime(actionTimeType, date, location);
}
/**
@@ -281,40 +245,26 @@ public static String shiftCETToSystemZone(final String time) {
*/
private static String shiftTimeToOtherZone(final String time, final boolean positiveShift) {
// Extract hours and minutes from the time parameter
- final DateTimeFormatter timeFormatter = DateTimeFormat.forPattern(TIME_FORMAT);
- final DateTime parsedTime = timeFormatter.parseDateTime(time);
+ final DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern(TIME_FORMAT);
+ final LocalTime parsedTime = LocalTime.parse(time, timeFormatter);
// Determine current CET offset in hours for the system timezone.
- final int UTCOffsetForCET = DateTimeZone.forID(CET_TIMEZONE).getOffset(new DateTime());
- final int UTCOffsetForSystem = DateTimeZone.getDefault().getOffset(new DateTime());
+ final int UTCOffsetForCET =
+ ZoneId.of(CET_TIMEZONE).getRules().getOffset(Instant.now()).getTotalSeconds();
+ final int UTCOffsetForSystem =
+ ZoneId.systemDefault().getRules().getOffset(Instant.now()).getTotalSeconds();
final int offsetHours =
- (UTCOffsetForCET - UTCOffsetForSystem) / (3600 * 1000) * (positiveShift ? 1 : -1);
+ (UTCOffsetForCET - UTCOffsetForSystem) / (3600) * (positiveShift ? 1 : -1);
// Add offset
- final DateTime shiftedTime =
- new DateTime()
- .withTime(parsedTime.getHourOfDay(), parsedTime.getMinuteOfHour(), 0, 0)
+ final ZonedDateTime shiftedTime =
+ ZonedDateTime.now()
+ .withHour(parsedTime.getHour())
+ .withMinute(parsedTime.getMinute())
+ .withSecond(0)
+ .withNano(0)
.plusHours(offsetHours);
- return timeFormatter.print(shiftedTime);
- }
-
- public static ZonedDateTime dateTimeToZonedDateTime(final DateTime dateTime) {
- if (dateTime == null) {
- return null;
- }
-
- return dateTime.toGregorianCalendar().toZonedDateTime();
- }
-
- private static DateTime zonedDateTimeToDateTime(final ZonedDateTime zonedDateTime) {
- if (zonedDateTime == null) {
- return null;
- }
-
- final long millis = zonedDateTime.toInstant().toEpochMilli();
- final DateTimeZone dateTimeZone =
- DateTimeZone.forTimeZone(TimeZone.getTimeZone(zonedDateTime.getZone()));
- return new DateTime(millis, dateTimeZone);
+ return timeFormatter.format(shiftedTime);
}
}
diff --git a/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/ReadSettingsHelper.java b/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/ReadSettingsHelper.java
index c53a3af0d37..ae02c55a788 100644
--- a/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/ReadSettingsHelper.java
+++ b/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/ReadSettingsHelper.java
@@ -13,7 +13,7 @@
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.StringUtils;
-import org.joda.time.DateTime;
+import org.opensmartgridplatform.shared.utils.JavaTimeHelpers;
public class ReadSettingsHelper {
/**
@@ -58,8 +58,8 @@ public static Boolean getBoolean(
* @param key The key in the settings for the date time.
* @return The date time.
*/
- public static DateTime getDate(final Map settings, final String key) {
- return getDate(settings, key, DateTime.now());
+ public static ZonedDateTime getDate(final Map settings, final String key) {
+ return getDate(settings, key, ZonedDateTime.now());
}
/**
@@ -70,13 +70,12 @@ public static DateTime getDate(final Map settings, final String
* @param defaultDate The default date to return.
* @return The date time.
*/
- public static DateTime getDate(
- final Map settings, final String key, final DateTime defaultDate) {
+ public static ZonedDateTime getDate(
+ final Map settings, final String key, final ZonedDateTime defaultDate) {
if (!settings.containsKey(key) || StringUtils.isBlank(settings.get(key))) {
return defaultDate;
}
-
- return DateTime.parse(settings.get(key));
+ return JavaTimeHelpers.parseToZonedDateTime(settings.get(key));
}
/**
diff --git a/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/TestGetDateTime.java b/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/TestGetDateTime.java
index dc90c37bfc3..b7a8b2f5380 100644
--- a/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/TestGetDateTime.java
+++ b/integration-tests/cucumber-tests-core/src/test/java/org/opensmartgridplatform/cucumber/core/TestGetDateTime.java
@@ -6,20 +6,20 @@
import static org.assertj.core.api.Assertions.assertThat;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
import org.junit.jupiter.api.Test;
public class TestGetDateTime {
- private DateTimeZone cetTime = DateTimeHelper.getCentralEuropeanTimeZone();
+ private final ZoneId cetTime = DateTimeHelper.getCentralEuropeanTimeZone();
@Test
public void testGetDateTime() {
- final DateTime nowPlus4 = new DateTime(this.cetTime).plusMinutes(4);
- final DateTime nowPlus6 = new DateTime(this.cetTime).plusMinutes(6);
+ final ZonedDateTime nowPlus4 = ZonedDateTime.now(this.cetTime).plusMinutes(4);
+ final ZonedDateTime nowPlus6 = ZonedDateTime.now(this.cetTime).plusMinutes(6);
- final DateTime dt = DateTimeHelper.getDateTime("now + 5 minutes");
+ final ZonedDateTime dt = DateTimeHelper.getDateTime("now + 5 minutes");
assertThat(dt).isStrictlyBetween(nowPlus4, nowPlus6);
}
diff --git a/integration-tests/cucumber-tests-execution/pom.xml b/integration-tests/cucumber-tests-execution/pom.xml
index 845ac04ffc5..751c02cfb9f 100644
--- a/integration-tests/cucumber-tests-execution/pom.xml
+++ b/integration-tests/cucumber-tests-execution/pom.xml
@@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0
org.opensmartgridplatform
parent-integration-tests
- 5.45.0-SNAPSHOT
+ 5.49.0-SNAPSHOT
../parent-integration-tests/pom.xml
diff --git a/integration-tests/cucumber-tests-execution/src/main/java/org/opensmartgridplatform/cucumber/execution/AppBase.java b/integration-tests/cucumber-tests-execution/src/main/java/org/opensmartgridplatform/cucumber/execution/AppBase.java
index adb7e467735..07cecf0ede5 100644
--- a/integration-tests/cucumber-tests-execution/src/main/java/org/opensmartgridplatform/cucumber/execution/AppBase.java
+++ b/integration-tests/cucumber-tests-execution/src/main/java/org/opensmartgridplatform/cucumber/execution/AppBase.java
@@ -11,7 +11,6 @@
import java.util.stream.Collectors;
import junit.runner.Version;
import org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter;
-import org.joda.time.DateTimeZone;
import org.junit.runner.Computer;
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
@@ -48,7 +47,6 @@ public abstract class AppBase {
public static int run(final AppBase app, final String[] testClasses, final String... args) {
// Ensure the tests are executed in UTC time
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
- DateTimeZone.setDefault(DateTimeZone.UTC);
final CmdLineParser p = new CmdLineParser(app);
try {
diff --git a/integration-tests/cucumber-tests-platform-common/pom.xml b/integration-tests/cucumber-tests-platform-common/pom.xml
index f018f1221d3..652a31e237e 100644
--- a/integration-tests/cucumber-tests-platform-common/pom.xml
+++ b/integration-tests/cucumber-tests-platform-common/pom.xml
@@ -13,7 +13,7 @@ SPDX-License-Identifier: Apache-2.0
org.opensmartgridplatform
parent-integration-tests
- 5.45.0-SNAPSHOT
+ 5.49.0-SNAPSHOT
../parent-integration-tests/pom.xml
diff --git a/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/database/ws/WsCoreResponseDataSteps.java b/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/database/ws/WsCoreResponseDataSteps.java
index f73027afd42..66782c83e15 100644
--- a/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/database/ws/WsCoreResponseDataSteps.java
+++ b/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/database/ws/WsCoreResponseDataSteps.java
@@ -9,7 +9,7 @@
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import java.lang.reflect.Field;
-import java.util.Date;
+import java.time.Instant;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.Assertions;
@@ -38,8 +38,8 @@ public ResponseData aResponseDataRecord(final Map settings) {
final ResponseData responseData =
this.responseDataRepository.save(new ResponseDataBuilder().fromSettings(settings).build());
- final Date creationTime =
- DateTimeHelper.getDateTime(settings.get(PlatformKeys.KEY_CREATION_TIME)).toDate();
+ final Instant creationTime =
+ DateTimeHelper.getDateTime(settings.get(PlatformKeys.KEY_CREATION_TIME)).toInstant();
LOGGER.info(
"Creating response data record with correlationUid: {} and creationTime: {}",
diff --git a/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/admin/devicemanagement/SetCommunicationNetworkInformationSteps.java b/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/admin/devicemanagement/SetCommunicationNetworkInformationSteps.java
index c8487dea002..50a5dbe012e 100644
--- a/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/admin/devicemanagement/SetCommunicationNetworkInformationSteps.java
+++ b/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/admin/devicemanagement/SetCommunicationNetworkInformationSteps.java
@@ -28,7 +28,8 @@ public class SetCommunicationNetworkInformationSteps {
public void receivingASetCommunicationNetworkInformationRequest(
final Map inputSettings) throws WebServiceSecurityException {
- final SetCommunicationNetworkInformationRequest request = createRequestFromInput(inputSettings);
+ final SetCommunicationNetworkInformationRequest request =
+ this.createRequestFromInput(inputSettings);
final SetCommunicationNetworkInformationResponse response =
this.client.setCommunicationNetworkInformation(request);
@@ -48,7 +49,7 @@ public void theSetCommunicationNetworkInformationResponseShouldBeReturned(
assertThat(response.getResult().name())
.as(PlatformKeys.KEY_RESULT)
.isEqualTo(inputSettings.get(PlatformKeys.KEY_RESULT));
- assertThat(response.getIpAddress()).isEqualTo(inputSettings.get(PlatformKeys.IP_ADDRESS));
+ assertThat(response.getIpAddress()).isEqualTo(inputSettings.get(PlatformKeys.NETWORK_ADDRESS));
assertThat(response.getBtsId())
.isEqualTo(Integer.parseInt(inputSettings.get(PlatformKeys.BTS_ID)));
assertThat(response.getCellId())
@@ -56,12 +57,12 @@ public void theSetCommunicationNetworkInformationResponseShouldBeReturned(
}
private SetCommunicationNetworkInformationRequest createRequestFromInput(
- Map inputSettings) {
+ final Map inputSettings) {
final SetCommunicationNetworkInformationRequest request =
new SetCommunicationNetworkInformationRequest();
request.setDeviceIdentification(inputSettings.get(PlatformKeys.KEY_DEVICE_IDENTIFICATION));
- request.setIpAddress(inputSettings.get(PlatformKeys.IP_ADDRESS));
+ request.setIpAddress(inputSettings.get(PlatformKeys.NETWORK_ADDRESS));
if (inputSettings.get(PlatformKeys.BTS_ID) != null) {
request.setBtsId(Integer.parseInt(inputSettings.get(PlatformKeys.BTS_ID)));
@@ -78,7 +79,8 @@ private SetCommunicationNetworkInformationRequest createRequestFromInput(
public void receivingASetCommunicationNetworkInformationRequestWithAnInvalidIp(
final Map inputSettings) throws WebServiceSecurityException {
- final SetCommunicationNetworkInformationRequest request = createRequestFromInput(inputSettings);
+ final SetCommunicationNetworkInformationRequest request =
+ this.createRequestFromInput(inputSettings);
try {
this.client.setCommunicationNetworkInformation(request);
diff --git a/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/core/devicemanagement/FindScheduledTasksSteps.java b/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/core/devicemanagement/FindScheduledTasksSteps.java
index 17ae0d7bfd9..c75001c1f25 100644
--- a/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/core/devicemanagement/FindScheduledTasksSteps.java
+++ b/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/core/devicemanagement/FindScheduledTasksSteps.java
@@ -15,11 +15,12 @@
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import javax.xml.datatype.XMLGregorianCalendar;
-import org.joda.time.DateTime;
import org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindScheduledTasksRequest;
import org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindScheduledTasksResponse;
import org.opensmartgridplatform.cucumber.core.DateTimeHelper;
@@ -27,6 +28,7 @@
import org.opensmartgridplatform.cucumber.platform.common.support.ws.core.CoreDeviceManagementClient;
import org.opensmartgridplatform.cucumber.platform.glue.steps.database.core.ScheduledTaskSteps;
import org.opensmartgridplatform.shared.exceptionhandling.WebServiceSecurityException;
+import org.opensmartgridplatform.shared.utils.JavaTimeHelpers;
import org.springframework.beans.factory.annotation.Autowired;
public class FindScheduledTasksSteps {
@@ -77,34 +79,36 @@ public void thenTheFindScheduledTasksResponseShouldContain(final DataTable tasks
}
}
- private static final Predicate<
+ private static Predicate<
org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.ScheduledTask>
hasOrganizationIdentification(final String organizationIdentification) {
return task -> task.getOrganisationIdentification().equals(organizationIdentification);
}
- private static final Predicate<
+ private static Predicate<
org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.ScheduledTask>
hasDeviceIdentification(final String deviceIdentification) {
return task -> task.getDeviceIdentification().equals(deviceIdentification);
}
- private static final Predicate<
+ private static Predicate<
org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.ScheduledTask>
hasMessageType(final String messageType) {
return task -> task.getMessageType().equals(messageType);
}
- private static final Predicate<
+ private static Predicate<
org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.ScheduledTask>
hasScheduledTime(final String scheduledTime) {
return task -> isEqual(task.getScheduledTime(), scheduledTime);
}
- private static final boolean isEqual(final XMLGregorianCalendar actual, final String expected) {
- final DateTime expectedDateTime =
- DateTimeHelper.shiftSystemZoneToUtc(DateTimeHelper.getDateTime(expected));
- final DateTime actualDateTime = new DateTime(actual.toGregorianCalendar());
+ private static boolean isEqual(final XMLGregorianCalendar actual, final String expected) {
+ final ZonedDateTime expectedDateTime =
+ DateTimeHelper.getDateTime(expected).withZoneSameInstant(ZoneId.of("UTC"));
+ final ZonedDateTime actualDateTime =
+ JavaTimeHelpers.gregorianCalendarToZonedDateTime(
+ actual.toGregorianCalendar(), ZoneId.of("UTC"));
return actualDateTime.isEqual(expectedDateTime);
}
}
diff --git a/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/core/devicemanagement/RetrieveReceivedEventNotifications.java b/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/core/devicemanagement/RetrieveReceivedEventNotifications.java
index cc255ac7299..c4d964eecd8 100644
--- a/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/core/devicemanagement/RetrieveReceivedEventNotifications.java
+++ b/integration-tests/cucumber-tests-platform-common/src/test/java/org/opensmartgridplatform/cucumber/platform/common/glue/steps/ws/core/devicemanagement/RetrieveReceivedEventNotifications.java
@@ -15,10 +15,10 @@
import io.cucumber.java.en.When;
import java.io.IOException;
import java.security.GeneralSecurityException;
+import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.joda.time.DateTime;
import org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindEventsRequest;
import org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindEventsResponse;
import org.opensmartgridplatform.cucumber.core.ScenarioContext;
@@ -56,7 +56,7 @@ public void allEvents(final Map data) {
final Event event =
new Event(
deviceIdentification,
- getDateTime(PlatformDefaults.TIMESTAMP).toDate(),
+ getDateTime(PlatformDefaults.TIMESTAMP).toInstant(),
eventType,
PlatformDefaults.DEFAULT_EVENT_DESCRIPTION,
PlatformDefaults.DEFAULT_INDEX);
@@ -73,7 +73,7 @@ public void anEvent(final int amount, final Map data) throws Exc
new Event(
deviceIdentification,
getDateTime(getString(data, PlatformKeys.TIMESTAMP, PlatformDefaults.TIMESTAMP))
- .toDate(),
+ .toInstant(),
getEnum(data, PlatformKeys.EVENT_TYPE, EventType.class, EventType.ALARM_NOTIFICATION),
getString(
data, PlatformKeys.KEY_DESCRIPTION, PlatformDefaults.DEFAULT_EVENT_DESCRIPTION),
@@ -212,13 +212,13 @@ public void theStoredEventsFromADeviceAreFilteredAndRetrieved(
throws Throwable {
final List events = new ArrayList<>();
final List eventIterator = this.retrieveStoredEvents(deviceIdentification);
- final DateTime
+ final ZonedDateTime
fromTimestamp = getDateTime(getString(expectedResponse, PlatformKeys.FROM_TIMESTAMP)),
toTimestamp = getDateTime(getString(expectedResponse, PlatformKeys.TO_TIMESTAMP));
for (final Event e : eventIterator) {
- if (fromTimestamp.isBefore(e.getDateTime().getTime())
- && toTimestamp.isAfter(e.getDateTime().getTime())) {
+ if (fromTimestamp.isBefore(ZonedDateTime.from(e.getDateTime()))
+ && toTimestamp.isAfter(ZonedDateTime.from(e.getDateTime()))) {
events.add(e);
}
}
@@ -259,7 +259,7 @@ public void theStoredEventsAreRetrieved(
@Then("^the stored events are filtered and retrieved$")
public void theStoredEventsAreFilteredAndRetrieved(final Map expectedResponse)
throws Throwable {
- List events;
+ final List events;
if (getString(expectedResponse, PlatformKeys.KEY_DEVICE_IDENTIFICATION).isEmpty()) {
events = this.retrieveStoredEvents();
diff --git a/integration-tests/cucumber-tests-platform-common/src/test/resources/features/common/osgp-adapter-ws-admin/DeviceManagement/SetCommunicationNetworkInformation.feature b/integration-tests/cucumber-tests-platform-common/src/test/resources/features/common/osgp-adapter-ws-admin/DeviceManagement/SetCommunicationNetworkInformation.feature
index ae4d3b76989..11a09868077 100644
--- a/integration-tests/cucumber-tests-platform-common/src/test/resources/features/common/osgp-adapter-ws-admin/DeviceManagement/SetCommunicationNetworkInformation.feature
+++ b/integration-tests/cucumber-tests-platform-common/src/test/resources/features/common/osgp-adapter-ws-admin/DeviceManagement/SetCommunicationNetworkInformation.feature
@@ -11,26 +11,16 @@ Feature: Set Communication Network Information
Given a device
| DeviceIdentification | TEST1024000000001 |
| OrganizationIdentification | test-org |
- | IpAddress | 127.0.0.1 |
+ | NetworkAddress | 127.0.0.1 |
| BtsId | 0 |
| CellId | 0 |
When receiving a set communication network information request
| DeviceIdentification | TEST1024000000001 |
- | IpAddress | 10.0.0.1 |
+ | NetworkAddress | 10.0.0.1 |
| BtsId | 20 |
| CellId | 1 |
Then the set communication network information response should be returned
- | Result | OK |
- | IpAddress | 10.0.0.1 |
- | BtsId | 20 |
- | CellId | 1 |
-
- Scenario: Set Communication Network Information with invalid ip
- Given a device
- | DeviceIdentification | TEST1024000000001 |
- | OrganizationIdentification | test-org |
- When receiving a set communication network information request with an invalid ip
- | DeviceIdentification | TEST1024000000001 |
- | IpAddress | scr@mbled |
- Then the set communication network information response contains soap fault
- | Message | INVALID_IP_ADDRESS |
\ No newline at end of file
+ | Result | OK |
+ | NetworkAddress | 10.0.0.1 |
+ | BtsId | 20 |
+ | CellId | 1 |
diff --git a/integration-tests/cucumber-tests-platform-distributionautomation/pom.xml b/integration-tests/cucumber-tests-platform-distributionautomation/pom.xml
index 232354dbadc..98cfb750b68 100644
--- a/integration-tests/cucumber-tests-platform-distributionautomation/pom.xml
+++ b/integration-tests/cucumber-tests-platform-distributionautomation/pom.xml
@@ -13,7 +13,7 @@ SPDX-License-Identifier: Apache-2.0
org.opensmartgridplatform
parent-integration-tests
- 5.45.0-SNAPSHOT
+ 5.49.0-SNAPSHOT
../parent-integration-tests/pom.xml
diff --git a/integration-tests/cucumber-tests-platform-microgrids/pom.xml b/integration-tests/cucumber-tests-platform-microgrids/pom.xml
index 5d7805572d8..be6487222c0 100644
--- a/integration-tests/cucumber-tests-platform-microgrids/pom.xml
+++ b/integration-tests/cucumber-tests-platform-microgrids/pom.xml
@@ -13,7 +13,7 @@ SPDX-License-Identifier: Apache-2.0
org.opensmartgridplatform
parent-integration-tests
- 5.45.0-SNAPSHOT
+ 5.49.0-SNAPSHOT
../parent-integration-tests/pom.xml
diff --git a/integration-tests/cucumber-tests-platform-microgrids/src/test/java/org/opensmartgridplatform/cucumber/platform/microgrids/glue/steps/database/ws/WsMicrogridsResponseDataSteps.java b/integration-tests/cucumber-tests-platform-microgrids/src/test/java/org/opensmartgridplatform/cucumber/platform/microgrids/glue/steps/database/ws/WsMicrogridsResponseDataSteps.java
index 0a51caa58d3..0bdd4984bf9 100644
--- a/integration-tests/cucumber-tests-platform-microgrids/src/test/java/org/opensmartgridplatform/cucumber/platform/microgrids/glue/steps/database/ws/WsMicrogridsResponseDataSteps.java
+++ b/integration-tests/cucumber-tests-platform-microgrids/src/test/java/org/opensmartgridplatform/cucumber/platform/microgrids/glue/steps/database/ws/WsMicrogridsResponseDataSteps.java
@@ -48,7 +48,7 @@ public ResponseData aResponseDataRecord(final Map settings) {
fld.setAccessible(true);
fld.set(
responseData,
- DateTimeHelper.getDateTime(settings.get(PlatformKeys.KEY_CREATION_TIME)).toDate());
+ DateTimeHelper.getDateTime(settings.get(PlatformKeys.KEY_CREATION_TIME)).toInstant());
this.microgridsResponseDataRepository.saveAndFlush(responseData);
}
} catch (final Exception e) {
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/pom.xml b/integration-tests/cucumber-tests-platform-publiclighting/pom.xml
index 75baff75575..e2adf9b524c 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/pom.xml
+++ b/integration-tests/cucumber-tests-platform-publiclighting/pom.xml
@@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0
org.opensmartgridplatform
parent-integration-tests
- 5.45.0-SNAPSHOT
+ 5.49.0-SNAPSHOT
../parent-integration-tests/pom.xml
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/domain/platform/LightMeasurementRtuDeviceCreator.java b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/domain/platform/LightMeasurementRtuDeviceCreator.java
index a7e6c5ce3d1..b919844c54b 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/domain/platform/LightMeasurementRtuDeviceCreator.java
+++ b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/domain/platform/LightMeasurementRtuDeviceCreator.java
@@ -21,7 +21,7 @@ public class LightMeasurementRtuDeviceCreator extends AbstractPlatformDeviceCrea
public RtuDevice apply(final Protocol protocol, final Map settings) {
RtuDevice device = new RtuDevice(this.deviceIdentification(settings));
device.setDeviceType(DeviceType.LIGHT_MEASUREMENT_RTU.getPlatformDeviceType());
- device.setNetworkAddress(this.networkAddress(settings));
+ device.setNetworkAddress(this.networkAddress(settings).getHostAddress());
device.setDeviceLifecycleStatus(this.deviceLifecycleStatus(settings));
device.setActivated(this.activated(settings));
device.updateProtocol(this.protocolInfo(protocol));
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/database/adapterprotocoloslp/OslpDeviceSteps.java b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/database/adapterprotocoloslp/OslpDeviceSteps.java
index 52442cb7f5b..a1aa762c491 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/database/adapterprotocoloslp/OslpDeviceSteps.java
+++ b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/database/adapterprotocoloslp/OslpDeviceSteps.java
@@ -10,8 +10,8 @@
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import java.nio.charset.StandardCharsets;
+import java.time.Instant;
import java.time.ZonedDateTime;
-import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
@@ -83,8 +83,7 @@ public void aPendingSetScheduleRequest(
PlatformKeys.KEY_ORGANIZATION_IDENTIFICATION,
PlatformDefaults.DEFAULT_ORGANIZATION_IDENTIFICATION);
- final Date expireDateTime =
- Date.from(ZonedDateTime.now().plusMinutes(expiresInMinutes).toInstant());
+ final Instant expireDateTime = ZonedDateTime.now().plusMinutes(expiresInMinutes).toInstant();
// just add a dummy DeviceRequest and a dummy
// ScheduleMessageDataContainerDto
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/database/ws/WsPublicLightingResponseDataSteps.java b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/database/ws/WsPublicLightingResponseDataSteps.java
index 6b066a646a9..aa07de6e8e8 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/database/ws/WsPublicLightingResponseDataSteps.java
+++ b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/database/ws/WsPublicLightingResponseDataSteps.java
@@ -53,7 +53,7 @@ private ResponseData createResponseDataRecord(
fld.setAccessible(true);
fld.set(
responseData,
- DateTimeHelper.getDateTime(settings.get(PlatformKeys.KEY_CREATION_TIME)).toDate());
+ DateTimeHelper.getDateTime(settings.get(PlatformKeys.KEY_CREATION_TIME)).toInstant());
responseDataRepository.saveAndFlush(responseData);
}
} catch (final Exception e) {
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/mocks/OslpDeviceSteps.java b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/mocks/OslpDeviceSteps.java
index d5e4f22e130..f391d8010f9 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/mocks/OslpDeviceSteps.java
+++ b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/mocks/OslpDeviceSteps.java
@@ -20,6 +20,8 @@
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.text.ParseException;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -27,7 +29,6 @@
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
-import org.joda.time.DateTimeZone;
import org.junit.Assert;
import org.opensmartgridplatform.adapter.protocol.oslp.elster.domain.entities.OslpDevice;
import org.opensmartgridplatform.adapter.protocol.oslp.elster.domain.repositories.OslpDeviceRepository;
@@ -70,6 +71,7 @@
import org.opensmartgridplatform.oslp.OslpEnvelope;
import org.opensmartgridplatform.oslp.OslpUtils;
import org.opensmartgridplatform.shared.infra.jms.MessageType;
+import org.opensmartgridplatform.shared.utils.JavaTimeHelpers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
@@ -79,6 +81,8 @@
*/
public class OslpDeviceSteps {
+ public static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
+
@Autowired private CoreDeviceConfiguration configuration;
@Autowired private MockOslpServer oslpMockServer;
@@ -639,17 +643,19 @@ private void checkAndValidateRequest(
if (StringUtils.isNotBlank(
expectedRequest.get(PlatformPubliclightingKeys.SCHEDULE_STARTDAY))) {
final String startDay =
- getDate(expectedRequest, PlatformPubliclightingKeys.SCHEDULE_STARTDAY)
- .toDateTime(DateTimeZone.UTC)
- .toString("yyyyMMdd");
+ JavaTimeHelpers.formatDate(
+ getDate(expectedRequest, PlatformPubliclightingKeys.SCHEDULE_STARTDAY)
+ .withZoneSameInstant(ZoneId.of("UTC")),
+ FORMATTER);
assertThat(schedule.getStartDay()).isEqualTo(startDay);
}
if (StringUtils.isNotBlank(expectedRequest.get(PlatformPubliclightingKeys.SCHEDULE_ENDDAY))) {
final String endDay =
- getDate(expectedRequest, PlatformPubliclightingKeys.SCHEDULE_ENDDAY)
- .toDateTime(DateTimeZone.UTC)
- .toString("yyyyMMdd");
+ JavaTimeHelpers.formatDate(
+ getDate(expectedRequest, PlatformPubliclightingKeys.SCHEDULE_ENDDAY)
+ .withZoneSameInstant(ZoneId.of("UTC")),
+ DateTimeFormatter.ofPattern("yyyyMMdd"));
assertThat(schedule.getEndDay()).isEqualTo(endDay);
}
@@ -1211,7 +1217,7 @@ public void theDeviceSendsARegisterDeviceRequestToThePlatform(
InetAddress.getByName(
getString(
settings,
- PlatformPubliclightingKeys.IP_ADDRESS,
+ PlatformPubliclightingKeys.NETWORK_ADDRESS,
PlatformPubliclightingDefaults.LOCALHOST))
.getAddress()))
.setDeviceType(
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/basicosgpfunctions/AuthorizeDeviceFunctionsSteps.java b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/basicosgpfunctions/AuthorizeDeviceFunctionsSteps.java
index f41365cc8ae..cfdf00cb446 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/basicosgpfunctions/AuthorizeDeviceFunctionsSteps.java
+++ b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/basicosgpfunctions/AuthorizeDeviceFunctionsSteps.java
@@ -12,10 +12,10 @@
import io.cucumber.java.en.When;
import java.io.IOException;
import java.security.GeneralSecurityException;
+import java.time.ZonedDateTime;
import java.util.Map;
import javax.naming.OperationNotSupportedException;
import javax.xml.datatype.DatatypeConfigurationException;
-import org.joda.time.DateTime;
import org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.GetStatusRequest;
import org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.LightValue;
import org.opensmartgridplatform.adapter.ws.schema.publiclighting.adhocmanagement.ResumeScheduleRequest;
@@ -162,7 +162,7 @@ private void setLightSchedule(final Map requestParameters)
schedule.setActionTime(ActionTimeType.SUNRISE);
schedule.setIndex(0);
schedule.setWeekDay(WeekDayType.ALL);
- schedule.setTime(DateTime.now().toString());
+ schedule.setTime(ZonedDateTime.now().toString());
schedule.setIsEnabled(true);
schedule.setMinimumLightsOn(10);
final org.opensmartgridplatform.adapter.ws.schema.publiclighting.schedulemanagement.LightValue
@@ -207,7 +207,7 @@ private void setTariffSchedule(final Map requestParameters)
schedule.setWeekDay(
org.opensmartgridplatform.adapter.ws.schema.tariffswitching.schedulemanagement.WeekDayType
.ALL);
- schedule.setTime(DateTime.now().toString());
+ schedule.setTime(ZonedDateTime.now().toString());
schedule.setIsEnabled(true);
schedule.setMinimumLightsOn(10);
request.getSchedules().add(schedule);
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/publiclighting/firmwaremanagement/UpdateFirmwareSteps.java b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/publiclighting/firmwaremanagement/UpdateFirmwareSteps.java
index b88f7fc887c..bf4e67d2b0d 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/publiclighting/firmwaremanagement/UpdateFirmwareSteps.java
+++ b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/publiclighting/firmwaremanagement/UpdateFirmwareSteps.java
@@ -11,6 +11,7 @@
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
+import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Map;
import javax.xml.datatype.DatatypeFactory;
@@ -69,7 +70,9 @@ public void receivingAnUpdateFirmwareRequest(final Map requestPa
if (requestParameters.containsKey(PlatformCommonKeys.SCHEDULED_TIME)) {
final GregorianCalendar c = new GregorianCalendar();
c.setTime(
- getDateTime(getString(requestParameters, PlatformCommonKeys.SCHEDULED_TIME)).toDate());
+ Date.from(
+ getDateTime(getString(requestParameters, PlatformCommonKeys.SCHEDULED_TIME))
+ .toInstant()));
final XMLGregorianCalendar scheduledTime =
DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
request.setScheduledTime(scheduledTime);
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/publiclighting/schedulemanagement/SetLightScheduleSteps.java b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/publiclighting/schedulemanagement/SetLightScheduleSteps.java
index 096867a472c..a5ac2175a54 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/publiclighting/schedulemanagement/SetLightScheduleSteps.java
+++ b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/publiclighting/schedulemanagement/SetLightScheduleSteps.java
@@ -5,20 +5,18 @@
package org.opensmartgridplatform.cucumber.platform.publiclighting.glue.steps.ws.publiclighting.schedulemanagement;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getDate;
-import static org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getEnum;
-import static org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getShort;
-import static org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString;
+import static org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.*;
import static org.opensmartgridplatform.cucumber.platform.core.CorrelationUidHelper.saveCorrelationUidInScenarioContext;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.util.GregorianCalendar;
import java.util.Map;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import org.apache.commons.lang3.StringUtils;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
import org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.AsyncRequest;
import org.opensmartgridplatform.adapter.ws.schema.publiclighting.common.OsgpResultType;
import org.opensmartgridplatform.adapter.ws.schema.publiclighting.schedulemanagement.ActionTimeType;
@@ -38,6 +36,7 @@
import org.opensmartgridplatform.cucumber.platform.publiclighting.PlatformPubliclightingDefaults;
import org.opensmartgridplatform.cucumber.platform.publiclighting.PlatformPubliclightingKeys;
import org.opensmartgridplatform.cucumber.platform.publiclighting.support.ws.publiclighting.PublicLightingScheduleManagementClient;
+import org.opensmartgridplatform.shared.utils.JavaTimeHelpers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -136,13 +135,14 @@ private void callAddSchedule(
DatatypeFactory.newInstance()
.newXMLGregorianCalendar(
((requestParameters
- .get(PlatformPubliclightingKeys.SCHEDULE_SCHEDULEDTIME)
- .isEmpty())
- ? DateTime.now()
- : getDate(
- requestParameters, PlatformPubliclightingKeys.SCHEDULE_SCHEDULEDTIME))
- .toDateTime(DateTimeZone.UTC)
- .toGregorianCalendar()));
+ .get(PlatformPubliclightingKeys.SCHEDULE_SCHEDULEDTIME)
+ .isEmpty())
+ ? GregorianCalendar.from(ZonedDateTime.now(ZoneId.of("UTC")))
+ : GregorianCalendar.from(
+ getDate(
+ requestParameters,
+ PlatformPubliclightingKeys.SCHEDULE_SCHEDULEDTIME)
+ .withZoneSameInstant(ZoneId.of("UTC"))))));
}
for (int i = 0; i < countSchedules; i++) {
@@ -186,13 +186,17 @@ private void addScheduleForRequest(
schedule.setStartDay(
DatatypeFactory.newInstance()
.newXMLGregorianCalendar(
- DateTime.parse(startDay).toDateTime(DateTimeZone.UTC).toGregorianCalendar()));
+ GregorianCalendar.from(
+ JavaTimeHelpers.parseToZonedDateTime(startDay)
+ .withZoneSameInstant(ZoneId.of("UTC")))));
}
if (StringUtils.isNotBlank(endDay)) {
schedule.setEndDay(
DatatypeFactory.newInstance()
.newXMLGregorianCalendar(
- DateTime.parse(endDay).toDateTime(DateTimeZone.UTC).toGregorianCalendar()));
+ GregorianCalendar.from(
+ JavaTimeHelpers.parseToZonedDateTime(endDay)
+ .withZoneSameInstant(ZoneId.of("UTC")))));
}
schedule.setActionTime(actionTime);
schedule.setTime(time);
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/tariffswitching/schedulemanagement/SetTariffScheduleSteps.java b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/tariffswitching/schedulemanagement/SetTariffScheduleSteps.java
index 30dd727cc9e..7c5bdb09a7c 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/tariffswitching/schedulemanagement/SetTariffScheduleSteps.java
+++ b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/glue/steps/ws/tariffswitching/schedulemanagement/SetTariffScheduleSteps.java
@@ -13,11 +13,12 @@
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.util.GregorianCalendar;
import java.util.Map;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
import org.opensmartgridplatform.adapter.ws.schema.tariffswitching.common.AsyncRequest;
import org.opensmartgridplatform.adapter.ws.schema.tariffswitching.common.OsgpResultType;
import org.opensmartgridplatform.adapter.ws.schema.tariffswitching.common.Page;
@@ -35,6 +36,7 @@
import org.opensmartgridplatform.cucumber.platform.publiclighting.PlatformPubliclightingDefaults;
import org.opensmartgridplatform.cucumber.platform.publiclighting.PlatformPubliclightingKeys;
import org.opensmartgridplatform.cucumber.platform.publiclighting.support.ws.tariffswitching.TariffSwitchingScheduleManagementClient;
+import org.opensmartgridplatform.shared.utils.JavaTimeHelpers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -86,14 +88,15 @@ private void callAddSchedule(
request.setScheduledTime(
DatatypeFactory.newInstance()
.newXMLGregorianCalendar(
- ((requestParameters
+ GregorianCalendar.from(
+ (requestParameters
.get(PlatformPubliclightingKeys.SCHEDULE_SCHEDULEDTIME)
.isEmpty())
- ? DateTime.now()
+ ? ZonedDateTime.now(ZoneId.of("UTC"))
: getDate(
- requestParameters, PlatformPubliclightingKeys.SCHEDULE_SCHEDULEDTIME))
- .toDateTime(DateTimeZone.UTC)
- .toGregorianCalendar()));
+ requestParameters,
+ PlatformPubliclightingKeys.SCHEDULE_SCHEDULEDTIME)
+ .withZoneSameInstant(ZoneId.of("UTC")))));
}
for (int i = 0; i < countSchedules; i++) {
@@ -141,13 +144,17 @@ private void addScheduleForRequest(
schedule.setStartDay(
DatatypeFactory.newInstance()
.newXMLGregorianCalendar(
- DateTime.parse(startDay).toDateTime(DateTimeZone.UTC).toGregorianCalendar()));
+ GregorianCalendar.from(
+ JavaTimeHelpers.parseToZonedDateTime(startDay)
+ .withZoneSameInstant(ZoneId.of("UTC")))));
}
if (!endDay.isEmpty()) {
schedule.setEndDay(
DatatypeFactory.newInstance()
.newXMLGregorianCalendar(
- DateTime.parse(endDay).toDateTime(DateTimeZone.UTC).toGregorianCalendar()));
+ GregorianCalendar.from(
+ JavaTimeHelpers.parseToZonedDateTime(endDay)
+ .withZoneSameInstant(ZoneId.of("UTC")))));
}
schedule.setTime(time);
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/mocks/oslpdevice/MockOslpChannelHandler.java b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/mocks/oslpdevice/MockOslpChannelHandler.java
index 71000cfac89..d6a110898f6 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/mocks/oslpdevice/MockOslpChannelHandler.java
+++ b/integration-tests/cucumber-tests-platform-publiclighting/src/test/java/org/opensmartgridplatform/cucumber/platform/publiclighting/mocks/oslpdevice/MockOslpChannelHandler.java
@@ -19,6 +19,7 @@
import java.security.PrivateKey;
import java.text.ParseException;
import java.time.LocalDateTime;
+import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
@@ -31,7 +32,6 @@
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.commons.codec.binary.Base64;
-import org.joda.time.DateTime;
import org.opensmartgridplatform.cucumber.platform.publiclighting.PlatformPubliclightingDefaults;
import org.opensmartgridplatform.oslp.Oslp;
import org.opensmartgridplatform.oslp.Oslp.Message;
@@ -531,9 +531,10 @@ void handle(final OslpEnvelope response) {
public static class OutOfSequenceEvent {
private final Long deviceId;
private final String request;
- private final DateTime timestamp;
+ private final ZonedDateTime timestamp;
- public OutOfSequenceEvent(final Long deviceId, final String request, final DateTime timestamp) {
+ public OutOfSequenceEvent(
+ final Long deviceId, final String request, final ZonedDateTime timestamp) {
this.deviceId = deviceId;
this.request = request;
this.timestamp = timestamp;
@@ -547,7 +548,7 @@ public String getRequest() {
return this.request;
}
- public DateTime getTimestamp() {
+ public ZonedDateTime getTimestamp() {
return this.timestamp;
}
}
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/src/test/resources/features/publiclighting/osgp-adapter-ws-core/Firmwaremanagement/PendingFirmwareUpdate.feature b/integration-tests/cucumber-tests-platform-publiclighting/src/test/resources/features/publiclighting/osgp-adapter-ws-core/Firmwaremanagement/PendingFirmwareUpdate.feature
index 856974e4fd1..c4e482d9da2 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/src/test/resources/features/publiclighting/osgp-adapter-ws-core/Firmwaremanagement/PendingFirmwareUpdate.feature
+++ b/integration-tests/cucumber-tests-platform-publiclighting/src/test/resources/features/publiclighting/osgp-adapter-ws-core/Firmwaremanagement/PendingFirmwareUpdate.feature
@@ -42,7 +42,7 @@ Feature: FirmwareManagement pending firmware update
When the device sends a register device request to the platform over ""
| DeviceIdentification | TEST1024010101010 |
| DeviceUid | eHW0eEFzN0R2Okd5 |
- | IpAddress | 127.0.0.2 |
+ | NetworkAddress | 127.0.0.2 |
| DeviceType | SSLD |
| HasSchedule | false |
Then the register device response contains
@@ -57,7 +57,7 @@ Feature: FirmwareManagement pending firmware update
| DeviceType | SSLD |
| DeviceUid | eHW0eEFzN0R2Okd5 |
| HasSchedule | false |
- | IpAddress | 127.0.0.2 |
+ | NetworkAddress | 127.0.0.2 |
And a get firmware version "" message is sent to device "TEST1024010101010" with deviceUid "eHW0eEFzN0R2Okd5"
And the device firmware file exists
| DeviceIdentification | TEST1024010101010 |
diff --git a/integration-tests/cucumber-tests-platform-publiclighting/src/test/resources/features/publiclighting/protocol-adapter-oslp/RegisterDevice.feature b/integration-tests/cucumber-tests-platform-publiclighting/src/test/resources/features/publiclighting/protocol-adapter-oslp/RegisterDevice.feature
index 663af5d79de..a7977189bcb 100644
--- a/integration-tests/cucumber-tests-platform-publiclighting/src/test/resources/features/publiclighting/protocol-adapter-oslp/RegisterDevice.feature
+++ b/integration-tests/cucumber-tests-platform-publiclighting/src/test/resources/features/publiclighting/protocol-adapter-oslp/RegisterDevice.feature
@@ -17,7 +17,7 @@ Feature: ProtocolAdapterOSLP Device Registration
| DeviceIdentification | TESTDEVICE0000001 |
| Protocol | |
| DeviceUid | eHW0eEFzN0R2Okd5 |
- | IpAddress | 127.0.0.2 |
+ | NetworkAddress | 127.0.0.2 |
| DeviceType | SSLD |
| HasSchedule | false |
Then the register device response contains
@@ -27,7 +27,7 @@ Feature: ProtocolAdapterOSLP Device Registration
| DeviceType | SSLD |
| DeviceUid | eHW0eEFzN0R2Okd5 |
| HasSchedule | false |
- | IpAddress | 127.0.0.2 |
+ | NetworkAddress | 127.0.0.2 |
Examples:
| Protocol |
@@ -49,7 +49,7 @@ Feature: ProtocolAdapterOSLP Device Registration
| DeviceIdentification | TESTDEVICE0000001 |
| Protocol | |
| DeviceUid | eHW0eEFzN0R2Okd5 |
- | IpAddress | 127.0.0.2 |
+ | NetworkAddress | 127.0.0.2 |
| DeviceType | SSLD |
Then the register device response contains
| Status | OK |
@@ -58,7 +58,7 @@ Feature: ProtocolAdapterOSLP Device Registration
| DeviceType | SSLD |
| DeviceUid | eHW0eEFzN0R2Okd5 |
| HasSchedule | false |
- | IpAddress | 127.0.0.2 |
+ | NetworkAddress | 127.0.0.2 |
Examples:
| Protocol |
@@ -80,7 +80,7 @@ Feature: ProtocolAdapterOSLP Device Registration
| DeviceIdentification | TESTDEVICE0000001 |
| DeviceUid | eHW0eEFzN0R2Okd5 |
| Protocol | |
- | IpAddress | 127.0.0.2 |
+ | NetworkAddress | 127.0.0.2 |
| DeviceType | SSLD |
Then the register device response contains
| Status | OK |
@@ -89,31 +89,31 @@ Feature: ProtocolAdapterOSLP Device Registration
| DeviceType | SSLD |
| DeviceUid | eHW0eEFzN0R2Okd5 |
| HasSchedule | false |
- | IpAddress | 127.0.0.2 |
+ | NetworkAddress | 127.0.0.2 |
Examples:
| Protocol |
| OSLP ELSTER |
@OslpMockServer
- Scenario Outline: Register device with IpAddress already in use by another device
+ Scenario Outline: Register device with NetworkAddress already in use by another device
Given an ssld oslp device
| DeviceIdentification | TESTDEVICE0000002 |
| DeviceUid | eHW0eEFzN0R2Okd5 |
| Protocol | |
- | IpAddress | 127.0.0.3 |
+ | NetworkAddress | 127.0.0.3 |
| DeviceType | SSLD |
And an ssld oslp device
| DeviceIdentification | TESTDEVICE0000003 |
| DeviceUid | sdfhDFDFLS34FDLSd |
- | IpAddress | 127.0.0.5 |
+ | NetworkAddress | 127.0.0.5 |
| Protocol | |
| DeviceType | SSLD |
When the device sends a register device request to the platform over ""
| DeviceIdentification | TESTDEVICE0000003 |
| DeviceUid | fIX1fFGaO1S3Ple6 |
| Protocol | |
- | IpAddress | 127.0.0.3 |
+ | NetworkAddress | 127.0.0.3 |
| DeviceType | SSLD |
Then the register device response contains
| Status | OK |
@@ -121,13 +121,13 @@ Feature: ProtocolAdapterOSLP Device Registration
| DeviceIdentification | TESTDEVICE0000003 |
| DeviceUid | fIX1fFGaO1S3Ple6 |
| Protocol | |
- | IpAddress | 127.0.0.3 |
+ | NetworkAddress | 127.0.0.3 |
| DeviceType | SSLD |
And the ssld oslp device contains
| DeviceIdentification | TESTDEVICE0000002 |
| DeviceUid | eHW0eEFzN0R2Okd5 |
| Protocol | |
- | IpAddress | null |
+ | NetworkAddress | null |
| DeviceType | SSLD |
Examples:
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/pom.xml b/integration-tests/cucumber-tests-platform-smartmetering/pom.xml
index b92a53e7157..9f8b6aff4a6 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/pom.xml
+++ b/integration-tests/cucumber-tests-platform-smartmetering/pom.xml
@@ -13,7 +13,7 @@ SPDX-License-Identifier: Apache-2.0
org.opensmartgridplatform
parent-integration-tests
- 5.45.0-SNAPSHOT
+ 5.49.0-SNAPSHOT
../parent-integration-tests/pom.xml
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/PlatformSmartmeteringDefaults.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/PlatformSmartmeteringDefaults.java
index 0febb458352..1118b3599a8 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/PlatformSmartmeteringDefaults.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/PlatformSmartmeteringDefaults.java
@@ -6,6 +6,7 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.time.Instant;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -60,24 +61,26 @@ public class PlatformSmartmeteringDefaults
public static final String PROTOCOL = "DSMR";
public static final String PROTOCOL_VERSION = "4.2.2";
- public static final Map PORT_MAPPING = new HashMap<>();
+ public static final Map PORT_MAPPING = new HashMap<>();
static {
+ // for DSMR 2.2 we will use the DSMR 4.2.2 simulator port, so we can test the config developed
+ // for DSMR 2.2
PORT_MAPPING.put(
- 1024L,
- new ProtocolInfo.Builder().withProtocol("DSMR").withProtocolVersion("4.2.2").build());
+ new ProtocolInfo.Builder().withProtocol("DSMR").withProtocolVersion("2.2").build(), 1024L);
PORT_MAPPING.put(
- 1026L, new ProtocolInfo.Builder().withProtocol("DSMR").withProtocolVersion("2.2").build());
+ new ProtocolInfo.Builder().withProtocol("DSMR").withProtocolVersion("4.2.2").build(),
+ 1024L);
PORT_MAPPING.put(
- 1027L, new ProtocolInfo.Builder().withProtocol("SMR").withProtocolVersion("5.0.0").build());
+ new ProtocolInfo.Builder().withProtocol("SMR").withProtocolVersion("5.0.0").build(), 1027L);
PORT_MAPPING.put(
- 1028L, new ProtocolInfo.Builder().withProtocol("SMR").withProtocolVersion("5.1").build());
+ new ProtocolInfo.Builder().withProtocol("SMR").withProtocolVersion("5.1").build(), 1028L);
PORT_MAPPING.put(
- 1029L, new ProtocolInfo.Builder().withProtocol("SMR").withProtocolVersion("5.2").build());
+ new ProtocolInfo.Builder().withProtocol("SMR").withProtocolVersion("5.2").build(), 1029L);
PORT_MAPPING.put(
- 1030L, new ProtocolInfo.Builder().withProtocol("SMR").withProtocolVersion("5.5").build());
+ new ProtocolInfo.Builder().withProtocol("SMR").withProtocolVersion("5.5").build(), 1030L);
PORT_MAPPING.put(
- 1031L, new ProtocolInfo.Builder().withProtocol("SMR").withProtocolVersion("4.3").build());
+ new ProtocolInfo.Builder().withProtocol("SMR").withProtocolVersion("4.3").build(), 1031L);
}
public static final Long INVOCATION_COUNTER = 12345L;
@@ -89,7 +92,7 @@ public class PlatformSmartmeteringDefaults
public static final boolean SELECTIVE_ACCESS_SUPPORTED = false;
public static final String SMART_METER_E = "SMART_METER_E";
public static final String SMART_METER_G = "SMART_METER_G";
- public static final Date TECHNICAL_INSTALLATION_DATE = new Date();
+ public static final Instant TECHNICAL_INSTALLATION_DATE = Instant.now();
public static final Date VALID_TO = null;
public static final Long VERSION = 0L;
public static final boolean WITH_LIST_SUPPORTED = false;
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/PlatformSmartmeteringKeys.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/PlatformSmartmeteringKeys.java
index 75fede84014..af0a0bce904 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/PlatformSmartmeteringKeys.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/PlatformSmartmeteringKeys.java
@@ -61,6 +61,7 @@ public class PlatformSmartmeteringKeys
public static final String MODULE_ACTIVE_FIRMWARE = "module_active_firmware";
public static final String COMM_MODULE_ACTIVE_FIRMWARE = "communication_module_active_firmware";
public static final String ACTIVE_FIRMWARE = "active_firmware";
+ public static final String FIRMWARE_HASH = "FirmwareHash";
public static final String KEY_DEVICE_MASTERKEY = "Master_key";
public static final String KEY_DEVICE_AUTHENTICATIONKEY = "Authentication_key";
public static final String KEY_DEVICE_ENCRYPTIONKEY = "Encryption_key";
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/BaseDeviceBuilder.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/BaseDeviceBuilder.java
index a850b0e5e5b..14e853025d9 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/BaseDeviceBuilder.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/BaseDeviceBuilder.java
@@ -6,18 +6,18 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.Date;
+import java.time.Instant;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.opensmartgridplatform.cucumber.core.ReadSettingsHelper;
import org.opensmartgridplatform.cucumber.platform.PlatformDefaults;
import org.opensmartgridplatform.cucumber.platform.PlatformKeys;
-import org.opensmartgridplatform.cucumber.platform.inputparsers.DateInputParser;
import org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringDefaults;
import org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringKeys;
import org.opensmartgridplatform.domain.core.entities.DeviceModel;
import org.opensmartgridplatform.domain.core.entities.ProtocolInfo;
import org.opensmartgridplatform.domain.core.valueobjects.DeviceLifecycleStatus;
+import org.opensmartgridplatform.shared.utils.JavaTimeHelpers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,7 +42,7 @@ public abstract class BaseDeviceBuilder> {
String alias = PlatformSmartmeteringDefaults.ALIAS;
boolean inMaintenance = PlatformSmartmeteringDefaults.IN_MAINTENANCE;
String gatewayDeviceIdentification = PlatformSmartmeteringDefaults.GATEWAY_DEVICE_IDENTIFICATION;
- Date technicalInstallationDate = PlatformSmartmeteringDefaults.TECHNICAL_INSTALLATION_DATE;
+ Instant technicalInstallationDate = PlatformSmartmeteringDefaults.TECHNICAL_INSTALLATION_DATE;
DeviceModel deviceModel = PlatformSmartmeteringDefaults.DEVICE_MODEL;
DeviceLifecycleStatus deviceLifeCycleStatus = PlatformDefaults.DEFAULT_DEVICE_LIFECYCLE_STATUS;
@@ -143,7 +143,7 @@ public T setGatewayDevice(final String gatewayDeviceIdentification) {
return (T) this;
}
- public T setTechnicalInstallationDate(final Date technicalInstallationDate) {
+ public T setTechnicalInstallationDate(final Instant technicalInstallationDate) {
this.technicalInstallationDate = technicalInstallationDate;
return (T) this;
}
@@ -208,8 +208,9 @@ public T withSettings(final Map inputSettings) {
}
if (inputSettings.containsKey(PlatformSmartmeteringKeys.TECHNICAL_INSTALLATION_DATE)) {
this.setTechnicalInstallationDate(
- DateInputParser.parse(
- inputSettings.get(PlatformSmartmeteringKeys.TECHNICAL_INSTALLATION_DATE)));
+ JavaTimeHelpers.parseToZonedDateTime(
+ inputSettings.get(PlatformSmartmeteringKeys.TECHNICAL_INSTALLATION_DATE))
+ .toInstant());
}
if (inputSettings.containsKey(PlatformKeys.KEY_DEVICE_LIFECYCLE_STATUS)) {
this.setDeviceLifecycleStatus(
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/DeviceBuilder.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/DeviceBuilder.java
index cf452a79bed..2914bc78194 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/DeviceBuilder.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/DeviceBuilder.java
@@ -53,7 +53,7 @@ public Device build() {
device.setTechnicalInstallationDate(this.technicalInstallationDate);
// updateRegistrationData sets the status to IN_USE, so setting of any
// other status has to be done after that.
- device.updateRegistrationData(this.networkAddress, this.deviceType);
+ device.updateRegistrationData(this.networkAddress.getHostAddress(), this.deviceType);
device.setDeviceLifecycleStatus(this.deviceLifeCycleStatus);
return device;
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/DlmsDeviceBuilder.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/DlmsDeviceBuilder.java
index 3764239bf25..b407cb710f8 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/DlmsDeviceBuilder.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/DlmsDeviceBuilder.java
@@ -42,6 +42,7 @@ public class DlmsDeviceBuilder implements CucumberBuilder {
private String protocolName = PlatformSmartmeteringDefaults.PROTOCOL;
private String protocolVersion = PlatformSmartmeteringDefaults.PROTOCOL_VERSION;
private Long invocationCounter = PlatformSmartmeteringDefaults.INVOCATION_COUNTER;
+ private String firmwareHash = null;
private String timezone;
@@ -166,6 +167,11 @@ public DlmsDeviceBuilder setInvocationCounter(final Long invocationCounter) {
return this;
}
+ public DlmsDeviceBuilder setFirmwareHash(final String firmwareHash) {
+ this.firmwareHash = firmwareHash;
+ return this;
+ }
+
@Override
public DlmsDeviceBuilder withSettings(final Map inputSettings) {
if (inputSettings.containsKey(PlatformSmartmeteringKeys.DEVICE_IDENTIFICATION)) {
@@ -251,6 +257,9 @@ public DlmsDeviceBuilder withSettings(final Map inputSettings) {
if (inputSettings.containsKey(PlatformSmartmeteringKeys.KEY_DEVICE_TIMEZONE)) {
this.setTimezone(getString(inputSettings, PlatformSmartmeteringKeys.KEY_DEVICE_TIMEZONE));
}
+ if (inputSettings.containsKey(PlatformSmartmeteringKeys.FIRMWARE_HASH)) {
+ this.setFirmwareHash(getString(inputSettings, PlatformSmartmeteringKeys.FIRMWARE_HASH));
+ }
/**
* For port/logical_id we want to be able to override the default value to be null to enable
@@ -263,8 +272,9 @@ public DlmsDeviceBuilder withSettings(final Map inputSettings) {
this.setLogicalId(Long.parseLong(inputSettings.get(PlatformSmartmeteringKeys.LOGICAL_ID)));
}
}
- if (inputSettings.containsKey(PlatformSmartmeteringKeys.PORT)) {
- if (inputSettings.get(PlatformSmartmeteringKeys.PORT).isEmpty()) {
+ final String port = inputSettings.get(PlatformSmartmeteringKeys.PORT);
+ if (hasPortDefined(inputSettings, port)) {
+ if (port.isEmpty()) {
this.setPort(null);
} else {
this.setPort(Long.parseLong(inputSettings.get(PlatformSmartmeteringKeys.PORT)));
@@ -276,6 +286,11 @@ public DlmsDeviceBuilder withSettings(final Map inputSettings) {
return this;
}
+ private static boolean hasPortDefined(
+ final Map inputSettings, final String port) {
+ return inputSettings.containsKey(PlatformSmartmeteringKeys.PORT) && port != null;
+ }
+
private void setTimezone(final String timezone) {
this.timezone = timezone;
}
@@ -308,15 +323,16 @@ public DlmsDevice build() {
dlmsDevice.setProtocol(this.protocolName, this.protocolVersion);
dlmsDevice.setInvocationCounter(this.invocationCounter);
dlmsDevice.setTimezone(this.timezone);
+ dlmsDevice.setFirmwareHash(this.firmwareHash);
return dlmsDevice;
}
public Long getPortBasedOnProtocolInfo(final String protocol, final String protocolVersion) {
- return PlatformSmartmeteringDefaults.PORT_MAPPING.entrySet().stream()
- .filter(e -> this.protocolsAreEqual(protocol, protocolVersion, e.getValue()))
+ return PlatformSmartmeteringDefaults.PORT_MAPPING.keySet().stream()
+ .filter(protocol1 -> this.protocolsAreEqual(protocol, protocolVersion, protocol1))
.findFirst()
- .map(e2 -> e2.getKey())
+ .map(protocol2 -> PlatformSmartmeteringDefaults.PORT_MAPPING.get(protocol2))
.orElseThrow(
() ->
new IllegalArgumentException(
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/SecretBuilder.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/SecretBuilder.java
index 495afa4d6fc..95951f46ae5 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/SecretBuilder.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/SecretBuilder.java
@@ -4,7 +4,7 @@
package org.opensmartgridplatform.cucumber.platform.smartmetering.builders.entities;
-import java.util.Date;
+import java.time.Instant;
import org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.SecurityKeyType;
import org.opensmartgridplatform.cucumber.platform.core.builders.Builder;
import org.opensmartgridplatform.cucumber.platform.smartmetering.SecurityKey;
@@ -19,7 +19,7 @@ public class SecretBuilder implements Builder {
private String key = SecurityKey.SECURITY_KEY_A.getDatabaseKey();
private SecretStatus status;
private String deviceIdentification;
- private Date creationTime;
+ private Instant creationTime;
private DbEncryptionKeyReference encryptionKeyReference;
public SecretBuilder withSecretType(final SecretType secretType) {
@@ -57,7 +57,7 @@ public SecretBuilder withSecretStatus(final SecretStatus status) {
return this;
}
- public SecretBuilder withCreationTime(final Date creationTime) {
+ public SecretBuilder withCreationTime(final Instant creationTime) {
this.creationTime = creationTime;
return this;
}
@@ -75,7 +75,7 @@ public DbEncryptedSecret build() {
securityKey.setSecretType(this.secretType);
securityKey.setEncodedSecret(this.key);
securityKey.setSecretStatus(this.status == null ? SecretStatus.ACTIVE : this.status);
- securityKey.setCreationTime(this.creationTime == null ? new Date() : this.creationTime);
+ securityKey.setCreationTime(this.creationTime == null ? Instant.now() : this.creationTime);
securityKey.setEncryptionKeyReference(this.encryptionKeyReference);
return securityKey;
}
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/SmartMeterBuilder.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/SmartMeterBuilder.java
index ee2d33a3eae..822ba06e5bd 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/SmartMeterBuilder.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/builders/entities/SmartMeterBuilder.java
@@ -77,7 +77,11 @@ public SmartMeter build() {
new GpsCoordinates(this.gpsLatitude, this.gpsLongitude));
device.setActivated(this.isActivated);
- device.updateRegistrationData(this.networkAddress, this.deviceType);
+ if (this.networkAddress != null) {
+ device.updateRegistrationData(this.networkAddress.getHostAddress(), this.deviceType);
+ } else {
+ device.updateRegistrationData(null, this.deviceType);
+ }
device.setBtsId(this.baseTransceiverStationId);
device.setCellId(this.cellId);
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/database/DlmsDatabase.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/database/DlmsDatabase.java
index 411000af810..a545f18807f 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/database/DlmsDatabase.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/database/DlmsDatabase.java
@@ -4,7 +4,7 @@
package org.opensmartgridplatform.cucumber.platform.smartmetering.database;
-import java.util.Date;
+import java.time.Instant;
import java.util.TimeZone;
import org.opensmartgridplatform.adapter.protocol.dlms.domain.repositories.DlmsDeviceRepository;
import org.opensmartgridplatform.secretmanagement.application.domain.DbEncryptionKeyReference;
@@ -34,12 +34,12 @@ public void prepareDatabaseForScenario() {
this.secretRepository.deleteAllInBatch();
if (this.encryptionKeyRepository.count() == 0) {
- final DbEncryptionKeyReference jreEncryptionKey = this.getJreEncryptionKey(new Date());
+ final DbEncryptionKeyReference jreEncryptionKey = this.getJreEncryptionKey(Instant.now());
this.encryptionKeyRepository.save(jreEncryptionKey);
}
}
- private DbEncryptionKeyReference getJreEncryptionKey(final Date now) {
+ private DbEncryptionKeyReference getJreEncryptionKey(final Instant now) {
final DbEncryptionKeyReference jreEncryptionKey = new DbEncryptionKeyReference();
jreEncryptionKey.setEncryptionProviderType(EncryptionProviderType.JRE);
jreEncryptionKey.setReference("1");
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/database/device/DlmsDeviceSteps.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/database/device/DlmsDeviceSteps.java
index 7654ebd00a1..c0c9ba2ca4b 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/database/device/DlmsDeviceSteps.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/database/device/DlmsDeviceSteps.java
@@ -19,6 +19,7 @@
import static org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringKeys.KEY_DEVICE_ENCRYPTIONKEY;
import static org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringKeys.KEY_DEVICE_FIRMWARE_UPDATE_KEY;
import static org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringKeys.KEY_DEVICE_MASTERKEY;
+import static org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringKeys.LLS1_ACTIVE;
import static org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringKeys.MBUS_DEFAULT_KEY;
import static org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringKeys.MBUS_FIRMWARE_UPDATE_AUTHENTICATION_KEY;
import static org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringKeys.MBUS_P0_KEY;
@@ -34,10 +35,11 @@
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -241,6 +243,12 @@ public void theDlmsDeviceWithIdentificationExistsWithProperties(
assertThat(device.getTimezone())
.as(PlatformKeys.DLMS_DEVICE_TIMEZONE)
.isEqualTo(dlmsDeviceAttributes.get(DLMS_DEVICE_TIMEZONE));
+
+ if (dlmsDeviceAttributes.containsKey(LLS1_ACTIVE)) {
+ assertThat(device.isLls1Active())
+ .as(LLS1_ACTIVE)
+ .isEqualTo(Boolean.valueOf(dlmsDeviceAttributes.get(LLS1_ACTIVE)));
+ }
}
@Then("^the smart meter is registered in the core database$")
@@ -702,8 +710,7 @@ private void createDlmsDeviceInSecretManagementDatabase(
final String deviceType =
inputSettings.getOrDefault(PlatformSmartmeteringKeys.DEVICE_TYPE, SMART_METER_E);
final List secretBuilders = new ArrayList<>();
- if (inputSettings.containsKey(PlatformSmartmeteringKeys.LLS1_ACTIVE)
- && "true".equals(inputSettings.get(PlatformSmartmeteringKeys.LLS1_ACTIVE))) {
+ if (inputSettings.containsKey(LLS1_ACTIVE) && "true".equals(inputSettings.get(LLS1_ACTIVE))) {
secretBuilders.add(
this.getAppropriateSecretBuilder(PlatformSmartmeteringKeys.PASSWORD, inputSettings));
secretBuilders.add(this.getAppropriateSecretBuilder(KEY_DEVICE_ENCRYPTIONKEY, inputSettings));
@@ -736,7 +743,7 @@ private void createDlmsDeviceInSecretManagementDatabase(
}
final DbEncryptionKeyReference encryptionKeyRef =
this.encryptionKeyRepository
- .findByTypeAndValid(EncryptionProviderType.JRE, new Date())
+ .findByTypeAndValid(EncryptionProviderType.JRE, Instant.now())
.iterator()
.next();
secretBuilders.stream()
@@ -852,7 +859,7 @@ public void simulateFailureOfChangeFromPreviousKeyOfDevice(
final DbEncryptionKeyReference encryptionKeyRef =
this.encryptionKeyRepository
- .findByTypeAndValid(EncryptionProviderType.JRE, new Date())
+ .findByTypeAndValid(EncryptionProviderType.JRE, Instant.now())
.iterator()
.next();
final DbEncryptedSecret secret =
@@ -862,7 +869,7 @@ public void simulateFailureOfChangeFromPreviousKeyOfDevice(
.withKey(key)
.withSecretStatus(SecretStatus.ACTIVE)
.withEncryptionKeyReference(encryptionKeyRef)
- .withCreationTime(new Date())
+ .withCreationTime(Instant.now())
.build();
this.encryptedSecretRepository.save(secret);
}
@@ -896,7 +903,7 @@ private void registerNewKeys(final long minutesAgo, final Map in
}
final DbEncryptionKeyReference encryptionKeyRef =
this.encryptionKeyRepository
- .findByTypeAndValid(EncryptionProviderType.JRE, new Date())
+ .findByTypeAndValid(EncryptionProviderType.JRE, Instant.now())
.iterator()
.next();
for (int i = 0; i < secretTypesToCreate.size(); i++) {
@@ -910,7 +917,7 @@ private void registerNewKeys(final long minutesAgo, final Map in
.withKey(key)
.withSecretStatus(SecretStatus.NEW)
.withEncryptionKeyReference(encryptionKeyRef)
- .withCreationTime(new Date(System.currentTimeMillis() - (minutesAgo * 60000L)))
+ .withCreationTime(Instant.now().minus(minutesAgo * 60000L, ChronoUnit.MILLIS))
.build();
this.encryptedSecretRepository.save(secret);
}
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/database/ws/WsSmartMeteringResponseDataSteps.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/database/ws/WsSmartMeteringResponseDataSteps.java
index 03a8ec82657..42f7cf0fe9e 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/database/ws/WsSmartMeteringResponseDataSteps.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/database/ws/WsSmartMeteringResponseDataSteps.java
@@ -52,7 +52,7 @@ public ResponseData aResponseDataRecord(final Map settings) {
fld.setAccessible(true);
fld.set(
responseData,
- DateTimeHelper.getDateTime(settings.get(PlatformKeys.KEY_CREATION_TIME)).toDate());
+ DateTimeHelper.getDateTime(settings.get(PlatformKeys.KEY_CREATION_TIME)).toInstant());
this.smartMeteringResponseDataRepository.saveAndFlush(responseData);
}
} catch (final Exception e) {
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/simulator/SimulatedConfigurationObjectSteps.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/simulator/SimulatedConfigurationObjectSteps.java
index 4b4f1d6f4a4..bd8e943017e 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/simulator/SimulatedConfigurationObjectSteps.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/simulator/SimulatedConfigurationObjectSteps.java
@@ -6,7 +6,6 @@
import static org.assertj.core.api.Assertions.assertThat;
-import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -14,6 +13,7 @@
import io.cucumber.java.en.Then;
import java.util.List;
import java.util.Map;
+import lombok.extern.slf4j.Slf4j;
import org.openmuc.jdlms.ObisCode;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationFlag;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationFlags;
@@ -24,6 +24,7 @@
import org.opensmartgridplatform.dlms.interfaceclass.attribute.DataAttribute;
import org.springframework.beans.factory.annotation.Autowired;
+@Slf4j
public class SimulatedConfigurationObjectSteps {
private static final int CLASS_ID = InterfaceClass.DATA.id();
@@ -35,8 +36,9 @@ public class SimulatedConfigurationObjectSteps {
@Autowired private JsonObjectCreator jsonObjectCreator;
- @Given("device simulation of {string} with configuration object")
- public void deviceSimulationOfConfigurationObject(
+ @Given(
+ "device simulation of {string} with configuration object values in structure type value attribute")
+ public void deviceSimulationOfConfigurationObjectValuesInStructureTypeValueAttribute(
final String deviceIdentification, final Map settings) {
this.deviceSimulatorSteps.deviceSimulationOfEquipmentIdentifier(deviceIdentification);
@@ -49,16 +51,52 @@ public void deviceSimulationOfConfigurationObject(
CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_VALUE, attributeValue, OBJECT_DESCRIPTION);
}
- @Then("device simulation of {string} should be with configuration object")
- public void deviceSimulationOfShouldBeWithConfigurationObject(
+ @Given(
+ "device simulation of {string} with configuration object values in bitstring type value attribute")
+ public void deviceSimulationOfConfigurationObjectValuesInBitstringTypeValueAttribute(
final String deviceIdentification, final Map settings) {
+ this.deviceSimulatorSteps.deviceSimulationOfEquipmentIdentifier(deviceIdentification);
+
+ final ConfigurationObject configurationObject =
+ ConfigurationObjectFactory.fromParameterMap(settings);
+ final ObjectNode attributeValue =
+ this.createBitstringForConfigurationObject(configurationObject, new JsonNodeFactory(false));
+ this.deviceSimulatorSteps.setDlmsAttributeValue(
+ CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_VALUE, attributeValue, OBJECT_DESCRIPTION);
+ }
+
+ @Then(
+ "device simulation should have values in a bitstring type value attribute of the configuration object")
+ public void
+ deviceSimulationShouldHaveValuesInABitstringTypeValueAttributeOfTheConfigurationObject(
+ final Map settings) {
+
+ final ConfigurationObject expectedConfigurationObject =
+ ConfigurationObjectFactory.fromParameterMap(settings);
+ final ObjectNode expectedValue =
+ this.createBitstringForConfigurationObject(
+ expectedConfigurationObject, new JsonNodeFactory(false));
+
+ this.assertDlmsAttributeValue(expectedValue);
+ }
+
+ @Then(
+ "device simulation should have values in a structure type value attribute of the configuration object")
+ public void
+ deviceSimulationShouldHaveValuesInAStructureTypeValueAttributeOfTheConfigurationObject(
+ final Map settings) {
+
final ConfigurationObject expectedConfigurationObject =
ConfigurationObjectFactory.fromParameterMap(settings);
final ObjectNode expectedValue =
this.createStructureForConfigurationObject(
expectedConfigurationObject, new JsonNodeFactory(false));
+ this.assertDlmsAttributeValue(expectedValue);
+ }
+
+ private void assertDlmsAttributeValue(final ObjectNode expectedValue) {
final ObjectNode actualValue =
this.deviceSimulatorSteps.getDlmsAttributeValue(
CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_VALUE, OBJECT_DESCRIPTION);
@@ -71,22 +109,35 @@ private ObjectNode createStructureForConfigurationObject(
final ObjectNode structureForConfigurationObject = jsonNodeFactory.objectNode();
this.jsonObjectCreator.setTypeNode(structureForConfigurationObject, "structure");
+
final ArrayNode configurationObjectElements = jsonNodeFactory.arrayNode();
+
configurationObjectElements.add(
this.createGprsOperationModeForConfigurationObject(
configurationObject.getGprsOperationMode(), jsonNodeFactory));
- configurationObjectElements.add(
- this.createFlagsForConfigurationObject(
- configurationObject.getConfigurationFlags(), jsonNodeFactory));
+
+ final String flagsString = this.createFlagString(configurationObject.getConfigurationFlags());
+ final ObjectNode flagsForConfigurationObject =
+ this.jsonObjectCreator.createAttributeValue("bit-string", flagsString, jsonNodeFactory);
+ configurationObjectElements.add(flagsForConfigurationObject);
+
structureForConfigurationObject.set("value", configurationObjectElements);
return structureForConfigurationObject;
}
+ private ObjectNode createBitstringForConfigurationObject(
+ final ConfigurationObject configurationObject, final JsonNodeFactory jsonNodeFactory) {
+
+ final String flagsString = this.createFlagString(configurationObject.getConfigurationFlags());
+
+ return this.jsonObjectCreator.createAttributeValue("bit-string", flagsString, jsonNodeFactory);
+ }
+
private ObjectNode createGprsOperationModeForConfigurationObject(
final GprsOperationModeType gprsOperationMode, final JsonNodeFactory jsonNodeFactory) {
- String textValue;
+ final String textValue;
if (gprsOperationMode == GprsOperationModeType.ALWAYS_ON) {
textValue = "1";
} else if (gprsOperationMode == GprsOperationModeType.TRIGGERED) {
@@ -97,9 +148,7 @@ private ObjectNode createGprsOperationModeForConfigurationObject(
return this.jsonObjectCreator.createAttributeValue("enumerate", textValue, jsonNodeFactory);
}
- private JsonNode createFlagsForConfigurationObject(
- final ConfigurationFlags configurationFlags, final JsonNodeFactory jsonNodeFactory) {
-
+ private String createFlagString(final ConfigurationFlags configurationFlags) {
final int bitStringLength = 16;
final char[] flags = new char[bitStringLength];
for (int i = 0; i < bitStringLength; i++) {
@@ -114,7 +163,6 @@ private JsonNode createFlagsForConfigurationObject(
}
}
}
- return this.jsonObjectCreator.createAttributeValue(
- "bit-string", new String(flags), jsonNodeFactory);
+ return new String(flags);
}
}
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/core/audittrail/AuditTrail.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/core/audittrail/AuditTrail.java
index 437ec5d2452..9c5b41784aa 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/core/audittrail/AuditTrail.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/core/audittrail/AuditTrail.java
@@ -29,7 +29,7 @@ public class AuditTrail {
@Autowired private DeviceLogItemPagingRepository deviceLogItemRepository;
- @Then("^the audit trail contains multiple retry log records$")
+ @Then("^the audit trail contains a retry log records$")
public void theAuditTrailContainsMultipleRetryLogRecords(final Map settings)
throws Throwable {
final String deviceIdentification =
@@ -38,7 +38,7 @@ public void theAuditTrailContainsMultipleRetryLogRecords(final Map filter =
dli -> Pattern.matches(PATTERN_RETRY_OPERATION, dli.getDecodedMessage());
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/notification/SmartMeteringNotificationSteps.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/notification/SmartMeteringNotificationSteps.java
index a77af901f4d..b2a7cc2a20c 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/notification/SmartMeteringNotificationSteps.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/notification/SmartMeteringNotificationSteps.java
@@ -4,8 +4,12 @@
package org.opensmartgridplatform.cucumber.platform.smartmetering.glue.steps.ws.smartmetering.notification;
+import static org.assertj.core.api.Assertions.assertThat;
+
import io.cucumber.java.en.Then;
+import java.util.Map;
import java.util.concurrent.TimeUnit;
+import org.apache.commons.beanutils.BeanUtils;
import org.junit.jupiter.api.Assertions;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.notification.Notification;
import org.opensmartgridplatform.cucumber.core.ScenarioContext;
@@ -54,9 +58,27 @@ public void noNotificationIsSent() throws Throwable {
this.waitForNotification(MAX_WAIT_FOR_NOTIFICATION, correlationUid, false);
}
- private void waitForNotification(
- final int maxTimeOut, final String correlationUid, final boolean expectCorrelationUid)
- throws Throwable {
+ @Then("^check notification$")
+ public void checkNotification(final Map notificationData) throws Throwable {
+ final String correlationUid =
+ (String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID);
+ if (correlationUid == null) {
+ Assertions.fail(
+ "No "
+ + PlatformKeys.KEY_CORRELATION_UID
+ + " stored in the scenario context. Unable to make assumptions as to whether a notification has been sent.");
+ }
+ final Notification notification =
+ this.waitForNotification(MAX_WAIT_FOR_NOTIFICATION, correlationUid, true);
+
+ assertThat(notification).isNotNull();
+ for (final String key : notificationData.keySet()) {
+ assertThat(BeanUtils.getProperty(notification, key)).isEqualTo(notificationData.get(key));
+ }
+ }
+
+ private Notification waitForNotification(
+ final int maxTimeOut, final String correlationUid, final boolean expectCorrelationUid) {
LOGGER.info(
"Waiting to make sure {} notification is received for correlation UID {} for at most {} milliseconds.",
@@ -70,7 +92,7 @@ private void waitForNotification(
final boolean gotExpectedNotification = expectCorrelationUid && notification != null;
final boolean didNotGetUnexpectedNotification = !expectCorrelationUid && notification == null;
if (gotExpectedNotification || didNotGetUnexpectedNotification) {
- return;
+ return notification;
}
if (expectCorrelationUid) {
@@ -83,5 +105,7 @@ private void waitForNotification(
} else {
Assertions.fail("Received notification for correlation UID: " + correlationUid);
}
+
+ return notification;
}
}
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundleSteps.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundleSteps.java
index 05df87188a7..a70fde4278a 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundleSteps.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundleSteps.java
@@ -156,7 +156,8 @@ private Map additionalSoapHeaders(final Map sett
(localPartOfName, value) -> {
if (dateTimeInMillisHeaders.contains(localPartOfName)) {
extraHeaders.put(
- localPartOfName, Long.toString(DateTimeHelper.getDateTime(value).getMillis()));
+ localPartOfName,
+ Long.toString(DateTimeHelper.getDateTime(value).toInstant().toEpochMilli()));
} else {
extraHeaders.put(localPartOfName, value);
}
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundledGetConfigurationObjectSteps.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundledGetConfigurationObjectSteps.java
index 4822aaa7769..75622183aab 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundledGetConfigurationObjectSteps.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundledGetConfigurationObjectSteps.java
@@ -10,6 +10,7 @@
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetConfigurationObjectRequest;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetConfigurationObjectResponse;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Response;
@@ -18,6 +19,8 @@
public class BundledGetConfigurationObjectSteps extends BaseBundleSteps {
+ static final String GPRS_OPERATION_MODE = "GprsOperationMode";
+
@Given("^the bundle request contains a get configuration object action$")
public void theBundleRequestContainsAGetConfigurationObject() throws Throwable {
@@ -49,9 +52,14 @@ public void theBundleResponseShouldContainAConfigurationObjectResponse(
final ConfigurationObject configurationObject =
((GetConfigurationObjectResponse) response).getConfigurationObject();
- assertThat(configurationObject.getGprsOperationMode().toString())
- .as("The gprs operation mode is not equal")
- .isEqualTo(values.get("GprsOperationMode"));
+ if (values.containsKey(GPRS_OPERATION_MODE)
+ && StringUtils.isNotBlank(values.get(GPRS_OPERATION_MODE))) {
+ assertThat(configurationObject.getGprsOperationMode())
+ .as("The gprs operation mode is not equal")
+ .hasToString(values.get(GPRS_OPERATION_MODE));
+ } else {
+ assertThat(configurationObject.getGprsOperationMode()).isNull();
+ }
configurationObject
.getConfigurationFlags()
diff --git a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundledGetPowerQualityProfileDataSteps.java b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundledGetPowerQualityProfileDataSteps.java
index 2c0e3a92524..7034f26f5b9 100644
--- a/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundledGetPowerQualityProfileDataSteps.java
+++ b/integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundledGetPowerQualityProfileDataSteps.java
@@ -6,22 +6,52 @@
import static org.assertj.core.api.Assertions.assertThat;
+import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
+import java.io.IOException;
+import java.math.BigDecimal;
import java.math.BigInteger;
+import java.security.GeneralSecurityException;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
+import javax.xml.datatype.XMLGregorianCalendar;
+import lombok.extern.slf4j.Slf4j;
+import org.openmuc.jdlms.ObisCode;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetPowerQualityProfileRequest;
+import org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetPowerQualityProfileResponse;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObject;
+import org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues;
+import org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.OsgpUnitType;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ProfileEntry;
+import org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ProfileEntryValue;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Response;
-import org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetPowerQualityProfileResponse;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.PowerQualityProfileData;
-import org.opensmartgridplatform.cucumber.platform.helpers.SettingsHelper;
+import org.opensmartgridplatform.cucumber.core.ScenarioContext;
import org.opensmartgridplatform.cucumber.platform.smartmetering.builders.GetPowerQualityProfileRequestBuilder;
+import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SignalQualityType;
+import org.opensmartgridplatform.shared.exceptionhandling.WebServiceSecurityException;
+@Slf4j
public class BundledGetPowerQualityProfileDataSteps extends BaseBundleSteps {
+ public static final String CLASS_ID = "classId";
+
+ public static final String LOGICAL_NAME = "logicalName";
+
+ public static final String DESCRIPTION = "description";
+
+ public static final String ATTRIBUTE_INDEX = "attributeIndex";
+
+ public static final String DATA_INDEX = "dataIndex";
+
+ public static final String UNIT = "unit";
+ public static final String VALUE_TYPE = "value_type";
+
+ private static final String LAST_RESPONSE = "last_response";
+
@Given("^the bundle request contains a get power quality profile request with parameters$")
public void theBundleRequestContainsAGetPowerQualityProfileRequestAction(
final Map parameters) throws Throwable {
@@ -32,85 +62,197 @@ public void theBundleRequestContainsAGetPowerQualityProfileRequestAction(
this.addActionToBundleRequest(action);
}
- @Then("^the bundle response should contain a power quality profile response with values$")
+ @Then(
+ "^the same bundle response should contain a power quality profile response with (\\d++) values for profile \"([^\"]*)\"$")
+ public void theSameBundleResponseShouldContainAGetPowerQualityProfileResponse(
+ final int nrOfValues, final String profileLogicalName, final DataTable valuesDataTable)
+ throws Throwable {
+
+ final Response response = (Response) ScenarioContext.current().get(LAST_RESPONSE);
+ this.theBundleResponseShouldContainAGetPowerQualityProfileResponse(
+ nrOfValues, profileLogicalName, response, valuesDataTable);
+ }
+
+ @Then(
+ "^the bundle response should contain a power quality profile response with (\\d++) values for profile \"([^\"]*)\"$")
public void theBundleResponseShouldContainAGetPowerQualityProfileResponse(
- final Map values) throws Throwable {
+ final int nrOfValues, final String profileLogicalName, final DataTable valuesDataTable)
+ throws Throwable {
+
+ final Response response = this.getNextBundleResponse();
+ ScenarioContext.current().put(LAST_RESPONSE, response);
+
+ this.theBundleResponseShouldContainAGetPowerQualityProfileResponse(
+ nrOfValues, profileLogicalName, response, valuesDataTable);
+ }
+
+ @Then("^the bundle response should contain an empty power quality profile response$")
+ public void theBundleResponseShouldContainAnEmptyGetPowerQualityProfileResponse()
+ throws GeneralSecurityException, IOException, WebServiceSecurityException {
final Response response = this.getNextBundleResponse();
+ ScenarioContext.current().put(LAST_RESPONSE, response);
assertThat(response).isInstanceOf(GetPowerQualityProfileResponse.class);
final GetPowerQualityProfileResponse getPowerQualityProfileResponse =
(GetPowerQualityProfileResponse) response;
- final PowerQualityProfileData powerQualityProfileData =
- getPowerQualityProfileResponse.getPowerQualityProfileDatas().get(0);
- this.assertEqualCaptureObjects(
- powerQualityProfileData.getCaptureObjectList().getCaptureObjects(), values);
- this.assertEqualProfileEntries(
- powerQualityProfileData.getProfileEntryList().getProfileEntries(), values);
+ assertThat(getPowerQualityProfileResponse.getPowerQualityProfileDatas()).isEmpty();
}
- private void assertEqualCaptureObjects(
- final List actualCaptureObjects, final Map expectedValues)
- throws AssertionError {
+ public void theBundleResponseShouldContainAGetPowerQualityProfileResponse(
+ final int nrOfValues,
+ final String profileLogicalName,
+ final Response response,
+ final DataTable valuesDataTable) {
+
+ assertThat(response).isInstanceOf(GetPowerQualityProfileResponse.class);
+
+ final GetPowerQualityProfileResponse getPowerQualityProfileResponse =
+ (GetPowerQualityProfileResponse) response;
+ final Optional optionalPowerQualityProfileData =
+ getPowerQualityProfileResponse.getPowerQualityProfileDatas().stream()
+ .filter(data -> this.matches(new ObisCode(profileLogicalName), data.getLogicalName()))
+ .findFirst();
+
+ assertThat(optionalPowerQualityProfileData).isPresent();
+ final PowerQualityProfileData powerQualityProfileData = optionalPowerQualityProfileData.get();
- final int expectedNumberOfCaptureObjects =
- SettingsHelper.getIntegerValue(expectedValues, "NumberOfCaptureObjects");
+ this.logData(powerQualityProfileData);
- assertThat(actualCaptureObjects.size())
- .as("Number of capture objects")
- .isEqualTo(expectedNumberOfCaptureObjects);
+ final List