Search in sources :

Example 1 with BundleRequest

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

the class BundleSteps method aABundleRequest.

@Given("^a bundle request$")
public void aABundleRequest(final Map<String, String> settings) throws Throwable {
    final BundleRequest request = new BundleRequest();
    request.setDeviceIdentification(getString(settings, PlatformSmartmeteringKeys.DEVICE_IDENTIFICATION, PlatformSmartmeteringDefaults.DEVICE_IDENTIFICATION));
    final Actions actions = new Actions();
    request.setActions(actions);
    ScenarioContext.current().put(PlatformSmartmeteringKeys.BUNDLE_REQUEST, request);
}
Also used : Actions(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.Actions) BundleRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleRequest) Given(io.cucumber.java.en.Given)

Example 2 with BundleRequest

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleRequest 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);
}
Also used : BundleResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse) BundleRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleRequest) Then(io.cucumber.java.en.Then)

Example 3 with BundleRequest

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleRequest 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);
}
Also used : BundleResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse) BundleRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleRequest) Then(io.cucumber.java.en.Then)

Example 4 with BundleRequest

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

the class BaseBundleSteps method addActionToBundleRequest.

protected void addActionToBundleRequest(final Action action) {
    final BundleRequest bundleRequest = (BundleRequest) ScenarioContext.current().get(PlatformSmartmeteringKeys.BUNDLE_REQUEST);
    bundleRequest.getActions().getActionList().add(action);
    this.increaseCount(PlatformSmartmeteringKeys.BUNDLE_ACTION_COUNT);
}
Also used : BundleRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleRequest)

Example 5 with BundleRequest

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

the class BundleSteps method theBundleRequestIsReceived.

@When("^the bundle request is received$")
public void theBundleRequestIsReceived() throws Throwable {
    final BundleRequest request = (BundleRequest) ScenarioContext.current().get(PlatformSmartmeteringKeys.BUNDLE_REQUEST);
    final BundleAsyncResponse asyncResponse = this.client.sendBundleRequest(request);
    assertThat(asyncResponse).isNotNull();
    ScenarioContextHelper.saveAsyncResponse(asyncResponse);
}
Also used : BundleRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleRequest) BundleAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleAsyncResponse) When(io.cucumber.java.en.When)

Aggregations

BundleRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleRequest)7 Then (io.cucumber.java.en.Then)2 When (io.cucumber.java.en.When)2 BundleAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleAsyncResponse)2 BundleResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse)2 Given (io.cucumber.java.en.Given)1 Actions (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.Actions)1