use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindAllOrganisationsResponse in project open-smart-grid-platform by OSGP.
the class FindOrganizationsSteps method theGetAllOrganizationsResponseContains.
@Then("^the get all organizations response contains$")
public void theGetAllOrganizationsResponseContains(final Map<String, String> expectedResult) {
final FindAllOrganisationsResponse response = (FindAllOrganisationsResponse) ScenarioContext.current().get(PlatformCommonKeys.RESPONSE);
final List<Organisation> organisations = response.getOrganisations();
final Organisation expected = this.createOrganisation(expectedResult);
for (final Organisation organisation : organisations) {
if (this.organisationMatches(expected, organisation)) {
return;
}
}
Assertions.fail("Expected organization \"" + expected.getOrganisationIdentification() + "\" was not found as one of the " + organisations.size() + " organizations in the response");
}
use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindAllOrganisationsResponse in project open-smart-grid-platform by OSGP.
the class DeviceManagementEndpoint method findAllOrganisations.
@PayloadRoot(localPart = "FindAllOrganisationsRequest", namespace = DEVICE_MANAGEMENT_NAMESPACE)
@ResponsePayload
public FindAllOrganisationsResponse findAllOrganisations(@OrganisationIdentification final String organisationIdentification, @RequestPayload final FindAllOrganisationsRequest request) throws OsgpException {
LOGGER.info("Find all organisations for organisation: {}.", organisationIdentification);
final FindAllOrganisationsResponse response = new FindAllOrganisationsResponse();
try {
final List<Organisation> organisations = this.deviceManagementService.findAllOrganisations(organisationIdentification);
response.getOrganisations().addAll(this.deviceManagementMapper.mapAsList(organisations, 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;
}
use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindAllOrganisationsResponse in project open-smart-grid-platform by OSGP.
the class FindOrganizationsSteps method theGetAllOrganizationsResponseContainsOrganization.
@Then("^the get all organizations response contains (\\d++) organizations?$")
public void theGetAllOrganizationsResponseContainsOrganization(final Integer expectedCount) {
final FindAllOrganisationsResponse response = (FindAllOrganisationsResponse) ScenarioContext.current().get(PlatformCommonKeys.RESPONSE);
assertThat(response.getOrganisations().size()).isEqualTo((int) expectedCount);
}
Aggregations