Search in sources :

Example 1 with When

use of io.cucumber.java.en.When in project cucumber-jvm by cucumber.

the class SpringInjectionStepDefinitions method I_call_the_url.

@When("I call the url {string}")
public void I_call_the_url(String url) throws Throwable {
    MockMvc mock = MockMvcBuilders.webAppContextSetup(wac).build();
    callUrl = mock.perform(get(url));
}
Also used : MockMvc(org.springframework.test.web.servlet.MockMvc) When(io.cucumber.java.en.When)

Example 2 with When

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

the class OperatorValidationSteps method updateCustomResource.

@When("update CR with {string} file")
public void updateCustomResource(String file) {
    Syndesis syndesis = ResourceFactory.get(Syndesis.class);
    syndesis.editCr(getCrFromFileAsString(file));
}
Also used : Syndesis(io.syndesis.qe.resource.impl.Syndesis) When(io.cucumber.java.en.When)

Example 3 with When

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

the class DataMapperSteps method mapDataMapperStep.

@When("MAP using Step {int} and field {string} to {string}")
public void mapDataMapperStep(int fromStep, String fromField, String toField) {
    DataMapperStepDefinition newDmStep = new DataMapperStepDefinition();
    newDmStep.setFromStep(fromStep);
    newDmStep.setInputFields(Collections.singletonList(fromField));
    newDmStep.setOutputFields(Collections.singletonList(toField));
    newDmStep.setMappingType(MappingType.MAP);
    newDmStep.setStrategy(null);
    super.getSteps().getLastStepDefinition().getDataMapperDefinition().getDataMapperStepDefinition().add(newDmStep);
}
Also used : DataMapperStepDefinition(io.syndesis.qe.entities.DataMapperStepDefinition) When(io.cucumber.java.en.When)

Example 4 with When

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

the class DataMapperSteps method separateDataMapperStep.

@When("SEPARATE using Step {int} and strategy {string} and source {string} into targets")
public void separateDataMapperStep(int fromStep, String strategy, String sourceField, DataTable targetMappingData) {
    DataMapperStepDefinition newDmStep = new DataMapperStepDefinition();
    newDmStep.setFromStep(fromStep);
    newDmStep.setInputFields(Collections.singletonList(sourceField));
    newDmStep.setOutputFields(targetMappingData.transpose().asList(String.class));
    newDmStep.setMappingType(MappingType.SEPARATE);
    newDmStep.setStrategy(SeparatorType.valueOf(strategy));
    super.getSteps().getLastStepDefinition().getDataMapperDefinition().getDataMapperStepDefinition().add(newDmStep);
}
Also used : DataMapperStepDefinition(io.syndesis.qe.entities.DataMapperStepDefinition) When(io.cucumber.java.en.When)

Example 5 with When

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

the class JmsValidationSteps method publishMessageFromResourceToDestinationWithName.

/**
 * Load JMS message from resource and send it to the topic/queue with name
 *
 * @param resourceName - name of resource file with the message
 * @param type - queue or topic
 * @param name - name of topic/queue
 */
@When("publish JMS message from resource {string} to {string} with name {string}")
public void publishMessageFromResourceToDestinationWithName(String resourceName, String type, String name) throws IOException {
    ClassLoader classLoader = this.getClass().getClassLoader();
    URL fileUrl = classLoader.getResource("jms_messages/" + resourceName);
    if (fileUrl == null) {
        fail("File with name " + resourceName + " doesn't exist in the resources");
    }
    File file = new File(fileUrl.getFile());
    String jmsMessage = new String(Files.readAllBytes(file.toPath()));
    JMSUtils.sendMessage("tcp", JMSUtils.Destination.valueOf(type.toUpperCase()), name, jmsMessage);
}
Also used : File(java.io.File) URL(java.net.URL) When(io.cucumber.java.en.When)

Aggregations

When (io.cucumber.java.en.When)111 SelenideElement (com.codeborne.selenide.SelenideElement)23 Map (java.util.Map)10 File (java.io.File)8 AttributeType (com.vaticle.typedb.core.concept.type.AttributeType)7 ModalDialogPage (io.syndesis.qe.pages.ModalDialogPage)7 Attribute (com.vaticle.typedb.core.concept.thing.Attribute)6 Account (io.syndesis.qe.account.Account)6 Form (io.syndesis.qe.fragments.common.form.Form)6 Syndesis (io.syndesis.qe.resource.impl.Syndesis)6 TimeoutException (java.util.concurrent.TimeoutException)6 RoleType (com.vaticle.typedb.core.concept.type.RoleType)5 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 Slf4j (lombok.extern.slf4j.Slf4j)5 ElementsCollection (com.codeborne.selenide.ElementsCollection)4 DataTable (io.cucumber.datatable.DataTable)4 IntegrationsEndpoint (io.syndesis.qe.endpoint.IntegrationsEndpoint)4 SyndesisRootPage (io.syndesis.qe.pages.SyndesisRootPage)4 List (java.util.List)4