Java 类cucumber.api.java.en.Given 实例源码

项目:syndesis-qe    文件:ConnectionsGeneralSteps.java   
@Given("^create SF connection")
public void createSalesforceConnection() {

    final Account salesforceAccount = accountsDirectory.getAccount("salesforce").get();
    final Connector salesforceConnector = connectorsEndpoint.get("salesforce");

    final Connection salesforceConnection = new Connection.Builder()
            .connector(salesforceConnector)
            .connectorId(salesforceConnector.getId())
            .id(RestConstants.getInstance().getSALESFORCE_CONNECTION_ID())
            .icon("fa-puzzle-piece")
            .name("New Fuse QE salesforce")
            .configuredProperties(TestUtils.map(
                    "clientId", salesforceAccount.getProperty("clientId"),
                    "clientSecret", salesforceAccount.getProperty("clientSecret"),
                    "loginUrl", salesforceAccount.getProperty("loginUrl"),
                    "userName", salesforceAccount.getProperty("userName"),
                    "password", salesforceAccount.getProperty("password")))
            .build();

    log.info("Creating salesforce connection {}", salesforceConnection.getName());
    connectionsEndpoint.create(salesforceConnection);
}
项目:TigerIsland    文件:SettlementFoundationStepDefs.java   
@Given("^There is a tile with an unoccupied Terrain hex$")
public void there_is_a_tile_with_an_unoccupied_Terrain_hex() throws Throwable {

    ArrayList<Coordinate> coordinates = new ArrayList<>();
    coordinates.add(new Coordinate(100,100));
    coordinates.add(new Coordinate(101,101));
    coordinates.add(new Coordinate(100,101));

    ArrayList<TerrainType> terrains = new ArrayList<>();
    terrains.add(TerrainType.VOLCANO);
    terrains.add(TerrainType.GRASS);
    terrains.add(TerrainType.LAKE);

    Tile tile = new Tile(coordinates, terrains);

    try{ game.placeTile(tile); }
    catch (AssertionError e){ exceptionThrown = true; }

}
项目:TigerIsland    文件:GridStepDefs.java   
@Given("^there are tiles placed on the board$")
public void there_are_tiles_placed_on_the_board() throws Throwable {
    gameBoard = new Grid(200);
    ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
    coordinates.add(new Coordinate(100,100));
    coordinates.add(new Coordinate(101,101));
    coordinates.add(new Coordinate(100,101));

    ArrayList<TerrainType> terrains = new ArrayList<TerrainType>();
    terrains.add(TerrainType.VOLCANO);
    terrains.add(TerrainType.GRASS);
    terrains.add(TerrainType.LAKE);

    Hex[] hexes = new Hex[3];
    hexes[0] = new Hex(new Coordinate(100,100), TerrainType.VOLCANO);
    hexes[1] = new Hex(new Coordinate(101,101), TerrainType.GRASS);
    hexes[2] = new Hex(new Coordinate(100,101), TerrainType.LAKE);

    Tile tile = new Tile(coordinates, terrains);
    try {gameBoard.placeTile(tile);}
    catch (AssertionError e) { exceptionThrown = true; }

}
项目:participationSystem3b    文件:AllTest.java   
@Given("^the user is on the login page$")
 public void a_list_of_users() throws Throwable {
driver.get(baseUrl+"/");
SeleniumUtils.entrarComoUsuario(driver);

SeleniumUtils.EsperaCargaPagina(driver, "id", "crear", 10);
SeleniumUtils.textoPresentePagina(driver, "Crea tu propuesta");
}
项目:NoraUi    文件:HelloByeSteps.java   
@RetryOnFailure(attempts = 3)
@Given("me any article, please. '(.*)' of '(.*)'.")
public void readBlog(String jsonArticles, String blog) throws FailureException {
    Articles articles = new Articles();
    articles.deserialize(jsonArticles);
    for (Article article : articles) {
        if ("anonymous".equals(article.getAuthor())) {
            new Result.Failure<>("anonymous", "anonymous is prohibited in demo blog!!", true, this.demoPage.getCallBack());
        } else {
            logger.info("> " + blog);
            logger.info("    > " + article.getTitle() + ": " + article.getText());
        }
    }
}
项目:syndesis-qe    文件:SalesforceSteps.java   
@Given("^create SF step for TW SF test")
public void createSfTwStep() {
    final Connector salesforceConnector = connectorsEndpoint.get("salesforce");

    final Connection salesforceConnection = connectionsEndpoint.get(RestConstants.getInstance().getSALESFORCE_CONNECTION_ID());
    final Step salesforceStep = new SimpleStep.Builder()
            .stepKind("endpoint")
            .connection(salesforceConnection)
            .action(TestUtils.findConnectorAction(salesforceConnector, "salesforce-create-sobject"))
            .build();
    steps.getSteps().add(salesforceStep);
}
项目:QAExercises    文件:RpnCalculatorStepdefs.java   
@Given("^the previous entries:$")
public void thePreviousEntries(List<Entry> entries) {
    for (Entry entry : entries) {
        calc.push(entry.first);
        calc.push(entry.second);
        calc.push(entry.operation);
    }
}
项目:pugtsdb    文件:RollUpGranularitySteps.java   
@Given("^a point on \"([^\"]*)\" \"([^\"]*)\" with a double (\\d+)$")
public void aPointOnWithADouble(String timestampState, String timestampUnitString, Double value) throws Throwable {
    String sql = " INSERT INTO point (\"metric_id\", \"timestamp\", \"value\") VALUES (?, ?, ?) ";

    try (Connection connection = pugTSDB.getDataSource().getConnection();
         PreparedStatement statement = connection.prepareStatement(sql)) {
        statement.setInt(1, metric.getId());
        statement.setTimestamp(2, resolveTimestamp(timestampState, timestampUnitString));
        statement.setBytes(3, metric.valueToBytes(value));
        statement.execute();
    }
}
项目:openaffect-server    文件:ReportMeauresSteps.java   
@Given("^there is an OpenAffect server")
public void there_is_an_OpenAffect_server() throws Throwable {
    Properties properties = new Properties();
    properties.load(this.getClass().getClassLoader().getResourceAsStream("environment.properties"));
    String url = properties.getProperty("io.openaffect.server.url");
    api.getApiClient().setBasePath(url);
}
项目:jwala    文件:BatchLoginRunSteps.java   
@Given("^I load predefined user accounts$")
public void loadUserAccounts() throws IOException {
    try (final Stream<String> stream = Files.lines(Paths.get(jwalaUi.getProperties().getProperty("data.source.dir")
            + "/user-accounts.csv"))) {
        stream.skip(1).forEach(item -> userAccounts.add(item.split(",")));
    }
}
项目:careconnect-reference-implementation    文件:FHIRServerResourceRESTfulSteps.java   
@Given("^Patient Search by familyName kanfeld$")
public void patient_Search_by_familyName_kanfeld() throws Throwable {
//    ourLog.info("GIVEN - Patient Search by familyName");

    bundle = client.search().forResource(Patient.class)
            .where(new StringClientParam("family").matches().value("kanfeld"))
            .returnBundle(Bundle.class).execute();

    Assert.assertNotNull(bundle);
}
项目:jwala    文件:CommonRunSteps.java   
@Given("^I created a group with the name \"(.*)\"$")
public void createGroup(final String groupName) {
    createGroupRunSteps.goToGroupTab();
    createGroupRunSteps.clickAddGroupBtn();
    createGroupRunSteps.checkIfAddGroupDialogBoxIsDisplayed();
    createGroupRunSteps.setGroupName(groupName);
    createGroupRunSteps.clickOkBtn();
    createGroupRunSteps.checkIfGroupWasAdded(groupName);
}
项目:hippo    文件:CmsSteps.java   
@Given("^I have a published publication with nominal date falling after (\\d+) weeks from now$")
public void iHaveAPublishedPublicationWithNominalDateFallingAfterWeeksFromNow(final int weeksFromNow)
    throws Throwable {

    final Publication publicationWithNominalDateBeforeCutOff = TestDataFactory.createBareMinimumPublication()
        .withNominalDate(Instant.now()
            .plus(DAYS_IN_WEEK * weeksFromNow, ChronoUnit.DAYS)
            .plus(1, ChronoUnit.DAYS))
        .build();

    testDataRepo.setPublication(publicationWithNominalDateBeforeCutOff);

    createPublishedPublication(publicationWithNominalDateBeforeCutOff);
}
项目:dashboard1b    文件:CucumberSteps.java   
@Given("^the user navigates to \"([^\"]*)\"$")
public void theUserNavigatesTo(String url) throws Throwable {
    driver.get(baseUrl + "/");
    assertTrue(su.isElementPresent(By.id(("email"))));
    assertTrue(su.isElementPresent(By.id(("password"))));


}
项目:open-kilda    文件:FlowPathTest.java   
@Given("^a multi-path topology$")
public void a_multi_path_topology() throws Throwable {
    ClassLoader classLoader = getClass().getClassLoader();
    File file = new File(classLoader.getResource(fileName).getFile());
    String json = new String(Files.readAllBytes(file.toPath()));

    pre_start = System.currentTimeMillis();
    assertTrue(TopologyHelp.CreateMininetTopology(json));
    start = System.currentTimeMillis();
}
项目:open-kilda    文件:FlowCrudBasicRunTest.java   
@Given("^a nonrandom linear topology of 5 switches$")
public void a_multi_path_topology() throws Throwable {
    ClassLoader classLoader = getClass().getClassLoader();
    File file = new File(classLoader.getResource(fileName).getFile());
    String json = new String(Files.readAllBytes(file.toPath()));
    assertTrue(TopologyHelp.CreateMininetTopology(json));
    // Should also wait for some of this to come up

}
项目:syndesis-qe    文件:S3Steps.java   
@Given("^create S3 copy step with bucket: \"([^\"]*)\"")
public void createS3CopyStep(String bucketName) {
    final Connector s3Connector = connectorsEndpoint.get("aws-s3");
    final Connection s3Connection = connectionsEndpoint.get(bucketName);
    final Step s3Step = new SimpleStep.Builder()
            .stepKind("endpoint")
            .connection(s3Connection)
            .action(TestUtils.findConnectorAction(s3Connector, "aws-s3-copy-object-connector"))
            .build();

    steps.getSteps().add(s3Step);
}
项目:jwala    文件:CommonRunSteps.java   
@Given("^I created a web app resource with the following parameters:$")
public void createWebAppResources(final Map<String, String> parameters) {
    navigationRunSteps.goToResourceTab();
    uploadResourceRunSteps.expandNode(parameters.get("group"));
    uploadResourceRunSteps.expandNode("Web Apps");
    uploadResourceRunSteps.clickNode(parameters.get("webApp"));
    uploadResourceRunSteps.clickAddResourceBtn();
    uploadResourceRunSteps.setDeployName(parameters.get("deployName"));
    uploadResourceRunSteps.setDeployPath(parameters.get("deployPath"));
    uploadResourceRunSteps.selectResourceFile(parameters.get("templateName"));
    uploadResourceRunSteps.clickAssignToJvmsCheckbox();
    uploadResourceRunSteps.clickUploadResourceDlgOkBtn();
    uploadResourceRunSteps.checkForSuccessfulResourceUpload();
}
项目:syndesis-qe    文件:S3ValidationSteps.java   
@Given("^clean S3 to S3 scenario, removes two sample buckets with names: \"([^\"]*)\"")
public void cleanupTwSf(List<String> bucketNames) {
    for (String bucket : bucketNames) {
        s3Utils.deleteS3Bucket(bucket);
    }
    TestSupport.getInstance().resetDB();
}
项目:hippo    文件:CmsSteps.java   
@Given("^I have a publication opened for editing$")
public void iHaveAPublicationOpenForEditing() throws Throwable {
    final Publication publication = TestDataFactory.createBareMinimumPublication().build();
    testDataRepo.setPublication(publication);

    createPublicationInEditableState(publication);

    // Since previous step created a new document which was not saved, immediately after a login,
    // the edit document screen is displayed (instead of dashboard)
    assertTrue("Publication edit screen is displayed", contentPage.isDocumentEditScreenOpen());
}
项目:QAExercises    文件:ShoppingStepdefs.java   
@Given("^the following groceries:$")
public void the_following_groceries(List<Grocery> groceries) {
    for (Grocery grocery : groceries) {
        calc.push(grocery.price.value);
        calc.push("+");
    }
}
项目:keti    文件:PolicyCreationStepsDefinitions.java   
@Given("^A policy with multiple actions containing one invalid action defined")
public void policy_with_multiple_actions_containing_one_invalid_action_defined() throws Throwable {
    this.testPolicyName = "multiple-actions-with-single-invalid-action-defined-policy-set";
    this.status = this.policyHelper.createPolicySet(
            "src/test/resources/multiple-actions-with-single-invalid-action-defined-policy-set.json",
            this.acsitSetUpFactory.getAcsZoneAdminRestTemplate(), this.acsitSetUpFactory.getZone1Headers());
}
项目:careconnect-reference-implementation    文件:FHIRServerResourceRESTfulSteps.java   
@Given("^Location Search by name Long$")
public void location_Search_by_name_Long() throws Throwable {
    bundle = client.search().forResource(Location.class)
            .where(new StringClientParam("name").matches().value("Long Eaton"))
            .returnBundle(Bundle.class).execute();

    Assert.assertNotNull(bundle);
}
项目:pugtsdb    文件:RollUpListenerSteps.java   
@Given("^a double metric named \"([^\"]*)\"$")
public void aDoubleMetricNamed(String name) throws Throwable {
    metric = new DoubleMetric(name, emptyMap());
    repositories.getMetricRepository().insertMetric(metric);
    repositories.getMetricRepository().getConnection().commit();
    repositories.getMetricRepository().getConnection().close();
}
项目:NoraUi    文件:LogoGameSteps.java   
/**
 * A check that all brands are not prohibited, because any minors can not play with alcohol and tobacco brands.
 *
 * @param jsonLogos
 *            Serialized Json representation of all logos (all brands)
 * @throws TechnicalException
 *             is throws if you have a technical error (format, configuration, datas, ...) in NoraUi.
 * @throws FailureException
 *             if the scenario encounters a functional error
 */
@Lorsque("Je vérifie que toutes les marques '(.*)' ne sont pas interdites")
@Given("I check that all brands '(.*)' are not prohibited")
public void checkThatAllBrandsIsNotProhibited(String jsonLogos) throws TechnicalException, FailureException {
    Logos logos = new Logos();
    logos.deserialize(jsonLogos);
    for (int i = 0; i < logos.size(); i++) {
        if (ProhibitedBrands.getAlcool().contains(logos.get(i).getBrand()) || ProhibitedBrands.getTabaco().contains(logos.get(i).getBrand())) {
            new Result.Failure<>(logos.get(i).getBrand(), Messages.format("Brand « %s » is prohibited.", logos.get(i).getBrand()), false, logos.get(i).getNid(),
                    Context.getCallBack(Callbacks.RESTART_WEB_DRIVER));
        }
    }
}
项目:hippo    文件:CmsSteps.java   
@Given("^I have a published publication with nominal date falling before (-?\\d+) (days|weeks|years) from now$")
public void iHaveAPublishedPublicationWithNominalDateFallingBeforeWeeksFromNow(final int valueFromNow, final String unit)
    throws Throwable {

    ChronoUnit chronoUnit = ChronoUnit.valueOf(unit.toUpperCase());
    final Publication publicationWithNominalDateBeforeCutOff = TestDataFactory.createBareMinimumPublication()
        .withNominalDate(LocalDateTime.now()
            .plus(valueFromNow, chronoUnit)
            .toInstant(ZoneOffset.UTC))
        .build();

    testDataRepo.setPublication(publicationWithNominalDateBeforeCutOff);

    createPublishedPublication(publicationWithNominalDateBeforeCutOff);
}
项目:jwala    文件:NavigationRunSteps.java   
@Given("^I expand the group operation's \"(.*)\" group$")
public void expandGroupInOperationsTab(final String groupName) {
    // check first if the group is already expanded, if it is there is no need to expand it
    if (jwalaUi.isElementExists(
            By.xpath("//td[text()='" + groupName + "']/preceding-sibling::td//span[contains(@class,'ui-icon-triangle-1-e')]"))) {
        jwalaUi.click(By.xpath("//td[text()='" + groupName + "']/preceding-sibling::td"));
    }
}
项目:pugtsdb    文件:RollUpGranularitySteps.java   
@Given("^a double metric named \"([^\"]*)\"$")
public void aDoubleMetricNamed(String name) throws Throwable {
    metric = new DoubleMetric(name, emptyMap());
    repositories.getMetricRepository().insertMetric(metric);
    repositories.getMetricRepository().getConnection().commit();
    repositories.getMetricRepository().getConnection().close();
}
项目:careconnect-reference-implementation    文件:JPAStepsDef.java   
@Given("^I have one AllergyIntolerance resource loaded$")
public void i_have_one_AllergyIntolerance_resource_loaded() throws Throwable {
    assertNotNull(allergyIntoleranceRepository.read(ctx,new IdType(1)));
}
项目:mastering-junit5    文件:BookSearchSteps.java   
@Given(".+book with the title '(.+)', written by '(.+)', published in (.+)")
public void addNewBook(final String title, final String author,
        @Format("dd MMMMM yyyy") final Date published) {
    Book book = new Book(title, author, published);
    library.addBook(book);
}
项目:careconnect-reference-implementation    文件:JPAStepsDef.java   
@Given("^I search for Organisations by SDSCode (\\w+)$")
public void i_have_search_for_these_Organisations_by_SDSCode(String SDSCode) throws Throwable {
    organizationList = organisationRepository.searchOrganization(new TokenParam().setSystem(CareConnectSystem.ODSOrganisationCode).setValue(SDSCode),null);
}
项目:testee.fi    文件:CucumberSteps.java   
@Given("^Cucumber works$")
public void cucumberWorks() {
    if (someBean == null) {
        throw new AssertionError("someBean should not be null");
    }
}
项目:jwala    文件:NavigationRunSteps.java   
@Given("^I am in the admin tab$")
public void goToAdminTab() {
    jwalaUi.clickTab("Admin");
}
项目:jwala    文件:UploadResourceRunSteps.java   
@Given("^I expand \"(.*)\" node$")
public void expandNode(final String nodeName) {
    if(!checkIfNodeIsAlreadyExpanded(nodeName))
    jwalaUi.expandNode(nodeName);
}
项目:careconnect-reference-implementation    文件:JPAStepsDef.java   
@Given("^I add a Patient with an Id of (\\d+)$")
public void i_add_a_Patient_with_an_Id_of(Integer id) throws Throwable {
    patient = patientRepository.read(ctx,new IdType().setValue(id.toString()));
}
项目:careconnect-reference-implementation    文件:JPAStepsDef.java   
@Given("^I have one Encounter resource loaded$")
public void i_have_one_Encounter_resource_loaded() throws Throwable {
    assertNotNull(encounterRepository.read(ctx,new IdType(1)));
}
项目:careconnect-reference-implementation    文件:JPAStepsDef.java   
@Given("^I add a ValueSet with an Id of ([^\"]*)$")
public void i_add_a_ValueSet_with_an_Id_of(String valueSetId) throws Throwable {
    resource = (Resource) valueSetRepository.read(new IdType().setValue("ValueSet/"+valueSetId));
}
项目:ohtu_miniprojekti    文件:Stepdefs.java   
@Given("^command \"([^\"]*)\" is selected$")
public void g_command_selected(String cmd) throws Throwable {
    inputLines.add(cmd);
}
项目:kheera    文件:DefaultStepDefs.java   
/**
 * see if all elements matching param1* are visible
 */
@Given("^sees all \"(.*)\"$")
public void seesAll(String fieldNamePattern) throws Exception{      
    super.seesAll(fieldNamePattern);
}
项目:syndesis-qe    文件:SfDbValidationSteps.java   
@Given("^clean before SF to DB, removes user with first name: \"([^\"]*)\" and last name: \"([^\"]*)\"")
public void cleanupSfDb(String firstName, String lastName) throws TwitterException {
    TestSupport.getInstance().resetDB();
    deleteAllSalesforceLeadsWithName(salesforce, firstName, lastName);
    dbUtils.deleteRecordsInTable(RestConstants.getInstance().getTODO_APP_NAME());
}