use of org.opensmartgridplatform.shared.exceptionhandling.ComponentType in project open-smart-grid-platform by OSGP.
the class BundleResponseMessageProcessorTest method technicalExceptionDetailsWithoutCauseOrMessageInFaultResponse.
@Test
public void technicalExceptionDetailsWithoutCauseOrMessageInFaultResponse() throws Exception {
final ComponentType component = ComponentType.PROTOCOL_DLMS;
final Exception exception = new TechnicalException(component, null, null);
final FaultResponseDto faultResponse = this.processor.faultResponseForException(exception, this.parameters, this.defaultMessage);
this.assertResponse(faultResponse, null, this.defaultMessage, component.name(), null, null, this.parameters);
}
use of org.opensmartgridplatform.shared.exceptionhandling.ComponentType in project open-smart-grid-platform by OSGP.
the class BundleResponseMessageProcessorTest method technicalExceptionDetailsAreIncludedInFaultResponse.
@Test
public void technicalExceptionDetailsAreIncludedInFaultResponse() throws Exception {
final FunctionalExceptionType functionalException = FunctionalExceptionType.UNSUPPORTED_DEVICE_ACTION;
final ComponentType component = ComponentType.PROTOCOL_DLMS;
final String message = "java.net.ConnectException: Connection refused";
final Throwable cause = new RuntimeException(message);
final Exception exception = new FunctionalException(functionalException, component, cause);
this.parameters.add(new FaultResponseParameterDto("deviceIdentification", "ESIM9999999999999"));
final FaultResponseDto faultResponse = this.processor.faultResponseForException(exception, this.parameters, this.defaultMessage);
this.assertResponse(faultResponse, functionalException.getCode(), functionalException.name(), component.name(), cause.getClass().getName(), message, this.parameters);
}
use of org.opensmartgridplatform.shared.exceptionhandling.ComponentType in project open-smart-grid-platform by OSGP.
the class BundleResponseMessageProcessorTest method functionalExceptionDetailsAreIncludedInFaultResponse.
@Test
public void functionalExceptionDetailsAreIncludedInFaultResponse() throws Exception {
final FunctionalExceptionType functionalException = FunctionalExceptionType.UNSUPPORTED_DEVICE_ACTION;
final ComponentType component = ComponentType.DOMAIN_SMART_METERING;
final String message = "No Action Value Response Object for Action Value Response DTO Object of class: org.opensmartgridplatform.dto.valueobjects.smartmetering.NonExistentResponseDto";
final Throwable cause = new RuntimeException(message);
final Exception exception = new FunctionalException(functionalException, component, cause);
final FaultResponseDto faultResponse = this.processor.faultResponseForException(exception, null, this.defaultMessage);
this.assertResponse(faultResponse, functionalException.getCode(), functionalException.name(), component.name(), cause.getClass().getName(), message, this.parameters);
}
Aggregations