Search in sources :

Example 1 with IntegrationOverview

use of io.syndesis.qe.endpoint.model.IntegrationOverview in project syndesis-qe by syndesisio.

the class CommonValidationSteps method verifyIntegrationState.

@Then("verify integration {string} has current state {string}")
public void verifyIntegrationState(String integrationName, String integrationState) {
    String integrationId = integrationsEndpoint.getIntegrationId(integrationName).get();
    integrationOverviewEndpoint = new IntegrationOverviewEndpoint();
    final IntegrationOverview integrationOverview = integrationOverviewEndpoint.getOverview(integrationId);
    log.debug("Actual state: {} and desired state: {}", integrationOverview.getCurrentState().name(), integrationState);
    Assertions.assertThat(integrationOverview.getCurrentState().name()).isEqualTo(integrationState);
}
Also used : IntegrationOverviewEndpoint(io.syndesis.qe.endpoint.IntegrationOverviewEndpoint) IntegrationOverview(io.syndesis.qe.endpoint.model.IntegrationOverview) Then(io.cucumber.java.en.Then)

Example 2 with IntegrationOverview

use of io.syndesis.qe.endpoint.model.IntegrationOverview in project syndesis-qe by syndesisio.

the class CommonValidationSteps method waitForIntegrationToBeActive.

@Then("wait max {int} minutes for integration with name: {string} to become active")
public void waitForIntegrationToBeActive(int waitTime, String integrationName) {
    final long start = System.currentTimeMillis();
    // wait for activation
    log.info("Waiting until integration \"{}\" becomes active. This may take a while...", integrationName);
    String integrationId = integrationsEndpoint.getIntegrationId(integrationName).get();
    final IntegrationOverview integrationOverview = integrationOverviewEndpoint.getOverview(integrationId);
    final boolean activated = TestUtils.waitForPublishing(integrationOverviewEndpoint, integrationOverview, TimeUnit.MINUTES, waitTime);
    if (!activated) {
        log.error("Integration was not active after {} minutes", waitTime);
        final String podName = OpenShiftUtils.getPod(p -> p.getMetadata().getName().contains(integrationName.replaceAll(" ", "-").toLowerCase())).getMetadata().getName();
        log.error(OpenShiftUtils.getInstance().pods().withName(podName).getLog());
        InfraFail.fail("Integration was not active after " + waitTime + " minutes");
    }
    log.info("Integration pod has been started. It took {}s to build the integration.", TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - start));
    if (TestUtils.isJenkins()) {
        log.info("Running on Jenkins, adding 2 min sleep");
        TestUtils.sleepIgnoreInterrupt(120000L);
    }
}
Also used : IntegrationOverview(io.syndesis.qe.endpoint.model.IntegrationOverview) Then(io.cucumber.java.en.Then)

Example 3 with IntegrationOverview

use of io.syndesis.qe.endpoint.model.IntegrationOverview in project syndesis-qe by syndesisio.

the class CommonValidationSteps method verifyIntegrationNotStarted.

@Then("verify that the integration with name {string} is not started")
public void verifyIntegrationNotStarted(String integrationName) {
    String integrationId = integrationsEndpoint.getIntegrationId(integrationName).get();
    final IntegrationOverview integrationOverview = integrationOverviewEndpoint.getOverview(integrationId);
    Assertions.assertThat(TestUtils.waitForPublishing(integrationOverviewEndpoint, integrationOverview, TimeUnit.MINUTES, 9)).as("No more integrations should be started").isFalse();
}
Also used : IntegrationOverview(io.syndesis.qe.endpoint.model.IntegrationOverview) Then(io.cucumber.java.en.Then)

Example 4 with IntegrationOverview

use of io.syndesis.qe.endpoint.model.IntegrationOverview 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 5 with IntegrationOverview

use of io.syndesis.qe.endpoint.model.IntegrationOverview in project syndesis-qe by syndesisio.

the class CommonValidationSteps method verifyWarningOnIntegration.

@Then("check that integration {word} contains warning {string}")
public void verifyWarningOnIntegration(String integrationName, String warning) {
    IntegrationOverview overview = integrationOverviewEndpoint.getOverview(integrationsEndpoint.getIntegrationId(integrationName).get());
    Assertions.assertThat(integrationOverviewEndpoint.getOverview(integrationsEndpoint.getIntegrationId(integrationName).get()).getBoard().getWarnings().getAsInt()).isGreaterThan(0);
    Assertions.assertThat(overview.getBoard().getMessages().stream().filter(leveledMessage -> leveledMessage.getDetail().get().contains(warning)).findFirst()).isNotEmpty();
}
Also used : Then(io.cucumber.java.en.Then) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Autowired(org.springframework.beans.factory.annotation.Autowired) IntegrationOverview(io.syndesis.qe.endpoint.model.IntegrationOverview) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) IntegrationsEndpoint(io.syndesis.qe.endpoint.IntegrationsEndpoint) Assertions.assertThatExceptionOfType(org.assertj.core.api.Assertions.assertThatExceptionOfType) Assertions(org.assertj.core.api.Assertions) Build(io.fabric8.openshift.api.model.Build) Integration(io.syndesis.common.model.integration.Integration) NoSuchElementException(java.util.NoSuchElementException) IntegrationDeployment(io.syndesis.common.model.integration.IntegrationDeployment) IntegrationOverviewEndpoint(io.syndesis.qe.endpoint.IntegrationOverviewEndpoint) InfraFail(io.syndesis.qe.test.InfraFail) When(io.cucumber.java.en.When) Pod(io.fabric8.kubernetes.api.model.Pod) OpenShiftUtils(io.syndesis.qe.utils.OpenShiftUtils) Collectors(java.util.stream.Collectors) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) TestUtils(io.syndesis.qe.utils.TestUtils) IntegrationDeploymentState(io.syndesis.common.model.integration.IntegrationDeploymentState) OpenShiftWaitUtils(io.syndesis.qe.wait.OpenShiftWaitUtils) IntegrationOverview(io.syndesis.qe.endpoint.model.IntegrationOverview) Then(io.cucumber.java.en.Then)

Aggregations

Then (io.cucumber.java.en.Then)5 IntegrationOverview (io.syndesis.qe.endpoint.model.IntegrationOverview)5 IntegrationOverviewEndpoint (io.syndesis.qe.endpoint.IntegrationOverviewEndpoint)2 When (io.cucumber.java.en.When)1 Pod (io.fabric8.kubernetes.api.model.Pod)1 Build (io.fabric8.openshift.api.model.Build)1 Integration (io.syndesis.common.model.integration.Integration)1 IntegrationDeployment (io.syndesis.common.model.integration.IntegrationDeployment)1 IntegrationDeploymentState (io.syndesis.common.model.integration.IntegrationDeploymentState)1 IntegrationsEndpoint (io.syndesis.qe.endpoint.IntegrationsEndpoint)1 InfraFail (io.syndesis.qe.test.InfraFail)1 OpenShiftUtils (io.syndesis.qe.utils.OpenShiftUtils)1 TestUtils (io.syndesis.qe.utils.TestUtils)1 OpenShiftWaitUtils (io.syndesis.qe.wait.OpenShiftWaitUtils)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 NoSuchElementException (java.util.NoSuchElementException)1 TimeUnit (java.util.concurrent.TimeUnit)1 Collectors (java.util.stream.Collectors)1 Slf4j (lombok.extern.slf4j.Slf4j)1