Search in sources :

Example 1 with FunctionalExceptionType

use of org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType 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);
}
Also used : ComponentType(org.opensmartgridplatform.shared.exceptionhandling.ComponentType) FaultResponseParameterDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.FaultResponseParameterDto) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) FaultResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.FaultResponseDto) FunctionalExceptionType(org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) TechnicalException(org.opensmartgridplatform.shared.exceptionhandling.TechnicalException) Test(org.junit.jupiter.api.Test)

Example 2 with FunctionalExceptionType

use of org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType 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);
}
Also used : ComponentType(org.opensmartgridplatform.shared.exceptionhandling.ComponentType) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) FaultResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.FaultResponseDto) FunctionalExceptionType(org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) TechnicalException(org.opensmartgridplatform.shared.exceptionhandling.TechnicalException) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 FaultResponseDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.FaultResponseDto)2 ComponentType (org.opensmartgridplatform.shared.exceptionhandling.ComponentType)2 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)2 FunctionalExceptionType (org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType)2 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)2 FaultResponseParameterDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.FaultResponseParameterDto)1