use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.testutil.GetResultImpl in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileSelectiveAccessHandlerTest method createCaptureObjectsProfile2.
private List<GetResult> createCaptureObjectsProfile2() {
final DataObject structureData1 = DataObject.newStructureData(DataObject.newUInteger32Data(8), DataObject.newOctetStringData(new byte[] { 0, 0, 1, 0, 0, (byte) 255 }), DataObject.newInteger32Data(2), DataObject.newUInteger32Data(0));
final DataObject structureData2 = DataObject.newStructureData(DataObject.newUInteger32Data(1), DataObject.newOctetStringData(new byte[] { 1, 0, 31, 24, 0, (byte) 255 }), DataObject.newInteger32Data(2), DataObject.newUInteger32Data(0));
final DataObject structureData3 = DataObject.newStructureData(DataObject.newUInteger32Data(1), DataObject.newOctetStringData(new byte[] { 1, 0, 51, 24, 0, (byte) 255 }), DataObject.newInteger32Data(2), DataObject.newUInteger32Data(0));
final GetResult getResult = new GetResultImpl(DataObject.newArrayData(Arrays.asList(structureData1, structureData2, structureData3)));
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 createCaptureObjects.
private List<GetResult> createCaptureObjects() {
final DataObject structureData1 = DataObject.newStructureData(DataObject.newUInteger32Data(8), DataObject.newOctetStringData(new byte[] { 0, 0, 1, 0, 0, (byte) 255 }), DataObject.newInteger32Data(2), DataObject.newUInteger32Data(0));
final DataObject structureData2 = DataObject.newStructureData(DataObject.newUInteger32Data(1), DataObject.newOctetStringData(new byte[] { 1, 0, 21, 4, 0, (byte) 255 }), DataObject.newInteger32Data(2), DataObject.newUInteger32Data(0));
final DataObject structureData3 = DataObject.newStructureData(DataObject.newUInteger32Data(1), DataObject.newOctetStringData(new byte[] { 1, 0, 23, 4, 0, (byte) 255 }), DataObject.newInteger32Data(2), DataObject.newUInteger32Data(0));
final GetResult getResult = new GetResultImpl(DataObject.newArrayData(Arrays.asList(structureData1, structureData2, structureData3)));
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 DeviceChannelsHelperTest method testGetChannelElementValuesIdenfiticationNumberNull.
@Test
public void testGetChannelElementValuesIdenfiticationNumberNull() throws Exception {
final GetResult identificationNumberNull = new GetResultImpl(null);
final List<GetResult> resultList = new ArrayList<>(Arrays.asList(this.primaryAddress, identificationNumberNull, this.manufacturerIdentification, this.version, this.deviceType));
when(this.device.isWithListSupported()).thenReturn(true);
when(this.conn.getDlmsMessageListener()).thenReturn(this.dlmsMessageListener);
when(this.conn.getConnection()).thenReturn(this.dlmsConnection);
when(this.dlmsConnection.get(anyList())).thenReturn(resultList);
final ChannelElementValuesDto values = this.deviceChannelsHelper.getChannelElementValues(this.conn, this.device, (short) 1);
assertThat(values.getIdentificationNumber()).isNull();
}
use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.testutil.GetResultImpl in project open-smart-grid-platform by OSGP.
the class GetActualPowerQualityCommandExecutorTest method generateMockedResult.
private List<GetResult> generateMockedResult(final List<GetActualPowerQualityCommandExecutor.PowerQualityObjectMetadata> metadatas, final AccessResultCode resultCode, final DataObject dateTimeDataObject) {
final List<GetResult> results = new ArrayList<>();
int idx = 1;
for (final PowerQualityObjectMetadata metadata : metadatas) {
if (metadata.getClassId() == CLASS_ID_CLOCK) {
results.add(new GetResultImpl(dateTimeDataObject, resultCode));
} else {
results.add(new GetResultImpl(DataObject.newInteger64Data(idx++), resultCode));
if (metadata.getClassId() == CLASS_ID_REGISTER) {
final List<DataObject> scalerUnit = new ArrayList<>();
scalerUnit.add(DataObject.newInteger64Data(1));
scalerUnit.add(DataObject.newInteger64Data(DlmsUnitTypeDto.VOLT.getIndex()));
results.add(new GetResultImpl(DataObject.newArrayData(scalerUnit), resultCode));
}
}
}
return results;
}
Aggregations