Search in sources :

Example 1 with CaptureObject

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

the class PowerQualityProfileSteps method theGetPowerQualityProfileResponseDataShouldBeReturned.

@Then("^the power quality profile response data should be returned$")
public void theGetPowerQualityProfileResponseDataShouldBeReturned(final Map<String, String> settings) throws Throwable {
    final GetPowerQualityProfileAsyncRequest asyncRequest = GetPowerQualityProfileRequestFactory.fromScenarioContext();
    final GetPowerQualityProfileResponse response = this.responseClient.getResponse(asyncRequest);
    assertThat(response).as("GetPowerQualityProfileResponseData should not be null").isNotNull();
    final int expectedNumberOfCaptureObjects = getInteger(settings, "NumberOfCaptureObjects", 0);
    final List<CaptureObject> actualCaptureObjects = response.getPowerQualityProfileDatas().get(0).getCaptureObjectList().getCaptureObjects();
    assertThat(actualCaptureObjects.size()).as("Number of capture objects").isEqualTo(expectedNumberOfCaptureObjects);
    for (int i = 0; i < expectedNumberOfCaptureObjects; i++) {
        final CaptureObject actualCaptureObject = actualCaptureObjects.get(i);
        this.validateCaptureObject(actualCaptureObject, settings, i + 1);
    }
    final int expectedNumberOfProfileEntries = getInteger(settings, "NumberOfProfileEntries", 0);
    final List<ProfileEntry> actualProfileEntries = response.getPowerQualityProfileDatas().get(0).getProfileEntryList().getProfileEntries();
    assertThat(actualProfileEntries.size()).as("Number of profile entries").isEqualTo(expectedNumberOfProfileEntries);
    if (expectedNumberOfProfileEntries > 0) {
        /*
       * Expected value equals expectedNumberOfCaptureObjects, because the
       * number of ProfileEntryValues in a ProfileEntry should match the
       * number of captured objects from the buffer.
       */
        assertThat(actualProfileEntries.get(0).getProfileEntryValue().size()).as("Number of profile entry values").isEqualTo(expectedNumberOfCaptureObjects);
    }
}
Also used : GetPowerQualityProfileResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetPowerQualityProfileResponse) CaptureObject(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObject) ProfileEntry(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ProfileEntry) GetPowerQualityProfileAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetPowerQualityProfileAsyncRequest) Then(io.cucumber.java.en.Then)

Example 2 with CaptureObject

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

the class BundledGetPowerQualityProfileDataSteps method assertEqualCaptureObjects.

private void assertEqualCaptureObjects(final List<CaptureObject> actualCaptureObjects, final Map<String, String> expectedValues) throws AssertionError {
    final int expectedNumberOfCaptureObjects = SettingsHelper.getIntegerValue(expectedValues, "NumberOfCaptureObjects");
    assertThat(actualCaptureObjects.size()).as("Number of capture objects").isEqualTo(expectedNumberOfCaptureObjects);
    for (int i = 0; i < expectedNumberOfCaptureObjects; i++) {
        final CaptureObject actualCaptureObject = actualCaptureObjects.get(i);
        this.assertEqualCaptureObject(actualCaptureObject, expectedValues, i + 1);
    }
}
Also used : CaptureObject(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObject)

Example 3 with CaptureObject

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

the class PowerQualityProfileDataMappingTest method testCaptureObject.

@Test
public void testCaptureObject() {
    final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CaptureObject captureObjectVo = this.makeCaptureObjectVo();
    final CaptureObject captureObject = this.monitoringMapper.map(captureObjectVo, CaptureObject.class);
    assertThat(captureObject).as("mapping CaptureObject should not return null").isNotNull();
}
Also used : CaptureObject(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObject) Test(org.junit.jupiter.api.Test)

Aggregations

CaptureObject (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObject)3 Then (io.cucumber.java.en.Then)1 Test (org.junit.jupiter.api.Test)1 ProfileEntry (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ProfileEntry)1 GetPowerQualityProfileAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetPowerQualityProfileAsyncRequest)1 GetPowerQualityProfileResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetPowerQualityProfileResponse)1