use of org.opensmartgridplatform.dto.valueobjects.smartmetering.ActionResponseDto in project open-smart-grid-platform by OSGP.
the class ActionMapperResponseService method mapAllActions.
public BundleMessagesResponse mapAllActions(final BundleMessagesRequestDto bundleMessageResponseDto) throws FunctionalException {
final List<ActionResponse> actionResponseList = new ArrayList<>();
for (final ActionResponseDto action : bundleMessageResponseDto.getAllResponses()) {
final ConfigurableMapper mapper = this.getMapper(action);
final Class<? extends ActionResponse> clazz = this.getClazz(action);
// mapper is monitoring mapper
final ActionResponse actionValueResponseObject = this.doMap(action, mapper, clazz);
actionResponseList.add(actionValueResponseObject);
}
return new BundleMessagesResponse(actionResponseList);
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.ActionResponseDto in project open-smart-grid-platform by OSGP.
the class BundleServiceTest method shouldHandleActionsWithResultContainingFaultResponseWithRetryableException.
@Test
public void shouldHandleActionsWithResultContainingFaultResponseWithRetryableException() {
final ActionResponseDto faultResponse = this.createFaultResponse(true);
final BundleMessagesRequestDto bundleMessagesRequest = new BundleMessagesRequestDto(Arrays.asList(this.createAction(this.builder.makePeriodicMeterReadsRequestDataDto(), faultResponse)));
final BundleMessagesRequestDto result = this.bundleService.callExecutors(null, new DlmsDevice(), bundleMessagesRequest, this.messageMetadata);
verify(this.bundleCommandExecutorMap).getCommandExecutor(PeriodicMeterReadsRequestDataDto.class);
assertThat(result.getAllResponses().size()).isOne();
assertThat(result.getAllResponses().get(0)).isNotNull();
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.ActionResponseDto in project open-smart-grid-platform by OSGP.
the class BundleServiceTest method shouldNotHandleActionsContainingResult.
@Test
public void shouldNotHandleActionsContainingResult() {
final ActionResponseDto previousActionResponse = new ActionResponseDto();
final BundleMessagesRequestDto bundleMessagesRequest = new BundleMessagesRequestDto(Arrays.asList(this.createAction(this.builder.makePeriodicMeterReadsRequestDataDto(), previousActionResponse)));
final BundleMessagesRequestDto result = this.bundleService.callExecutors(null, new DlmsDevice(), bundleMessagesRequest, this.messageMetadata);
verify(this.bundleCommandExecutorMap, never()).getCommandExecutor(PeriodicMeterReadsRequestDataDto.class);
assertThat(result.getAllResponses().size()).isOne();
assertThat(result.getAllResponses().get(0)).isEqualTo(previousActionResponse);
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.ActionResponseDto in project open-smart-grid-platform by OSGP.
the class ClearAlarmRegisterCommandExecutorTest method testAsBundleResponse.
@Test
void testAsBundleResponse() throws ProtocolAdapterException {
final ActionResponseDto responseDto = this.executor.asBundleResponse(AccessResultCode.SUCCESS);
assertThat(responseDto.getResult()).isEqualTo(OsgpResultTypeDto.OK);
}
Aggregations