Class BigDataGSpec


  • public class BigDataGSpec
    extends BaseGSpec
    Steps definition for big data functionality
    • Constructor Detail

      • BigDataGSpec

        public BigDataGSpec​(CommonG spec)
        Generic constructor.
        Parameters:
        spec - object
    • Method Detail

      • createBasicMapping

        @Given("^I create a Cassandra index named \'(.+?)\' in table \'(.+?)\' using magic_column \'(.+?)\' using keyspace \'(.+?)\'$")
        public void createBasicMapping​(String index_name,
                                       String table,
                                       String column,
                                       String keyspace)
                                throws Exception
        Create a basic Index.
        Parameters:
        index_name - index name
        table - the table where index will be created.
        column - the column where index will be saved
        keyspace - keyspace used
        Throws:
        Exception - exception
      • createCassandraKeyspace

        @Given("^I create a Cassandra keyspace named \'(.+)\'$")
        public void createCassandraKeyspace​(String keyspace)
        Create a Cassandra Keyspace.
        Parameters:
        keyspace - cassandra keyspace
      • connect

        @Given("^I connect to \'(Cassandra|Mongo|Elasticsearch)\' cluster at \'(.+)\'$")
        public void connect​(String clusterType,
                            String url)
                     throws DBException,
                            UnknownHostException
        Connect to cluster.
        Parameters:
        clusterType - DB type (Cassandra|Mongo|Elasticsearch)
        url - url where is started Cassandra cluster
        Throws:
        DBException - DBException
        UnknownHostException - UnknownHostException
      • createTableWithData

        @Given("^I create a Cassandra table named \'(.+?)\' using keyspace \'(.+?)\' with:$")
        public void createTableWithData​(String table,
                                        String keyspace,
                                        io.cucumber.datatable.DataTable datatable)
        Create table
        Parameters:
        table - Cassandra table
        datatable - datatable used for parsing elements
        keyspace - Cassandra keyspace
      • insertData

        @Given("^I insert in keyspace \'(.+?)\' and table \'(.+?)\' with:$")
        public void insertData​(String keyspace,
                               String table,
                               io.cucumber.datatable.DataTable datatable)
        Insert Data
        Parameters:
        table - Cassandra table
        datatable - datatable used for parsing elements
        keyspace - Cassandra keyspace
      • dropElasticsearchIndexes

        @Given("^I drop every existing elasticsearch index$")
        public void dropElasticsearchIndexes()
        Drop all the ElasticSearch indexes.
      • dropElasticsearchIndex

        @Given("^I drop an elasticsearch index named \'(.+?)\'$")
        public void dropElasticsearchIndex​(String index)
        Drop an specific index of ElasticSearch.
        Parameters:
        index - ES index
      • dropCassandraKeyspace

        @Given("^I drop a Cassandra keyspace \'(.+)\'$")
        public void dropCassandraKeyspace​(String keyspace)
        Drop a Cassandra Keyspace.
        Parameters:
        keyspace - Cassandra keyspace
      • createMongoDBDataBase

        @Given("^I create a MongoDB dataBase \'(.+?)\'$")
        public void createMongoDBDataBase​(String databaseName)
        Create a MongoDB dataBase.
        Parameters:
        databaseName - Mongo database
      • dropMongoDBDataBase

        @Given("^I drop a MongoDB database \'(.+?)\'$")
        public void dropMongoDBDataBase​(String databaseName)
        Drop MongoDB Database.
        Parameters:
        databaseName - mongo database
      • insertOnMongoTable

        @Given("^I insert into a MongoDB database \'(.+?)\' and table \'(.+?)\' this values:$")
        public void insertOnMongoTable​(String dataBase,
                                       String tabName,
                                       io.cucumber.datatable.DataTable table)
        Insert data in a MongoDB table.
        Parameters:
        dataBase - Mongo database
        tabName - Mongo table
        table - Datatable used for insert elements
      • truncateTableInMongo

        @Given("^I drop every document at a MongoDB database \'(.+?)\' and table \'(.+?)\'")
        public void truncateTableInMongo​(String database,
                                         String table)
        Truncate table in MongoDB.
        Parameters:
        database - Mongo database
        table - Mongo table
      • insertOnMongoTable

        @Given("^I insert into MongoDB database \'(.+?)\' and collection \'(.+?)\' the document from schema \'(.+?)\'$")
        public void insertOnMongoTable​(String dataBase,
                                       String collection,
                                       String document)
                                throws Exception
        Insert document in a MongoDB table.
        Parameters:
        dataBase - Mongo database
        collection - Mongo collection
        document - document used for schema
        Throws:
        Exception - Exception
      • connectToZk

        @Given("^I connect to Zookeeper at \'(.+)\'$")
        public void connectToZk​(String zookeeperHosts)
                         throws InterruptedException
        Connect to zookeeper.
        Parameters:
        zookeeperHosts - as host:port (comma separated)
        Throws:
        InterruptedException - exception
      • sendQueryOfType

        @When("^I execute a query over fields \'(.+?)\' with schema \'(.+?)\' of type \'(json|string)\' with magic_column \'(.+?)\' from table: \'(.+?)\' using keyspace: \'(.+?)\' with:$")
        public void sendQueryOfType​(String fields,
                                    String schema,
                                    String type,
                                    String magic_column,
                                    String table,
                                    String keyspace,
                                    io.cucumber.datatable.DataTable modifications)
        Execute a query with schema over a cluster
        Parameters:
        fields - columns on which the query is executed. Example: "latitude,longitude" or "*" or "count(*)"
        schema - the file of configuration (.conf) with the options of mappin. If schema is the word "empty", method will not add a where clause.
        type - type of the changes in schema (string or json)
        table - table for create the index
        magic_column - magic column where index will be saved. If you don't need index, you can add the word "empty"
        keyspace - keyspace used
        modifications - all data in "where" clause. Where schema is "empty", query has not a where clause. So it is necessary to provide an empty table. Example: ||.
      • sendQueryOfType

        @When("^I execute a query \'(.+?)\' of type \'(json|string)\' in mongo \'(.+?)\' database using collection \'(.+?)\' with:$")
        public void sendQueryOfType​(String query,
                                    String type,
                                    String database,
                                    String collection,
                                    io.cucumber.datatable.DataTable modifications)
                             throws Exception
        Execute a query on (mongo) database
        Parameters:
        query - path to query
        type - type of data in query (string or json)
        database - MongoDB database
        collection - collection in database
        modifications - modifications to perform in query
        Throws:
        Exception - Exception
      • elasticSearchQueryWithFilter

        @When("^I execute an elasticsearch query over index \'(.*?)\' and mapping \'(.*?)\' and column \'(.*?)\' with value \'(.*?)\' to \'(.*?)\'$")
        public void elasticSearchQueryWithFilter​(String indexName,
                                                 String mappingName,
                                                 String columnName,
                                                 String filterType,
                                                 String value)
        Execute query with filter over elasticsearch
        Parameters:
        indexName - index name
        mappingName - mapping name
        columnName - column Name
        filterType - it could be equals, gt, gte, lt and lte.
        value - value of the column to be filtered.
      • createCustomMapping

        @When("^I create a Cassandra index named \'(.+?)\' with schema \'(.+?)\' of type \'(json|string)\' in table \'(.+?)\' using magic_column \'(.+?)\' using keyspace \'(.+?)\' with:$")
        public void createCustomMapping​(String index_name,
                                        String schema,
                                        String type,
                                        String table,
                                        String magic_column,
                                        String keyspace,
                                        io.cucumber.datatable.DataTable modifications)
                                 throws Exception
        Create a Cassandra index.
        Parameters:
        index_name - index name
        schema - the file of configuration (.conf) with the options of mappin
        type - type of the changes in schema (string or json)
        table - table for create the index
        magic_column - magic column where index will be saved
        keyspace - keyspace used
        modifications - data introduced for query fields defined on schema
        Throws:
        Exception - Exception
      • dropTableWithData

        @When("^I drop a Cassandra table named \'(.+?)\' using keyspace \'(.+?)\'$")
        public void dropTableWithData​(String table,
                                      String keyspace)
        Drop table
        Parameters:
        table - Table name
        keyspace - Keyspace
      • truncateTable

        @When("^I truncate a Cassandra table named \'(.+?)\' using keyspace \'(.+?)\'$")
        public void truncateTable​(String table,
                                  String keyspace)
        Truncate table
        Parameters:
        table - table name
        keyspace - keyspace
      • removeZNode

        @When("^I remove the zNode \'(.+?)\'$")
        public void removeZNode​(String zNode)
                         throws Exception
        Delete zPath, it should be empty
        Parameters:
        zNode - Path at zookeeper
        Throws:
        Exception - Exception
      • createZNode

        @When("^I create the zNode \'(.+?)\'( with content \'(.+?)\')? which (IS|IS NOT) ephemeral$")
        public void createZNode​(String path,
                                String foo,
                                String content,
                                boolean ephemeral)
                         throws Exception
        Create zPath and domcument
        Parameters:
        path - path at zookeeper
        foo - a dummy match group
        content - if it has content it should be defined
        ephemeral - if it's created as ephemeral or not
        Throws:
        Exception - Exception
      • createElasticsearchIndex

        @When("^I create an elasticsearch index named \'(.+?)\'( removing existing index if exist)?$")
        public void createElasticsearchIndex​(String index,
                                             String removeIndex)
        Create an elasticsearch index.
        Parameters:
        index - index
        removeIndex - removeIndex
      • indexElasticsearchDocument

        @When("^I index a document in the index named \'(.+?)\' using the mapping named \'(.+?)\' with key \'(.+?)\' and value \'(.+?)\'$")
        public void indexElasticsearchDocument​(String indexName,
                                               String mappingName,
                                               String key,
                                               String value)
                                        throws Exception
        Index a document within a mapping type.
        Parameters:
        indexName - indexName
        mappingName - mappingName
        key - key
        value - value
        Throws:
        Exception - Exception
      • assertKeyspaceOnCassandraExists

        @Then("^a Cassandra keyspace \'(.+?)\' exists$")
        public void assertKeyspaceOnCassandraExists​(String keyspace)
        Checks if a keyspaces exists in Cassandra.
        Parameters:
        keyspace - keyspace
      • assertTableExistsOnCassandraKeyspace

        @Then("^a Cassandra keyspace \'(.+?)\' contains a table \'(.+?)\'$")
        public void assertTableExistsOnCassandraKeyspace​(String keyspace,
                                                         String tableName)
        Checks if a cassandra keyspace contains a table.
        Parameters:
        keyspace - keyspace
        tableName - tableName
      • assertRowNumberOfTableOnCassandraKeyspace

        @Then("^a Cassandra keyspace \'(.+?)\' contains a table \'(.+?)\' with \'(.+?)\' rows$")
        public void assertRowNumberOfTableOnCassandraKeyspace​(String keyspace,
                                                              String tableName,
                                                              String numberRows)
        Checks the number of rows in a cassandra table.
        Parameters:
        keyspace - keyspace
        tableName - tableName
        numberRows - numberRows
      • assertValuesOfTable

        @Then("^a Cassandra keyspace \'(.+?)\' contains a table \'(.+?)\' with values:$")
        public void assertValuesOfTable​(String keyspace,
                                        String tableName,
                                        io.cucumber.datatable.DataTable data)
                                 throws InterruptedException
        Checks if a cassandra table contains the values of a DataTable.
        Parameters:
        keyspace - keyspace
        tableName - tableName
        data - data
        Throws:
        InterruptedException - InterruptedException
      • assertValuesOfTableMongo

        @Then("^a Mongo dataBase \'(.+?)\' contains a table \'(.+?)\' with values:")
        public void assertValuesOfTableMongo​(String dataBase,
                                             String tableName,
                                             io.cucumber.datatable.DataTable data)
        Checks the values of a MongoDB table.
        Parameters:
        dataBase - dataBase
        tableName - tableName
        data - data
      • aMongoDataBaseContainsaTable

        @Then("^a Mongo dataBase \'(.+?)\' doesnt contains a table \'(.+?)\'$")
        public void aMongoDataBaseContainsaTable​(String database,
                                                 String tableName)
        Checks if a MongoDB database contains a table.
        Parameters:
        database - database
        tableName - tableName
      • checkZnodeExists

        @Then("^the zNode \'(.+?)\' exists( and contains \'(.+?)\')?$")
        public void checkZnodeExists​(String zNode,
                                     String foo,
                                     String document)
                              throws Exception
        Read zPath
        Parameters:
        zNode - path at zookeeper
        document - expected content of znode
        foo - Required parameter for optional string
        Throws:
        Exception - Exception
      • checkZnodeNotExist

        @Then("^the zNode \'(.+?)\' does not exist")
        public void checkZnodeNotExist​(String zNode)
                                throws Exception
        Throws:
        Exception
      • elasticSearchIndexExist

        @Then("^An elasticsearch index named \'(.+?)\' exists")
        public void elasticSearchIndexExist​(String indexName)
        Check that the ElasticSearch index exists.
        Parameters:
        indexName - indexName
      • elasticSearchIndexDoesNotExist

        @Then("^An elasticsearch index named \'(.+?)\' does not exist")
        public void elasticSearchIndexDoesNotExist​(String indexName)
        Check that the ElasticSearch index does not exist.
        Parameters:
        indexName - indexName
      • elasticSearchIndexContainsDocument

        @Then("^The Elasticsearch index named \'(.+?)\' and mapping \'(.+?)\' contains a column named \'(.+?)\' with the value \'(.+?)\'$")
        public void elasticSearchIndexContainsDocument​(String indexName,
                                                       String mappingName,
                                                       String columnName,
                                                       String columnValue)
                                                throws Exception
        Check that an elasticsearch index contains a specific document
        Parameters:
        indexName - indexName
        columnName - columnName
        columnValue - columnValue
        mappingName - mappingName
        Throws:
        Exception - Exception