Search in sources :

Example 56 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class ConnectionsPublicApiSteps method checkConnectionProperties.

/**
 * DataTable ->  | property1 | value |
 * | property2 | value |
 */
@Then("^check that (\\w+) connection contains properties$")
public void checkConnectionProperties(String connectionName, DataTable tagsData) {
    List<List<String>> connectionProperties = tagsData.cells();
    Connection connection = connectionsEndpoint.getConnectionByName(connectionName);
    for (List<String> connectionProperty : connectionProperties) {
        assertThat(connection.getConfiguredProperties()).containsEntry(connectionProperty.get(0), connectionProperty.get(1));
    }
}
Also used : Connection(io.syndesis.common.model.connection.Connection) List(java.util.List) Then(io.cucumber.java.en.Then)

Example 57 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class IntegrationsPublicApiSteps method checkState.

@Then("^check that state of the integration (\\w+) is (\\w+)$")
public void checkState(String integrationName, String desiredState) {
    if ("Unpublished".equals(desiredState)) {
        String integrationId = internalIntegrationsEndpoint.getIntegrationId(integrationName).get();
        final IntegrationOverview integrationOverview = integrationOverviewEndpoint.getOverview(integrationId);
        TestUtils.waitForUnpublishing(integrationOverviewEndpoint, integrationOverview, TimeUnit.MINUTES, 10);
    }
    assertThat(integrationsEndpoint.getStateOfIntegration(integrationName).get("currentState").asText()).isEqualTo(desiredState);
}
Also used : IntegrationOverview(io.syndesis.qe.endpoint.model.IntegrationOverview) Then(io.cucumber.java.en.Then)

Example 58 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class UpgradeSteps method checkPullSecret.

@Then("check that pull secret is linked in the service accounts")
public void checkPullSecret() {
    boolean found = false;
    // If it is present in the server, it was linked to all others needed
    for (LocalObjectReference imagePullSecret : OpenShiftUtils.getInstance().getServiceAccount("syndesis-server").getImagePullSecrets()) {
        if (imagePullSecret.getName().equals(TestConfiguration.syndesisPullSecretName())) {
            found = true;
            break;
        }
    }
    assertThat(found).as("The pull secret should be linked to service account, but wasn't").isTrue();
}
Also used : LocalObjectReference(io.fabric8.kubernetes.api.model.LocalObjectReference) Then(io.cucumber.java.en.Then)

Example 59 with Then

use of io.cucumber.java.en.Then in project grakn by graknlabs.

the class TypeQLSteps method answer_groups_are.

@Then("answer groups are")
public void answer_groups_are(List<Map<String, String>> answerIdentifierTable) {
    Set<AnswerIdentifierGroup> answerIdentifierGroups = answerIdentifierTable.stream().collect(Collectors.groupingBy(x -> x.get(AnswerIdentifierGroup.GROUP_COLUMN_NAME))).values().stream().map(AnswerIdentifierGroup::new).collect(Collectors.toSet());
    assertEquals(String.format("Expected [%d] answer groups, but found [%d].", answerIdentifierGroups.size(), answerGroups.size()), answerIdentifierGroups.size(), answerGroups.size());
    for (AnswerIdentifierGroup answerIdentifierGroup : answerIdentifierGroups) {
        String[] identifier = answerIdentifierGroup.ownerIdentifier.split(":", 2);
        UniquenessCheck checker;
        switch(identifier[0]) {
            case "label":
                checker = new LabelUniquenessCheck(identifier[1]);
                break;
            case "key":
                checker = new KeyUniquenessCheck(identifier[1]);
                break;
            case "value":
                checker = new ValueUniquenessCheck(identifier[1]);
                break;
            default:
                throw new IllegalStateException("Unexpected value: " + identifier[0]);
        }
        ConceptMapGroup answerGroup = answerGroups.stream().filter(ag -> checker.check(ag.owner())).findAny().orElse(null);
        assertNotNull(String.format("The group identifier [%s] does not match any of the answer group owners.", answerIdentifierGroup.ownerIdentifier), answerGroup);
        List<Map<String, String>> answersIdentifiers = answerIdentifierGroup.answersIdentifiers;
        for (ConceptMap answer : answerGroup.conceptMaps()) {
            List<Map<String, String>> matchingIdentifiers = new ArrayList<>();
            for (Map<String, String> answerIdentifiers : answersIdentifiers) {
                if (matchAnswerConcept(answerIdentifiers, answer)) {
                    matchingIdentifiers.add(answerIdentifiers);
                }
            }
            assertEquals(String.format("An identifier entry (row) should match 1-to-1 to an answer, but there were [%d] matching identifier entries for answer with variables %s.", matchingIdentifiers.size(), answer.concepts().keySet().toString()), 1, matchingIdentifiers.size());
        }
    }
}
Also used : Then(io.cucumber.java.en.Then) LocalDateTime(java.time.LocalDateTime) TypeQLDelete(com.vaticle.typeql.lang.query.TypeQLDelete) TypeQLInsert(com.vaticle.typeql.lang.query.TypeQLInsert) HashMap(java.util.HashMap) TypeQLUndefine(com.vaticle.typeql.lang.query.TypeQLUndefine) Reference(com.vaticle.typeql.lang.pattern.variable.Reference) ArrayList(java.util.ArrayList) Concept(com.vaticle.typedb.core.concept.Concept) Matcher(java.util.regex.Matcher) Given(io.cucumber.java.en.Given) Map(java.util.Map) TypeQLDefine(com.vaticle.typeql.lang.query.TypeQLDefine) TypeQL(com.vaticle.typeql.lang.TypeQL) When(io.cucumber.java.en.When) Assert.assertNotNull(org.junit.Assert.assertNotNull) Set(java.util.Set) Assert.assertTrue(org.junit.Assert.assertTrue) ConceptMap(com.vaticle.typedb.core.concept.answer.ConceptMap) NumericGroup(com.vaticle.typedb.core.concept.answer.NumericGroup) Collectors(java.util.stream.Collectors) Util.assertThrows(com.vaticle.typedb.core.common.test.Util.assertThrows) TypeQLException(com.vaticle.typeql.lang.common.exception.TypeQLException) DateTimeParseException(java.time.format.DateTimeParseException) List(java.util.List) TypeQLUpdate(com.vaticle.typeql.lang.query.TypeQLUpdate) Attribute(com.vaticle.typedb.core.concept.thing.Attribute) LocalDate(java.time.LocalDate) Pattern(java.util.regex.Pattern) Util.assertThrowsWithMessage(com.vaticle.typedb.core.common.test.Util.assertThrowsWithMessage) ScenarioDefinitionException(com.vaticle.typedb.core.test.behaviour.exception.ScenarioDefinitionException) TypeQLMatch(com.vaticle.typeql.lang.query.TypeQLMatch) ConceptMapGroup(com.vaticle.typedb.core.concept.answer.ConceptMapGroup) Numeric(com.vaticle.typedb.core.concept.answer.Numeric) ConnectionSteps.tx(com.vaticle.typedb.core.test.behaviour.connection.ConnectionSteps.tx) Assert.assertEquals(org.junit.Assert.assertEquals) ConceptMapGroup(com.vaticle.typedb.core.concept.answer.ConceptMapGroup) ArrayList(java.util.ArrayList) ConceptMap(com.vaticle.typedb.core.concept.answer.ConceptMap) HashMap(java.util.HashMap) Map(java.util.Map) ConceptMap(com.vaticle.typedb.core.concept.answer.ConceptMap) Then(io.cucumber.java.en.Then)

Example 60 with Then

use of io.cucumber.java.en.Then in project grakn by graknlabs.

the class RelationTypeSteps method relation_type_get_role_type_get_supertype.

@Then("relation\\( ?{type_label} ?) get role\\( ?{type_label} ?) get supertype: {scoped_label}")
public void relation_type_get_role_type_get_supertype(String relationLabel, String roleLabel, Parameters.ScopedLabel superLabel) {
    RoleType superType = tx().concepts().getRelationType(superLabel.scope()).getRelates(superLabel.label());
    assertEquals(superType, tx().concepts().getRelationType(relationLabel).getRelates(roleLabel).getSupertype());
}
Also used : RoleType(com.vaticle.typedb.core.concept.type.RoleType) Then(io.cucumber.java.en.Then)

Aggregations

Then (io.cucumber.java.en.Then)124 SelenideElement (com.codeborne.selenide.SelenideElement)20 AttributeType (com.vaticle.typedb.core.concept.type.AttributeType)16 List (java.util.List)13 HashMap (java.util.HashMap)10 SyndesisRootPage (io.syndesis.qe.pages.SyndesisRootPage)9 Map (java.util.Map)9 ThingType (com.vaticle.typedb.core.concept.type.ThingType)8 DataTable (io.cucumber.datatable.DataTable)8 When (io.cucumber.java.en.When)8 Pod (io.fabric8.kubernetes.api.model.Pod)8 Quantity (io.fabric8.kubernetes.api.model.Quantity)8 ArrayList (java.util.ArrayList)8 Date (java.util.Date)8 TimeoutException (java.util.concurrent.TimeoutException)8 TestUtils (io.syndesis.qe.utils.TestUtils)7 HTTPResponse (io.syndesis.qe.utils.http.HTTPResponse)7 OpenShiftWaitUtils (io.syndesis.qe.wait.OpenShiftWaitUtils)7 Slf4j (lombok.extern.slf4j.Slf4j)7 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)7