Search in sources :

Example 1 with GetAssociationLnObjectsResponse

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetAssociationLnObjectsResponse in project open-smart-grid-platform by OSGP.

the class AssociationLnObjects method theObjectlistShouldBeReturned.

@Then("^the objectlist should be returned$")
public void theObjectlistShouldBeReturned(final Map<String, String> settings) throws Throwable {
    final GetAssociationLnObjectsAsyncRequest asyncRequest = AssociationLnObjectsRequestFactory.fromScenarioContext();
    final GetAssociationLnObjectsResponse response = this.responseClient.getResponse(asyncRequest);
    assertThat(response.getResult()).as("Response should be OK").isEqualTo(OsgpResultType.OK);
    assertThat(response.getAssociationLnList()).as("Response should contain an AssociationLnList").isNotNull();
    assertThat(response.getAssociationLnList().getAssociationLnListElement().get(0)).as("AssociationLnList shoudl have at least one entry").isNotNull();
    final AssociationLnListElement element = response.getAssociationLnList().getAssociationLnListElement().get(0);
    assertThat(element.getAccessRights()).as("AccessRights should be present").isNotNull();
    assertThat(element.getClassId()).as("ClassId should be present").isNotNull();
    assertThat(element.getLogicalName()).as("LogicalName should be present").isNotNull();
    assertThat(element.getVersion()).as("Version should be present").isNotNull();
    assertThat(element.getAccessRights().getAttributeAccess().getAttributeAccessItem().get(0).getAttributeId()).as("AttributeId should be present").isNotNull();
}
Also used : AssociationLnListElement(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.AssociationLnListElement) GetAssociationLnObjectsAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetAssociationLnObjectsAsyncRequest) GetAssociationLnObjectsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetAssociationLnObjectsResponse) Then(io.cucumber.java.en.Then)

Example 2 with GetAssociationLnObjectsResponse

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetAssociationLnObjectsResponse in project open-smart-grid-platform by OSGP.

the class SmartMeteringAdhocEndpoint method getAssociationLnObjectsResponse.

@PayloadRoot(localPart = "GetAssociationLnObjectsAsyncRequest", namespace = SMARTMETER_ADHOC_NAMESPACE)
@ResponsePayload
public GetAssociationLnObjectsResponse getAssociationLnObjectsResponse(@RequestPayload final GetAssociationLnObjectsAsyncRequest request) throws OsgpException {
    GetAssociationLnObjectsResponse response = null;
    try {
        response = new GetAssociationLnObjectsResponse();
        final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
        response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue()));
        if (responseData.getMessageData() instanceof AssociationLnListType) {
            response.setAssociationLnList(this.adhocMapper.map(responseData.getMessageData(), org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.AssociationLnListType.class));
        }
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : AssociationLnListType(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AssociationLnListType) ScanMbusChannelsResponseData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ScanMbusChannelsResponseData) ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) GetAssociationLnObjectsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetAssociationLnObjectsResponse) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) TechnicalException(org.opensmartgridplatform.shared.exceptionhandling.TechnicalException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Aggregations

GetAssociationLnObjectsResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetAssociationLnObjectsResponse)2 Then (io.cucumber.java.en.Then)1 ResponseData (org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData)1 AssociationLnListElement (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.AssociationLnListElement)1 GetAssociationLnObjectsAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetAssociationLnObjectsAsyncRequest)1 AssociationLnListType (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AssociationLnListType)1 ScanMbusChannelsResponseData (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ScanMbusChannelsResponseData)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1