Search in sources :

Example 1 with GetPowerQualityProfileRequest

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequest in project open-smart-grid-platform by OSGP.

the class GetPowerQualityProfileRequestMapperTest method testGetPowerQualityProfileRequest.

@Test
public void testGetPowerQualityProfileRequest() {
    final GetPowerQualityProfileRequest getPowerQualityProfileRequest = this.makeRequest();
    final GetPowerQualityProfileRequestData result = this.mapper.map(getPowerQualityProfileRequest, GetPowerQualityProfileRequestData.class);
    assertThat(result).withFailMessage("mapping GetPowerQualityProfileRequest should not return null").isNotNull();
    assertThat(result).withFailMessage("mapping GetPowerQualityProfileRequest should return correct type").isOfAnyClassIn(GetPowerQualityProfileRequestData.class);
    assertThat(result.getBeginDate()).withFailMessage(MAPPED_VALUE_MESSAGE).isEqualTo(DATE);
    assertThat(result.getEndDate()).withFailMessage(MAPPED_VALUE_MESSAGE).isEqualTo(DATE);
}
Also used : GetPowerQualityProfileRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequestData) GetPowerQualityProfileRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequest) Test(org.junit.jupiter.api.Test)

Example 2 with GetPowerQualityProfileRequest

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequest in project open-smart-grid-platform by OSGP.

the class GetPowerQualityProfileRequestMessageProcessor method handleMessage.

@Override
protected void handleMessage(final MessageMetadata deviceMessageMetadata, final Object dataObject) throws FunctionalException {
    final GetPowerQualityProfileRequest getPowerQualityProfileRequest = (GetPowerQualityProfileRequest) dataObject;
    this.monitoringService.requestPowerQualityProfile(deviceMessageMetadata, getPowerQualityProfileRequest);
}
Also used : GetPowerQualityProfileRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequest)

Example 3 with GetPowerQualityProfileRequest

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequest in project open-smart-grid-platform by OSGP.

the class GetPowerQualityProfileRequestMappingTest method convertGetPowerQualityProfileRequest.

@Test
public void convertGetPowerQualityProfileRequest() {
    final org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetPowerQualityProfileRequest source = this.makeRequest();
    final Object result = this.mapper.map(source, GetPowerQualityProfileRequest.class);
    assertThat(result).as("mapping GetPowerQualityProfileRequest should not return null").isNotNull();
    assertThat(result).as("mapping GetPowerQualityProfileRequest  should return correct type").isInstanceOf(GetPowerQualityProfileRequest.class);
    final GetPowerQualityProfileRequest target = (GetPowerQualityProfileRequest) result;
    assertThat(target.getDeviceIdentification()).isEqualTo(source.getDeviceIdentification());
    assertThat(target.getProfileType()).isEqualTo(source.getProfileType());
    final DateTime targetEndDate = new DateTime(target.getEndDate());
    assertThat(targetEndDate.getYear()).isEqualTo(source.getBeginDate().getYear());
}
Also used : GetPowerQualityProfileRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequest) DateTime(org.joda.time.DateTime) Test(org.junit.jupiter.api.Test)

Example 4 with GetPowerQualityProfileRequest

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequest in project open-smart-grid-platform by OSGP.

the class SmartMeteringMonitoringEndpoint method getGetPowerQualityProfile.

@PayloadRoot(localPart = "GetPowerQualityProfileRequest", namespace = SMARTMETER_MONITORING_NAMESPACE)
@ResponsePayload
public GetPowerQualityProfileAsyncResponse getGetPowerQualityProfile(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetPowerQualityProfileRequest request, @MessagePriority final String messagePriority, @ResponseUrl final String responseUrl, @ScheduleTime final String scheduleTime, @BypassRetry final String bypassRetry) throws OsgpException {
    final GetPowerQualityProfileRequest requestData = this.monitoringMapper.map(request, GetPowerQualityProfileRequest.class);
    final RequestMessageMetadata requestMessageMetadata = RequestMessageMetadata.newBuilder().withOrganisationIdentification(organisationIdentification).withDeviceIdentification(request.getDeviceIdentification()).withDeviceFunction(DeviceFunction.GET_PROFILE_GENERIC_DATA).withMessageType(MessageType.GET_PROFILE_GENERIC_DATA).withMessagePriority(messagePriority).withScheduleTime(scheduleTime).withBypassRetry(bypassRetry).build();
    final AsyncResponse asyncResponse = this.requestService.enqueueAndSendRequest(requestMessageMetadata, requestData);
    this.saveResponseUrlIfNeeded(asyncResponse.getCorrelationUid(), responseUrl);
    return this.monitoringMapper.map(asyncResponse, GetPowerQualityProfileAsyncResponse.class);
}
Also used : GetPowerQualityProfileRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequest) GetPowerQualityProfileAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetPowerQualityProfileAsyncResponse) AsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse) ClearAlarmRegisterAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ClearAlarmRegisterAsyncResponse) ReadAlarmRegisterAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ReadAlarmRegisterAsyncResponse) PeriodicMeterReadsGasAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.PeriodicMeterReadsGasAsyncResponse) ActualMeterReadsGasAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasAsyncResponse) ActualPowerQualityAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualPowerQualityAsyncResponse) ActualMeterReadsAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsAsyncResponse) PeriodicMeterReadsAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.PeriodicMeterReadsAsyncResponse) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Aggregations

GetPowerQualityProfileRequest (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequest)4 Test (org.junit.jupiter.api.Test)2 DateTime (org.joda.time.DateTime)1 AsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AsyncResponse)1 ActualMeterReadsAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsAsyncResponse)1 ActualMeterReadsGasAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasAsyncResponse)1 ActualPowerQualityAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ActualPowerQualityAsyncResponse)1 ClearAlarmRegisterAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ClearAlarmRegisterAsyncResponse)1 GetPowerQualityProfileAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetPowerQualityProfileAsyncResponse)1 PeriodicMeterReadsAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.PeriodicMeterReadsAsyncResponse)1 PeriodicMeterReadsGasAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.PeriodicMeterReadsGasAsyncResponse)1 ReadAlarmRegisterAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.ReadAlarmRegisterAsyncResponse)1 GetPowerQualityProfileRequestData (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequestData)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1