Skip to content

Commit 6dc52c4

Browse files
committed
Merge branch 'development' into feature/SMHE-1748_SF_JasperW_to_shared
2 parents e2c0a72 + e4f2ce1 commit 6dc52c4

File tree

138 files changed

+1101
-558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+1101
-558
lines changed

integration-tests/cucumber-tests-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0
1212
<parent>
1313
<groupId>org.opensmartgridplatform</groupId>
1414
<artifactId>parent-integration-tests</artifactId>
15-
<version>5.48.0-SNAPSHOT</version>
15+
<version>5.49.0-SNAPSHOT</version>
1616
<relativePath>../parent-integration-tests/pom.xml</relativePath>
1717
</parent>
1818

integration-tests/cucumber-tests-execution/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0
1212
<parent>
1313
<groupId>org.opensmartgridplatform</groupId>
1414
<artifactId>parent-integration-tests</artifactId>
15-
<version>5.48.0-SNAPSHOT</version>
15+
<version>5.49.0-SNAPSHOT</version>
1616
<relativePath>../parent-integration-tests/pom.xml</relativePath>
1717
</parent>
1818

integration-tests/cucumber-tests-platform-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SPDX-License-Identifier: Apache-2.0
1313
<parent>
1414
<groupId>org.opensmartgridplatform</groupId>
1515
<artifactId>parent-integration-tests</artifactId>
16-
<version>5.48.0-SNAPSHOT</version>
16+
<version>5.49.0-SNAPSHOT</version>
1717
<relativePath>../parent-integration-tests/pom.xml</relativePath>
1818
</parent>
1919

integration-tests/cucumber-tests-platform-distributionautomation/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SPDX-License-Identifier: Apache-2.0
1313
<parent>
1414
<groupId>org.opensmartgridplatform</groupId>
1515
<artifactId>parent-integration-tests</artifactId>
16-
<version>5.48.0-SNAPSHOT</version>
16+
<version>5.49.0-SNAPSHOT</version>
1717
<relativePath>../parent-integration-tests/pom.xml</relativePath>
1818
</parent>
1919

integration-tests/cucumber-tests-platform-microgrids/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SPDX-License-Identifier: Apache-2.0
1313
<parent>
1414
<groupId>org.opensmartgridplatform</groupId>
1515
<artifactId>parent-integration-tests</artifactId>
16-
<version>5.48.0-SNAPSHOT</version>
16+
<version>5.49.0-SNAPSHOT</version>
1717
<relativePath>../parent-integration-tests/pom.xml</relativePath>
1818
</parent>
1919

integration-tests/cucumber-tests-platform-publiclighting/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache-2.0
1212
<parent>
1313
<groupId>org.opensmartgridplatform</groupId>
1414
<artifactId>parent-integration-tests</artifactId>
15-
<version>5.48.0-SNAPSHOT</version>
15+
<version>5.49.0-SNAPSHOT</version>
1616
<relativePath>../parent-integration-tests/pom.xml</relativePath>
1717
</parent>
1818

integration-tests/cucumber-tests-platform-smartmetering/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SPDX-License-Identifier: Apache-2.0
1313
<parent>
1414
<groupId>org.opensmartgridplatform</groupId>
1515
<artifactId>parent-integration-tests</artifactId>
16-
<version>5.48.0-SNAPSHOT</version>
16+
<version>5.49.0-SNAPSHOT</version>
1717
<relativePath>../parent-integration-tests/pom.xml</relativePath>
1818
</parent>
1919

integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/AcceptanceTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"classpath:features/osgp-adapter-ws-core",
1717
"classpath:features/osgp-adapter-ws-smartmetering"
1818
},
19-
tags = {"not @Skip", "not @NightlyBuildOnly"},
19+
tags = {"@blahgxf"},
2020
glue = {
2121
"classpath:org.opensmartgridplatform.cucumber.platform.glue",
2222
"classpath:org.opensmartgridplatform.cucumber.platform.common.glue",

integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/simulator/SimulatedConfigurationObjectSteps.java

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

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

9-
import com.fasterxml.jackson.databind.JsonNode;
109
import com.fasterxml.jackson.databind.node.ArrayNode;
1110
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
1211
import com.fasterxml.jackson.databind.node.ObjectNode;
1312
import io.cucumber.java.en.Given;
1413
import io.cucumber.java.en.Then;
1514
import java.util.List;
1615
import java.util.Map;
16+
import lombok.extern.slf4j.Slf4j;
1717
import org.openmuc.jdlms.ObisCode;
1818
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationFlag;
1919
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigurationFlags;
@@ -24,6 +24,7 @@
2424
import org.opensmartgridplatform.dlms.interfaceclass.attribute.DataAttribute;
2525
import org.springframework.beans.factory.annotation.Autowired;
2626

27+
@Slf4j
2728
public class SimulatedConfigurationObjectSteps {
2829

2930
private static final int CLASS_ID = InterfaceClass.DATA.id();
@@ -35,8 +36,9 @@ public class SimulatedConfigurationObjectSteps {
3536

3637
@Autowired private JsonObjectCreator jsonObjectCreator;
3738

38-
@Given("device simulation of {string} with configuration object")
39-
public void deviceSimulationOfConfigurationObject(
39+
@Given(
40+
"device simulation of {string} with configuration object values in structure type value attribute")
41+
public void deviceSimulationOfConfigurationObjectValuesInStructureTypeValueAttribute(
4042
final String deviceIdentification, final Map<String, String> settings) {
4143

4244
this.deviceSimulatorSteps.deviceSimulationOfEquipmentIdentifier(deviceIdentification);
@@ -49,16 +51,52 @@ public void deviceSimulationOfConfigurationObject(
4951
CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_VALUE, attributeValue, OBJECT_DESCRIPTION);
5052
}
5153

52-
@Then("device simulation of {string} should be with configuration object")
53-
public void deviceSimulationOfShouldBeWithConfigurationObject(
54+
@Given(
55+
"device simulation of {string} with configuration object values in bitstring type value attribute")
56+
public void deviceSimulationOfConfigurationObjectValuesInBitstringTypeValueAttribute(
5457
final String deviceIdentification, final Map<String, String> settings) {
5558

59+
this.deviceSimulatorSteps.deviceSimulationOfEquipmentIdentifier(deviceIdentification);
60+
61+
final ConfigurationObject configurationObject =
62+
ConfigurationObjectFactory.fromParameterMap(settings);
63+
final ObjectNode attributeValue =
64+
this.createBitstringForConfigurationObject(configurationObject, new JsonNodeFactory(false));
65+
this.deviceSimulatorSteps.setDlmsAttributeValue(
66+
CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_VALUE, attributeValue, OBJECT_DESCRIPTION);
67+
}
68+
69+
@Then(
70+
"device simulation should have values in a bitstring type value attribute of the configuration object")
71+
public void
72+
deviceSimulationShouldHaveValuesInABitstringTypeValueAttributeOfTheConfigurationObject(
73+
final Map<String, String> settings) {
74+
75+
final ConfigurationObject expectedConfigurationObject =
76+
ConfigurationObjectFactory.fromParameterMap(settings);
77+
final ObjectNode expectedValue =
78+
this.createBitstringForConfigurationObject(
79+
expectedConfigurationObject, new JsonNodeFactory(false));
80+
81+
this.assertDlmsAttributeValue(expectedValue);
82+
}
83+
84+
@Then(
85+
"device simulation should have values in a structure type value attribute of the configuration object")
86+
public void
87+
deviceSimulationShouldHaveValuesInAStructureTypeValueAttributeOfTheConfigurationObject(
88+
final Map<String, String> settings) {
89+
5690
final ConfigurationObject expectedConfigurationObject =
5791
ConfigurationObjectFactory.fromParameterMap(settings);
5892
final ObjectNode expectedValue =
5993
this.createStructureForConfigurationObject(
6094
expectedConfigurationObject, new JsonNodeFactory(false));
6195

96+
this.assertDlmsAttributeValue(expectedValue);
97+
}
98+
99+
private void assertDlmsAttributeValue(final ObjectNode expectedValue) {
62100
final ObjectNode actualValue =
63101
this.deviceSimulatorSteps.getDlmsAttributeValue(
64102
CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_VALUE, OBJECT_DESCRIPTION);
@@ -71,22 +109,35 @@ private ObjectNode createStructureForConfigurationObject(
71109

72110
final ObjectNode structureForConfigurationObject = jsonNodeFactory.objectNode();
73111
this.jsonObjectCreator.setTypeNode(structureForConfigurationObject, "structure");
112+
74113
final ArrayNode configurationObjectElements = jsonNodeFactory.arrayNode();
114+
75115
configurationObjectElements.add(
76116
this.createGprsOperationModeForConfigurationObject(
77117
configurationObject.getGprsOperationMode(), jsonNodeFactory));
78-
configurationObjectElements.add(
79-
this.createFlagsForConfigurationObject(
80-
configurationObject.getConfigurationFlags(), jsonNodeFactory));
118+
119+
final String flagsString = this.createFlagString(configurationObject.getConfigurationFlags());
120+
final ObjectNode flagsForConfigurationObject =
121+
this.jsonObjectCreator.createAttributeValue("bit-string", flagsString, jsonNodeFactory);
122+
configurationObjectElements.add(flagsForConfigurationObject);
123+
81124
structureForConfigurationObject.set("value", configurationObjectElements);
82125

83126
return structureForConfigurationObject;
84127
}
85128

129+
private ObjectNode createBitstringForConfigurationObject(
130+
final ConfigurationObject configurationObject, final JsonNodeFactory jsonNodeFactory) {
131+
132+
final String flagsString = this.createFlagString(configurationObject.getConfigurationFlags());
133+
134+
return this.jsonObjectCreator.createAttributeValue("bit-string", flagsString, jsonNodeFactory);
135+
}
136+
86137
private ObjectNode createGprsOperationModeForConfigurationObject(
87138
final GprsOperationModeType gprsOperationMode, final JsonNodeFactory jsonNodeFactory) {
88139

89-
String textValue;
140+
final String textValue;
90141
if (gprsOperationMode == GprsOperationModeType.ALWAYS_ON) {
91142
textValue = "1";
92143
} else if (gprsOperationMode == GprsOperationModeType.TRIGGERED) {
@@ -97,9 +148,7 @@ private ObjectNode createGprsOperationModeForConfigurationObject(
97148
return this.jsonObjectCreator.createAttributeValue("enumerate", textValue, jsonNodeFactory);
98149
}
99150

100-
private JsonNode createFlagsForConfigurationObject(
101-
final ConfigurationFlags configurationFlags, final JsonNodeFactory jsonNodeFactory) {
102-
151+
private String createFlagString(final ConfigurationFlags configurationFlags) {
103152
final int bitStringLength = 16;
104153
final char[] flags = new char[bitStringLength];
105154
for (int i = 0; i < bitStringLength; i++) {
@@ -114,7 +163,6 @@ private JsonNode createFlagsForConfigurationObject(
114163
}
115164
}
116165
}
117-
return this.jsonObjectCreator.createAttributeValue(
118-
"bit-string", new String(flags), jsonNodeFactory);
166+
return new String(flags);
119167
}
120168
}

integration-tests/cucumber-tests-platform-smartmetering/src/test/java/org/opensmartgridplatform/cucumber/platform/smartmetering/glue/steps/ws/smartmetering/smartmeteringbundle/BundledGetConfigurationObjectSteps.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import io.cucumber.java.en.Given;
1111
import io.cucumber.java.en.Then;
1212
import java.util.Map;
13+
import org.apache.commons.lang3.StringUtils;
1314
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetConfigurationObjectRequest;
1415
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetConfigurationObjectResponse;
1516
import org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Response;
@@ -18,6 +19,8 @@
1819

1920
public class BundledGetConfigurationObjectSteps extends BaseBundleSteps {
2021

22+
static final String GPRS_OPERATION_MODE = "GprsOperationMode";
23+
2124
@Given("^the bundle request contains a get configuration object action$")
2225
public void theBundleRequestContainsAGetConfigurationObject() throws Throwable {
2326

@@ -49,9 +52,14 @@ public void theBundleResponseShouldContainAConfigurationObjectResponse(
4952
final ConfigurationObject configurationObject =
5053
((GetConfigurationObjectResponse) response).getConfigurationObject();
5154

52-
assertThat(configurationObject.getGprsOperationMode().toString())
53-
.as("The gprs operation mode is not equal")
54-
.isEqualTo(values.get("GprsOperationMode"));
55+
if (values.containsKey(GPRS_OPERATION_MODE)
56+
&& StringUtils.isNotBlank(values.get(GPRS_OPERATION_MODE))) {
57+
assertThat(configurationObject.getGprsOperationMode())
58+
.as("The gprs operation mode is not equal")
59+
.hasToString(values.get(GPRS_OPERATION_MODE));
60+
} else {
61+
assertThat(configurationObject.getGprsOperationMode()).isNull();
62+
}
5563

5664
configurationObject
5765
.getConfigurationFlags()

0 commit comments

Comments
 (0)