Skip to content

Commit

Permalink
Merge branch 'development' into feature/FDP-2849-notifications-server
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderv committed Mar 6, 2025
2 parents 09cd171 + 538fc63 commit 874a4ba
Show file tree
Hide file tree
Showing 115 changed files with 1,259 additions and 153 deletions.
2 changes: 1 addition & 1 deletion integration-tests/cucumber-tests-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-integration-tests</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-integration-tests/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/cucumber-tests-execution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-integration-tests</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-integration-tests/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/cucumber-tests-platform-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-integration-tests</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-integration-tests/pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-integration-tests</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-integration-tests/pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-integration-tests</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-integration-tests/pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,7 @@ public class PlatformSmartmeteringKeys
public static final String PUSH_OBJECT_OBIS_CODES = "PushObjectObisCodes";
public static final String PUSH_OBJECT_ATTRIBUTE_IDS = "PushObjectAttributeIds";
public static final String PUSH_OBJECT_DATA_INDEXES = "PushObjectDataIndexes";

public static final String OBJECT_TYPE = "ObjectType";
public static final String INT_VALUE = "IntValue";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// SPDX-FileCopyrightText: Copyright Contributors to the GXF project
//
// SPDX-License-Identifier: Apache-2.0

package org.opensmartgridplatform.cucumber.platform.smartmetering.glue.steps.ws.smartmetering.smartmeteringadhoc;

import static org.assertj.core.api.Assertions.assertThat;

import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import java.util.Map;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.SetSpecificAttributeValueAsyncRequest;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.SetSpecificAttributeValueAsyncResponse;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.SetSpecificAttributeValueRequest;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.SetSpecificAttributeValueResponse;
import org.opensmartgridplatform.cucumber.core.ScenarioContext;
import org.opensmartgridplatform.cucumber.platform.PlatformKeys;
import org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringKeys;
import org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.adhoc.SetSpecificAttributeValueRequestFactory;
import org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.adhoc.SmartMeteringAdHocRequestClient;
import org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.adhoc.SmartMeteringAdHocResponseClient;
import org.springframework.beans.factory.annotation.Autowired;

public class SetSpecificAttributeValue {

@Autowired
private SmartMeteringAdHocRequestClient<
SetSpecificAttributeValueAsyncResponse, SetSpecificAttributeValueRequest>
requestClient;

@Autowired
private SmartMeteringAdHocResponseClient<
SetSpecificAttributeValueResponse, SetSpecificAttributeValueAsyncRequest>
responseClient;

@When("^the Set Specific Attribute Value request is received$")
public void whenTheSetSpecificAttributeValueRequestIsReceived(final Map<String, String> settings)
throws Throwable {

final SetSpecificAttributeValueRequest request =
SetSpecificAttributeValueRequestFactory.fromParameterMap(settings);
final SetSpecificAttributeValueAsyncResponse asyncResponse =
this.requestClient.doRequest(request);

assertThat(asyncResponse).as("AsyncResponse should not be null").isNotNull();
ScenarioContext.current()
.put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid());
}

@Then("^the Set Specific Attribute Value response should be returned$")
public void thenTheValueShouldBeSetOnTheDevice(final Map<String, String> settings)
throws Throwable {

final SetSpecificAttributeValueAsyncRequest asyncRequest =
SetSpecificAttributeValueRequestFactory.fromScenarioContext();
final SetSpecificAttributeValueResponse response =
this.responseClient.getResponse(asyncRequest);

assertThat(response.getResult().name())
.as("Result is not as expected.")
.isEqualTo(settings.get(PlatformSmartmeteringKeys.RESULT));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-FileCopyrightText: Copyright Contributors to the GXF project
//
// SPDX-License-Identifier: Apache-2.0

package org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.adhoc;

import java.math.BigInteger;
import java.util.Map;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.AllowedObjectType;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.SetSpecificAttributeValueAsyncRequest;
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.SetSpecificAttributeValueRequest;
import org.opensmartgridplatform.cucumber.platform.smartmetering.PlatformSmartmeteringKeys;
import org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.RequestFactoryHelper;

public class SetSpecificAttributeValueRequestFactory {

private SetSpecificAttributeValueRequestFactory() {
// Private constructor for utility class
}

public static SetSpecificAttributeValueRequest fromParameterMap(
final Map<String, String> parameters) {
final SetSpecificAttributeValueRequest request = new SetSpecificAttributeValueRequest();
request.setDeviceIdentification(
parameters.get(PlatformSmartmeteringKeys.DEVICE_IDENTIFICATION));
request.setObjectType(
AllowedObjectType.valueOf(parameters.get(PlatformSmartmeteringKeys.OBJECT_TYPE)));
request.setAttribute(new BigInteger(parameters.get(PlatformSmartmeteringKeys.ATTRIBUTE)));
request.setIntValue(new BigInteger(parameters.get(PlatformSmartmeteringKeys.INT_VALUE)));
return request;
}

public static SetSpecificAttributeValueAsyncRequest fromScenarioContext() {
final SetSpecificAttributeValueAsyncRequest asyncRequest =
new SetSpecificAttributeValueAsyncRequest();
asyncRequest.setCorrelationUid(RequestFactoryHelper.getCorrelationUidFromScenarioContext());
asyncRequest.setDeviceIdentification(
RequestFactoryHelper.getDeviceIdentificationFromScenarioContext());
return asyncRequest;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SPDX-FileCopyrightText: Contributors to the GXF project
#
# SPDX-License-Identifier: Apache-2.0

@SmartMetering @Platform @SmartMeteringAdHoc
Feature: SmartMetering AdHoc
As a grid operator
I want to be able to set a specific attribute value in a device
So I can change the configuration of a device

Scenario Outline: Set watchdog timer for a <protocol> <version> device
Given a dlms device
| DeviceIdentification | <deviceIdentification> |
| DeviceType | SMART_METER_E |
| Protocol | <protocol> |
| ProtocolVersion | <version> |
When the Set Specific Attribute Value request is received
| DeviceIdentification | <deviceIdentification> |
| ObjectType | WATCHDOG_TIMER |
| Attribute | 2 |
| IntValue | 42 |
Then the Set Specific Attribute Value response should be returned
| DeviceIdentification | <deviceIdentification> |
| Result | <response> |

Examples:
| deviceIdentification | protocol | version | response |
| TEST1024000000001 | DSMR | 4.2.2 | OK |
@NightlyBuildOnly
Examples:
| deviceIdentification | protocol | version | response |
| TEST1024000000001 | DSMR | 2.2 | NOT_OK |
| TEST1031000000001 | SMR | 4.3 | OK |
| TEST1027000000001 | SMR | 5.0.0 | OK |
| TEST1028000000001 | SMR | 5.1 | OK |
| TEST1029000000001 | SMR | 5.2 | OK |
| TEST1030000000001 | SMR | 5.5 | OK |
2 changes: 1 addition & 1 deletion integration-tests/cucumber-tests-platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-integration-tests</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-integration-tests/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/cucumber-tests-protocol-iec60870/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-integration-tests</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-integration-tests/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/parent-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>super-osgp</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../../super/pom.xml</relativePath>
</parent>
<distributionManagement>
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SPDX-License-Identifier: Apache-2.0
<modelVersion>4.0.0</modelVersion>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>integration-tests</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion osgp/platform/osgp-adapter-domain-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-platform</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-platform/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion osgp/platform/osgp-adapter-domain-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-platform</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-platform/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion osgp/platform/osgp-adapter-domain-publiclighting/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-platform</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-platform/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion osgp/platform/osgp-adapter-domain-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-platform</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-platform/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion osgp/platform/osgp-adapter-domain-smartmetering/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SPDX-License-Identifier: Apache-2.0
<parent>
<groupId>org.opensmartgridplatform</groupId>
<artifactId>parent-platform</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>6.15.0-SNAPSHOT</version>
<relativePath>../parent-platform/pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetPushSetupSmsRequestData;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetPushSetupUdpRequestData;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetRandomisationSettingsRequestData;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetSpecificAttributeValueRequestData;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetThdConfigurationRequestData;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequestData;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecificAttributeValueRequestData;
Expand Down Expand Up @@ -118,6 +119,7 @@
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SetPushSetupSmsRequestDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SetPushSetupUdpRequestDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SetRandomisationSettingsRequestDataDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SetSpecificAttributeValueRequestDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SetThdConfigurationRequestDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDaysRequestDataDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecificAttributeValueRequestDto;
Expand Down Expand Up @@ -172,6 +174,8 @@ public class ActionMapperService {
CLASS_MAP.put(UpdateFirmwareRequestData.class, UpdateFirmwareRequestDto.class);
CLASS_MAP.put(SetKeysRequestData.class, SetKeysRequestDto.class);
CLASS_MAP.put(SpecificAttributeValueRequestData.class, SpecificAttributeValueRequestDto.class);
CLASS_MAP.put(
SetSpecificAttributeValueRequestData.class, SetSpecificAttributeValueRequestDto.class);
CLASS_MAP.put(
GetAssociationLnObjectsRequestData.class, GetAssociationLnObjectsRequestDto.class);
CLASS_MAP.put(CoupleMbusDeviceRequestData.class, GetAssociationLnObjectsRequestDto.class);
Expand Down Expand Up @@ -270,6 +274,7 @@ private void postConstruct() {
CLASS_TO_MAPPER_MAP.put(UpdateFirmwareRequestData.class, this.commonMapper);
CLASS_TO_MAPPER_MAP.put(SetKeysRequestData.class, this.configurationMapper);
CLASS_TO_MAPPER_MAP.put(SpecificAttributeValueRequestData.class, this.commonMapper);
CLASS_TO_MAPPER_MAP.put(SetSpecificAttributeValueRequestData.class, this.commonMapper);
CLASS_TO_MAPPER_MAP.put(GetAssociationLnObjectsRequestData.class, this.commonMapper);
CLASS_TO_MAPPER_MAP.put(SetClockConfigurationRequestData.class, this.configurationMapper);
CLASS_TO_MAPPER_MAP.put(GetThdFingerprintRequestData.class, this.monitoringMapper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.opensmartgridplatform.domain.core.entities.SmartMeter;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AssociationLnListType;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ScanMbusChannelsResponseData;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetSpecificAttributeValueRequest;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecificAttributeValueRequest;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SynchronizeTimeRequestData;
import org.opensmartgridplatform.domain.core.valueobjects.smartmetering.TestAlarmSchedulerRequestData;
Expand All @@ -22,6 +23,7 @@
import org.opensmartgridplatform.dto.valueobjects.smartmetering.ObisCodeValuesDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.ScanMbusChannelsRequestDataDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.ScanMbusChannelsResponseDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SetSpecificAttributeValueRequestDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecificAttributeValueRequestDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.SynchronizeTimeRequestDto;
import org.opensmartgridplatform.dto.valueobjects.smartmetering.TestAlarmSchedulerRequestDto;
Expand Down Expand Up @@ -248,6 +250,47 @@ public void handleGetSpecificAttributeValueResponse(
this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}

public void setSpecificAttributeValue(
final MessageMetadata messageMetadata, final SetSpecificAttributeValueRequest request)
throws FunctionalException {

log.debug(
"setSpecificAttributeValue for organisationIdentification: {} for deviceIdentification: {}",
messageMetadata.getOrganisationIdentification(),
messageMetadata.getDeviceIdentification());

final SmartMeter smartMeter =
this.domainHelperService.findSmartMeter(messageMetadata.getDeviceIdentification());

final SetSpecificAttributeValueRequestDto requestDto =
new SetSpecificAttributeValueRequestDto(
request.getObjectType(), request.getAttribute(), request.getIntValue());

this.osgpCoreRequestMessageSender.send(
requestDto,
messageMetadata
.builder()
.withNetworkAddress(smartMeter.getNetworkAddress())
.withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId())
.build());
}

public void handleSetSpecificAttributeValueResponse(
final MessageMetadata messageMetadata,
final ResponseMessageResultType deviceResult,
final OsgpException exception,
final String resultData) {

log.debug(
"handleSetSpecificAttributeValueResponse for MessageType: {}",
messageMetadata.getMessageType());

final ResponseMessage responseMessage =
this.createResponseMessageWithDataObject(
deviceResult, exception, messageMetadata, resultData);
this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}

public void scanMbusChannels(final MessageMetadata messageMetadata) throws FunctionalException {

log.debug(
Expand Down
Loading

0 comments on commit 874a4ba

Please sign in to comment.