use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ProfileEntry 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);
}
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ProfileEntry in project open-smart-grid-platform by OSGP.
the class PowerQualityProfileResponseDataConverter method mapProfileEntries.
private List<ProfileEntry> mapProfileEntries(final PowerQualityProfileData source) {
final List<ProfileEntry> result = new ArrayList<>();
for (final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntry profileEntryValuesVo : source.getProfileEntries()) {
final ProfileEntry profileEntry = new ProfileEntry();
for (final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntryValue profileEntryValueVo : profileEntryValuesVo.getProfileEntryValues()) {
profileEntry.getProfileEntryValue().add(this.mapperFacade.map(profileEntryValueVo, ProfileEntryValue.class));
}
result.add(profileEntry);
}
return result;
}
Aggregations