Search in sources :

Example 1 with FindOrganisationResponse

use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindOrganisationResponse in project open-smart-grid-platform by OSGP.

the class FindOrganizationsSteps method theGetOrganizationResponseContains.

@Then("^the get organization response contains$")
public void theGetOrganizationResponseContains(final Map<String, String> expectedResult) {
    final FindOrganisationResponse response = (FindOrganisationResponse) ScenarioContext.current().get(PlatformCommonKeys.RESPONSE);
    final Organisation organisation = response.getOrganisation();
    final Organisation expected = this.createOrganisation(expectedResult);
    assertThat(this.organisationMatches(expected, organisation)).as("Expected organization \"" + expected.getOrganisationIdentification() + "\" was not found as the organization in the response").isTrue();
}
Also used : Organisation(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.Organisation) FindOrganisationResponse(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindOrganisationResponse) Then(io.cucumber.java.en.Then)

Example 2 with FindOrganisationResponse

use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindOrganisationResponse in project open-smart-grid-platform by OSGP.

the class DeviceManagementEndpoint method findOrganisation.

@PayloadRoot(localPart = "FindOrganisationRequest", namespace = DEVICE_MANAGEMENT_NAMESPACE)
@ResponsePayload
public FindOrganisationResponse findOrganisation(@OrganisationIdentification final String organisationIdentification, @RequestPayload final FindOrganisationRequest request) throws OsgpException {
    LOGGER.info("Find organisation for organisation: {}.", organisationIdentification);
    final FindOrganisationResponse response = new FindOrganisationResponse();
    try {
        final Organisation organisation = this.deviceManagementService.findOrganisation(organisationIdentification, request.getOrganisationIdentification());
        response.setOrganisation(this.deviceManagementMapper.map(organisation, org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.Organisation.class));
    } catch (final ConstraintViolationException e) {
        throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations()));
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : ValidationException(org.opensmartgridplatform.domain.core.exceptions.ValidationException) Organisation(org.opensmartgridplatform.domain.core.entities.Organisation) ConstraintViolationException(javax.validation.ConstraintViolationException) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) ValidationException(org.opensmartgridplatform.domain.core.exceptions.ValidationException) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ConstraintViolationException(javax.validation.ConstraintViolationException) FindOrganisationResponse(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindOrganisationResponse) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Aggregations

FindOrganisationResponse (org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindOrganisationResponse)2 Then (io.cucumber.java.en.Then)1 ConstraintViolationException (javax.validation.ConstraintViolationException)1 Organisation (org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.Organisation)1 Organisation (org.opensmartgridplatform.domain.core.entities.Organisation)1 ValidationException (org.opensmartgridplatform.domain.core.exceptions.ValidationException)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1