idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
122,100
public ImportStatus importCorporaSave ( boolean overwrite , String aliasName , String statusEmailAdress , boolean waitForOtherTasks , String ... paths ) { return importCorporaSave ( overwrite , aliasName , statusEmailAdress , waitForOtherTasks , Arrays . asList ( paths ) ) ; }
Imports several corpora .
122,101
private Long markCoveredTokens ( Map < SNode , Long > markedAndCovered , SNode tok ) { RelannisNodeFeature f = RelannisNodeFeature . extract ( tok ) ; if ( markedAndCovered . containsKey ( tok ) && f != null && f . getMatchedNode ( ) == null ) { return markedAndCovered . get ( tok ) ; } return f != null ? f . getMatche...
Checks if a token is covered by a matched node but not a match by it self .
122,102
private Long tokenMatch ( SNode tok ) { SFeature featMatched = tok . getFeature ( ANNIS_NS , FEAT_MATCHEDNODE ) ; Long matchRaw = featMatched == null ? null : featMatched . getValue_SNUMERIC ( ) ; return matchRaw ; }
Checks if a token is a marked match
122,103
public String getBuildDescription ( ) { StringBuilder sb = new StringBuilder ( ) ; for ( String name : startParameter . getExcludedTaskNames ( ) ) { sb . append ( "-x " ) ; sb . append ( name ) ; sb . append ( " " ) ; } for ( String name : startParameter . getTaskNames ( ) ) { sb . append ( name ) ; sb . append ( " " )...
Get a description of this profiled build . It contains info about tasks passed to gradle as targets from the command line .
122,104
public ProjectMetrics getProjectProfile ( String projectPath ) { ProjectMetrics result = projects . get ( projectPath ) ; if ( result == null ) { result = new ProjectMetrics ( projectPath ) ; projects . put ( projectPath , result ) ; } return result ; }
Get the profiling container for the specified project
122,105
public long getElapsedArtifactTransformTime ( ) { long result = 0 ; for ( FragmentedOperation transform : transforms . values ( ) ) { result += transform . getElapsedTime ( ) ; } return result ; }
Get the total artifact transformation time .
122,106
public long getElapsedTotalExecutionTime ( ) { long result = 0 ; for ( ProjectMetrics projectMetrics : projects . values ( ) ) { result += projectMetrics . getElapsedTime ( ) ; } return result ; }
Get the total task execution time from all projects .
122,107
private void shutdownIfComplete ( ) { if ( ! buildProfileComplete . get ( ) || ! buildResultComplete . get ( ) ) { return ; } MetricsDispatcher dispatcher = this . dispatcherSupplier . get ( ) ; logger . info ( "Shutting down dispatcher" ) ; try { dispatcher . stopAsync ( ) . awaitTerminated ( TIMEOUT_MS , TimeUnit . M...
Conditionally shutdown the dispatcher because Gradle listener event order appears to be non - deterministic .
122,108
public TaskExecution getTaskProfile ( String taskPath ) { TaskExecution result = tasks . get ( taskPath ) ; if ( result == null ) { result = new TaskExecution ( taskPath ) ; tasks . put ( taskPath , result ) ; } return result ; }
Gets the task profiling container for the specified task .
122,109
public CompositeOperation < TaskExecution > getTasks ( ) { List < TaskExecution > taskExecutions = CollectionUtils . sort ( tasks . values ( ) , slowestFirst ( ) ) ; return new CompositeOperation < TaskExecution > ( taskExecutions ) ; }
Returns the task executions for this project .
122,110
public void close ( ) throws IOException { final List < IOException > exceptionList = new ArrayList < > ( ) ; for ( final Node node : nodeList ) { try { node . close ( ) ; } catch ( final IOException e ) { exceptionList . add ( e ) ; } } if ( exceptionList . isEmpty ( ) ) { print ( "Closed all nodes." ) ; } else { if (...
Close a cluster runner .
122,111
public void clean ( ) { final Path bPath = FileSystems . getDefault ( ) . getPath ( basePath ) ; for ( int i = 0 ; i < 3 ; i ++ ) { try { final CleanUpFileVisitor visitor = new CleanUpFileVisitor ( ) ; Files . walkFileTree ( bPath , visitor ) ; if ( ! visitor . hasErrors ( ) ) { print ( "Deleted " + basePath ) ; return...
Delete all configuration files and directories .
122,112
public void build ( final String ... args ) { if ( args != null ) { final CmdLineParser parser = new CmdLineParser ( this , ParserProperties . defaults ( ) . withUsageWidth ( 80 ) ) ; try { parser . parseArgument ( args ) ; } catch ( final CmdLineException e ) { throw new ClusterRunnerException ( "Failed to parse args:...
Create and start Elasticsearch cluster with arguments .
122,113
public Node getNode ( final int i ) { if ( i < 0 || i >= nodeList . size ( ) ) { return null ; } return nodeList . get ( i ) ; }
Return a node by the node index .
122,114
@ SuppressWarnings ( "resource" ) public boolean startNode ( final int i ) { if ( i >= nodeList . size ( ) ) { return false ; } if ( ! nodeList . get ( i ) . isClosed ( ) ) { return false ; } final Node node = new ClusterRunnerNode ( envList . get ( i ) , pluginList ) ; try { node . start ( ) ; nodeList . set ( i , nod...
Start a closed node .
122,115
public Node getNode ( final String name ) { if ( name == null ) { return null ; } for ( final Node node : nodeList ) { if ( name . equals ( node . settings ( ) . get ( NODE_NAME ) ) ) { return node ; } } return null ; }
Return a node by the name .
122,116
public int getNodeIndex ( final Node node ) { for ( int i = 0 ; i < nodeList . size ( ) ; i ++ ) { if ( nodeList . get ( i ) . equals ( node ) ) { return i ; } } return - 1 ; }
Return a node index .
122,117
public synchronized Node masterNode ( ) { final ClusterState state = client ( ) . admin ( ) . cluster ( ) . prepareState ( ) . execute ( ) . actionGet ( ) . getState ( ) ; final String name = state . nodes ( ) . getMasterNode ( ) . getName ( ) ; return getNode ( name ) ; }
Return a master node .
122,118
public synchronized Node nonMasterNode ( ) { final ClusterState state = client ( ) . admin ( ) . cluster ( ) . prepareState ( ) . execute ( ) . actionGet ( ) . getState ( ) ; final String name = state . nodes ( ) . getMasterNode ( ) . getName ( ) ; for ( final Node node : nodeList ) { if ( ! node . isClosed ( ) && ! na...
Return a non - master node .
122,119
public ClusterHealthStatus ensureGreen ( final String ... indices ) { final ClusterHealthResponse actionGet = client ( ) . admin ( ) . cluster ( ) . health ( Requests . clusterHealthRequest ( indices ) . waitForGreenStatus ( ) . waitForEvents ( Priority . LANGUID ) . waitForNoRelocatingShards ( true ) ) . actionGet ( )...
Wait for green state of a cluster .
122,120
public void connect ( ) throws DBException { try { LOGGER . debug ( "Initializing MongoDB client" ) ; mongoClient = new MongoClient ( this . host , this . port ) ; } catch ( UnknownHostException e ) { throw new DBException ( e . toString ( ) ) ; } }
Connect to MongoDB Host .
122,121
public boolean exitsMongoDbDataBase ( String dataBaseName ) { List < String > dataBaseList = mongoClient . getDatabaseNames ( ) ; return dataBaseList . contains ( dataBaseName ) ; }
Checks if a database exists in MongoDB .
122,122
public void createMongoDBCollection ( String colectionName , DataTable options ) { BasicDBObject aux = new BasicDBObject ( ) ; List < List < String > > rowsOp = options . raw ( ) ; for ( int i = 0 ; i < rowsOp . size ( ) ; i ++ ) { List < String > rowOp = rowsOp . get ( i ) ; if ( rowOp . get ( 0 ) . equals ( "size" ) ...
Create a MongoDB collection .
122,123
public void dropAllDataMongoDBCollection ( String collectionName ) { DBCollection db = getMongoDBCollection ( collectionName ) ; DBCursor objectsList = db . find ( ) ; try { while ( objectsList . hasNext ( ) ) { db . remove ( objectsList . next ( ) ) ; } } finally { objectsList . close ( ) ; } }
Drop all the data associated to a MongoDB Collection .
122,124
public void insertIntoMongoDBCollection ( String collection , DataTable table ) { List < String [ ] > colRel = coltoArrayList ( table ) ; for ( int i = 1 ; i < table . raw ( ) . size ( ) ; i ++ ) { BasicDBObject doc = new BasicDBObject ( ) ; List < String > row = table . raw ( ) . get ( i ) ; for ( int x = 0 ; x < row ...
Insert data in a MongoDB Collection .
122,125
public void insertDocIntoMongoDBCollection ( String collection , String document ) { DBObject dbObject = ( DBObject ) JSON . parse ( document ) ; this . dataBase . getCollection ( collection ) . insert ( dbObject ) ; }
Insert document in a MongoDB Collection .
122,126
public List < DBObject > readFromMongoDBCollection ( String collection , DataTable table ) { List < DBObject > res = new ArrayList < DBObject > ( ) ; List < String [ ] > colRel = coltoArrayList ( table ) ; DBCollection aux = this . dataBase . getCollection ( collection ) ; for ( int i = 1 ; i < table . raw ( ) . size (...
Read data from a MongoDB collection .
122,127
public void setSettings ( LinkedHashMap < String , Object > settings ) { Settings . Builder builder = Settings . settingsBuilder ( ) ; for ( Map . Entry < String , Object > entry : settings . entrySet ( ) ) { builder . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } this . settings = builder . build ( ) ; }
Set settings about ES connector .
122,128
public void connect ( ) throws java . net . UnknownHostException { this . client = TransportClient . builder ( ) . settings ( this . settings ) . build ( ) . addTransportAddress ( new InetSocketTransportAddress ( InetAddress . getByName ( this . es_host ) , this . es_native_port ) ) ; }
Connect to ES .
122,129
public boolean createSingleIndex ( String indexName ) throws ElasticsearchException { CreateIndexRequest indexRequest = new CreateIndexRequest ( indexName ) ; CreateIndexResponse res = this . client . admin ( ) . indices ( ) . create ( indexRequest ) . actionGet ( ) ; return indexExists ( indexName ) ; }
Create an ES Index .
122,130
public boolean dropSingleIndex ( String indexName ) throws ElasticsearchException { DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest ( indexName ) ; DeleteIndexResponse res = this . client . admin ( ) . indices ( ) . delete ( deleteIndexRequest ) . actionGet ( ) ; return indexExists ( indexName ) ; }
Drop an ES Index
122,131
public boolean indexExists ( String indexName ) { return this . client . admin ( ) . indices ( ) . prepareExists ( indexName ) . execute ( ) . actionGet ( ) . isExists ( ) ; }
Check if an index exists in ES
122,132
public void createMapping ( String indexName , String mappingName , ArrayList < XContentBuilder > mappingSource ) { IndicesExistsResponse existsResponse = this . client . admin ( ) . indices ( ) . prepareExists ( indexName ) . execute ( ) . actionGet ( ) ; if ( ! existsResponse . isExists ( ) ) { if ( ! createSingleInd...
Create a mapping over an index
122,133
public boolean existsMapping ( String indexName , String mappingName ) { ClusterStateResponse resp = this . client . admin ( ) . cluster ( ) . prepareState ( ) . execute ( ) . actionGet ( ) ; if ( resp . getState ( ) . getMetaData ( ) . index ( indexName ) == null ) { return false ; } ImmutableOpenMap < String , Mappin...
Check if a mapping exists in an expecific index .
122,134
public void indexDocument ( String indexName , String mappingName , String id , XContentBuilder document ) throws Exception { client . prepareIndex ( indexName , mappingName , id ) . setSource ( document ) . get ( ) ; }
Indexes a document .
122,135
public void deleteDocument ( String indexName , String mappingName , String id ) { client . prepareDelete ( indexName , mappingName , id ) . get ( ) ; }
Deletes a document by its id .
122,136
@ After ( order = ORDER_20 , value = { "@mobile or @web" } ) public void seleniumTeardown ( ) { if ( commonspec . getDriver ( ) != null ) { commonspec . getLogger ( ) . debug ( "Shutdown Selenium client" ) ; commonspec . getDriver ( ) . close ( ) ; commonspec . getDriver ( ) . quit ( ) ; } }
Close selenium web driver .
122,137
public static void set ( String key , String value ) { PROPS . get ( ) . setProperty ( key , value ) ; }
Set a string to share in other class .
122,138
@ Given ( "^I connect to kafka at '(.+)' using path '(.+)'$" ) public void connectKafka ( String zkHost , String zkPath ) throws UnknownHostException { String zkPort = zkHost . split ( ":" ) [ 1 ] ; zkHost = zkHost . split ( ":" ) [ 0 ] ; commonspec . getKafkaUtils ( ) . setZkHost ( zkHost , zkPort , zkPath ) ; commons...
Connect to Kafka .
122,139
@ When ( "^I copy the kafka topic '(.*?)' to file '(.*?)' with headers '(.*?)'$" ) public void topicToFile ( String topic_name , String filename , String header ) throws Exception { commonspec . getKafkaUtils ( ) . resultsToFile ( topic_name , filename , header ) ; }
Copy Kafka Topic content to file
122,140
@ When ( "^I increase '(.+?)' partitions in a Kafka topic named '(.+?)'" ) public void modifyPartitions ( int numPartitions , String topic_name ) throws Exception { commonspec . getKafkaUtils ( ) . modifyTopicPartitioning ( topic_name , numPartitions ) ; }
Modify partitions in a Kafka topic .
122,141
@ When ( "^I send a message '(.+?)' to the kafka topic named '(.+?)'" ) public void sendAMessage ( String message , String topic_name ) throws Exception { commonspec . getKafkaUtils ( ) . sendMessage ( message , topic_name ) ; }
Sending a message in a Kafka topic .
122,142
@ Then ( "^A kafka topic named '(.+?)' exists" ) public void kafkaTopicExist ( String topic_name ) throws KeeperException , InterruptedException { assert commonspec . getKafkaUtils ( ) . getZkUtils ( ) . pathExists ( "/" + topic_name ) : "There is no topic with that name" ; }
Check that a kafka topic exist
122,143
@ Then ( "^The number of partitions in topic '(.+?)' should be '(.+?)''?$" ) public void checkNumberOfPartitions ( String topic_name , int numOfPartitions ) throws Exception { Assertions . assertThat ( commonspec . getKafkaUtils ( ) . getPartitions ( topic_name ) ) . isEqualTo ( numOfPartitions ) ; }
Check that the number of partitions is like expected .
122,144
@ Given ( "^I switch to iframe with '([^:]*?):(.+?)'$" ) public void seleniumIdFrame ( String method , String idframe ) throws IllegalAccessException , NoSuchFieldException , ClassNotFoundException { assertThat ( commonspec . locateElement ( method , idframe , 1 ) ) ; if ( method . equals ( "id" ) || method . equals ( ...
Swith to the iFrame where id matches idframe
122,145
@ Given ( "^a new window is opened$" ) public void seleniumGetwindows ( ) { Set < String > wel = commonspec . getDriver ( ) . getWindowHandles ( ) ; Assertions . assertThat ( wel ) . as ( "Element count doesnt match" ) . hasSize ( 2 ) ; }
Get all opened windows and store it .
122,146
@ When ( "^I drag '([^:]*?):(.+?)' and drop it to '([^:]*?):(.+?)'$" ) public void seleniumDrag ( String smethod , String source , String dmethod , String destination ) throws ClassNotFoundException , NoSuchFieldException , SecurityException , IllegalArgumentException , IllegalAccessException { Actions builder = new Ac...
Searchs for two webelements dragging the first one to the second
122,147
@ When ( "^I de-select every item on the element on index '(\\d+?)'$" ) public void elementDeSelect ( Integer index ) { Select sel = null ; sel = new Select ( commonspec . getPreviousWebElements ( ) . getPreviousWebElements ( ) . get ( index ) ) ; if ( sel . isMultiple ( ) ) { sel . deselectAll ( ) ; } }
Choose no option from a select webelement found previously
122,148
@ When ( "^I change active window$" ) public void seleniumChangeWindow ( ) { String originalWindowHandle = commonspec . getDriver ( ) . getWindowHandle ( ) ; Set < String > windowHandles = commonspec . getDriver ( ) . getWindowHandles ( ) ; for ( String window : windowHandles ) { if ( ! window . equals ( originalWindow...
Change current window to another opened window .
122,149
@ Then ( "^this text exists '(.+?)'$" ) public void assertSeleniumTextInSource ( String text ) { assertThat ( this . commonspec , commonspec . getDriver ( ) ) . as ( "Expected text not found at page" ) . contains ( text ) ; }
Checks if a text exists in the source of an already loaded URL .
122,150
@ Then ( "^we are in page '(.+?)'$" ) public void checkURL ( String url ) throws Exception { if ( commonspec . getWebHost ( ) == null ) { throw new Exception ( "Web host has not been set" ) ; } if ( commonspec . getWebPort ( ) == null ) { throw new Exception ( "Web port has not been set" ) ; } String webURL = commonspe...
Checks that we are in the URL passed
122,151
@ Then ( "^I save selenium dcos acs auth cookie in variable '(.+?)'$" ) public void getDcosAcsAuthCookie ( String envVar ) throws Exception { if ( commonspec . getSeleniumCookies ( ) != null && commonspec . getSeleniumCookies ( ) . size ( ) != 0 ) { for ( Cookie cookie : commonspec . getSeleniumCookies ( ) ) { if ( coo...
Get dcos - auth - cookie
122,152
@ Then ( "^The cookie '(.+?)' exists in the saved cookies$" ) public void checkIfCookieExists ( String cookieName ) { Assertions . assertThat ( commonspec . cookieExists ( cookieName ) ) . isEqualTo ( true ) ; }
Check if a cookie exists
122,153
@ Then ( "^I have '(.+?)' selenium cookies saved$" ) public void getSeleniumCookiesSize ( int numberOfCookies ) throws Exception { Assertions . assertThat ( commonspec . getSeleniumCookies ( ) . size ( ) ) . isEqualTo ( numberOfCookies ) ; }
Check if the length of the cookie set match with the number of cookies thas must be saved
122,154
@ Then ( "^I save content of element in index '(\\d+?)' in environment variable '(.+?)'$" ) public void saveContentWebElementInEnvVar ( Integer index , String envVar ) { assertThat ( this . commonspec , commonspec . getPreviousWebElements ( ) ) . as ( "There are less found elements than required" ) . hasAtLeast ( index...
Takes the content of a webElement and stores it in the thread environment variable passed as parameter
122,155
@ Given ( "^I save \'(.+?)\' in variable \'(.+?)\'$" ) public void saveInEnvironment ( String value , String envVar ) { ThreadProperty . set ( envVar , value ) ; }
Save value for future use .
122,156
@ When ( "^I sort elements in '(.+?)' by '(.+?)' criteria in '(.+?)' order$" ) public void sortElements ( String envVar , String criteria , String order ) { String value = ThreadProperty . get ( envVar ) ; JsonArray jsonArr = JsonValue . readHjson ( value ) . asArray ( ) ; List < JsonValue > jsonValues = new ArrayList ...
Sort elements in envVar by a criteria and order .
122,157
@ Then ( "^an exception '(.+?)' thrown( with class '(.+?)'( and message like '(.+?)')?)?" ) public void assertExceptionNotThrown ( String exception , String foo , String clazz , String bar , String exceptionMsg ) throws ClassNotFoundException { List < Exception > exceptions = commonspec . getExceptions ( ) ; if ( "IS N...
Checks if an exception has been thrown .
122,158
@ When ( "^I send a '(.+?)' request to '(.+?)'( with user and password '(.+:.+?)')? based on '([^:]+?)'( as '(json|string|gov)')? with:$" ) public void sendRequest ( String requestType , String endPoint , String foo , String loginInfo , String baseData , String baz , String type , DataTable modifications ) throws Excep...
Send a request of the type specified
122,159
@ When ( "^I send a '(.+?)' request to '(.+?)'( with user and password '(.+:.+?)')?( based on '([^:]+?)')?( as '(json|string|gov)')?$" ) public void sendRequestNoDataTable ( String requestType , String endPoint , String foo , String loginInfo , String bar , String baseData , String baz , String type ) throws Exception ...
Same sendRequest but in this case we do not receive a data table with modifications . Besides the data and request header are optional as well . In case we want to simulate sending a json request with empty data we just to avoid baseData
122,160
public void copyTo ( String localPath , String remotePath ) throws Exception { FileInputStream fis = null ; String rfile = remotePath ; String localfile = localPath ; boolean ptimestamp = true ; String command = "scp " + ( ptimestamp ? "-p" : "" ) + " -d -t " + rfile ; Channel channel = session . openChannel ( "exec" )...
Copy localPath to remotePath using the session created
122,161
public void runCommand ( String command ) throws Exception { String result = "" ; String extras = "export PYTHONWARNINGS=\"ignore:Unverified HTTPS request\" && " ; Channel channel = session . openChannel ( "exec" ) ; ( ( ChannelExec ) channel ) . setCommand ( extras + command ) ; channel . setInputStream ( null ) ; ( (...
Execute the command in the session created
122,162
@ Given ( "^I authenticate to DCOS cluster '(.+?)' using email '(.+?)'( with user '(.+?)'( and password '(.+?)'| and pem file '(.+?)'))?$" ) public void authenticateDCOSpem ( String remoteHost , String email , String foo , String user , String bar , String password , String pemFile ) throws Exception { String DCOSsecre...
Authenticate in a DCOS cluster
122,163
@ Given ( "^I( do not)? set sso token using host '(.+?)' with user '(.+?)' and password '(.+?)'( and tenant '(.+?)')?$" ) public void setGoSecSSOCookie ( String set , String ssoHost , String userName , String passWord , String foo , String tenant ) throws Exception { if ( set == null ) { HashMap < String , String > sso...
Generate token to authenticate in gosec SSO
122,164
@ Given ( "^I save the IP of an unused node in hosts '(.+?)' in the in environment variable '(.+?)'?$" ) public void getUnusedNode ( String hosts , String envVar ) throws Exception { Set < String > hostList = new HashSet ( Arrays . asList ( hosts . split ( "," ) ) ) ; commonspec . executeCommand ( "dcos task | awk '{pr...
Checks if there are any unused nodes in the cluster and returns the IP of one of them . REQUIRES A PREVIOUSLY - ESTABLISHED SSH CONNECTION TO DCOS - CLI TO WORK
122,165
@ Given ( "^I convert jsonSchema '(.+?)' to json and save it in variable '(.+?)'" ) public void convertJSONSchemaToJSON ( String jsonSchema , String envVar ) throws Exception { String json = commonspec . parseJSONSchema ( new JSONObject ( jsonSchema ) ) . toString ( ) ; ThreadProperty . set ( envVar , json ) ; }
Convert jsonSchema to json
122,166
@ Given ( "^json (.+?) matches schema (.+?)$" ) public void jsonMatchesSchema ( String json , String schema ) throws Exception { JSONObject jsonschema = new JSONObject ( schema ) ; JSONObject jsondeploy = new JSONObject ( json ) ; commonspec . matchJsonToSchema ( jsonschema , jsondeploy ) ; }
Check if json is validated against a schema
122,167
@ Given ( "^I get service '(.+?)' health status in cluster '(.+?)' and save it in variable '(.+?)'" ) public void getServiceHealthStatus ( String service , String cluster , String envVar ) throws Exception { String health = commonspec . retrieveHealthServiceStatus ( service , cluster ) ; ThreadProperty . set ( envVar ,...
Get service health status
122,168
@ Given ( "^I destroy service '(.+?)' in cluster '(.+?)'" ) public void destroyService ( String service , String cluster ) throws Exception { String endPoint = "/service/deploy-api/deploy/uninstall?app=" + service ; Future response ; this . commonspec . setRestProtocol ( "https://" ) ; this . commonspec . setRestHost (...
Destroy specified service
122,169
@ When ( "^All resources from service '(.+?)' have been freed$" ) public void checkResources ( String service ) throws Exception { Future < Response > response = commonspec . generateRequest ( "GET" , true , null , null , "/mesos/state-summary" , null , null ) ; String json = "[" + response . get ( ) . getResponseBody ...
Check if resources are released after uninstall and framework doesn t appear as inactive on mesos
122,170
@ Then ( "^I add a new DCOS label with key '(.+?)' and value '(.+?)' to the service '(.+?)'?$" ) public void sendAppendRequest ( String key , String value , String service ) throws Exception { commonspec . runCommandAndGetResult ( "touch " + service + ".json && dcos marathon app show " + service + " > /dcos/" + service...
A PUT request over the body value .
122,171
@ Then ( "^I modify marathon environment variable '(.+?)' with value '(.+?)' for service '(.+?)'?$" ) public void setMarathonProperty ( String key , String value , String service ) throws Exception { commonspec . runCommandAndGetResult ( "touch " + service + "-env.json && dcos marathon app show " + service + " > /dcos/...
Set a environment variable in marathon and deploy again .
122,172
@ Then ( "^service '(.+?)' status in cluster '(.+?)' is '(suspended|running|deploying)'( in less than '(\\d+?)' seconds checking every '(\\d+?)' seconds)?" ) public void serviceStatusCheck ( String service , String cluster , String status , String foo , Integer totalWait , Integer interval ) throws Exception { String r...
Check service status has value specified
122,173
@ Then ( "^The role '(.+?)' of the service '(.+?)' with instance '(.+?)' complies the constraints '(.+?)'$" ) public void checkComponentConstraints ( String role , String service , String instance , String constraints ) throws Exception { checkComponentConstraint ( role , service , instance , constraints . split ( "," ...
Check if a role of a service complies the established constraints
122,174
@ Given ( "^I open a ssh connection to '(.+?)'( in port '(.+?)')? with user '(.+?)'( and password '(.+?)')?( using pem file '(.+?)')?$" ) public void openSSHConnection ( String remoteHost , String tmp , String remotePort , String user , String foo , String password , String bar , String pemFile ) throws Exception { if ...
Opens a ssh connection to remote host
122,175
@ Given ( "^I run '(.+?)' locally( with exit status '(.+?)')?( and save the value in environment variable '(.+?)')?$" ) public void executeLocalCommand ( String command , String foo , Integer exitStatus , String bar , String envVar ) throws Exception { if ( exitStatus == null ) { exitStatus = 0 ; } commonspec . runLoca...
Executes the command specified in local system
122,176
@ Then ( "^the command output contains '(.+?)'$" ) public void findShellOutput ( String search ) throws Exception { assertThat ( commonspec . getCommandResult ( ) ) . as ( "Contains " + search + "." ) . contains ( search ) ; }
Check the existence of a text at a command output
122,177
@ Then ( "^the command output does not contain '(.+?)'$" ) public void notFindShellOutput ( String search ) throws Exception { assertThat ( commonspec . getCommandResult ( ) ) . as ( "NotContains " + search + "." ) . doesNotContain ( search ) ; }
Check the non existence of a text at a command output
122,178
@ Then ( "^the command exit status is '(.+?)'$" ) public void checkShellExitStatus ( int expectedExitStatus ) throws Exception { assertThat ( commonspec . getCommandExitStatus ( ) ) . as ( "Is equal to " + expectedExitStatus + "." ) . isEqualTo ( expectedExitStatus ) ; }
Check the exitStatus of previous command execution matches the expected one
122,179
@ 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 { String query = "CREATE INDEX " + index_name + " ON " + table + " (" + colum...
Create a basic Index .
122,180
@ Given ( "^I( securely)? connect to '(Cassandra|Mongo|Elasticsearch)' cluster at '(.+)'$" ) public void connect ( String secured , String clusterType , String url ) throws DBException , UnknownHostException { switch ( clusterType ) { case "Cassandra" : commonspec . getCassandraClient ( ) . setHost ( url ) ; commonspec...
Connect to cluster .
122,181
@ Given ( "^I connect to Elasticsearch cluster at host '(.+?)'( using native port '(.+?)')?( using cluster name '(.+?)')?$" ) public void connectToElasticSearch ( String host , String foo , String nativePort , String bar , String clusterName ) throws DBException , UnknownHostException , NumberFormatException { LinkedHa...
Connect to ElasticSearch using custom parameters
122,182
@ Given ( "^I obtain elasticsearch cluster name in '([^:]+?)(:.+?)?' and save it in variable '(.+?)'?$" ) public void saveElasticCluster ( String host , String port , String envVar ) throws Exception { commonspec . setRestProtocol ( "http://" ) ; commonspec . setRestHost ( host ) ; commonspec . setRestPort ( port ) ; F...
Save clustername of elasticsearch in an environment varible for future use .
122,183
@ Given ( "^I insert into a MongoDB database '(.+?)' and table '(.+?)' this values:$" ) public void insertOnMongoTable ( String dataBase , String tabName , DataTable table ) { commonspec . getMongoDBClient ( ) . connectToMongoDBDataBase ( dataBase ) ; commonspec . getMongoDBClient ( ) . insertIntoMongoDBCollection ( ta...
Insert data in a MongoDB table .
122,184
@ Given ( "^I drop every document at a MongoDB database '(.+?)' and table '(.+?)'" ) public void truncateTableInMongo ( String database , String table ) { commonspec . getMongoDBClient ( ) . connectToMongoDBDataBase ( database ) ; commonspec . getMongoDBClient ( ) . dropAllDataMongoDBCollection ( table ) ; }
Truncate table in MongoDB .
122,185
@ Given ( "^I insert into MongoDB database '(.+?)' and collection '(.+?)' the document from schema '(.+?)'$" ) public void insertOnMongoTable ( String dataBase , String collection , String document ) throws Exception { String retrievedDoc = commonspec . retrieveData ( document , "json" ) ; commonspec . getMongoDBClient...
Insert document in a MongoDB table .
122,186
@ 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 , DataTable modifi...
Execute a query with schema over a cluster
122,187
@ 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 ) { try { commonspec . setResultsType ( "elastic...
Execute query with filter over elasticsearch
122,188
@ 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 , DataTabl...
Create a Cassandra index .
122,189
@ When ( "^I create an elasticsearch index named '(.+?)'( removing existing index if exist)?$" ) public void createElasticsearchIndex ( String index , String removeIndex ) { if ( removeIndex != null && commonspec . getElasticSearchClient ( ) . indexExists ( index ) ) { commonspec . getElasticSearchClient ( ) . dropSing...
Create an elasticsearch index .
122,190
@ 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 { ArrayList < XContentBuilder > mappingsource = new ArrayList < XC...
Index a document within a mapping type .
122,191
@ Then ( "^a Cassandra keyspace '(.+?)' exists$" ) public void assertKeyspaceOnCassandraExists ( String keyspace ) { assertThat ( commonspec . getCassandraClient ( ) . getKeyspaces ( ) ) . as ( "The keyspace " + keyspace + " exists on cassandra" ) . contains ( keyspace ) ; }
Checks if a keyspaces exists in Cassandra .
122,192
@ Then ( "^a Cassandra keyspace '(.+?)' does not exist$" ) public void assertKeyspaceOnCassandraDoesNotExist ( String keyspace ) { assertThat ( commonspec . getCassandraClient ( ) . getKeyspaces ( ) ) . as ( "The keyspace " + keyspace + " does not exist on cassandra" ) . doesNotContain ( keyspace ) ; }
Checks a keyspace does not exist in Cassandra .
122,193
@ Then ( "^a Cassandra keyspace '(.+?)' contains a table '(.+?)'$" ) public void assertTableExistsOnCassandraKeyspace ( String keyspace , String tableName ) { assertThat ( commonspec . getCassandraClient ( ) . getTables ( keyspace ) ) . as ( "The table " + tableName + "exists on cassandra" ) . contains ( tableName ) ; ...
Checks if a cassandra keyspace contains a table .
122,194
@ Then ( "^a Cassandra keyspace '(.+?)' does not contain a table '(.+?)'$" ) public void assertTableDoesNotExistOnCassandraKeyspace ( String keyspace , String tableName ) { assertThat ( commonspec . getCassandraClient ( ) . getTables ( keyspace ) ) . as ( "The table " + tableName + "exists on cassandra" ) . doesNotCont...
Checks a cassandra keyspace does not contain a table .
122,195
@ Then ( "^a Cassandra keyspace '(.+?)' contains a table '(.+?)' with '(.+?)' rows$" ) public void assertRowNumberOfTableOnCassandraKeyspace ( String keyspace , String tableName , String numberRows ) { Long numberRowsLong = Long . parseLong ( numberRows ) ; commonspec . getCassandraClient ( ) . useKeyspace ( keyspace )...
Checks the number of rows in a cassandra table .
122,196
@ Then ( "^a Cassandra keyspace '(.+?)' contains a table '(.+?)' with values:$" ) public void assertValuesOfTable ( String keyspace , String tableName , DataTable data ) throws InterruptedException { commonspec . getCassandraClient ( ) . useKeyspace ( keyspace ) ; Map < String , String > dataTableColumns = extractColum...
Checks if a cassandra table contains the values of a DataTable .
122,197
@ Then ( "^a Mongo dataBase '(.+?)' contains a table '(.+?)' with values:" ) public void assertValuesOfTableMongo ( String dataBase , String tableName , DataTable data ) { commonspec . getMongoDBClient ( ) . connectToMongoDBDataBase ( dataBase ) ; ArrayList < DBObject > result = ( ArrayList < DBObject > ) commonspec . ...
Checks the values of a MongoDB table .
122,198
@ Then ( "^a Mongo dataBase '(.+?)' doesnt contains a table '(.+?)'$" ) public void aMongoDataBaseContainsaTable ( String database , String tableName ) { commonspec . getMongoDBClient ( ) . connectToMongoDBDataBase ( database ) ; Set < String > collectionsNames = commonspec . getMongoDBClient ( ) . getMongoDBCollection...
Checks if a MongoDB database contains a table .
122,199
@ Then ( "^There are results found with:$" ) public void resultsMustBe ( DataTable expectedResults ) throws Exception { String type = commonspec . getResultsType ( ) ; assertThat ( type ) . isNotEqualTo ( "" ) . overridingErrorMessage ( "It's necessary to define the result type" ) ; switch ( type ) { case "cassandra" :...
Checks the different results of a previous query