idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
37,100 | public void setScreenImage ( byte [ ] content ) { logger . entering ( content ) ; this . screenImage = Arrays . copyOf ( content , content . length ) ; logger . exiting ( ) ; } | Set the image content | 44 | 4 |
37,101 | public static void addReporterMetadataItem ( String key , String itemType , String value ) { logger . entering ( new Object [ ] { key , itemType , value } ) ; if ( StringUtils . isNotBlank ( value ) && supportedMetaDataProperties . contains ( itemType ) ) { Map < String , String > subMap = reporterMetadata . get ( key ... | Adds an new item to the reporter metadata . | 173 | 9 |
37,102 | public static String toJsonAsString ( ) { logger . entering ( ) ; Gson gson = new GsonBuilder ( ) . setPrettyPrinting ( ) . create ( ) ; JsonObject configItem = new JsonObject ( ) ; for ( Entry < String , Map < String , String > > entry : ReporterConfigMetadata . getReporterMetaData ( ) . entrySet ( ) ) { Map < String ... | This method will generate JSON string representation of the all items in current ReportConfigMetadata . | 205 | 18 |
37,103 | public static String getPackage ( String element ) { Preconditions . checkNotNull ( element , "argument 'element' can not be null" ) ; return element . substring ( 0 , element . lastIndexOf ( ' ' ) ) ; } | Extracts the package from a qualified class . | 52 | 10 |
37,104 | public static String getClass ( String element ) { Preconditions . checkNotNull ( element , "argument 'element' can not be null" ) ; return element . substring ( element . lastIndexOf ( ' ' ) + 1 ) ; } | Extracts the class name from a qualified class . | 52 | 11 |
37,105 | @ Override public boolean filter ( Object data ) { logger . entering ( new Object [ ] { data } ) ; invocationCount += 1 ; for ( int index : this . indexes ) { if ( invocationCount == index ) { logger . exiting ( true ) ; return true ; } } logger . exiting ( false ) ; return false ; } | This function identifies whether the object falls in the filtering criteria or not based on the indexes provided . For this we are using the invocation count for comparing the index . | 70 | 32 |
37,106 | public synchronized static void initConfig ( ISuite suite ) { SeLionLogger . getLogger ( ) . entering ( suite ) ; Map < ConfigProperty , String > initialValues = new HashMap <> ( ) ; for ( ConfigProperty prop : ConfigProperty . values ( ) ) { String paramValue = suite . getParameter ( prop . getName ( ) ) ; // empty va... | Parses suite parameters and generates SeLion Config object | 133 | 12 |
37,107 | public synchronized static void initConfig ( ITestContext context ) { SeLionLogger . getLogger ( ) . entering ( context ) ; Map < ConfigProperty , String > initialValues = new HashMap <> ( ) ; Map < String , String > testParams = context . getCurrentXmlTest ( ) . getLocalParameters ( ) ; if ( ! testParams . isEmpty ( )... | Parses configuration file and extracts values for test environment | 214 | 11 |
37,108 | public synchronized static void initConfig ( ) { SeLionLogger . getLogger ( ) . entering ( ) ; Map < ConfigProperty , String > initialValues = new HashMap <> ( ) ; initConfig ( initialValues ) ; SeLionLogger . getLogger ( ) . exiting ( ) ; } | Reads and parses configuration file Initializes the configuration reloading all data | 67 | 15 |
37,109 | public static void printSeLionConfigValues ( ) { SeLionLogger . getLogger ( ) . entering ( ) ; StringBuilder builder = new StringBuilder ( "SeLion configuration: {" ) ; boolean isFirst = true ; for ( ConfigProperty configProperty : ConfigProperty . values ( ) ) { if ( ! isFirst ) { builder . append ( ", " ) ; } builder... | Prints SeLion Config Values | 177 | 7 |
37,110 | public static synchronized void setConfigProperty ( ConfigProperty configProperty , Object configPropertyValue ) { checkArgument ( configProperty != null , "Config property cannot be null." ) ; checkArgument ( configPropertyValue != null , "Config property value cannot be null." ) ; getConfig ( ) . setProperty ( config... | Sets a SeLion configuration value . This is useful when you want to override or set a setting . | 79 | 22 |
37,111 | private boolean generateJavaCode ( File baseFile , File dataFile , File extendedFile ) { return ( baseFile . lastModified ( ) < dataFile . lastModified ( ) || ( extendedFile . exists ( ) && baseFile . lastModified ( ) < extendedFile . lastModified ( ) ) ) ; } | 3 . Last modified timestamp of the extended java file is greater than that of the corresponding yaml file . | 68 | 21 |
37,112 | public static synchronized void spawnLocalHub ( AbstractTestSession testSession ) { LOGGER . entering ( testSession . getPlatform ( ) ) ; if ( ! isRunLocally ( ) ) { LOGGER . exiting ( ) ; return ; } setupToBootList ( ) ; for ( LocalServerComponent eachItem : toBoot ) { try { eachItem . boot ( testSession ) ; } catch (... | This method is responsible for spawning a local hub for supporting local executions | 174 | 13 |
37,113 | static synchronized void shutDownHub ( ) { LOGGER . entering ( ) ; if ( ! isRunLocally ( ) ) { LOGGER . exiting ( ) ; return ; } // shutdown in reverse order Collections . reverse ( toBoot ) ; for ( LocalServerComponent eachItem : toBoot ) { eachItem . shutdown ( ) ; } clearToBootList ( ) ; LOGGER . exiting ( ) ; } | This method helps shut down the already spawned hub for local runs | 85 | 12 |
37,114 | public static void initReportData ( List < ISuite > suites ) { logger . entering ( suites ) ; if ( ! isReportInitialized ) { for ( ISuite suite : suites ) { Map < String , ISuiteResult > r = suite . getResults ( ) ; for ( ISuiteResult r2 : r . values ( ) ) { ITestContext tc = r2 . getTestContext ( ) ; ITestNGMethod [ ]... | init the uniques id for the methods needed to create the navigation . | 154 | 14 |
37,115 | public static String getStringFromISODateString ( String dateISOString ) { Date date ; String formattedDate ; DateFormat formatter = getFormatter ( ) ; try { date = formatter . parse ( dateISOString ) ; formattedDate = DateFormat . getDateTimeInstance ( DateFormat . MEDIUM , DateFormat . SHORT ) . format ( date ) ; } c... | Return an reader friendly date from ISO 8601 combined date and time string . | 118 | 15 |
37,116 | public static Entry < String , String > formatReportDataForBrowsableReports ( Entry < String , String > entryItem ) { String key = entryItem . getKey ( ) ; String value = entryItem . getValue ( ) ; String formattedKey = key ; String formattedValue = value ; switch ( key ) { case ReporterDateFormatter . CURRENTDATE : fo... | Formats specific keys and values into readable form for HTML Reporter . | 134 | 13 |
37,117 | public synchronized String getConfigProperty ( Config . ConfigProperty configProperty ) { SeLionLogger . getLogger ( ) . entering ( configProperty ) ; checkArgument ( configProperty != null , "Config property cannot be null" ) ; // Search locally then query SeLionConfig if not found String propValue = null ; if ( baseC... | Get the configuration property value for configProperty . | 158 | 9 |
37,118 | public synchronized void setConfigProperty ( Config . ConfigProperty configProperty , Object configPropertyValue ) { checkArgument ( configProperty != null , "Config property cannot be null" ) ; checkArgument ( checkNotInGlobalScope ( configProperty ) , String . format ( "The configuration property (%s) is not supporte... | Sets the SeLion configuration property value . | 121 | 10 |
37,119 | public synchronized boolean isLocalValuePresent ( ConfigProperty configProperty ) { checkArgument ( configProperty != null , "Config property cannot be null" ) ; String value = baseConfig . getString ( configProperty . getName ( ) ) ; return value != null ; } | Answer if local configuration contains a value for specified property . | 56 | 11 |
37,120 | private void initSeLionRemoteProxySpecificValues ( RemoteProxy proxy ) { if ( SeLionRemoteProxy . class . getCanonicalName ( ) . equals ( proxy . getOriginalRegistrationRequest ( ) . getConfiguration ( ) . proxy ) ) { SeLionRemoteProxy srp = ( SeLionRemoteProxy ) proxy ; // figure out if the proxy is scheduled to shutd... | SeLion specific features | 213 | 5 |
37,121 | private String appendMoreLogsLink ( final String fileName , String url ) throws IOException { FileBackedStringBuffer buffer = new FileBackedStringBuffer ( ) ; int index = retrieveIndexValueFromFileName ( fileName ) ; index ++ ; File logFileName = retrieveFileFromLogsFolder ( Integer . toString ( index ) ) ; if ( logFil... | This method helps to display More log information of the node machine . | 221 | 13 |
37,122 | private File getLogsDirectory ( ) { if ( logsDirectory != null ) { return logsDirectory ; } logsDirectory = new File ( SeLionGridConstants . LOGS_DIR ) ; if ( ! logsDirectory . exists ( ) ) { logsDirectory . mkdirs ( ) ; } return logsDirectory ; } | This method get the Logs file directory | 67 | 8 |
37,123 | protected void process ( HttpServletRequest request , HttpServletResponse response , String fileName ) throws IOException { // TODO put this html code in a template response . setContentType ( "text/html" ) ; response . setCharacterEncoding ( "UTF-8" ) ; response . setStatus ( 200 ) ; FileBackedStringBuffer buffer = ne... | This method display the log file content | 317 | 7 |
37,124 | private String renderLogFileContents ( String fileName ) throws IOException { FileBackedStringBuffer buffer = new FileBackedStringBuffer ( ) ; int index = retrieveIndexValueFromFileName ( fileName ) ; int runningIndex = 0 ; File eachFile = null ; while ( ( eachFile = retrieveFileFromLogsFolder ( Integer . toString ( ru... | This method read the content of the file and append into FileBackedStringBuffer | 193 | 16 |
37,125 | private File retrieveFileFromLogsFolder ( String index ) { File [ ] logFiles = getLogsDirectory ( ) . listFiles ( new LogFilesFilter ( ) ) ; File fileToReturn = null ; for ( File eachLogFile : logFiles ) { String fileName = eachLogFile . getName ( ) . split ( "\\Q.\\E" ) [ 0 ] ; if ( fileName . endsWith ( index ) ) { f... | Get the log files from the directory | 112 | 7 |
37,126 | public static GuiMapReader getInstance ( String pageDomain , String pageClassName ) throws IOException { logger . entering ( new Object [ ] { pageDomain , pageClassName } ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( pageClassName ) , "pageClassName can not be null, empty, or whitespace" ) ; String gui... | Method to get the reader instance depending on the input parameters . | 353 | 12 |
37,127 | private static String getFilePath ( String file ) { logger . entering ( file ) ; String filePath = null ; URL fileURL = GuiMapReaderFactory . class . getClassLoader ( ) . getResource ( file ) ; if ( fileURL != null ) { filePath = fileURL . getPath ( ) ; } logger . exiting ( filePath ) ; return filePath ; } | Method to get the complete file path . | 81 | 8 |
37,128 | public int getNumberOfColumns ( ) { List < WebElement > cells ; String xPath = getXPathBase ( ) + "tr" ; List < WebElement > elements = HtmlElementUtils . locateElements ( xPath ) ; if ( elements . size ( ) > 0 && getDataStartIndex ( ) - 1 < elements . size ( ) ) { cells = elements . get ( getDataStartIndex ( ) - 1 ) .... | Returns the number of columns in a table . If the table is empty column count cannot be determined and 0 will be returned . | 122 | 25 |
37,129 | public void clickLinkInCell ( int row , int column ) { String xPath = getXPathBase ( ) + "tr[" + row + "]/td[" + column + "]/a" ; new Link ( xPath ) . click ( ) ; } | Goes to the cell addressed by row and column indices and clicks link in that cell . Performs wait until page would be loaded | 57 | 26 |
37,130 | public String getRowText ( int rowIndex ) { String rowText = null ; String xPath = getXPathBase ( ) + "tr[" + rowIndex + "]" ; rowText = HtmlElementUtils . locateElement ( xPath ) . getText ( ) ; return rowText ; } | Returns the single row of a table as a long string of text using the input row index . | 64 | 19 |
37,131 | public void checkCheckboxInCell ( int row , int column ) { String checkboxLocator = getXPathBase ( ) + "tr[" + row + "]/td[" + column + "]/input" ; CheckBox cb = new CheckBox ( checkboxLocator ) ; cb . check ( ) ; } | Tick the checkbox in a cell of a table indicated by input row and column indices | 71 | 18 |
37,132 | public void uncheckCheckboxInCell ( int row , int column ) { String checkboxLocator = getXPathBase ( ) + "tr[" + row + "]/td[" + column + "]/input" ; CheckBox cb = new CheckBox ( checkboxLocator ) ; cb . uncheck ( ) ; } | Untick a checkbox in a cell of a table indicated by the input row and column indices . | 73 | 20 |
37,133 | protected void process ( HttpServletRequest request , HttpServletResponse response ) throws IOException { boolean doStatusQuery = request . getParameter ( PING_NODES ) != null ; String acceptHeader = request . getHeader ( "Accept" ) ; if ( acceptHeader != null && acceptHeader . equalsIgnoreCase ( "application/json" ) )... | This method gets all the nodes which are connected to the grid machine from the Registry and displays them in html page . | 165 | 23 |
37,134 | @ Override public Object [ ] [ ] getDataByKeys ( String [ ] keys ) { logger . entering ( Arrays . toString ( keys ) ) ; Object [ ] [ ] obj = new Object [ keys . length ] [ 1 ] ; for ( int i = 0 ; i < keys . length ; i ++ ) { obj [ i ] [ 0 ] = getSingleExcelRow ( getObject ( ) , keys [ i ] , true ) ; } logger . exiting ... | This function will use the input string representing the keys to collect and return the correct excel sheet data rows as two dimensional object to be used as TestNG DataProvider . | 113 | 33 |
37,135 | @ Override public Iterator < Object [ ] > getDataByFilter ( DataProviderFilter dataFilter ) { logger . entering ( dataFilter ) ; List < Object [ ] > objs = new ArrayList <> ( ) ; Field [ ] fields = resource . getCls ( ) . getDeclaredFields ( ) ; // Extracting number of rows of data to read // Notice that numRows is ret... | Gets data from Excel sheet by applying the given filter . | 376 | 12 |
37,136 | protected Object getSingleExcelRow ( Object userObj , String key , boolean isExternalCall ) { logger . entering ( new Object [ ] { userObj , key , isExternalCall } ) ; Class < ? > cls ; try { cls = Class . forName ( userObj . getClass ( ) . getName ( ) ) ; } catch ( ClassNotFoundException e ) { throw new DataProviderEx... | This method fetches a specific row from an excel sheet which can be identified using a key and returns the data as an Object which can be cast back into the user s actual data type . | 206 | 38 |
37,137 | private void setValueForArrayType ( DataMemberInformation memberInfo ) throws IllegalAccessException , ArrayIndexOutOfBoundsException , IllegalArgumentException , InstantiationException { logger . entering ( memberInfo ) ; Field eachField = memberInfo . getField ( ) ; Object objectToSetDataInto = memberInfo . getObject... | A utility method that setups up data members which are arrays . | 530 | 12 |
37,138 | private void setValueForNonArrayType ( DataMemberInformation memberInfo ) throws IllegalAccessException , InstantiationException , IllegalArgumentException , InvocationTargetException , NoSuchMethodException , SecurityException { logger . entering ( memberInfo ) ; Field eachField = memberInfo . getField ( ) ; Class < ?... | A utility method that setups up data members which are NOT arrays . | 543 | 13 |
37,139 | public List < String > getHeaderRowContents ( String sheetName , int size ) { return excelReader . getHeaderRowContents ( sheetName , size ) ; } | Utility to get the header row contents of the excel sheet | 34 | 12 |
37,140 | public int getWidth ( ) { try { return ( ( RemoteWebElement ) getElement ( ) ) . getSize ( ) . width ; } catch ( NumberFormatException e ) { throw new WebElementException ( "Attribute " + WIDTH + " not found for Image " + getLocator ( ) , e ) ; } } | This function is to get image s width . | 70 | 9 |
37,141 | public int getHeight ( ) { try { return ( ( RemoteWebElement ) getElement ( ) ) . getSize ( ) . height ; } catch ( NumberFormatException e ) { throw new WebElementException ( "Attribute " + HEIGHT + " not found for Image " + getLocator ( ) , e ) ; } } | This function is to get image s height . | 69 | 9 |
37,142 | void checkPort ( int port , String msg ) { StringBuilder message = new StringBuilder ( ) . append ( " " ) . append ( msg ) ; String portInUseError = String . format ( "Port %d is already in use. Please shutdown the service " + "listening on this port or configure a different port%s." , port , message ) ; boolean free =... | Check the port availability | 144 | 4 |
37,143 | @ Override public Object [ ] [ ] getDataByIndex ( String indexes ) throws IOException , DataProviderException { logger . entering ( indexes ) ; int [ ] arrayIndex = DataProviderHelper . parseIndexString ( indexes ) ; Object [ ] [ ] yamlObjRequested = getDataByIndex ( arrayIndex ) ; logger . exiting ( ( Object [ ] ) yam... | Gets yaml data for requested indexes . | 93 | 9 |
37,144 | public void selectByValue ( String value ) { getDispatcher ( ) . beforeSelect ( this , value ) ; new Select ( getElement ( ) ) . selectByValue ( value ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIActions ( UIActions . SELECTED , value ) ; } getDispatcher ( ) . afterSelect ( t... | Select all options that have a value matching the argument . | 98 | 11 |
37,145 | public void selectByLabel ( String label ) { getDispatcher ( ) . beforeSelect ( this , label ) ; new Select ( getElement ( ) ) . selectByVisibleText ( label ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIActions ( UIActions . SELECTED , label ) ; } getDispatcher ( ) . afterSele... | Select all options that display text matching the argument . | 100 | 10 |
37,146 | public void selectByValue ( String [ ] values ) { for ( int i = 0 ; i < values . length ; i ++ ) { selectByValue ( values [ i ] ) ; } } | Select all options that have a value matching any arguments . | 41 | 11 |
37,147 | public void selectByLabel ( String [ ] labels ) { for ( int i = 0 ; i < labels . length ; i ++ ) { selectByLabel ( labels [ i ] ) ; } } | Select all options that display text matching any arguments . | 41 | 10 |
37,148 | public void selectByIndex ( String [ ] indexes ) { for ( int i = 0 ; i < indexes . length ; i ++ ) { selectByIndex ( Integer . parseInt ( indexes [ i ] ) ) ; } } | Select the option at the given indexes . This is done by examing the index attribute of an element and not merely by counting . | 47 | 26 |
37,149 | public String [ ] getSelectOptions ( ) { List < WebElement > optionList = getElement ( ) . findElements ( By . tagName ( "option" ) ) ; String [ ] optionArray = new String [ optionList . size ( ) ] ; for ( int i = 0 ; i < optionList . size ( ) ; i ++ ) { optionArray [ i ] = optionList . get ( i ) . getText ( ) ; } retu... | Returns all options currently selected . | 100 | 6 |
37,150 | public String getSelectedLabel ( ) { List < WebElement > options = getElement ( ) . findElements ( By . tagName ( "option" ) ) ; for ( WebElement option : options ) { if ( option . isSelected ( ) ) { return option . getText ( ) ; } } return null ; } | Get a single selected label . If multiple options are selected then the first one is returned . | 70 | 18 |
37,151 | public String getSelectedValue ( ) { List < WebElement > options = getElement ( ) . findElements ( By . tagName ( "option" ) ) ; for ( WebElement option : options ) { if ( option . isSelected ( ) ) { return option . getAttribute ( "value" ) ; } } return null ; } | Get a single selected value . If multiple options are selected then the first one is returned . | 73 | 18 |
37,152 | public String [ ] getSelectedLabels ( ) { List < WebElement > options = getElement ( ) . findElements ( By . tagName ( "option" ) ) ; List < String > selected = new ArrayList < String > ( ) ; for ( WebElement option : options ) { if ( option . isSelected ( ) ) { selected . add ( option . getText ( ) ) ; } } return ( St... | Gets multiple selected labels . | 111 | 6 |
37,153 | public String [ ] getSelectedValues ( ) { List < WebElement > options = getElement ( ) . findElements ( By . tagName ( "option" ) ) ; List < String > selected = new ArrayList < String > ( ) ; for ( WebElement option : options ) { if ( option . isSelected ( ) ) { selected . add ( option . getAttribute ( "value" ) ) ; } ... | Gets multiple selected values . | 113 | 6 |
37,154 | public String [ ] getContentLabel ( ) { List < WebElement > options = getElement ( ) . findElements ( By . tagName ( "option" ) ) ; List < String > contents = new ArrayList < String > ( ) ; for ( WebElement option : options ) { contents . add ( option . getText ( ) ) ; } return ( String [ ] ) contents . toArray ( new S... | Get all labels whether they are selected or not . | 97 | 10 |
37,155 | public String [ ] getContentValue ( ) { List < WebElement > options = getElement ( ) . findElements ( By . tagName ( "option" ) ) ; List < String > contents = new ArrayList < String > ( ) ; for ( WebElement option : options ) { contents . add ( option . getAttribute ( "value" ) ) ; } return ( String [ ] ) contents . to... | Get all values whether they are selected or not . | 100 | 10 |
37,156 | public void deselectByValue ( String value ) { getDispatcher ( ) . beforeDeselect ( this , value ) ; new Select ( getElement ( ) ) . deselectByValue ( value ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIActions ( UIActions . CLEARED , value ) ; } getDispatcher ( ) . afterDesel... | Deselect all options that have a value matching the argument . | 105 | 13 |
37,157 | public void deselectByIndex ( int index ) { getDispatcher ( ) . beforeDeselect ( this , index ) ; new Select ( getElement ( ) ) . deselectByIndex ( index ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIActions ( UIActions . CLEARED , Integer . toString ( index ) ) ; } getDispatc... | Deselect the option at the given index . This is done by examing the index attribute of an element and not merely by counting . | 111 | 28 |
37,158 | public void deselectByLabel ( String label ) { getDispatcher ( ) . beforeDeselect ( this , label ) ; new Select ( getElement ( ) ) . deselectByVisibleText ( label ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIActions ( UIActions . CLEARED , label ) ; } getDispatcher ( ) . afte... | Deselect all options that display text matching the argument . | 107 | 12 |
37,159 | public void click ( String locator ) { getDispatcher ( ) . beforeClick ( this , locator ) ; getElement ( ) . click ( ) ; validatePresenceOfAlert ( ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIAction ( UIActions . CLICKED ) ; } WebDriverWaitUtils . waitUntilElementIsPresent ( ... | The RadioButton click function and wait for object to load | 114 | 11 |
37,160 | private void parseResults ( ) { logger . entering ( ) ; if ( result . getStatus ( ) == ITestResult . SUCCESS ) { this . status = "Passed" ; } else if ( result . getStatus ( ) == ITestResult . FAILURE ) { this . status = "Failed" ; } else if ( result . getStatus ( ) == ITestResult . SKIP ) { this . status = "Skipped" ; ... | Parse the test results and convert to the MethodInfo fields | 341 | 12 |
37,161 | public String getStackTraceInfo ( Throwable aThrowable ) { final Writer localWriter = new StringWriter ( ) ; final PrintWriter printWriter = new PrintWriter ( localWriter ) ; aThrowable . printStackTrace ( printWriter ) ; return localWriter . toString ( ) ; } | Used to return StackTrace of an Exception as String . | 63 | 12 |
37,162 | public String toJson ( ) { logger . entering ( ) ; parseResults ( ) ; Gson gson = new GsonBuilder ( ) . setPrettyPrinting ( ) . create ( ) ; String json = gson . toJson ( this ) ; logger . exiting ( json ) ; return json ; } | This method generate the JSON string for the instance . GSON builder helps to build JSON string and it will exclude the static and transient variable during generation . | 66 | 30 |
37,163 | public static synchronized ConfigParser setConfigFile ( String file ) { LOGGER . entering ( file ) ; if ( configuration == null ) { configFile = file ; } LOGGER . exiting ( parser . toString ( ) ) ; return parser ; } | Set the config file | 51 | 4 |
37,164 | public List < String > getRowContents ( Row row , int size ) { logger . entering ( new Object [ ] { row , size } ) ; List < String > rowData = new ArrayList < String > ( ) ; if ( row != null ) { for ( int i = 1 ; i <= size ; i ++ ) { String data = null ; if ( row . getCell ( i ) != null ) { data = row . getCell ( i ) .... | Return the row contents of the specified row in a list of string format . | 126 | 15 |
37,165 | public int getRowIndex ( String sheetName , String key ) { logger . entering ( new Object [ ] { sheetName , key } ) ; int index = - 1 ; Sheet sheet = fetchSheet ( sheetName ) ; int rowCount = sheet . getPhysicalNumberOfRows ( ) ; for ( int i = 0 ; i < rowCount ; i ++ ) { Row row = sheet . getRow ( i ) ; if ( row == nul... | Search for the input key from the specified sheet name and return the index position of the row that contained the key | 163 | 22 |
37,166 | static List < String > getExecutableNames ( ) { List < String > executableNames = new ArrayList <> ( ) ; if ( Platform . getCurrent ( ) . is ( Platform . WINDOWS ) ) { Collections . addAll ( executableNames , ProcessNames . PHANTOMJS . getWindowsImageName ( ) , ProcessNames . CHROMEDRIVER . getWindowsImageName ( ) , Pr... | Utility method to return the executable names for the specified platform . | 198 | 13 |
37,167 | static String extractMsi ( String msiFile ) { LOGGER . entering ( msiFile ) ; Process process = null ; String exeFilePath = null ; boolean isMsiExtracted = true ; try { process = Runtime . getRuntime ( ) . exec ( new String [ ] { "msiexec" , "/a" , msiFile , "/qn" , "TARGETDIR=" + SeLionConstants . SELION_HOME_DIR } ) ... | Installs MicrosoftWebDriver . msi file as administrator in SELION_HOME_DIR and also deletes unwanted file and directory created by Msiexec . | 296 | 34 |
37,168 | public RemoteWebDriver createDriver ( MobileNodeType nodeType , WebDriverPlatform platform , CommandExecutor command , URL url , Capabilities caps ) { if ( mobileProviders . containsKey ( nodeType ) ) { logger . log ( Level . FINE , "Found mobile driver provider that supports " + nodeType ) ; return mobileProviders . g... | Creates a new RemoteWebDriver instance from the first MobileProvider that supports the specified nodeType . | 115 | 20 |
37,169 | public static void waitUntilElementIsClickable ( final String elementLocator ) { logger . entering ( elementLocator ) ; By by = HtmlElementUtils . resolveByType ( elementLocator ) ; ExpectedCondition < WebElement > condition = ExpectedConditions . elementToBeClickable ( by ) ; waitForCondition ( condition ) ; logger . ... | Waits until element is cickable . | 81 | 9 |
37,170 | public static void waitUntilElementIsInvisible ( final String elementLocator ) { logger . entering ( elementLocator ) ; By by = HtmlElementUtils . resolveByType ( elementLocator ) ; ExpectedCondition < Boolean > condition = ExpectedConditions . invisibilityOfElementLocated ( by ) ; waitForCondition ( condition ) ; logg... | Waits until element is either invisible or not present on the DOM . | 80 | 14 |
37,171 | public static void waitUntilElementIsPresent ( final String elementLocator ) { logger . entering ( elementLocator ) ; By by = HtmlElementUtils . resolveByType ( elementLocator ) ; ExpectedCondition < WebElement > condition = ExpectedConditions . presenceOfElementLocated ( by ) ; waitForCondition ( condition ) ; logger ... | Waits until element is present on the DOM of a page . This does not necessarily mean that the element is visible . | 79 | 24 |
37,172 | public static void waitUntilElementIsVisible ( final String elementLocator ) { logger . entering ( elementLocator ) ; By by = HtmlElementUtils . resolveByType ( elementLocator ) ; ExpectedCondition < WebElement > condition = ExpectedConditions . visibilityOfElementLocated ( by ) ; waitForCondition ( condition ) ; logge... | Waits until element is present on the DOM of a page and visible . Visibility means that the element is not only displayed but also has a height and width that is greater than 0 . | 80 | 38 |
37,173 | public static void waitUntilPageTitleContains ( final String pageTitle ) { logger . entering ( pageTitle ) ; Preconditions . checkArgument ( StringUtils . isNotEmpty ( pageTitle ) , "Expected Page title cannot be null (or) empty." ) ; ExpectedCondition < Boolean > condition = ExpectedConditions . titleContains ( pageTi... | Waits until the current page s title contains a case - sensitive substring of the given title . | 94 | 20 |
37,174 | public static void waitUntilTextPresent ( final String searchString ) { logger . entering ( searchString ) ; Preconditions . checkArgument ( StringUtils . isNotEmpty ( searchString ) , "Search string cannot be null (or) empty." ) ; ExpectedCondition < Boolean > conditionToCheck = new ExpectedCondition < Boolean > ( ) {... | Waits until text appears anywhere within the current page s < ; body> ; tag . | 120 | 20 |
37,175 | public static void waitUntilAllElementsArePresent ( final String ... locators ) { logger . entering ( new Object [ ] { Arrays . toString ( locators ) } ) ; Preconditions . checkArgument ( locators != null , "Please provide a valid set of locators." ) ; for ( String eachLocator : locators ) { waitUntilElementIsPresent (... | Waits until both two elements appear at the page Waits until all the elements are present on the DOM of a page . This does not necessarily mean that the element is visible . | 94 | 36 |
37,176 | public static boolean changePassword ( String userName , String newPassword ) { LOGGER . entering ( userName , newPassword . replaceAll ( "." , "*" ) ) ; boolean changeSucceeded = false ; File authFile = new File ( AUTH_FILE_LOCATION ) ; try { authFile . delete ( ) ; authFile . createNewFile ( ) ; createAuthFile ( auth... | Changes the password for the given user to the new password | 138 | 11 |
37,177 | protected void parse ( String json ) { logger . entering ( json ) ; try { Gson gson = new Gson ( ) ; BaseLog baseLog = gson . fromJson ( json , this . getClass ( ) ) ; this . msg = baseLog . msg ; this . screen = baseLog . screen ; this . location = baseLog . location ; this . href = baseLog . href ; } catch ( JsonSynt... | Parsing the JSON string using Gson library . | 122 | 11 |
37,178 | public void shutdown ( ) throws Exception { if ( type == null ) { return ; } if ( type instanceof Hub ) { ( ( Hub ) type ) . stop ( ) ; } if ( type instanceof SelfRegisteringRemote ) { ( ( SelfRegisteringRemote ) type ) . stopRemoteServer ( ) ; } if ( type instanceof SeleniumServer ) { ( ( SeleniumServer ) type ) . sto... | Shutdown the instance | 105 | 4 |
37,179 | public void boot ( String [ ] args ) throws Exception { SeLionStandaloneConfiguration configuration = new SeLionStandaloneConfiguration ( ) ; JCommander commander = new JCommander ( ) ; commander . setAcceptUnknownOptions ( true ) ; commander . addObject ( configuration ) ; commander . parse ( args ) ; LauncherConfigur... | Boot the instance base on the arguments supplied | 265 | 8 |
37,180 | @ Override public void dragToValue ( double value ) { logger . entering ( value ) ; WebElement webElement = findElement ( locator ) ; Point currentLocation = webElement . getLocation ( ) ; Dimension elementSize = webElement . getSize ( ) ; int x = currentLocation . getX ( ) ; int y = currentLocation . getY ( ) + ( elem... | it is not accurate and is best to used only for setting value to 0 or 1 otherwise the result is close to parameter | 277 | 24 |
37,181 | public void exiting ( Object object ) { if ( ! getLogger ( ) . isLoggable ( Level . FINER ) ) { return ; } FrameInfo fi = getLoggingFrame ( ) ; getLogger ( ) . exiting ( fi . className , fi . methodName , object ) ; } | Function exit log convenience method . | 65 | 6 |
37,182 | private static FrameInfo getLoggingFrame ( ) { StackTraceElement [ ] stackTrace = Thread . currentThread ( ) . getStackTrace ( ) ; StackTraceElement loggingFrame = null ; /* * We need to dig through all the frames until we get to a frame that contains this class, then dig through all * frames for this class, to finally... | Calculate the logging frame s class name and method name . | 255 | 13 |
37,183 | @ Override public void onStart ( ISuite suite ) { logger . entering ( suite ) ; if ( ListenerManager . isCurrentMethodSkipped ( this ) ) { logger . exiting ( ListenerManager . THREAD_EXCLUSION_MSG ) ; return ; } // Nothing should query for SeLionConfig values before this point. Config . initConfig ( suite ) ; ConfigSum... | Initiate config on suite start | 255 | 7 |
37,184 | public static String filterOutputDirectory ( String base , String suiteName ) { logger . entering ( new Object [ ] { base , suiteName } ) ; int index = base . lastIndexOf ( suiteName ) ; String outputFolderWithoutName = base . substring ( 0 , index ) ; logger . exiting ( outputFolderWithoutName + File . separator ) ; r... | Generates and returns output directory string path | 87 | 8 |
37,185 | @ Override public void onFinish ( ISuite suite ) { logger . entering ( suite ) ; if ( ListenerManager . isCurrentMethodSkipped ( this ) ) { logger . exiting ( ListenerManager . THREAD_EXCLUSION_MSG ) ; return ; } LocalGridManager . shutDownHub ( ) ; logger . exiting ( ) ; } | Closes selenium session when suite finished to run | 76 | 11 |
37,186 | @ Override public void onStart ( ITestContext context ) { logger . entering ( context ) ; if ( ListenerManager . isCurrentMethodSkipped ( this ) ) { logger . exiting ( ListenerManager . THREAD_EXCLUSION_MSG ) ; return ; } String testName = context . getCurrentXmlTest ( ) . getName ( ) ; // initializing the ConfigSummar... | On start each suite initialize config object and report object | 460 | 10 |
37,187 | private void invokeInitializersBasedOnPriority ( ITestContext context ) { ServiceLoader < Initializer > serviceLoader = ServiceLoader . load ( Initializer . class ) ; List < AbstractConfigInitializer > loader = new ArrayList < AbstractConfigInitializer > ( ) ; for ( Initializer l : serviceLoader ) { loader . add ( ( Ab... | This method facilitates initialization of all configurations from the current project as well as downstream consumers . | 108 | 17 |
37,188 | @ Override public boolean filter ( Object data ) { logger . entering ( data ) ; String [ ] keyValues = filterKeyValues . split ( "," ) ; String tempKey = null ; Field field ; try { field = data . getClass ( ) . getDeclaredField ( filterKeyName ) ; field . setAccessible ( true ) ; for ( String keyValue : keyValues ) { t... | This function identifies whether the object falls in the filtering criteria or not based on the filterKeyName and its corresponding filterKeyValues . | 206 | 26 |
37,189 | public static void isValidXpath ( String locator ) { logger . entering ( locator ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( locator ) , INVALID_LOCATOR_ERR_MSG ) ; if ( locator . startsWith ( "xpath=/" ) || locator . startsWith ( "/" ) ) { throw new UnsupportedOperationException ( "Use xpath dot not... | Validates a child locator to have the xpath dot notation . | 123 | 14 |
37,190 | public static boolean isElementPresent ( String locator ) { logger . entering ( locator ) ; boolean flag = false ; try { flag = HtmlElementUtils . locateElement ( locator ) != null ; } catch ( NoSuchElementException e ) { // NOSONAR } logger . exiting ( flag ) ; return flag ; } | Checks if the provided element is present on the page based on the locator provided | 71 | 17 |
37,191 | String getSubFolderName ( ) { if ( subFolderName == null ) { String relPath = getAbsolutePath ( ) . replace ( REPO_ABSOLUTE_PATH , "" ) ; relPath = relPath . substring ( relPath . indexOf ( SystemUtils . FILE_SEPARATOR ) + 1 ) ; String [ ] parts = relPath . split ( "[\\\\/]" ) ; subFolderName = ( ( parts . length < 3 )... | Returns the optional sub folder for the artifact | 132 | 8 |
37,192 | private CommandLine createCommandForChildProcess ( ) throws IOException { LOGGER . entering ( ) ; CommandLine cmdLine = CommandLine . parse ( "appium" ) ; // add the program argument / dash options cmdLine . addArguments ( getProgramArguments ( ) ) ; LOGGER . exiting ( cmdLine . toString ( ) ) ; return cmdLine ; } | This method loads the default arguments required to spawn appium | 79 | 11 |
37,193 | public MgcpSignal provide ( String pkg , String signal , int requestId , NotifiedEntity notifiedEntity , Map < String , String > parameters , MgcpEndpoint endpoint ) throws UnrecognizedMgcpPackageException , UnsupportedMgcpSignalException { switch ( pkg ) { case AudioPackage . PACKAGE_NAME : return provideAudioSignal (... | Provides an MGCP Signal to be executed . | 124 | 10 |
37,194 | public boolean contains ( Format format ) { for ( Format f : list ) { if ( f . matches ( format ) ) return true ; } return false ; } | Checks that collection has specified format . | 33 | 8 |
37,195 | public void intersection ( Formats other , Formats intersection ) { intersection . list . clear ( ) ; for ( Format f1 : list ) { for ( Format f2 : other . list ) { if ( f1 . matches ( f2 ) ) intersection . list . add ( f2 ) ; } } } | Find the intersection between this collection and other | 65 | 8 |
37,196 | public void add ( Task task ) { synchronized ( LOCK ) { //terminated task will be selected immediately before start task . setListener ( this ) ; this . task [ wi ] = task ; wi ++ ; } } | Adds task to the chain . | 46 | 6 |
37,197 | private void continueExecution ( ) { //increment task index i ++ ; //submit next if the end of the chain not reached yet if ( i < task . length && task [ i ] != null ) { scheduler . submit ( task [ i ] ) ; } else if ( listener != null ) { listener . onTermination ( ) ; } } | Submits next task for the execution | 74 | 7 |
37,198 | public char getDataLength ( ) { char length = 0 ; List < StunAttribute > attrs = getAttributes ( ) ; for ( StunAttribute att : attrs ) { int attLen = att . getDataLength ( ) + StunAttribute . HEADER_LENGTH ; // take attribute padding into account: attLen += ( 4 - ( attLen % 4 ) ) % 4 ; length += attLen ; } return lengt... | Returns the length of this message s body . | 90 | 9 |
37,199 | public void addAttribute ( StunAttribute attribute ) throws IllegalArgumentException { if ( getAttributePresentity ( attribute . getAttributeType ( ) ) == N_A ) { throw new IllegalArgumentException ( "The attribute " + attribute . getName ( ) + " is not allowed in a " + getName ( ) ) ; } synchronized ( attributes ) { a... | Adds the specified attribute to this message . If an attribute with that name was already added it would be replaced . | 92 | 22 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.