use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.testutil.GetResultImpl in project open-smart-grid-platform by OSGP.
the class SetPushSetupAlarmCommandExecutorTest method testSetPushObjectListWithInvalidPushObject.
@Test
void testSetPushObjectListWithInvalidPushObject() throws IOException {
// SETUP
when(this.conn.getConnection()).thenReturn(this.dlmsConnection);
when(this.dlmsConnection.get(any(AttributeAddress.class))).thenReturn(new GetResultImpl(DataObject.newNullData(), AccessResultCode.OBJECT_UNDEFINED));
final PushSetupAlarmDto pushSetupAlarmDto = new PushSetupAlarmDto.Builder().withPushObjectList(PUSH_OBJECT_LIST).build();
// CALL
final Throwable thrown = catchThrowable(() -> {
this.executor.execute(this.conn, this.DLMS_DEVICE, pushSetupAlarmDto, this.messageMetadata);
});
// VERIFY
assertThat(thrown).isInstanceOf(ProtocolAdapterException.class);
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.testutil.GetResultImpl in project open-smart-grid-platform by OSGP.
the class JdlmsObjectToStringUtilTest method testDescribeGetResultWithNullResultCodeAndData.
@Test
public void testDescribeGetResultWithNullResultCodeAndData() {
final GetResult getResult = new GetResultImpl(null, null);
final String description = JdlmsObjectToStringUtil.describeGetResult(getResult);
assertThat(description).isEqualTo("Result code is null, Result data is null");
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.testutil.GetResultImpl in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileNoSelectiveAccessHandlerTest method createPartialNotAllowedCaptureObjects.
private List<GetResult> createPartialNotAllowedCaptureObjects() {
final DataObject allowedCaptureObject1 = DataObject.newStructureData(DataObject.newUInteger32Data(8), DataObject.newOctetStringData(new byte[] { 0, 0, 1, 0, 0, (byte) 255 }), DataObject.newInteger32Data(2), DataObject.newUInteger32Data(0));
final DataObject nonAllowedCaptureObject2 = DataObject.newStructureData(DataObject.newUInteger32Data(1), DataObject.newOctetStringData(new byte[] { 80, 0, 32, 32, 0, (byte) 255 }), DataObject.newInteger32Data(2), DataObject.newUInteger32Data(0));
final DataObject allowedCaptureObject3 = DataObject.newStructureData(DataObject.newUInteger32Data(1), DataObject.newOctetStringData(new byte[] { 1, 0, 52, 32, 0, (byte) 255 }), DataObject.newInteger32Data(2), DataObject.newUInteger32Data(0));
final GetResult getResult = new GetResultImpl(DataObject.newArrayData(Arrays.asList(allowedCaptureObject1, nonAllowedCaptureObject2, allowedCaptureObject3)));
return Collections.singletonList(getResult);
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.testutil.GetResultImpl in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileNoSelectiveAccessHandlerTest method createProfileEntries.
private List<GetResult> createProfileEntries() {
final List<DataObject> structures = new ArrayList<>();
final DataObject structureData1 = DataObject.newStructureData(DataObject.newOctetStringData(new byte[] { 7, (byte) 228, 3, 15, 7, 0, 0, 0, 0, (byte) 255, (byte) 196, 0 }), DataObject.newUInteger32Data(3), DataObject.newUInteger32Data(2));
structures.add(structureData1);
structures.add(DataObject.newStructureData(DataObject.newNullData(), DataObject.newUInteger32Data(3), DataObject.newUInteger32Data(2)));
structures.add(DataObject.newStructureData(DataObject.newNullData(), DataObject.newUInteger32Data(3), DataObject.newUInteger32Data(2)));
structures.add(DataObject.newStructureData(DataObject.newNullData(), DataObject.newUInteger32Data(3), DataObject.newUInteger32Data(2)));
final GetResult getResult = new GetResultImpl(DataObject.newArrayData(structures));
return Collections.singletonList(getResult);
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.testutil.GetResultImpl in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileSelectiveAccessHandlerTest method createProfileEntries.
private List<GetResult> createProfileEntries() {
final List<DataObject> structures = new ArrayList<>();
final DataObject structureData1 = DataObject.newStructureData(DataObject.newOctetStringData(new byte[] { 7, (byte) 228, 3, 15, 7, 0, 0, 0, 0, (byte) 255, (byte) 196, 0 }), DataObject.newUInteger32Data(3), DataObject.newUInteger32Data(2));
structures.add(structureData1);
structures.add(DataObject.newStructureData(DataObject.newNullData(), DataObject.newUInteger32Data(3), DataObject.newUInteger32Data(2)));
structures.add(DataObject.newStructureData(DataObject.newNullData(), DataObject.newUInteger32Data(3), DataObject.newUInteger32Data(2)));
structures.add(DataObject.newStructureData(DataObject.newNullData(), DataObject.newUInteger32Data(3), DataObject.newUInteger32Data(2)));
final GetResult getResult = new GetResultImpl(DataObject.newArrayData(structures));
return Collections.singletonList(getResult);
}
Aggregations