use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse in project open-smart-grid-platform by OSGP.
the class BundleSteps method theNumberOfResponsesInTheBundleResponseShouldMatchTheNumberOfActionsInTheBundleRequest.
@Then("^the number of responses in the bundle response should match the number of actions in the bundle request$")
public void theNumberOfResponsesInTheBundleResponseShouldMatchTheNumberOfActionsInTheBundleRequest() throws Throwable {
this.ensureBundleResponse();
final BundleRequest request = (BundleRequest) ScenarioContext.current().get(PlatformSmartmeteringKeys.BUNDLE_REQUEST);
final BundleResponse response = (BundleResponse) ScenarioContext.current().get(PlatformSmartmeteringKeys.BUNDLE_RESPONSE);
this.assertSameSize(request, response);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse in project open-smart-grid-platform by OSGP.
the class BundleSteps method theOrderOfTheResponsesInTheBundleResponseShouldMatchTheOrderOfActionsInTheBundleRequest.
@Then("^the order of the responses in the bundle response should match the order of actions in the bundle request$")
public void theOrderOfTheResponsesInTheBundleResponseShouldMatchTheOrderOfActionsInTheBundleRequest() throws Throwable {
this.ensureBundleResponse();
final BundleRequest request = (BundleRequest) ScenarioContext.current().get(PlatformSmartmeteringKeys.BUNDLE_REQUEST);
final BundleResponse response = (BundleResponse) ScenarioContext.current().get(PlatformSmartmeteringKeys.BUNDLE_RESPONSE);
this.assertSameSize(request, response);
this.assertSameOrder(request, response);
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse in project open-smart-grid-platform by OSGP.
the class ActionMapperResponseService method mapAllActions.
public BundleResponse mapAllActions(final Serializable actionList) throws FunctionalException {
final BundleMessagesResponse bundleResponseMessageDataContainer = (BundleMessagesResponse) actionList;
final AllResponses allResponses = new ObjectFactory().createAllResponses();
final List<? extends ActionResponse> actionValueList = bundleResponseMessageDataContainer.getBundleList();
for (final ActionResponse actionValueResponseObject : actionValueList) {
final ConfigurableMapper mapper = this.getMapper(actionValueResponseObject);
final Class<?> clazz = this.getClazz(actionValueResponseObject);
final Response response = this.doMap(actionValueResponseObject, mapper, clazz);
allResponses.getResponseList().add(response);
}
final BundleResponse bundleResponse = new ObjectFactory().createBundleResponse();
bundleResponse.setAllResponses(allResponses);
return bundleResponse;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse in project open-smart-grid-platform by OSGP.
the class BaseBundleSteps method getNextBundleResponse.
protected Response getNextBundleResponse() throws WebServiceSecurityException, GeneralSecurityException, IOException {
this.ensureBundleResponse();
final BundleResponse bundleResponse = (BundleResponse) ScenarioContext.current().get(PlatformSmartmeteringKeys.BUNDLE_RESPONSE);
return bundleResponse.getAllResponses().getResponseList().get(this.getAndIncreaseCount(PlatformSmartmeteringKeys.BUNDLE_RESPONSE_COUNT));
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse in project open-smart-grid-platform by OSGP.
the class BaseBundleSteps method ensureBundleResponse.
protected void ensureBundleResponse() throws WebServiceSecurityException, GeneralSecurityException, IOException {
if (ScenarioContext.current().get(PlatformSmartmeteringKeys.BUNDLE_RESPONSE) == null) {
final String correlationUid = (String) ScenarioContext.current().get(PlatformSmartmeteringKeys.KEY_CORRELATION_UID);
final BundleAsyncRequest asyncRequest = new BundleAsyncRequest();
asyncRequest.setCorrelationUid(correlationUid);
asyncRequest.setDeviceIdentification((String) ScenarioContext.current().get(PlatformSmartmeteringKeys.DEVICE_IDENTIFICATION));
final BundleResponse response = this.client.retrieveBundleResponse(asyncRequest);
ScenarioContext.current().put(PlatformSmartmeteringKeys.BUNDLE_RESPONSE, response);
assertThat(response.getAllResponses().getResponseList().size()).isEqualTo(ScenarioContext.current().get(PlatformSmartmeteringKeys.BUNDLE_ACTION_COUNT));
}
}
Aggregations