Search in sources :

Example 1 with And

use of cucumber.api.java.en.And in project open-kilda by telstra.

the class FlowCrudSteps method eachFlowIsInUPState.

@And("^each flow is in UP state$")
public void eachFlowIsInUPState() {
    for (FlowPayload flow : flows) {
        FlowIdStatusPayload status = Failsafe.with(retryPolicy.abortIf(p -> p != null && FlowState.UP == ((FlowIdStatusPayload) p).getStatus())).get(() -> northboundService.getFlowStatus(flow.getId()));
        assertNotNull(status);
        assertThat(format("The flow status for '%s' can't be retrived.", flow.getId()), status, hasProperty("id", equalTo(flow.getId())));
        assertThat(format("The flow '%s' has wrong status.", flow.getId()), status, hasProperty("status", equalTo(FlowState.UP)));
    }
}
Also used : FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) FlowIdStatusPayload(org.openkilda.messaging.payload.flow.FlowIdStatusPayload) And(cucumber.api.java.en.And)

Example 2 with And

use of cucumber.api.java.en.And in project open-kilda by telstra.

the class FlowCrudSteps method eachFlowIsCreatedAndStoredInTopologyEngine.

@Then("^each flow is created and stored in TopologyEngine$")
public void eachFlowIsCreatedAndStoredInTopologyEngine() {
    List<Flow> expextedFlows = flows.stream().map(flow -> new Flow(flow.getId(), flow.getMaximumBandwidth(), flow.isIgnoreBandwidth(), 0, flow.getId(), null, flow.getSource().getSwitchId(), flow.getDestination().getSwitchId(), flow.getSource().getPortId(), flow.getDestination().getPortId(), flow.getSource().getVlanId(), flow.getDestination().getVlanId(), 0, 0, null, null)).collect(toList());
    for (Flow expectedFlow : expextedFlows) {
        ImmutablePair<Flow, Flow> flowPair = Failsafe.with(retryPolicy.abortIf(Objects::nonNull)).get(() -> topologyEngineService.getFlow(expectedFlow.getFlowId()));
        assertNotNull(format("The flow '%s' is missing.", expectedFlow.getFlowId()), flowPair);
        assertThat(format("The flow '%s' is different.", expectedFlow.getFlowId()), flowPair.getLeft(), is(equalTo(expectedFlow)));
    }
}
Also used : RangeSet(com.google.common.collect.RangeSet) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) Assert.assertThat(org.junit.Assert.assertThat) Given(cucumber.api.java.en.Given) NorthboundService(org.openkilda.atdd.staging.service.northbound.NorthboundService) FloodlightService(org.openkilda.atdd.staging.service.floodlight.FloodlightService) Then(cucumber.api.java.en.Then) SwitchInfoData(org.openkilda.messaging.info.event.SwitchInfoData) Matchers.reflectEquals(com.nitorcreations.Matchers.reflectEquals) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) ImmutablePair(org.openkilda.messaging.model.ImmutablePair) Collections.emptyList(java.util.Collections.emptyList) Range(com.google.common.collect.Range) TopologyChecker(org.openkilda.atdd.staging.steps.helpers.TopologyChecker) FlowEndpointPayload(org.openkilda.messaging.payload.flow.FlowEndpointPayload) RetryPolicy(net.jodah.failsafe.RetryPolicy) UUID(java.util.UUID) String.format(java.lang.String.format) Objects(java.util.Objects) List(java.util.List) TopologyEngineService(org.openkilda.atdd.staging.service.topology.TopologyEngineService) Assert.assertFalse(org.junit.Assert.assertFalse) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Optional(java.util.Optional) Matchers.is(org.hamcrest.Matchers.is) IslInfoData(org.openkilda.messaging.info.event.IslInfoData) ContiguousSet(com.google.common.collect.ContiguousSet) Switch(org.openkilda.atdd.staging.model.topology.TopologyDefinition.Switch) TreeRangeSet(com.google.common.collect.TreeRangeSet) PathInfoData(org.openkilda.messaging.info.event.PathInfoData) Matchers.hasProperty(org.hamcrest.Matchers.hasProperty) FlowIdStatusPayload(org.openkilda.messaging.payload.flow.FlowIdStatusPayload) DiscreteDomain(com.google.common.collect.DiscreteDomain) And(cucumber.api.java.en.And) Flow(org.openkilda.messaging.model.Flow) Logger(org.slf4j.Logger) Assert.assertNotNull(org.junit.Assert.assertNotNull) Assert.assertTrue(org.junit.Assert.assertTrue) Failsafe(net.jodah.failsafe.Failsafe) TimeUnit(java.util.concurrent.TimeUnit) Collectors.toList(java.util.stream.Collectors.toList) Assert.assertNull(org.junit.Assert.assertNull) OutPort(org.openkilda.atdd.staging.model.topology.TopologyDefinition.OutPort) En(cucumber.api.java8.En) FlowState(org.openkilda.messaging.payload.flow.FlowState) VisibleForTesting(com.google.common.annotations.VisibleForTesting) When(cucumber.api.java.en.When) TopologyDefinition(org.openkilda.atdd.staging.model.topology.TopologyDefinition) Objects(java.util.Objects) Flow(org.openkilda.messaging.model.Flow) Then(cucumber.api.java.en.Then)

Example 3 with And

use of cucumber.api.java.en.And in project open-kilda by telstra.

the class FlowCrudSteps method eachFlowCanNotBeReadFromNorthbound.

@And("^each flow can not be read from Northbound$")
public void eachFlowCanNotBeReadFromNorthbound() {
    for (FlowPayload flow : flows) {
        FlowPayload result = Failsafe.with(retryPolicy.abortIf(Objects::isNull)).get(() -> northboundService.getFlow(flow.getId()));
        assertNull(format("The flow '%s' exists.", flow.getId()), result);
    }
}
Also used : FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) Objects(java.util.Objects) And(cucumber.api.java.en.And)

Example 4 with And

use of cucumber.api.java.en.And in project open-kilda by telstra.

the class StormTopologyLCM method allStormTopologiesInTheSameState.

/**
 * We compare old inner state of cache bolt and OFELinkBolt with new state after reload
 * topologies.
 */
@And("^all storm topologies in the same state$")
public void allStormTopologiesInTheSameState() throws Throwable {
    DumpStateManager actualSateDumpsFromBolts = kafkaUtils.getStateDumpsFromBolts();
    // CacheBolt part
    Set<ImmutablePair<Flow, Flow>> actualCacheBoltFlows = actualSateDumpsFromBolts.getCacheBoltState().getFlowDump().getFlows();
    Set<ImmutablePair<Flow, Flow>> expectedCacheBoltFlows = expectedStateDumpsFromBolts.getCacheBoltState().getFlowDump().getFlows();
    assertTrue(CollectionUtils.isEqualCollection(actualCacheBoltFlows, expectedCacheBoltFlows));
    // OFELinkBolt
    OFELinkBoltState actualOfeLinkBoltState = actualSateDumpsFromBolts.getOfeLinkBoltState();
    OFELinkBoltState expectedOfeLinkBoltState = expectedStateDumpsFromBolts.getOfeLinkBoltState();
    assertTrue(CollectionUtils.isEqualCollection(expectedOfeLinkBoltState.getDiscovery(), actualOfeLinkBoltState.getDiscovery()));
}
Also used : DumpStateManager(org.openkilda.messaging.ctrl.state.visitor.DumpStateManager) OFELinkBoltState(org.openkilda.messaging.ctrl.state.OFELinkBoltState) ImmutablePair(org.openkilda.messaging.model.ImmutablePair) And(cucumber.api.java.en.And)

Example 5 with And

use of cucumber.api.java.en.And in project syndesis-qe by syndesisio.

the class DataMapperStep method startMapperDefinition.

/**
 * Just creates mapper step definition, the mapper will be generated on the integration creation.
 *
 * @param mapperName
 */
@And("start mapper definition with name: \"([^\"]*)\"")
public void startMapperDefinition(String mapperName) {
    final Step mapperStep = new Step.Builder().stepKind(StepKind.mapper).name(mapperName).build();
    steps.getStepDefinitions().add(new StepDefinition(mapperStep, new DataMapperDefinition()));
}
Also used : DataMapperDefinition(io.syndesis.qe.bdd.entities.DataMapperDefinition) DataMapperStepDefinition(io.syndesis.qe.bdd.entities.DataMapperStepDefinition) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition) Step(io.syndesis.common.model.integration.Step) And(cucumber.api.java.en.And)

Aggregations

And (cucumber.api.java.en.And)83 FlowPayload (org.openkilda.messaging.payload.flow.FlowPayload)17 SelenideElement (com.codeborne.selenide.SelenideElement)6 List (java.util.List)6 RestResponse (alien4cloud.rest.model.RestResponse)5 TopologyDTO (alien4cloud.topology.TopologyDTO)5 DataTableRow (gherkin.formatter.model.DataTableRow)5 FunctionPropertyValue (org.alien4cloud.tosca.model.definitions.FunctionPropertyValue)5 LocationModifierReference (alien4cloud.model.orchestrators.locations.LocationModifierReference)4 TopologyValidationResult (alien4cloud.topology.TopologyValidationResult)4 Path (java.nio.file.Path)4 Objects (java.util.Objects)4 TestUtils.nullAsString (alien4cloud.it.utils.TestUtils.nullAsString)3 JsonObject (com.eclipsesource.json.JsonObject)3 JavaType (com.fasterxml.jackson.databind.JavaType)3 Step (io.syndesis.common.model.integration.Step)3 StepDefinition (io.syndesis.qe.bdd.entities.StepDefinition)3 ArrayList (java.util.ArrayList)3 NodeInstanceDTO (alien4cloud.rest.service.model.NodeInstanceDTO)2 PatchServiceResourceRequest (alien4cloud.rest.service.model.PatchServiceResourceRequest)2