Search in sources :

Example 1 with ComponentType

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

Example 2 with ComponentType

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);
}
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 3 with ComponentType

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);
}
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)3 FaultResponseDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.FaultResponseDto)3 ComponentType (org.opensmartgridplatform.shared.exceptionhandling.ComponentType)3 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)3 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)3 FunctionalExceptionType (org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType)2 FaultResponseParameterDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.FaultResponseParameterDto)1