Search in sources :

Example 1 with Organisation

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

the class FindOrganizationsSteps method createOrganisation.

private Organisation createOrganisation(final Map<String, String> expectedResult) {
    final Organisation expected = new Organisation();
    expected.setOrganisationIdentification(getString(expectedResult, PlatformKeys.KEY_ORGANIZATION_IDENTIFICATION, PlatformDefaults.DEFAULT_ORGANIZATION_IDENTIFICATION));
    expected.setName(getString(expectedResult, PlatformKeys.KEY_NAME, PlatformDefaults.DEFAULT_ORGANIZATION_NAME));
    expected.getDomains().addAll(this.createDomains(expectedResult));
    expected.setPrefix(getString(expectedResult, PlatformKeys.KEY_PREFIX, PlatformDefaults.DEFAULT_PREFIX));
    return expected;
}
Also used : Organisation(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.Organisation)

Example 2 with Organisation

use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.Organisation 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 3 with Organisation

use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.Organisation 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");
}
Also used : Organisation(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.Organisation) FindAllOrganisationsResponse(org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindAllOrganisationsResponse) Then(io.cucumber.java.en.Then)

Aggregations

Organisation (org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.Organisation)3 Then (io.cucumber.java.en.Then)2 FindAllOrganisationsResponse (org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindAllOrganisationsResponse)1 FindOrganisationResponse (org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.FindOrganisationResponse)1