idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
39,600 | public Map < SNode , Long > getMarkedAndCovered ( ) { if ( cachedMarkedAndCoveredNodes == null ) { if ( document != null ) { cachedMarkedAndCoveredNodes = CommonHelper . createSNodeMapFromIDs ( markedAndCovered , document . getDocumentGraph ( ) ) ; } } return cachedMarkedAndCoveredNodes ; } | This map is used for calculating the colors of a matching node . |
39,601 | private List < Long > calculateOrderedMatchNumbersGlobally ( int [ ] [ ] adjacencyMatrix , boolean matrixIsFilled , Set < Long > singleMatches ) { List < Long > orderedMatchNumbers = new ArrayList < Long > ( ) ; if ( matrixIsFilled ) { int first = - 1 ; int second = - 1 ; outerFor : for ( int i = 0 ; i < adjacencyMatri... | This method determine a valid order of match numbers and returns them as a list . If the underlying result set is not alignable it returns an empty list . |
39,602 | public static < T > void runWithCallback ( Callable < T > job , final FutureCallback < T > callback ) { final UI ui = UI . getCurrent ( ) ; ListeningExecutorService exec = MoreExecutors . listeningDecorator ( Executors . newSingleThreadExecutor ( ) ) ; ListenableFuture < T > future = exec . submit ( job ) ; if ( callba... | Execute the job in the background and provide a callback which is called when the job is finished . |
39,603 | public void delExampleQueries ( List < String > corpusNames ) { if ( corpusNames == null || corpusNames . isEmpty ( ) ) { log . info ( "delete all example queries" ) ; jdbcTemplate . execute ( "TRUNCATE example_queries" ) ; } else { List < Long > ids = queryDao . mapCorpusNamesToIds ( corpusNames ) ; for ( Long id : id... | Deletes all example queries for a given corpus list . |
39,604 | public void generateQueries ( Boolean overwrite ) { List < AnnisCorpus > corpora = queryDao . listCorpora ( ) ; for ( AnnisCorpus annisCorpus : corpora ) { generateQueries ( annisCorpus . getId ( ) , overwrite ) ; } } | Generates example queries for all imported corpora . |
39,605 | private URI buildSaltId ( List < String > path , String saltID ) { StringBuilder sb = new StringBuilder ( "salt:/" ) ; Iterator < String > itPath = path . iterator ( ) ; while ( itPath . hasNext ( ) ) { String dir = itPath . next ( ) ; sb . append ( pathEscaper . escape ( dir ) ) ; if ( itPath . hasNext ( ) ) { sb . ap... | Builds a proper salt ID . |
39,606 | public static String getVersion ( ) { String rev = getBuildRevision ( ) ; Date date = getBuildDate ( ) ; StringBuilder result = new StringBuilder ( ) ; result . append ( getReleaseName ( ) ) ; if ( ! "" . equals ( rev ) || date != null ) { result . append ( " (" ) ; boolean added = false ; if ( ! "" . equals ( rev ) ) ... | Get a humand readable summary of the version of this build . |
39,607 | public static Date getBuildDate ( ) { Date result = null ; try { DateFormat format = new SimpleDateFormat ( "yyyy-MM-dd_HH-mm-ss" ) ; String raw = versionProperties . getProperty ( "build_date" ) ; if ( raw != null ) { result = format . parse ( raw ) ; } } catch ( ParseException ex ) { log . debug ( null , ex ) ; } ret... | Get the date when ANNIS was built . |
39,608 | private String mergeConfigValue ( String key , Set < String > corpora , CorpusConfigMap corpusConfigurations ) { Set < String > values = new TreeSet < > ( ) ; for ( String corpus : corpora ) { CorpusConfig config = corpusConfigurations . get ( corpus ) ; if ( config != null ) { String v = config . getConfig ( key ) ; i... | If all values of a specific corpus property have the same value this value is returned otherwise the value of the default configuration is choosen . |
39,609 | private CorpusConfig mergeConfigs ( Set < String > corpora , CorpusConfigMap corpusConfigurations ) { CorpusConfig corpusConfig = new CorpusConfig ( ) ; String leftCtx = mergeConfigValue ( KEY_MAX_CONTEXT_LEFT , corpora , corpusConfigurations ) ; String rightCtx = mergeConfigValue ( KEY_MAX_CONTEXT_RIGHT , corpora , co... | Builds a single config for selection of one or muliple corpora . |
39,610 | private String checkSegments ( String key , Set < String > corpora , CorpusConfigMap corpusConfigurations ) { String segmentation = null ; for ( String corpus : corpora ) { CorpusConfig c = null ; if ( corpusConfigurations . containsConfig ( corpus ) ) { c = corpusConfigurations . get ( corpus ) ; } else { c = corpusCo... | Checks if all selected corpora have the same default segmentation layer . If not the tok layer is taken because every corpus has this one . |
39,611 | private void updateContext ( Container c , int maxCtx , int ctxSteps , boolean keepCustomValues ) { if ( ! keepCustomValues ) { c . removeAllItems ( ) ; } for ( Integer i : PREDEFINED_CONTEXTS ) { if ( i < maxCtx ) { c . addItem ( i ) ; } } for ( int step = ctxSteps ; step < maxCtx ; step += ctxSteps ) { c . addItem ( ... | Updates context combo boxes . |
39,612 | @ Path ( "userconfig" ) @ Produces ( "application/xml" ) public UserConfig getUserConfig ( ) { Subject user = SecurityUtils . getSubject ( ) ; user . checkPermission ( "admin:read:userconfig" ) ; return adminDao . retrieveUserConfig ( ( String ) user . getPrincipal ( ) ) ; } | Get the user configuration for the currently logged in user . |
39,613 | @ Path ( "userconfig" ) @ Consumes ( "application/xml" ) public Response setUserConfig ( JAXBElement < UserConfig > config ) { Subject user = SecurityUtils . getSubject ( ) ; user . checkPermission ( "admin:write:userconfig" ) ; String userName = ( String ) user . getPrincipal ( ) ; adminDao . storeUserConfig ( userNam... | Sets the user configuration for the currently logged in user . |
39,614 | public void setConfig ( String configName , String configValue ) { if ( config == null ) { config = new Properties ( ) ; } if ( configValue == null ) { config . remove ( configName ) ; } else { config . setProperty ( configName , configValue ) ; } } | Add a new configuration . If the config name already exists the config value is overwritten . |
39,615 | public static List < ContentRange > parseFromHeader ( String rawRange , long totalSize , int maxNum ) throws InvalidRangeException { List < ContentRange > result = new ArrayList < > ( ) ; if ( rawRange != null ) { if ( ! fullPattern . matcher ( rawRange ) . matches ( ) ) { throw new InvalidRangeException ( "invalid syn... | Parses the header value of a HTTP Range request |
39,616 | protected List < String > getMatchesWithClause ( QueryData queryData , List < QueryNode > alternative , String indent ) { String indent2 = indent + TABSTOP ; String indent3 = indent2 + TABSTOP ; StringBuilder sbRaw = new StringBuilder ( ) ; sbRaw . append ( indent ) . append ( "matchesRaw AS\n" ) ; sbRaw . append ( ind... | Uses the inner SQL generator and provides an ordered and limited view on the matches with a match number . |
39,617 | protected String getSolutionFromMatchesWithClause ( IslandsPolicy . IslandPolicies islandPolicy , String matchesName , String indent ) { String indent2 = indent + TABSTOP ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( indent ) . append ( "solutions AS\n" ) ; sb . append ( indent ) . append ( "(\n" ) ; sb . ... | Breaks down the matches table so that each node of each match has it s own row . |
39,618 | public static String toAQL ( List < QueryNode > alternative ) { List < String > fragments = new LinkedList < > ( ) ; for ( QueryNode n : alternative ) { String frag = n . toAQLNodeFragment ( ) ; if ( frag != null && ! frag . isEmpty ( ) ) { fragments . add ( frag ) ; } } for ( QueryNode n : alternative ) { String frag ... | Outputs this alternative as an equivalent AQL query . |
39,619 | public String toAQL ( ) { StringBuilder sb = new StringBuilder ( ) ; Iterator < List < QueryNode > > itAlternative = alternatives . iterator ( ) ; while ( itAlternative . hasNext ( ) ) { List < QueryNode > alt = itAlternative . next ( ) ; if ( alternatives . size ( ) > 1 ) { sb . append ( "(" ) ; } sb . append ( toAQL ... | Outputs this normalized query data as an equivalent AQL query . |
39,620 | public boolean writeUser ( User user ) { if ( resourcePath != null ) { lock . writeLock ( ) . lock ( ) ; try { File userDir = new File ( resourcePath , "users" ) ; if ( userDir . isDirectory ( ) ) { File userFile = new File ( userDir . getAbsolutePath ( ) , user . getName ( ) ) ; Properties props = user . toProperties ... | Writes the user to the disk |
39,621 | public boolean deleteUser ( String userName ) { if ( resourcePath != null ) { lock . writeLock ( ) . lock ( ) ; try { File userDir = new File ( resourcePath , "users" ) ; if ( userDir . isDirectory ( ) ) { File userFile = new File ( userDir . getAbsolutePath ( ) , userName ) ; return userFile . delete ( ) ; } } finally... | Deletes the user from the disk |
39,622 | public boolean deleteGroup ( String groupName ) { if ( groupsFile != null ) { lock . writeLock ( ) . lock ( ) ; try { reloadGroupsFromFile ( ) ; groups . remove ( groupName ) ; return writeGroupFile ( ) ; } finally { lock . writeLock ( ) . unlock ( ) ; } } return false ; } | Deletes the group from the disk |
39,623 | private User getUserFromFile ( File userFile ) { if ( userFile . isFile ( ) && userFile . canRead ( ) ) { try ( FileInputStream userFileIO = new FileInputStream ( userFile ) ; ) { Properties userProps = new Properties ( ) ; userProps . load ( userFileIO ) ; return new User ( userFile . getName ( ) , userProps ) ; } cat... | Internal helper function to parse a user file . It assumes the calling function already has handled the locking . |
39,624 | @ Transactional ( readOnly = false , propagation = Propagation . REQUIRES_NEW , isolation = Isolation . READ_COMMITTED ) public void checkAndRemoveTopLevelCorpus ( String corpusName ) { if ( existConflictingTopLevelCorpus ( corpusName ) ) { log . info ( "delete conflicting corpus: {}" , corpusName ) ; List < String > c... | Deletes a top level corpus when it is already exists . |
39,625 | public Properties toProperties ( ) { Properties props = new Properties ( ) ; if ( passwordHash != null ) { props . put ( "password" , passwordHash ) ; } if ( groups != null && ! groups . isEmpty ( ) ) { props . put ( "groups" , Joiner . on ( ',' ) . join ( groups ) ) ; } if ( permissions != null && ! permissions . isEm... | Constructs a represention that is equal to the content of an ANNIS user file . |
39,626 | public static VisualizerInput createInput ( String corpus , String docName , Visualizer config , boolean isUsingRawText , List < String > nodeAnnoFilter ) { VisualizerInput input = new VisualizerInput ( ) ; input . setMappings ( parseMappings ( config ) ) ; input . setNamespace ( config . getNamespace ( ) ) ; String en... | Creates the input . It only takes the salt project or the raw text from the text table never both since the increase the performance for large texts . |
39,627 | private Set < SNode > getMatchedNodes ( SDocumentGraph graph ) { Set < SNode > matchedNodes = new HashSet < > ( ) ; for ( SNode node : graph . getNodes ( ) ) { if ( node . getFeature ( AnnisConstants . ANNIS_NS , AnnisConstants . FEAT_MATCHEDNODE ) != null ) matchedNodes . add ( node ) ; } return matchedNodes ; } | Takes a match and returns the matched nodes . |
39,628 | public void outputText ( SDocumentGraph graph , boolean alignmc , int matchNumber , Writer out ) throws IOException , IllegalArgumentException { if ( matchNumber == 0 ) { List < String > headerLine = new ArrayList < > ( ) ; for ( Map . Entry < Integer , TreeSet < String > > match : annotationsForMatchedNodes . entrySet... | Takes a match and outputs a csv - line |
39,629 | private boolean handleArtificialDominanceRelation ( SDocumentGraph graph , SNode source , SNode target , SRelation rel , SLayer layer , long componentID , long pre ) { List < SRelation < SNode , SNode > > mirrorRelations = graph . getRelations ( source . getId ( ) , target . getId ( ) ) ; if ( mirrorRelations != null &... | In ANNIS there is a special combined dominance component which has an empty name but which should not directly be included in the Salt graph . |
39,630 | private SLayer findOrAddSLayer ( String name , SDocumentGraph graph ) { List < SLayer > layerList = graph . getLayerByName ( name ) ; SLayer layer = ( layerList != null && layerList . size ( ) > 0 ) ? layerList . get ( 0 ) : null ; if ( layer == null ) { layer = SaltFactory . createSLayer ( ) ; layer . setName ( name )... | Retrieves an existing layer by it s name or creates and adds a new one if not existing yet |
39,631 | public String getPageAnnoForGridEvent ( SSpan span ) { int left = getLeftIndexFromSNode ( span ) ; int right = getRightIndexFromSNode ( span ) ; if ( sspans == null ) { log . warn ( "no page annos found" ) ; return null ; } int leftIdx = - 1 ; for ( Integer i : sspans . keySet ( ) ) { if ( i <= left ) { leftIdx = i ; }... | Returns a page annotation for a span if the span is overlapped by a page annotation . |
39,632 | public int getLeftIndexFromSNode ( SSpan s ) { RelannisNodeFeature feat = ( RelannisNodeFeature ) s . getFeature ( SaltUtil . createQName ( ANNIS_NS , FEAT_RELANNIS_NODE ) ) . getValue ( ) ; return ( int ) feat . getLeftToken ( ) ; } | Get the most left token index of a SSpan . |
39,633 | public int getRightIndexFromSNode ( SSpan s ) { RelannisNodeFeature feat = ( RelannisNodeFeature ) s . getFeature ( SaltUtil . createQName ( ANNIS_NS , FEAT_RELANNIS_NODE ) ) . getValue_SOBJECT ( ) ; return ( int ) feat . getRightToken ( ) ; } | Get the most right token index of a SSpan . |
39,634 | private void setUpTable ( ) { setSizeFull ( ) ; table . setSizeFull ( ) ; table . setSelectable ( false ) ; table . setImmediate ( true ) ; table . addStyleName ( "example-queries-table" ) ; table . addStyleName ( ChameleonTheme . TABLE_STRIPED ) ; table . addGeneratedColumn ( COLUMN_OPEN_CORPUS_BROWSER , new ShowCorpu... | Sets some layout properties . |
39,635 | private void addItems ( List < ExampleQuery > examples ) { if ( examples != null && examples . size ( ) > 0 ) { egContainer . addAll ( examples ) ; showTab ( ) ; } else { hideTabSheet ( ) ; } } | Add items if there are any and put the example query tab in the foreground . |
39,636 | private void showTab ( ) { if ( parentTab != null ) { tab = parentTab . getTab ( this ) ; if ( tab != null ) { tab . setEnabled ( true ) ; if ( ! ( parentTab . getSelectedTab ( ) instanceof ResultViewPanel ) ) { parentTab . setSelectedTab ( tab ) ; } } } } | Shows the tab and put into the foreground if no query is executed yet . |
39,637 | private static List < ExampleQuery > loadExamplesFromRemote ( Set < String > corpusNames ) { List < ExampleQuery > result = new LinkedList < > ( ) ; WebResource service = Helper . getAnnisWebResource ( ) ; try { if ( corpusNames == null || corpusNames . isEmpty ( ) ) { result = service . path ( "query" ) . path ( "corp... | Loads the available example queries for a specific corpus . |
39,638 | public void setSelectedCorpusInBackground ( final Set < String > selectedCorpora ) { loadingIndicator . setVisible ( true ) ; table . setVisible ( false ) ; Background . run ( new ExampleFetcher ( selectedCorpora , UI . getCurrent ( ) ) ) ; } | Sets the selected corpora and causes a reload |
39,639 | private List < File > unzipCorpus ( File outDir , ZipFile zip ) { List < File > rootDirs = new ArrayList < > ( ) ; Enumeration < ? extends ZipEntry > zipEnum = zip . entries ( ) ; while ( zipEnum . hasMoreElements ( ) ) { ZipEntry e = zipEnum . nextElement ( ) ; File outFile = new File ( outDir , e . getName ( ) . repl... | Extract the zipped ANNIS corpus files to an output directory . |
39,640 | 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 . |
39,641 | 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 . |
39,642 | 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 |
39,643 | 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 . |
39,644 | 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 |
39,645 | public long getElapsedArtifactTransformTime ( ) { long result = 0 ; for ( FragmentedOperation transform : transforms . values ( ) ) { result += transform . getElapsedTime ( ) ; } return result ; } | Get the total artifact transformation time . |
39,646 | 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 . |
39,647 | 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 . |
39,648 | 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 . |
39,649 | public CompositeOperation < TaskExecution > getTasks ( ) { List < TaskExecution > taskExecutions = CollectionUtils . sort ( tasks . values ( ) , slowestFirst ( ) ) ; return new CompositeOperation < TaskExecution > ( taskExecutions ) ; } | Returns the task executions for this project . |
39,650 | 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 . |
39,651 | 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 . |
39,652 | 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 . |
39,653 | 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 . |
39,654 | @ 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 . |
39,655 | 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 . |
39,656 | 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 . |
39,657 | 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 . |
39,658 | 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 . |
39,659 | 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 . |
39,660 | 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 . |
39,661 | public boolean exitsMongoDbDataBase ( String dataBaseName ) { List < String > dataBaseList = mongoClient . getDatabaseNames ( ) ; return dataBaseList . contains ( dataBaseName ) ; } | Checks if a database exists in MongoDB . |
39,662 | 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 . |
39,663 | 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 . |
39,664 | 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 . |
39,665 | 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 . |
39,666 | 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 . |
39,667 | 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 . |
39,668 | 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 . |
39,669 | 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 . |
39,670 | 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 |
39,671 | public boolean indexExists ( String indexName ) { return this . client . admin ( ) . indices ( ) . prepareExists ( indexName ) . execute ( ) . actionGet ( ) . isExists ( ) ; } | Check if an index exists in ES |
39,672 | 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 |
39,673 | 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 . |
39,674 | public void indexDocument ( String indexName , String mappingName , String id , XContentBuilder document ) throws Exception { client . prepareIndex ( indexName , mappingName , id ) . setSource ( document ) . get ( ) ; } | Indexes a document . |
39,675 | public void deleteDocument ( String indexName , String mappingName , String id ) { client . prepareDelete ( indexName , mappingName , id ) . get ( ) ; } | Deletes a document by its id . |
39,676 | @ 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 . |
39,677 | public static void set ( String key , String value ) { PROPS . get ( ) . setProperty ( key , value ) ; } | Set a string to share in other class . |
39,678 | @ 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 . |
39,679 | @ 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 |
39,680 | @ 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 . |
39,681 | @ 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 . |
39,682 | @ 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 |
39,683 | @ 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 . |
39,684 | @ 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 |
39,685 | @ 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 . |
39,686 | @ 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 |
39,687 | @ 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 |
39,688 | @ 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 . |
39,689 | @ 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 . |
39,690 | @ 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 |
39,691 | @ 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 |
39,692 | @ 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 |
39,693 | @ 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 |
39,694 | @ 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 |
39,695 | @ Given ( "^I save \'(.+?)\' in variable \'(.+?)\'$" ) public void saveInEnvironment ( String value , String envVar ) { ThreadProperty . set ( envVar , value ) ; } | Save value for future use . |
39,696 | @ 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 . |
39,697 | @ 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 . |
39,698 | @ 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 |
39,699 | @ 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.