idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
37,000 | public static < T > String fromIterable ( Iterable < T > rows , Class < T > rowType ) { if ( rows == null ) throw new NullPointerException ( "rows == null" ) ; if ( rowType == null ) throw new NullPointerException ( "rowType == null" ) ; Method [ ] declaredMethods = rowType . getDeclaredMethods ( ) ; Arrays . sort ( de... | Create a table from a group of objects . Public accessor methods on the class type with no arguments will be used as the columns . | 424 | 27 |
37,001 | public String getBaseClassName ( ) { CodeGeneratorLoggerFactory . getLogger ( ) . debug ( String . format ( "Reading base class name from data file [%s]" , fileName ) ) ; String baseClass = reader . getBaseClassName ( ) ; if ( baseClass == null ) { String path = new File ( fileName ) . getAbsolutePath ( ) ; throw new I... | Return the base page class name from the PageYaml input | 111 | 12 |
37,002 | public TestPlatform platform ( ) { CodeGeneratorLoggerFactory . getLogger ( ) . debug ( String . format ( "Specified platform in data file [%s] : [%s] " , fileName , reader . getPlatform ( ) ) ) ; TestPlatform currentPlatform = reader . getPlatform ( ) ; if ( currentPlatform == null ) { String dataFile = new File ( fil... | Return the platform specified in the PageYaml input | 121 | 10 |
37,003 | public static void registerListener ( ListenerInfo information ) { if ( isServiceLoaderDisabled ( ) ) { // Donot even attempt register any listeners if the user doesnt want them to be managed. return ; } logger . entering ( information ) ; listenerMap . put ( information . getListenerClassName ( ) , information ) ; } | Register your Listener using this method . | 69 | 8 |
37,004 | public static Map < String , String > getParameters ( HttpServletRequest request ) { Map < String , String > parameters = new HashMap <> ( ) ; Enumeration < ? > names = request . getParameterNames ( ) ; while ( names . hasMoreElements ( ) ) { String key = ( String ) names . nextElement ( ) ; String value = request . ge... | Helps retrieve the parameters and its values as a Map | 116 | 11 |
37,005 | static String saveGetLocation ( WebDriver driver ) { logger . entering ( driver ) ; String location = "n/a" ; try { if ( driver != null ) { location = driver . getCurrentUrl ( ) ; } } catch ( Exception exception ) { logger . log ( Level . FINER , "Current location couldn't be retrieved by getCurrentUrl(). This can be S... | getCurrentURL will throw Exception | 113 | 6 |
37,006 | public String returnArg ( String key ) { SeLionElement element = HtmlSeLionElementSet . getInstance ( ) . findMatch ( key ) ; if ( element == null ) { return key ; } if ( ! element . isUIElement ( ) ) { return key ; } return key . substring ( 0 , key . indexOf ( element . getElementClass ( ) ) ) ; } | DO NOT tamper with this method | 86 | 7 |
37,007 | public static List < GUIObjectDetails > transformKeys ( List < String > keys , TestPlatform platform ) { List < GUIObjectDetails > htmlObjectDetailsList = null ; // Get the HTML object list based on the platform. // Note: This part is reached only when there is a valid platform specified. So it's safe to proceed withou... | This method convert each key in the data sheet into corresponding HtmlObjectDetails object and returns list of HtmlObjectDetails | 216 | 24 |
37,008 | public void type ( String value ) { getDispatcher ( ) . beforeType ( this , value ) ; RemoteWebElement element = getElement ( ) ; element . clear ( ) ; element . sendKeys ( value ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIActions ( UIActions . ENTERED , value ) ; } getDispa... | The TextField type function | 104 | 5 |
37,009 | public void type ( String value , boolean isKeepExistingText ) { if ( isKeepExistingText ) { getDispatcher ( ) . beforeType ( this , value ) ; getElement ( ) . sendKeys ( value ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIActions ( UIActions . ENTERED , value ) ; } getDispatc... | The TextField type function which allow users to keep the TextField and append the input text to it . | 116 | 21 |
37,010 | public void clear ( ) { getElement ( ) . clear ( ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIAction ( UIActions . CLEARED ) ; } } | Text TextField clear function | 56 | 5 |
37,011 | public String getText ( ) { String text = getElement ( ) . getText ( ) ; if ( text . isEmpty ( ) ) { text = getValue ( ) ; } return text ; } | Get the text value from a TextField object . | 42 | 10 |
37,012 | public void uploadFile ( String filePath ) { SeLionLogger . getLogger ( ) . entering ( filePath ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( filePath ) , "Please provide a valid file path to work with." ) ; String filePathToUse = new File ( filePath ) . getAbsolutePath ( ) ; LocalFileDetector detector... | A Utility method that helps with uploading a File to a Web Application . | 144 | 14 |
37,013 | public void check ( ) { getDispatcher ( ) . beforeCheck ( this ) ; RemoteWebElement e = ( RemoteWebElement ) getElement ( ) ; while ( ! e . isSelected ( ) ) { e . click ( ) ; } if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIAction ( UIActions . CHECKED ) ; } getDispatcher ( ) . aft... | The CheckBox check function It invokes selenium session to handle the check action against the element . | 107 | 21 |
37,014 | public void check ( String locator ) { getDispatcher ( ) . beforeCheck ( this , locator ) ; this . check ( ) ; validatePresenceOfAlert ( ) ; WebDriverWaitUtils . waitUntilElementIsPresent ( locator ) ; getDispatcher ( ) . afterUncheck ( this , locator ) ; } | The CheckBox check function It invokes selenium session to handle the check action against the element . Waits until element is found with given locator . | 73 | 32 |
37,015 | public void uncheck ( ) { getDispatcher ( ) . beforeUncheck ( this ) ; RemoteWebElement e = ( RemoteWebElement ) getElement ( ) ; while ( e . isSelected ( ) ) { e . click ( ) ; } if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIAction ( UIActions . UNCHECKED ) ; } getDispatcher ( ) .... | The CheckBox uncheck function It invokes SeLion session to handle the uncheck action against the element . | 109 | 23 |
37,016 | public void uncheck ( String locator ) { getDispatcher ( ) . beforeUncheck ( this , locator ) ; this . uncheck ( ) ; validatePresenceOfAlert ( ) ; WebDriverWaitUtils . waitUntilElementIsPresent ( locator ) ; getDispatcher ( ) . afterUncheck ( this , locator ) ; } | The CheckBox uncheck function It invokes SeLion session to handle the uncheck action against the element . Waits until element is found with given locator . | 76 | 34 |
37,017 | public void click ( ) { getDispatcher ( ) . beforeClick ( this ) ; getElement ( ) . click ( ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIAction ( UIActions . CLICKED ) ; } getDispatcher ( ) . afterClick ( this ) ; } | The CheckBox click function and wait for page to load | 81 | 11 |
37,018 | public void click ( String locator ) { getDispatcher ( ) . beforeClick ( this , locator ) ; click ( ) ; validatePresenceOfAlert ( ) ; WebDriverWaitUtils . waitUntilElementIsPresent ( locator ) ; getDispatcher ( ) . afterClick ( this , locator ) ; } | The CheckBox click function and wait for object to load | 70 | 11 |
37,019 | public ManagedArtifact getArtifact ( String pathInfo ) { LOGGER . entering ( ) ; ManagedArtifact managedArtifact = serverRepository . getArtifact ( pathInfo ) ; LOGGER . exiting ( managedArtifact ) ; return managedArtifact ; } | Returns the managed artifact requested in the HTTP call . | 57 | 10 |
37,020 | static void cleanup ( ) { LOGGER . entering ( ) ; for ( String temp : files ) { new File ( temp ) . delete ( ) ; } // Cleaning up the files list files . clear ( ) ; LOGGER . exiting ( ) ; } | Cleanup all the files already downloaded within the same JVM process . Automatically called internally . | 53 | 19 |
37,021 | static void checkForDownloads ( List < String > artifactNames , boolean checkTimeStamp , boolean cleanup ) { LOGGER . entering ( ) ; if ( checkTimeStamp && ( lastModifiedTime == DOWNLOAD_FILE . lastModified ( ) ) ) { return ; } lastModifiedTime = DOWNLOAD_FILE . lastModified ( ) ; if ( cleanup ) { cleanup ( ) ; } List ... | Check download . json and download files based on artifact names | 203 | 11 |
37,022 | static String downloadFile ( String artifactUrl , String checksum ) { LOGGER . entering ( new Object [ ] { artifactUrl , checksum } ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( artifactUrl ) , "Invalid URL: Cannot be null or empty" ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( checksu... | Download a file from the specified url | 195 | 7 |
37,023 | public void insertCode ( ) throws IOException , ParseException { CompilationUnit cuResult = JavaParser . parse ( baseFile ) ; if ( cuResult . getImports ( ) != null ) { List < ImportDeclaration > importsFromBaseFile = cuResult . getImports ( ) ; for ( ImportDeclaration eachImport : importsFromExtendedFile ) { if ( ! im... | This method will add methods fields and import statement to existing java file | 166 | 13 |
37,024 | public boolean add ( SeLionElement element ) { // if already initialized, add the new elements to the front of the list. if ( initialized ) { CodeGeneratorLogger logger = CodeGeneratorLoggerFactory . getLogger ( ) ; // info messages are only displayed after initialization happens if ( isExactMatch ( element . getElemen... | Add an element to the list | 196 | 6 |
37,025 | public void generateReport ( List < XmlSuite > xmlSuites , List < ISuite > suites , String sOpDirectory ) { logger . entering ( new Object [ ] { xmlSuites , suites , sOpDirectory } ) ; if ( ListenerManager . isCurrentMethodSkipped ( this ) ) { logger . exiting ( ListenerManager . THREAD_EXCLUSION_MSG ) ; return ; } if ... | The first method that gets called when generating the report . Generates data in way the Excel should appear . Creates the Excel Report and writes it to a file . | 358 | 33 |
37,026 | public void setExcelFileName ( String fileName ) { Preconditions . checkArgument ( StringUtils . endsWith ( fileName , ".xls" ) , "Excel file name must end with '.xls'." ) ; reportFileName = fileName ; } | Sets the output file name for the Excel Report . The file should have xls extension . | 59 | 19 |
37,027 | @ SuppressWarnings ( "rawtypes" ) private void createExcelReport ( ) { logger . entering ( ) ; wb = new HSSFWorkbook ( ) ; Styles . initStyles ( wb ) ; // Report Details this . createReportInfo ( ) ; // Map of sheet names - individual reports and corresponding data this . createReportMap ( ) ; // Render reports in the ... | Initialized styles used in the workbook . Generates the report related info . Creates the structure of the Excel Reports | 161 | 23 |
37,028 | private void createReportInfo ( ) { logger . entering ( ) ; HSSFSheet summarySheet = wb . createSheet ( ReportSheetNames . TESTSUMMARYREPORT . getName ( ) ) ; Map < String , String > reportInfo = new LinkedHashMap < String , String > ( ) ; for ( Entry < String , String > temp : ConfigSummaryData . getConfigSummary ( ) ... | Create Run details like owner of run time and stage used . | 282 | 12 |
37,029 | private void generateSummaryData ( List < ISuite > suites ) { logger . entering ( suites ) ; SummarizedData tempSuite ; SummarizedData tempTest ; SummarizedData tempGroups ; this . generateTestCaseResultData ( suites ) ; // Generating Group Summary data for ( ISuite suite : suites ) { tempSuite = new SummarizedData ( )... | Generates all summarized counts for various reports | 784 | 8 |
37,030 | private List < TestCaseResult > createResultFromMap ( IResultMap resultMap ) { logger . entering ( resultMap ) ; List < TestCaseResult > statusWiseResults = new ArrayList < TestCaseResult > ( ) ; for ( ITestResult singleMethodResult : resultMap . getAllResults ( ) ) { TestCaseResult tcresult1 = new TestCaseResult ( ) ;... | Generates individual TestCase Results based on map of passed failed and skipped methods Returns the list of TestCaseResult objects generated . | 137 | 25 |
37,031 | private void showAssertInfo ( IAssert < ? > assertCommand , AssertionError ex , boolean failedTest ) { ITestResult testResult = Reporter . getCurrentTestResult ( ) ; // Checks whether the soft assert was called in a TestNG test run or else within a Java application. String methodName = "main" ; if ( testResult != null ... | Shows a message in Reporter based on the assert result and also includes the stacktrace for failed assert . | 271 | 21 |
37,032 | @ Override public RemoteWebDriver createDriver ( WebDriverPlatform platform , CommandExecutor commandExecutor , URL url , Capabilities caps ) { if ( platform . equals ( WebDriverPlatform . ANDROID ) ) { if ( commandExecutor == null ) { return new SeLionAppiumAndroidDriver ( url , caps ) ; } else { return new SeLionAppi... | create an instance of SeLionAppiumIOSDriver or SeLionAppiumAndroidDriver | 190 | 20 |
37,033 | static void copyFileFromResources ( String sourcePath , String destPath ) throws IOException { LOGGER . entering ( new Object [ ] { sourcePath , destPath } ) ; File downloadFile = new File ( destPath ) ; if ( ! downloadFile . exists ( ) ) { InputStream stream = JarSpawner . class . getResourceAsStream ( sourcePath ) ; ... | Copy file from source path to destination location | 118 | 8 |
37,034 | public String getDateText ( ) { String value = null ; value = HtmlElementUtils . locateElement ( dateTextLocator ) . getText ( ) ; return value ; } | Gets the current setting month and year from the calendar header . | 39 | 13 |
37,035 | public void setDate ( Calendar to ) { // Navigate from the current date // to the new date navigateMonth ( calendar , to ) ; // Select the day-of-month. clickDay ( to . get ( Calendar . DATE ) ) ; Calendar cal = calendar ; cal . set ( Calendar . YEAR , to . get ( Calendar . YEAR ) ) ; cal . set ( Calendar . MONTH , to ... | This is the main function of the DatePicker object to select the date specified by the input parameter . It will calculate how many time needed to click on the next month or previous month button to arrive at the correct month and year in the input parameters . It then click on the day - of - month tablet to select the... | 116 | 78 |
37,036 | public void setDate ( String date ) { if ( date == null || date . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Date cannot be null or empty." ) ; } try { Date dateToSet = new SimpleDateFormat ( "MM/dd/yyyy" ) . parse ( date ) ; Calendar to = Calendar . getInstance ( ) ; to . setTime ( dateToSet ) ; ... | This function set the date on the DatePicker using the input paramter in the format of MM . dd . yyyy string | 119 | 27 |
37,037 | public void datePickerInit ( String prevMonthLocator , String nextMonthLocator , String dateTextLocator ) { this . prevMonthLocator = prevMonthLocator ; this . nextMonthLocator = nextMonthLocator ; this . dateTextLocator = dateTextLocator ; } | DatePicker comes with default locators for widget controls previous button next button and date text . This method gives access to override these default locators . | 63 | 30 |
37,038 | public void reset ( ) { this . getElement ( ) . clear ( ) ; Grid . driver ( ) . findElement ( By . tagName ( "body" ) ) . click ( ) ; this . calendar = Calendar . getInstance ( ) ; this . getElement ( ) . click ( ) ; } | Clears the date picker . Some browsers require clicking on an element outside of the date picker field to properly reset the calendar to today s date . | 64 | 31 |
37,039 | public int size ( ) { int size = 0 ; try { if ( getParent ( ) != null ) { size = getParent ( ) . locateChildElements ( getLocator ( ) ) . size ( ) ; } else { size = HtmlElementUtils . locateElements ( getLocator ( ) ) . size ( ) ; } } catch ( NoSuchElementException e ) { // NOSONAR // do nothing, let size be returned a... | Returns the number of containers found on the page . | 103 | 10 |
37,040 | public WebElement locateElement ( int index , String childLocator ) { if ( index < 0 ) { throw new IllegalArgumentException ( "index cannot be a negative value" ) ; } setIndex ( index ) ; WebElement locatedElement = null ; if ( getParent ( ) != null ) { locatedElement = getParent ( ) . locateChildElement ( childLocator... | Sets the container index and searches for the descendant element using the child locator . | 108 | 17 |
37,041 | public static Object instantiatePrimitiveArray ( Class < ? > type , String [ ] values ) { logger . entering ( new Object [ ] { type , values } ) ; validateParams ( type , values ) ; checkArgument ( isPrimitiveArray ( type ) , type + " is NOT a primitive array type." ) ; Class < ? > componentType = type . getComponentTy... | This helper method facilitates creation of primitive arrays and pre - populates them with the set of String values provided . | 212 | 22 |
37,042 | public static Object instantiatePrimitiveObject ( Class < ? > type , Object objectToInvokeUpon , String valueToAssign ) { logger . entering ( new Object [ ] { type , objectToInvokeUpon , valueToAssign } ) ; validateParams ( type , objectToInvokeUpon , valueToAssign ) ; checkArgument ( type . isPrimitive ( ) , type + " ... | This helper method facilitates creation of primitive data type object and initialize it with the provided value . | 169 | 18 |
37,043 | public static Object instantiateWrapperObject ( Class < ? > type , Object objectToInvokeUpon , String valueToAssign ) { logger . entering ( new Object [ ] { type , objectToInvokeUpon , valueToAssign } ) ; validateParams ( type , objectToInvokeUpon , valueToAssign ) ; checkArgument ( ClassUtils . isPrimitiveWrapper ( ty... | This helper method facilitates creation of Wrapper data type object and initialize it with the provided value . | 199 | 19 |
37,044 | void startProcess ( boolean squelch ) throws IOException { LOGGER . entering ( squelch ) ; if ( ! squelch ) { LOGGER . fine ( "Executing command " + cmdLine . toString ( ) ) ; } watchdog . reset ( ) ; DefaultExecutor executor = new DefaultExecutor ( ) ; executor . setWatchdog ( watchdog ) ; executor . setStreamHandler ... | Start a process based on the commands provided . | 145 | 9 |
37,045 | String [ ] getJavaClassPathArguments ( String jarNamePrefix , String mainClass ) { LOGGER . entering ( ) ; Set < String > uniqueClassPathEntries = new LinkedHashSet <> ( ) ; // find all jars in the SELION_HOME_DIR if ( getLauncherOptions ( ) . isIncludeJarsInSeLionHomeDir ( ) ) { Collection < File > homeFiles = FileUti... | Get the classpath for the child process . Determines all jars from CWD and SELION_HOME_DIR . Does not recurse into sub directories . Filters out duplicates . | 493 | 40 |
37,046 | String [ ] getJavaSystemPropertiesArguments ( ) throws IOException { LOGGER . entering ( ) ; List < String > args = new LinkedList <> ( ) ; // Next, FWD all JVM -D args to the child process args . addAll ( Arrays . asList ( getPresentJavaSystemPropertiesArguments ( ) ) ) ; // Setup logging for child process args . addA... | Get required system properties to launch the sub process | 138 | 9 |
37,047 | @ Override public Iterator < Object [ ] > getDataByFilter ( DataProviderFilter dataFilter ) { Preconditions . checkArgument ( resource != null , "File resource cannot be null" ) ; logger . entering ( dataFilter ) ; Class < ? > arrayType ; JsonReader reader = null ; try { reader = new JsonReader ( getReader ( resource )... | Gets JSON data from a resource by applying the given filter . | 198 | 13 |
37,048 | @ Override public Hashtable < String , Object > getDataAsHashtable ( ) { Preconditions . checkArgument ( resource != null , "File resource cannot be null" ) ; logger . entering ( ) ; // Over-writing the resource because there is a possibility that a user // can give a type resource . setCls ( Hashtable [ ] . class ) ; ... | A utility method to give out JSON data as HashTable . Please note this method works on the rule that the json object that needs to be parsed MUST contain a key named id . | 466 | 36 |
37,049 | protected void startHtml ( PrintWriter out ) { logger . entering ( out ) ; try { Template t = ve . getTemplate ( "/templates/header.part.html" ) ; VelocityContext context = new VelocityContext ( ) ; StringBuilder output = new StringBuilder ( ) ; for ( Entry < String , String > temp : ConfigSummaryData . getConfigSummar... | Starts HTML stream | 239 | 4 |
37,050 | void printUsageInfo ( ) { StringBuilder usage = new StringBuilder ( ) ; usage . append ( " System Properties: \n" ) ; usage . append ( " -DselionHome=<folderPath>: \n" ) ; usage . append ( " Path of SeLion home directory. Defaults to <user.home>/.selion2/ \n" ) ; usage . append ( " -D[property]=[value]: \n" ) ; usage .... | Print the usage of SeLion Grid jar | 136 | 9 |
37,051 | public boolean isTextPresent ( String pattern ) { String text = getElement ( ) . getText ( ) ; return ( text != null && ( text . contains ( pattern ) || text . matches ( pattern ) ) ) ; } | It is to check whether the element s text matches with the specified pattern . | 47 | 15 |
37,052 | public static void log ( String message , boolean takeScreenshot , boolean saveSrc ) { SeLionReporter reporter = new SeLionReporter ( ) ; BaseLog currentLog = new BaseLog ( ) ; currentLog . setMsg ( message ) ; currentLog . setLocation ( Gatherer . saveGetLocation ( Grid . driver ( ) ) ) ; reporter . setCurrentLog ( cu... | Generates log entry with message provided | 105 | 7 |
37,053 | public void shutdownProcesses ( ) throws ProcessHandlerException { LOGGER . info ( "Shutting down all our node processes." ) ; ProcessHandler handler = ProcessHandlerFactory . createInstance ( ) ; List < ProcessInfo > processes = handler . potentialProcessToBeKilled ( ) ; handler . killProcess ( processes ) ; LOGGER . ... | This method terminates all Node processes that we started . | 82 | 11 |
37,054 | public void scrollLeft ( ) { logger . entering ( ) ; WebElement webElement = this . findElement ( By . className ( SCROLLVIEW_CLASS ) ) ; swipeLeft ( webElement ) ; logger . exiting ( ) ; } | Scroll the screen to the left . The underlying application should have atleast one scroll view belonging to the class android . widget . ScrollView . | 51 | 29 |
37,055 | public void scrollRight ( ) { logger . entering ( ) ; WebElement webElement = this . findElement ( By . className ( SCROLLVIEW_CLASS ) ) ; swipeRight ( webElement ) ; logger . exiting ( ) ; } | Scroll the screen to the right . The underlying application should have atleast one scroll view belonging to the class android . widget . ScrollView . | 51 | 29 |
37,056 | public void scrollUp ( ) { logger . entering ( ) ; WebElement webElement = this . findElement ( By . className ( SCROLLVIEW_CLASS ) ) ; swipeUp ( webElement ) ; logger . exiting ( ) ; } | Scroll the screen up . The underlying application should have atleast one scroll view belonging to the class android . widget . ScrollView . | 51 | 27 |
37,057 | public void scrollDown ( ) { logger . entering ( ) ; WebElement webElement = this . findElement ( By . className ( SCROLLVIEW_CLASS ) ) ; swipeDown ( webElement ) ; logger . exiting ( ) ; } | Scroll the screen down . The underlying application should have atleast one scroll view belonging to the class android . widget . ScrollView . | 51 | 27 |
37,058 | public void setMaxBrowserInstances ( String browserName , int maxBrowserInstances ) { logger . entering ( new Object [ ] { browserName , maxBrowserInstances } ) ; validateBrowserName ( browserName ) ; BrowserStatistics lStatistics = createStatisticsIfNotPresent ( browserName ) ; lStatistics . setMaxBrowserInstances ( m... | Sets the maximum instances for a particular browser . This call creates a unique statistics for the provided browser name it does not exists . | 83 | 26 |
37,059 | public void incrementWaitingRequests ( String browserName ) { logger . entering ( browserName ) ; validateBrowserName ( browserName ) ; BrowserStatistics lStatistics = createStatisticsIfNotPresent ( browserName ) ; lStatistics . incrementWaitingRequests ( ) ; logger . exiting ( ) ; } | Increments the waiting request for the provided browser name . This call creates a unique statistics for the provided browser name it does not exists . | 62 | 27 |
37,060 | public static synchronized void printConfiguration ( String testName ) { LocalConfig currentConfig = getConfig ( testName ) ; currentConfig . printConfigValues ( testName ) ; } | A utility method that can dump the configuration for a given < ; test> ; identified with its name . | 36 | 23 |
37,061 | public RemoteWebElement getElement ( ) { RemoteWebElement foundElement = null ; try { if ( parent == null ) { foundElement = HtmlElementUtils . locateElement ( getLocator ( ) ) ; } else { foundElement = parent . locateChildElement ( locator ) ; } } catch ( ParentNotFoundException p ) { throw p ; } catch ( NoSuchElement... | Instance method used to call static class method locateElement . | 102 | 11 |
37,062 | public List < WebElement > getElements ( ) { List < WebElement > foundElements = null ; try { if ( parent == null ) { foundElements = HtmlElementUtils . locateElements ( getLocator ( ) ) ; } else { foundElements = parent . locateChildElements ( getLocator ( ) ) ; } } catch ( NoSuchElementException n ) { addInfoForNoSuc... | Instance method used to call static class method locateElements . | 103 | 12 |
37,063 | private void addInfoForNoSuchElementException ( NoSuchElementException cause ) { if ( parent == null ) { throw cause ; } BasicPageImpl page = this . parent . getCurrentPage ( ) ; if ( page == null ) { throw cause ; } String resolvedPageName = page . getClass ( ) . getSimpleName ( ) ; // Find if page exists: This part i... | A utility method to provide additional information to the user when a NoSuchElementException is thrown . | 300 | 19 |
37,064 | public Object clickAndExpect ( ExpectedCondition < ? > expectedCondition ) { dispatcher . beforeClick ( this , expectedCondition ) ; getElement ( ) . click ( ) ; if ( Boolean . parseBoolean ( Config . getConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) ) { logUIAction ( UIActions . CLICKED ) ; } if ( parent != ... | The click function and wait based on the ExpectedCondition . | 185 | 12 |
37,065 | public void hover ( final Object ... expected ) { dispatcher . beforeHover ( this , expected ) ; new Actions ( Grid . driver ( ) ) . moveToElement ( getElement ( ) ) . perform ( ) ; try { for ( Object expect : expected ) { if ( expect instanceof AbstractElement ) { AbstractElement a = ( AbstractElement ) expect ; WebDr... | Moves the mouse pointer to the middle of the element . And waits for the expected elements to be visible . | 154 | 22 |
37,066 | @ Override public Object [ ] [ ] getAllData ( ) { logger . entering ( ) ; Object [ ] [ ] objectArray ; if ( ( null == resource . getCls ( ) ) && ( null != resource . getXpathMap ( ) ) ) { Document doc = getDocument ( ) ; Object [ ] [ ] [ ] multipleObjectDataProviders = new Object [ resource . getXpathMap ( ) . size ( )... | Generates a two dimensional array for TestNG DataProvider from the XML data . | 295 | 16 |
37,067 | @ Override public Object [ ] [ ] getAllKeyValueData ( ) { logger . entering ( ) ; Object [ ] [ ] objectArray ; try { JAXBContext context = JAXBContext . newInstance ( resource . getCls ( ) ) ; Unmarshaller unmarshaller = context . createUnmarshaller ( ) ; StreamSource xmlStreamSource = new StreamSource ( resource . get... | Generates a two dimensional array for TestNG DataProvider from the XML data representing a map of name value collection . | 219 | 23 |
37,068 | @ Override public Object [ ] [ ] getDataByKeys ( String [ ] keys ) { logger . entering ( Arrays . toString ( keys ) ) ; if ( null == resource . getCls ( ) ) { resource . setCls ( KeyValueMap . class ) ; } Object [ ] [ ] objectArray ; try { JAXBContext context = JAXBContext . newInstance ( resource . getCls ( ) ) ; Unma... | Generates a two dimensional array for TestNG DataProvider from the XML data representing a map of name value collection filtered by keys . | 272 | 26 |
37,069 | private List < ? > loadDataFromXmlFile ( ) { logger . entering ( ) ; Preconditions . checkArgument ( resource . getCls ( ) != null , "Please provide a valid type." ) ; List < ? > returned ; try { JAXBContext context = JAXBContext . newInstance ( Wrapper . class , resource . getCls ( ) ) ; Unmarshaller unmarshaller = co... | Generates a list of the declared type after parsing the XML file . | 220 | 14 |
37,070 | private List < ? > loadDataFromXml ( String xml , Class < ? > cls ) { logger . entering ( new Object [ ] { xml , cls } ) ; Preconditions . checkArgument ( cls != null , "Please provide a valid type." ) ; List < ? > returned ; try { JAXBContext context = JAXBContext . newInstance ( Wrapper . class , cls ) ; Unmarshaller... | Generates a list of the declared type after parsing the XML data string . | 235 | 15 |
37,071 | @ SuppressWarnings ( "unchecked" ) private String getFilteredXml ( Document document , String xpathExpression ) { logger . entering ( new Object [ ] { document , xpathExpression } ) ; List < Node > nodes = ( List < Node > ) document . selectNodes ( xpathExpression ) ; StringBuilder newDocument = new StringBuilder ( doc... | Generates an XML string containing only the nodes filtered by the XPath expression . | 156 | 16 |
37,072 | private JsonObject generateConfigSummary ( ) throws JsonParseException { logger . entering ( ) ; if ( jsonConfigSummary == null ) { jsonConfigSummary = new JsonObject ( ) ; for ( Entry < String , String > temp : ConfigSummaryData . getConfigSummary ( ) . entrySet ( ) ) { jsonConfigSummary . addProperty ( temp . getKey ... | This method will generate Configuration summary by fetching the details from ReportDataGenerator | 107 | 16 |
37,073 | public void generateLocalConfigSummary ( String suiteName , String testName ) { logger . entering ( new Object [ ] { suiteName , testName } ) ; try { Map < String , String > testLocalConfigValues = ConfigSummaryData . getLocalConfigSummary ( testName ) ; JsonObject json = new JsonObject ( ) ; if ( testLocalConfigValues... | This method will generate local Configuration summary by fetching the details from ReportDataGenerator | 274 | 17 |
37,074 | public synchronized void insertConfigMethod ( String suite , String test , String packages , String classname , ITestResult result ) { logger . entering ( new Object [ ] { suite , test , packages , classname , result } ) ; String type = null ; if ( result . getMethod ( ) . isBeforeSuiteConfiguration ( ) ) { type = BEFO... | This method is used to insert configuration method details based on the suite test groups and class name . | 445 | 19 |
37,075 | public synchronized void writeJSON ( String outputDirectory , boolean bForceWrite ) { logger . entering ( new Object [ ] { outputDirectory , bForceWrite } ) ; long currentTime = System . currentTimeMillis ( ) ; if ( ! bForceWrite && ( currentTime - previousTime < ONE_MINUTE ) ) { return ; } previousTime = currentTime ;... | Generate the final report . json from the completed test and completed configuration temporary files . | 97 | 17 |
37,076 | private void generateReports ( String outputDirectory ) { logger . entering ( outputDirectory ) ; ClassLoader localClassLoader = this . getClass ( ) . getClassLoader ( ) ; try ( BufferedWriter writer = new BufferedWriter ( new FileWriter ( outputDirectory + File . separator + "index.html" ) ) ; BufferedWriter jsonWrite... | Generate JSON report and HTML report | 271 | 7 |
37,077 | private void generateHTMLReport ( BufferedWriter writer , BufferedReader templateReader , String jsonReport ) throws IOException { logger . entering ( new Object [ ] { writer , templateReader , jsonReport } ) ; String readLine = null ; while ( ( readLine = templateReader . readLine ( ) ) != null ) { if ( readLine . tri... | Writing JSON content to HTML file | 128 | 6 |
37,078 | private JsonObject buildJSONReport ( ) { logger . entering ( ) ; Gson gson = new GsonBuilder ( ) . setPrettyPrinting ( ) . create ( ) ; JsonArray testObjects = loadJSONArray ( jsonCompletedTest ) ; for ( TestMethodInfo temp : completedTest ) { testObjects . add ( gson . fromJson ( temp . toJson ( ) , JsonElement . clas... | Construct the JSON report for report generation | 399 | 7 |
37,079 | private JsonObject getReportSummaryCounts ( JsonArray testObjects ) { logger . entering ( testObjects ) ; int runningCount = 0 ; int skippedCount = 0 ; int passedCount = 0 ; int failedCount = 0 ; String result ; for ( JsonElement test : testObjects ) { result = test . getAsJsonObject ( ) . get ( "status" ) . getAsStrin... | Provides a JSON object representing the counts of tests passed failed skipped and running . | 265 | 16 |
37,080 | private JsonArray loadJSONArray ( File jsonFile ) throws JsonParseException { logger . entering ( jsonFile ) ; String jsonTxt ; try { jsonTxt = FileUtils . readFileToString ( jsonFile , "UTF-8" ) ; } catch ( IOException e ) { logger . log ( Level . SEVERE , e . getMessage ( ) , e ) ; throw new ReporterException ( e ) ;... | Load the json array for the given file | 197 | 8 |
37,081 | private String [ ] getNodeProgramArguments ( ) throws IOException { LOGGER . entering ( ) ; LOGGER . fine ( "This instance is considered a SeLion Grid Node" ) ; List < String > args = new LinkedList <> ( ) ; if ( ! commands . contains ( NODE_CONFIG_ARG ) ) { args . add ( NODE_CONFIG_ARG ) ; args . add ( NODE_CONFIG_FIL... | Get SeLion Node related arguments to pass | 161 | 9 |
37,082 | private String [ ] getHubProgramArguments ( ) throws IOException { LOGGER . entering ( ) ; LOGGER . fine ( "This instance is considered a SeLion Grid Hub" ) ; List < String > args = new LinkedList <> ( ) ; if ( ! commands . contains ( HUB_CONFIG_ARG ) ) { String hubConfig = HUB_CONFIG_FILE ; // To verify this is SeLion... | Get SeLion Grid related arguments to pass | 348 | 9 |
37,083 | String getHost ( ) { LOGGER . entering ( ) ; String val = "" ; InstanceType type = getType ( ) ; if ( commands . contains ( HOST_ARG ) ) { val = commands . get ( commands . indexOf ( HOST_ARG ) + 1 ) ; LOGGER . exiting ( val ) ; return val ; } try { if ( type . equals ( InstanceType . SELENIUM_NODE ) || type . equals (... | Get the host for the instance represented by this launcher | 225 | 10 |
37,084 | int getPort ( ) { LOGGER . entering ( ) ; int val = - 1 ; InstanceType type = getType ( ) ; if ( commands . contains ( PORT_ARG ) ) { val = Integer . parseInt ( commands . get ( commands . indexOf ( PORT_ARG ) + 1 ) ) ; LOGGER . exiting ( val ) ; return val ; } try { if ( type . equals ( InstanceType . SELENIUM_NODE ) ... | Get the port for the instance represented by this launcher | 197 | 10 |
37,085 | private String getSeleniumConfigFilePath ( ) { LOGGER . entering ( ) ; String result = null ; InstanceType type = getType ( ) ; if ( type . equals ( InstanceType . SELENIUM_NODE ) ) { result = NODE_CONFIG_FILE ; if ( commands . contains ( NODE_CONFIG_ARG ) ) { result = commands . get ( commands . indexOf ( NODE_CONFIG_... | Get the config file path for the instance represented by this launcher . | 191 | 13 |
37,086 | private boolean matchAgainstMobileNodeType ( Map < String , Object > nodeCapability , String mobileNodeType ) { String nodeValue = ( String ) nodeCapability . get ( MOBILE_NODE_TYPE ) ; return ! StringUtils . isBlank ( nodeValue ) && nodeValue . equalsIgnoreCase ( mobileNodeType ) ; } | Matches requested mobileNodeType against node capabilities . | 75 | 10 |
37,087 | public static RemoteNodeInformation getRemoteNodeInfo ( String hostName , int port , SessionId session ) { logger . entering ( new Object [ ] { hostName , port , session } ) ; RemoteNodeInformation node = null ; String errorMsg = "Failed to acquire remote webdriver node and port info. Root cause: " ; // go ahead and ab... | For a given Session ID against a host on a particular port this method returns the remote webdriver node and the port to which the execution was redirected to by the hub . | 394 | 34 |
37,088 | public static String getBuildValue ( SeLionBuildProperty property ) { return getInfo ( ) . getProperty ( property . getPropertyValue ( ) , property . getFallBackValue ( ) ) ; } | Returns values for build time info | 43 | 6 |
37,089 | public static SeLionDataProvider getDataProvider ( DataResource resource ) throws IOException { logger . entering ( resource ) ; if ( resource == null ) { return null ; } switch ( resource . getType ( ) . toUpperCase ( ) ) { case "XML" : return new XmlDataProviderImpl ( ( XmlDataSource ) resource ) ; case "JSON" : retu... | Load the Data provider implementation for the data file type | 147 | 10 |
37,090 | private boolean isSupportedOnHub ( Class < ? extends HttpServlet > servlet ) { LOGGER . entering ( ) ; final boolean response = getRegistry ( ) . getHub ( ) . getConfiguration ( ) . servlets . contains ( servlet . getCanonicalName ( ) ) ; LOGGER . exiting ( response ) ; return response ; } | Determine if the hub supports the servlet in question by looking at the registry configuration . | 76 | 19 |
37,091 | private boolean isSupportedOnNode ( Class < ? extends HttpServlet > servlet ) { LOGGER . entering ( ) ; RequestConfig requestConfig = RequestConfig . custom ( ) . setConnectTimeout ( CONNECTION_TIMEOUT ) . setSocketTimeout ( CONNECTION_TIMEOUT ) . build ( ) ; CloseableHttpClient client = HttpClientBuilder . create ( ) ... | Determine if the remote proxy supports the servlet in question by sending a http request to the remote . The proxy configuration could also be used to make a similar decision . This approach allows the remote to use a servlet which implements the same functionality as the servlet expected but does not necessarily resid... | 334 | 90 |
37,092 | public int getMaxConcurrency ( ) { LOGGER . entering ( ) ; if ( maxTestCase == - 1 ) { try { SauceLabsHttpResponse result = doSauceRequest ( "/limits" ) ; JsonObject obj = result . getEntityAsJsonObject ( ) ; maxTestCase = obj . get ( "concurrency" ) . getAsInt ( ) ; } catch ( JsonSyntaxException | IllegalStateExceptio... | Get the maximum number of test case that can run in parallel for the primary account . | 142 | 17 |
37,093 | public static void assertNotEquals ( Object actual , Object expected , String msg ) { hardAssert . assertNotEquals ( actual , expected , msg ) ; } | assertNotEquals method is used to assert based on actual and expected values and provide a Pass result for a mismatch . | 35 | 24 |
37,094 | public static void verifyEquals ( Object actual , Object expected , String msg ) { getSoftAssertInContext ( ) . assertEquals ( actual , expected , msg ) ; } | verifyEquals method is used to assert based on actual and expected values and provide a Pass result for a same match . verifyEquals will yield a Fail result for a mismatch and continue to run the test case . | 38 | 44 |
37,095 | public static void verifyNotEquals ( Object actual , Object expected , String msg ) { getSoftAssertInContext ( ) . assertNotEquals ( actual , expected , msg ) ; } | verifyNotEquals method is used to assert based on actual and expected values and provide a Pass result for a mismatch and continue to run the test . | 40 | 31 |
37,096 | public static void assertEquals ( Object actual , Object expected , String message ) { hardAssert . assertEquals ( actual , expected , message ) ; } | assertEquals method is used to assert based on actual and expected values and provide a Pass result for a same match . assertEquals will yield a Fail result for a mismatch and abort the test case . | 33 | 41 |
37,097 | public static boolean wildCardMatch ( String text , String pattern ) { logger . entering ( new Object [ ] { text , pattern } ) ; Preconditions . checkArgument ( text != null , "The text on which the search is to be run cannot be null." ) ; Preconditions . checkArgument ( pattern != null , "The search pattern cannot be ... | Performs a wild - card matching for the text and pattern provided . | 217 | 14 |
37,098 | public void setId ( String id ) { logger . entering ( id ) ; this . id = id ; logger . exiting ( ) ; } | Set the id for this page source object | 29 | 8 |
37,099 | public byte [ ] getScreenImage ( ) { logger . entering ( ) ; logger . exiting ( this . screenImage ) ; return Arrays . copyOf ( screenImage , screenImage . length ) ; } | Get the image content | 43 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.