idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
3,500 | public void addChangelogFile ( File changelogFile ) throws IOException , ChangelogParseException { new ChangelogHandler ( this . format . getHeader ( ) ) . addChangeLog ( changelogFile ) ; } | Adds the supplied Changelog file as a Changelog to the header |
3,501 | public String build ( final File directory ) throws NoSuchAlgorithmException , IOException { final String rpm = format . getLead ( ) . getName ( ) + "." + format . getLead ( ) . getArch ( ) . toString ( ) . toLowerCase ( ) + ".rpm" ; final File file = new File ( directory , rpm ) ; if ( file . exists ( ) ) file . delet... | Generates an RPM with a standard name consisting of the RPM package name version release and type in the given directory . |
3,502 | protected byte [ ] getSpecial ( final int tag , final int count ) { final ByteBuffer buffer = ByteBuffer . allocate ( 16 ) ; buffer . putInt ( tag ) ; buffer . putInt ( 0x00000007 ) ; buffer . putInt ( count * - 16 ) ; buffer . putInt ( 0x00000010 ) ; return buffer . array ( ) ; } | Returns the special header expected by RPM for a particular header . |
3,503 | protected int [ ] convert ( final Integer [ ] ints ) { int [ ] array = new int [ ints . length ] ; int count = 0 ; for ( int i : ints ) array [ count ++ ] = i ; return array ; } | Converts an array of Integer objects into an equivalent array of int primitives . |
3,504 | private Object toActualNumber ( Double value , Type type ) { if ( type . equals ( Byte . class ) ) return value . byteValue ( ) ; if ( type . equals ( Short . class ) ) return value . shortValue ( ) ; if ( type . equals ( Integer . class ) ) return value . intValue ( ) ; if ( type . equals ( Long . class ) ) return val... | but I m going to rely on the user to not do anything silly |
3,505 | public void setHandler ( Object handler ) { if ( handler instanceof ContentHandler ) setContentHandler ( ( ContentHandler ) handler ) ; if ( handler instanceof EntityResolver ) setEntityResolver ( ( EntityResolver ) handler ) ; if ( handler instanceof ErrorHandler ) setErrorHandler ( ( ErrorHandler ) handler ) ; if ( h... | Registers given handler with all its implementing interfaces . This would be handy if you want to register to all interfaces implemented by given handler object |
3,506 | public static void redirectStreams ( Process process , OutputStream output , OutputStream error ) { if ( output != null ) new Thread ( new IOPump ( process . getInputStream ( ) , output , false , false ) . asRunnable ( ) ) . start ( ) ; if ( error != null ) new Thread ( new IOPump ( process . getErrorStream ( ) , error... | Redirects given process s input and error streams to the specified streams . the streams specified are not closed automatically . The streams passed can be null if you don t want to redirect them . |
3,507 | public static Object [ ] concat ( Object array1 [ ] , Object array2 [ ] ) { Class < ? > class1 = array1 . getClass ( ) . getComponentType ( ) ; Class < ? > class2 = array2 . getClass ( ) . getComponentType ( ) ; Class < ? > commonClass = class1 . isAssignableFrom ( class2 ) ? class1 : ( class2 . isAssignableFrom ( clas... | Returns new array which has all values from array1 and array2 in order . The componentType for the new array is determined by the componentTypes of two arrays . |
3,508 | public static Transformer setOutputProperties ( Transformer transformer , boolean omitXMLDeclaration , int indentAmount , String encoding ) { transformer . setOutputProperty ( OutputKeys . OMIT_XML_DECLARATION , omitXMLDeclaration ? "yes" : "no" ) ; if ( indentAmount > 0 ) { transformer . setOutputProperty ( OutputKeys... | to set various output properties on given transformer . |
3,509 | public boolean consume ( int ch ) { offset ++ ; if ( ch == 0x0D ) { skipLF = true ; line ++ ; col = 0 ; return true ; } else if ( ch == 0x0A ) { if ( skipLF ) { skipLF = false ; return false ; } else { line ++ ; col = 0 ; return true ; } } else { skipLF = false ; col ++ ; return true ; } } | return value tells whether the given character has been included in location or not |
3,510 | public static String [ ] getTokens ( String str , String delim , boolean trim ) { StringTokenizer stok = new StringTokenizer ( str , delim ) ; String tokens [ ] = new String [ stok . countTokens ( ) ] ; for ( int i = 0 ; i < tokens . length ; i ++ ) { tokens [ i ] = stok . nextToken ( ) ; if ( trim ) tokens [ i ] = tok... | Splits given string into tokens with delimiters specified . It uses StringTokenizer for tokenizing . |
3,511 | public static String ordinalize ( int number ) { int modulo = number % 100 ; if ( modulo >= 11 && modulo <= 13 ) return number + "th" ; switch ( number % 10 ) { case 1 : return number + "st" ; case 2 : return number + "nd" ; case 3 : return number + "rd" ; default : return number + "th" ; } } | Turns a non - negative number into an ordinal string used to denote the position in an ordered sequence such as 1st 2nd 3rd 4th |
3,512 | public static String getText ( ) { Transferable contents = clipboard ( ) . getContents ( null ) ; try { if ( contents != null && contents . isDataFlavorSupported ( DataFlavor . stringFlavor ) ) return ( String ) contents . getTransferData ( DataFlavor . stringFlavor ) ; else return null ; } catch ( UnsupportedFlavorExc... | returns the current text contents of clipboard . If clipboard has no text contents or has no content it returns null |
3,513 | public static void clear ( ) { clipboard ( ) . setContents ( new Transferable ( ) { public DataFlavor [ ] getTransferDataFlavors ( ) { return new DataFlavor [ 0 ] ; } public boolean isDataFlavorSupported ( DataFlavor flavor ) { return false ; } public Object getTransferData ( DataFlavor flavor ) throws UnsupportedFlavo... | clears contents of clipboard |
3,514 | public void set ( byte [ ] buff , int offset , int length ) { if ( offset < 0 ) throw new IndexOutOfBoundsException ( "ByteSequence index out of range: " + offset ) ; if ( length < 0 ) throw new IndexOutOfBoundsException ( "ByteSequence index out of range: " + length ) ; if ( offset > buff . length - length ) throw new... | replaces the internal byte buffer with the given byte array . |
3,515 | public static Class getClassingClass ( int offset ) { Class [ ] context = ClassContext . INSTANCE . getClassContext ( ) ; offset += 2 ; return context . length > offset ? context [ offset ] : null ; } | returns the calling class . |
3,516 | public static String [ ] split ( String fileName ) { int dot = fileName . lastIndexOf ( '.' ) ; if ( dot == - 1 ) return new String [ ] { fileName , null } ; else return new String [ ] { fileName . substring ( 0 , dot ) , fileName . substring ( dot + 1 ) } ; } | splits given fileName into name and extension . |
3,517 | public static String getName ( String fileName ) { int dot = fileName . lastIndexOf ( '.' ) ; return dot == - 1 ? fileName : fileName . substring ( 0 , dot ) ; } | Returns name of the file without extension |
3,518 | public static String getExtension ( String fileName ) { int dot = fileName . lastIndexOf ( '.' ) ; return dot == - 1 ? null : fileName . substring ( dot + 1 ) ; } | Returns extension of the file . Returns null if there is no extension |
3,519 | public static void mkdir ( File dir ) throws IOException { if ( ! dir . exists ( ) && ! dir . mkdir ( ) ) throw new IOException ( "couldn't create directory: " + dir ) ; } | create specified directory if doesn t exist . |
3,520 | public XSModel parseString ( String schema , String baseURI ) { return xsLoader . load ( new DOMInputImpl ( null , null , baseURI , schema , null ) ) ; } | Parse an XML Schema document from String specified |
3,521 | public String findPrefix ( String uri ) { if ( uri == null ) uri = "" ; String prefix = getPrefix ( uri ) ; if ( prefix == null ) { String defaultURI = getURI ( "" ) ; if ( defaultURI == null ) defaultURI = "" ; if ( Util . equals ( uri , defaultURI ) ) prefix = "" ; } return prefix ; } | Return one of the prefixes mapped to a Namespace URI . |
3,522 | public String declarePrefix ( String uri ) { String prefix = findPrefix ( uri ) ; if ( prefix == null ) { if ( uri . isEmpty ( ) ) prefix = "" ; else { prefix = suggested . getProperty ( uri , suggestPrefix ) ; if ( getURI ( prefix ) != null ) { if ( prefix . isEmpty ( ) ) prefix = "ns" ; int i = 1 ; String _prefix ; w... | generated a new prefix and binds it to given uri . |
3,523 | @ SuppressWarnings ( { "unchecked" , "ManualArrayToCollectionCopy" } ) public static < E , T extends E > Collection < E > addAll ( Collection < E > c , T ... array ) { for ( T obj : array ) c . add ( obj ) ; return c ; } | Adds objects in array to the given collection |
3,524 | @ SuppressWarnings ( "unchecked" ) public static < E , T extends E > Collection < E > removeAll ( Collection < E > c , T ... array ) { for ( T obj : array ) c . remove ( obj ) ; return c ; } | Removes objects in array to the given collection |
3,525 | public static < T > List < T > filter ( Collection < T > c , Filter < T > filter ) { if ( c . size ( ) == 0 ) return Collections . emptyList ( ) ; List < T > filteredList = new ArrayList < T > ( c . size ( ) ) ; for ( T element : c ) { if ( filter . select ( element ) ) filteredList . add ( element ) ; } return filtere... | Returns List with elements from given collections which are selected by specified filter |
3,526 | public String [ ] command ( ) throws IOException { List < String > cmd = new ArrayList < String > ( ) ; String executable = javaHome . getCanonicalPath ( ) + FileUtil . SEPARATOR + "bin" + FileUtil . SEPARATOR + "java" ; if ( OS . get ( ) . isWindows ( ) ) executable += ".exe" ; cmd . add ( executable ) ; String path =... | Returns command with all its arguments |
3,527 | public Process launch ( OutputStream output , OutputStream error ) throws IOException { Process process = Runtime . getRuntime ( ) . exec ( command ( ) , null , workingDir ) ; RuntimeUtil . redirectStreams ( process , output , error ) ; return process ; } | launches jvm with current configuration . |
3,528 | public static void setInitialFocus ( Window window , final Component comp ) { window . addWindowFocusListener ( new WindowAdapter ( ) { public void windowGainedFocus ( WindowEvent we ) { comp . requestFocusInWindow ( ) ; we . getWindow ( ) . removeWindowFocusListener ( this ) ; } } ) ; } | sets intial focus in window to the specified component |
3,529 | public static void doAction ( JTextField textField ) { String command = null ; if ( textField . getAction ( ) != null ) command = ( String ) textField . getAction ( ) . getValue ( Action . ACTION_COMMAND_KEY ) ; ActionEvent event = null ; for ( ActionListener listener : textField . getActionListeners ( ) ) { if ( event... | Programmatically perform action on textfield . This does the same thing as if the user had pressed enter key in textfield . |
3,530 | public static void setText ( JTextComponent textComp , String text ) { if ( text == null ) text = "" ; if ( textComp . getCaret ( ) instanceof DefaultCaret ) { DefaultCaret caret = ( DefaultCaret ) textComp . getCaret ( ) ; int updatePolicy = caret . getUpdatePolicy ( ) ; caret . setUpdatePolicy ( DefaultCaret . NEVER_... | sets text of textComp without moving its caret . |
3,531 | public boolean merge ( ResourceMetadata other ) { boolean modified = m_metrics . addAll ( other . m_metrics ) ; if ( ! modified ) { modified = ! m_attributes . equals ( other . m_attributes ) ; } m_attributes . putAll ( other . m_attributes ) ; return modified ; } | Merges the metrics and attributes from the given instance to the current instance . |
3,532 | protected Result check ( ) throws Exception { m_repository . select ( Context . DEFAULT_CONTEXT , new Resource ( "notreal" ) , Optional . of ( Timestamp . fromEpochMillis ( 0 ) ) , Optional . of ( Timestamp . fromEpochMillis ( 0 ) ) ) ; return Result . healthy ( ) ; } | Perform simple query ; Establishes only that we can go to the database without excepting . |
3,533 | public Set < String > getSourceNames ( ) { return Sets . newHashSet ( Iterables . transform ( getDatasources ( ) . values ( ) , new Function < Datasource , String > ( ) { public String apply ( Datasource input ) { return input . getSource ( ) ; } } ) ) ; } | Returns the set of unique source names ; The names of the underlying samples used as the source of aggregations . |
3,534 | public void breadthFirstSearch ( Context context , SearchResultVisitor visitor , Resource root ) { Queue < Resource > queue = Lists . newLinkedList ( ) ; queue . add ( root ) ; while ( ! queue . isEmpty ( ) ) { Resource r = queue . remove ( ) ; for ( SearchResults . Result result : m_searcher . search ( context , match... | Visits all nodes in the resource tree bellow the given resource using breadth - first search . |
3,535 | public void depthFirstSearch ( Context context , SearchResultVisitor visitor , Resource root ) { ArrayDeque < SearchResults . Result > stack = Queues . newArrayDeque ( ) ; boolean skipFirstVisit = true ; SearchResults initialResults = new SearchResults ( ) ; initialResults . addResult ( root , new ArrayList < String > ... | Visits all nodes in the resource tree bellow the given resource using depth - first search . |
3,536 | private Set < String > searchForIds ( Context context , TermQuery query , ConsistencyLevel readConsistency ) { Set < String > ids = Sets . newTreeSet ( ) ; BoundStatement bindStatement = m_searchStatement . bind ( ) ; bindStatement . setString ( Schema . C_TERMS_CONTEXT , context . getId ( ) ) ; bindStatement . setStri... | Returns the set of resource ids that match the given term query . |
3,537 | private Set < String > searchForIds ( Context context , BooleanQuery query , ConsistencyLevel readConsistency ) { Set < String > ids = Sets . newTreeSet ( ) ; for ( BooleanClause clause : query . getClauses ( ) ) { Set < String > subQueryIds ; Query subQuery = clause . getQuery ( ) ; if ( subQuery instanceof BooleanQue... | Returns the set of resource ids that match the given boolean query . |
3,538 | public List < String > splitIdIntoElements ( String id ) { Preconditions . checkNotNull ( id , "id argument" ) ; List < String > elements = Lists . newArrayList ( ) ; int startOfNextElement = 0 ; int numConsecutiveEscapeCharacters = 0 ; char [ ] idChars = id . toCharArray ( ) ; for ( int i = 0 ; i < idChars . length ; ... | Splits a resource id into a list of elements . |
3,539 | private static void maybeAddSanitizedElement ( final String element , final List < String > elements ) { String sanitizedElement = element . trim ( ) ; if ( sanitizedElement . length ( ) == 0 ) { return ; } sanitizedElement = MATCH_ESCAPED_COLON . matcher ( sanitizedElement ) . replaceAll ( ":" ) ; sanitizedElement = M... | Maybe adds to element to the list after being sanitized . |
3,540 | public String joinElementsToId ( List < String > elements ) { Preconditions . checkNotNull ( elements , "elements argument" ) ; StringBuilder sb = new StringBuilder ( ) ; for ( String el : elements ) { if ( el == null ) { continue ; } String trimmedEl = el . trim ( ) ; if ( trimmedEl . length ( ) < 1 ) { continue ; } t... | Joins a list of elements into a resource id escaping special characters if required . |
3,541 | private Double aggregate ( Datasource ds , Collection < Double > values ) { return ( ( values . size ( ) / m_intervalsPer ) > ds . getXff ( ) ) ? ds . getAggregationFuction ( ) . apply ( values ) : Double . NaN ; } | is within XFF otherwise return NaN . |
3,542 | private boolean inRange ( ) { if ( m_working == null || m_nextOut == null ) { return false ; } Timestamp rangeUpper = m_nextOut . getTimestamp ( ) ; Timestamp rangeLower = m_nextOut . getTimestamp ( ) . minus ( m_resolution ) ; return m_working . getTimestamp ( ) . lte ( rangeUpper ) && m_working . getTimestamp ( ) . g... | true if the working input Row is within the Range of the next output Row ; false otherwise |
3,543 | public Class < ? > getBody ( String message ) { final Set < IdentifierLine > identifierLines = this . definitions . keySet ( ) ; final IdentifierLine messageId = new IdentifierLine ( ) ; for ( IdentifierLine id : identifierLines ) { final Map < Integer , String > mapIds = id . getMapIds ( ) ; final Set < Integer > keys... | GETTERS AND SETTERS |
3,544 | public static ExpectedCondition < List < WebElement > > presenceOfNbElementsLocatedBy ( final By locator , final int nb ) { return new ExpectedCondition < List < WebElement > > ( ) { public List < WebElement > apply ( WebDriver driver ) { final List < WebElement > elements = driver . findElements ( locator ) ; return e... | An expectation for checking that nb elements that match the locator are present on the web page . |
3,545 | public static ExpectedCondition < List < WebElement > > visibilityOfNbElementsLocatedBy ( final By locator , final int nb ) { return new ExpectedCondition < List < WebElement > > ( ) { public List < WebElement > apply ( WebDriver driver ) { int nbElementIsDisplayed = 0 ; final List < WebElement > elements = driver . fi... | An expectation for checking that nb elements present on the web page that match the locator are visible . Visibility means that the elements are not only displayed but also have a height and width that is greater than 0 . |
3,546 | public static ExpectedCondition < Boolean > waitForLoad ( ) { return new ExpectedCondition < Boolean > ( ) { public Boolean apply ( WebDriver driver ) { return ( ( JavascriptExecutor ) driver ) . executeScript ( "return document.readyState" ) . equals ( "complete" ) ; } } ; } | Expects that the target page is completely loaded . |
3,547 | public static String format ( String templateMessage , Object ... args ) throws TechnicalException { if ( null != templateMessage && countWildcardsOccurrences ( templateMessage , "%s" ) == args . length ) { try { return String . format ( templateMessage , args ) ; } catch ( final Exception e ) { throw new TechnicalExce... | Format given message with provided arguments |
3,548 | public static String getMessage ( String key , String bundle ) { if ( ! messagesBundles . containsKey ( bundle ) ) { if ( Context . getLocale ( ) == null ) { messagesBundles . put ( bundle , ResourceBundle . getBundle ( "i18n/" + bundle , Locale . getDefault ( ) ) ) ; } else { messagesBundles . put ( bundle , ResourceB... | Gets a message by key using the resources bundle given in parameters . |
3,549 | private static int countWildcardsOccurrences ( String templateMessage , String occurrence ) { if ( templateMessage != null && occurrence != null ) { final Pattern pattern = Pattern . compile ( occurrence ) ; final Matcher matcher = pattern . matcher ( templateMessage ) ; int count = 0 ; while ( matcher . find ( ) ) { c... | Count the number of occurrences of a given wildcard . |
3,550 | public void writeFailedResult ( int line , String value ) { logger . debug ( "Write Failed result => line:{} value:{}" , line , value ) ; writeValue ( resultColumnName , line , value ) ; } | Writes a fail result |
3,551 | public void writeSuccessResult ( int line ) { logger . debug ( "Write Success result => line:{}" , line ) ; writeValue ( resultColumnName , line , Messages . getMessage ( Messages . SUCCESS_MESSAGE ) ) ; } | Writes a success result |
3,552 | public void writeWarningResult ( int line , String value ) { logger . debug ( "Write Warning result => line:{} value:{}" , line , value ) ; writeValue ( resultColumnName , line , value ) ; } | Writes a warning result |
3,553 | public void writeDataResult ( String column , int line , String value ) { logger . debug ( "Write Data result => column:{} line:{} value:{}" , column , line , value ) ; writeValue ( column , line , value ) ; } | Writes some data as result . |
3,554 | private void displayMessageAtTheBeginningOfMethod ( String methodName , List < GherkinStepCondition > conditions ) { logger . debug ( "{} with {} contition(s)" , methodName , conditions . size ( ) ) ; displayConditionsAtTheBeginningOfMethod ( conditions ) ; } | Display a message at the beginning of method . |
3,555 | public boolean checkConditions ( List < GherkinStepCondition > conditions ) { for ( GherkinStepCondition gherkinCondition : conditions ) { logger . debug ( "checkConditions {} in context is " , gherkinCondition . getActual ( ) , Context . getValue ( gherkinCondition . getActual ( ) ) ) ; if ( ! gherkinCondition . check... | Check all conditions . |
3,556 | @ Et ( "Je sauvegarde la valeur de cette API REST '(.*)' '(.*)' '(.*)' dans '(.*)' du contexte[\\.|\\?]" ) @ And ( "I save the value of REST API '(.*)' '(.*)' '(.*)' in '(.*)' context key[\\.|\\?]" ) public void saveValue ( String method , String pageKey , String uri , String targetKey , List < GherkinStepCondition > c... | Save result of REST API in memory if all expected parameters equals actual parameters in conditions . |
3,557 | @ Experimental ( name = "validActivationEmail" ) @ RetryOnFailure ( attempts = 3 , delay = 60 ) @ Et ( "Je valide le mail d'activation '(.*)'[\\.|\\?]" ) @ And ( "I valid activation email '(.*)'[\\.|\\?]" ) public void validActivationEmail ( String mailHost , String mailUser , String mailPassword , String senderMail , ... | Valid activation email . |
3,558 | @ Times ( { @ Time ( name = "AM" ) , @ Time ( name = "{pageKey}" ) } ) @ Lorsque ( "'(.*)' est ouvert[\\.|\\?]" ) @ Given ( "'(.*)' is opened[\\.|\\?]" ) public void openUrlIfDifferent ( @ TimeName ( "pageKey" ) String pageKey , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureException { g... | Open Url if different with conditions . |
3,559 | @ Et ( "Je retourne vers '(.*)'" ) @ And ( "I go back to '(.*)'" ) public void goToUrl ( String pageKey ) throws TechnicalException , FailureException { goToUrl ( pageKey , true ) ; } | Go to Url . |
3,560 | private void navigateTo ( String pageKey , String urlToOpen , String windowHandle ) { Context . addWindow ( pageKey , windowHandle ) ; Context . setMainWindow ( pageKey ) ; Context . getDriver ( ) . navigate ( ) . to ( urlToOpen ) ; } | navigateTo change url on the same window . |
3,561 | private void switchToWindow ( String key , String handleToKeep ) { Context . addWindow ( key , handleToKeep ) ; Context . setMainWindow ( key ) ; Context . getDriver ( ) . switchTo ( ) . window ( handleToKeep ) ; } | switchToWindow switch to an other Window . |
3,562 | protected void clickOn ( PageElement toClick , Object ... args ) throws TechnicalException , FailureException { displayMessageAtTheBeginningOfMethod ( "clickOn: %s in %s" , toClick . toString ( ) , toClick . getPage ( ) . getApplication ( ) ) ; try { Context . waitUntil ( ExpectedConditions . elementToBeClickable ( Uti... | Click on html element . |
3,563 | protected boolean checkInputText ( PageElement pageElement , String textOrKey ) throws FailureException , TechnicalException { WebElement inputText = null ; String value = getTextOrKey ( textOrKey ) ; try { inputText = Context . waitUntil ( ExpectedConditions . presenceOfElementLocated ( Utilities . getLocator ( pageEl... | Checks if input text contains expected value . |
3,564 | protected void expectText ( PageElement pageElement , String textOrKey ) throws FailureException , TechnicalException { WebElement element = null ; String value = getTextOrKey ( textOrKey ) ; try { element = Context . waitUntil ( ExpectedConditions . presenceOfElementLocated ( Utilities . getLocator ( pageElement ) ) )... | Expects that an element contains expected value . |
3,565 | protected boolean checkMandatoryTextField ( PageElement pageElement ) throws FailureException { WebElement inputText = null ; try { inputText = Context . waitUntil ( ExpectedConditions . presenceOfElementLocated ( Utilities . getLocator ( pageElement ) ) ) ; } catch ( final Exception e ) { new Result . Failure < > ( pa... | Checks mandatory text field . |
3,566 | protected void checkText ( PageElement pageElement , String textOrKey ) throws TechnicalException , FailureException { WebElement webElement = null ; String value = getTextOrKey ( textOrKey ) ; try { webElement = Context . waitUntil ( ExpectedConditions . presenceOfElementLocated ( Utilities . getLocator ( pageElement ... | Checks if HTML text contains expected value . |
3,567 | protected void updateList ( PageElement pageElement , String textOrKey ) throws TechnicalException , FailureException { String value = getTextOrKey ( textOrKey ) ; try { setDropDownValue ( pageElement , value ) ; } catch ( final Exception e ) { new Result . Failure < > ( e . getMessage ( ) , Messages . format ( Message... | Update a html select with a text value . |
3,568 | protected void updateDateValidated ( PageElement pageElement , String dateType , String date ) throws TechnicalException , FailureException { logger . debug ( "updateDateValidated with elementName={}, dateType={} and date={}" , pageElement , dateType , date ) ; final DateFormat formatter = new SimpleDateFormat ( Consta... | Update a html input text value with a date . |
3,569 | protected void saveElementValue ( String field , String targetKey , Page page ) throws TechnicalException , FailureException { logger . debug ( "saveValueInStep: {} to {} in {}." , field , targetKey , page . getApplication ( ) ) ; String txt = "" ; try { final WebElement elem = Utilities . findElement ( page , field ) ... | Save value in memory . |
3,570 | protected boolean checkRadioList ( PageElement pageElement , String value ) throws FailureException { try { final List < WebElement > radioButtons = Context . waitUntil ( ExpectedConditions . presenceOfAllElementsLocatedBy ( Utilities . getLocator ( pageElement ) ) ) ; for ( final WebElement button : radioButtons ) { i... | Checks that given value is matching the selected radio list button . |
3,571 | protected void updateRadioList ( PageElement pageElement , String valueOrKey ) throws TechnicalException , FailureException { final String value = Context . getValue ( valueOrKey ) != null ? Context . getValue ( valueOrKey ) : valueOrKey ; try { final List < WebElement > radioButtons = Context . waitUntil ( ExpectedCon... | Update html radio button by text input . |
3,572 | protected void passOver ( PageElement element ) throws TechnicalException , FailureException { try { final String javascript = "var evObj = document.createEvent('MouseEvents');" + "evObj.initMouseEvent(\"mouseover\",true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);" + "arguments[0].dispatchEvent... | Passes over a specific page element triggering mouseover js event . |
3,573 | protected void selectCheckbox ( PageElement element , boolean checked , Object ... args ) throws TechnicalException , FailureException { try { final WebElement webElement = Context . waitUntil ( ExpectedConditions . elementToBeClickable ( Utilities . getLocator ( element , args ) ) ) ; if ( webElement . isSelected ( ) ... | Checks a checkbox type element . |
3,574 | protected void switchFrame ( PageElement element , Object ... args ) throws FailureException , TechnicalException { try { Context . waitUntil ( ExpectedConditions . frameToBeAvailableAndSwitchToIt ( Utilities . getLocator ( element , args ) ) ) ; } catch ( final Exception e ) { new Result . Failure < > ( element , Mess... | Switches to the given frame . |
3,575 | protected void uploadFile ( PageElement pageElement , String fileOrKey , Object ... args ) throws TechnicalException , FailureException { final String path = Context . getValue ( fileOrKey ) != null ? Context . getValue ( fileOrKey ) : System . getProperty ( USER_DIR ) + File . separator + DOWNLOADED_FILES_FOLDER + Fil... | Updates a html file input with the path of the file to upload . |
3,576 | public static Map < String , Method > getAllCucumberMethods ( Class < ? > clazz ) { final Map < String , Method > result = new HashMap < > ( ) ; final CucumberOptions co = clazz . getAnnotation ( CucumberOptions . class ) ; final Set < Class < ? > > classes = getClasses ( co . glue ( ) ) ; classes . add ( BrowserSteps ... | Gets all Cucumber methods . |
3,577 | public static Cookie getAuthenticationCookie ( String domainUrl ) throws TechnicalException { if ( getInstance ( ) . authCookie == null ) { final String cookieStr = System . getProperty ( SESSION_COOKIE ) ; try { if ( cookieStr != null && ! "" . equals ( cookieStr ) ) { final int indexValue = cookieStr . indexOf ( '=' ... | Returns a Cookie object by retrieving data from - Dcookie maven parameter . |
3,578 | public static String usingAuthentication ( String url ) { if ( authenticationTypes . BASIC . toString ( ) . equals ( getInstance ( ) . authenticationType ) ) { return url . replace ( "://" , "://" + getLogin ( ) + ":" + getPassword ( ) + "@" ) ; } return url ; } | Process a given url using the current authentication mode . |
3,579 | public static WebElement isElementPresentAndGetFirstOne ( By element ) { final WebDriver webDriver = Context . getDriver ( ) ; webDriver . manage ( ) . timeouts ( ) . implicitlyWait ( DriverFactory . IMPLICIT_WAIT * 2 , TimeUnit . MICROSECONDS ) ; final List < WebElement > foundElements = webDriver . findElements ( ele... | Check if element present and get first one . |
3,580 | @ Lorsque ( "Je patiente '(.*)' secondes[\\.|\\?]" ) @ Then ( "I wait '(.*)' seconds[\\.|\\?]" ) public void wait ( int time , List < GherkinStepCondition > conditions ) throws InterruptedException { Thread . sleep ( ( long ) time * 1000 ) ; } | Waits a time in second . |
3,581 | @ Lorsque ( "Je patiente la disparition de '(.*)-(.*)' avec un timeout de '(.*)' secondes[\\.|\\?]" ) @ Then ( "I wait staleness of '(.*)-(.*)' with timeout of '(.*)' seconds[\\.|\\?]" ) public void waitStalenessOf ( String page , String element , int time , List < GherkinStepCondition > conditions ) throws TechnicalEx... | Waits staleness of element with timeout of x seconds . |
3,582 | @ Lorsque ( "Si '(.*)' vérifie '(.*)', je fais '(.*)' fois:")
@ Then ( "If '(.*)' matches '(.*)', I do '(.*)' times:" ) public void loop ( String actual , String expected , int times , List < GherkinConditionedLoopedStep > steps ) { try { if ( new GherkinStepCondition ( "loopKey" , expected , actual ) . checkConditio... | Loops on steps execution for a specific number of times . |
3,583 | @ Lorsque ( "Je vérifie les champs obligatoires:")
@ Given ( "I check mandatory fields:" ) public void checkMandatoryFields ( Map < String , String > mandatoryFields ) throws TechnicalException , FailureException { final List < String > errors = new ArrayList < > ( ) ; for ( final Entry < String , String > element : ... | Check all mandatory fields . |
3,584 | @ Et ( "Je sauvegarde la valeur de '(.*)-(.*)' dans la clé '(.*)' du contexte[\\.|\\?]")
@ And ( "I save the value of '(.*)-(.*)' in '(.*)' context key[\\.|\\?]" ) public void saveValue ( String page , String field , String targetKey , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureExce... | Save field in memory if all expected parameters equals actual parameters in conditions . The value is saved directly into the Context targetKey . |
3,585 | @ Quand ( "Je clique sur '(.*)-(.*)'[\\.|\\?]" ) @ When ( "I click on '(.*)-(.*)'[\\.|\\?]" ) public void clickOn ( String page , String toClick , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureException { logger . debug ( "{} clickOn: {}" , page , toClick ) ; clickOn ( Page . getInstance... | Click on html element if all expected parameters equals actual parameters in conditions . |
3,586 | @ Quand ( "Je clique via js sur xpath '(.*)' de '(.*)' page[\\.|\\?]" ) @ When ( "I click by js on xpath '(.*)' from '(.*)' page[\\.|\\?]" ) public void clickOnXpathByJs ( String xpath , String page , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureException { logger . debug ( "clickOnByJs... | Click on html element using Javascript if all expected parameters equals actual parameters in conditions . |
3,587 | @ Quand ( "Je passe au dessus de '(.*)-(.*)'[\\.|\\?]" ) @ When ( "I pass over '(.*)-(.*)'[\\.|\\?]" ) public void passOver ( String page , String elementName , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureException { passOver ( Page . getInstance ( page ) . getPageElementByKey ( '-' + ... | Simulates the mouse over a html element |
3,588 | @ Quand ( "Je mets à jour la date '(.*)-(.*)' avec une '(.*)' date '(.*)'[\\.|\\?]")
@ When ( "I update date '(.*)-(.*)' with a '(.*)' date '(.*)'[\\.|\\?]" ) public void updateDate ( String page , String elementName , String dateType , String dateOrKey , List < GherkinStepCondition > conditions ) throws TechnicalExc... | Update a html input text with a date . |
3,589 | @ Lorsque ( "Je vérifie le champ obligatoire '(.*)-(.*)' de type '(.*)'[\\.|\\?]")
@ Then ( "I check mandatory field '(.*)-(.*)' of type '(.*)'[\\.|\\?]" ) public void checkMandatoryField ( String page , String fieldName , String type , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureExc... | Checks that mandatory field is no empty with conditions . |
3,590 | @ Et ( "Je vérifie le texte '(.*)-(.*)' avec '(.*)'[\\.|\\?]")
@ And ( "I check text '(.*)-(.*)' with '(.*)'[\\.|\\?]" ) public void checkInputText ( String page , String elementName , String textOrKey , List < GherkinStepCondition > conditions ) throws FailureException , TechnicalException { if ( ! checkInputText ( ... | Checks if html input text contains expected value . |
3,591 | @ Et ( "Je vérifie que '(.*)-(.*)' est visible[\\.|\\?]")
@ And ( "I check that '(.*)-(.*)' is visible[\\.|\\?]" ) public void checkElementVisible ( String page , String elementName , List < GherkinStepCondition > conditions ) throws FailureException , TechnicalException { checkElementVisible ( Page . getInstance ( p... | Checks if an html element is visible . |
3,592 | @ Et ( "Je vérifie le message '(.*)' sur l'alerte")
@ And ( "I check message '(.*)' on alert" ) public void checkAlert ( String messageOrKey ) throws TechnicalException , FailureException { final String message = Context . getValue ( messageOrKey ) != null ? Context . getValue ( messageOrKey ) : messageOrKey ; final ... | Checks that a given page displays a html alert with a message . |
3,593 | @ Et ( "Je mets à jour la liste radio '(.*)-(.*)' avec '(.*)'[\\.|\\?]")
@ And ( "I update radio list '(.*)-(.*)' with '(.*)'[\\.|\\?]" ) public void updateRadioList ( String page , String elementName , String valueOrKey , List < GherkinStepCondition > conditions ) throws TechnicalException , FailureException { updat... | Updates the value of a html radio element with conditions . |
3,594 | public WebDriver getDriver ( ) { String driverName = Context . getBrowser ( ) ; driverName = driverName != null ? driverName : DEFAULT_DRIVER ; WebDriver driver = null ; if ( ! drivers . containsKey ( driverName ) ) { try { driver = generateWebDriver ( driverName ) ; } catch ( final TechnicalException e ) { logger . er... | Get selenium driver . Drivers are lazy loaded . |
3,595 | private WebDriver generateIEDriver ( ) throws TechnicalException { final String pathWebdriver = DriverFactory . getPath ( Driver . IE ) ; if ( ! new File ( pathWebdriver ) . setExecutable ( true ) ) { throw new TechnicalException ( Messages . getMessage ( TechnicalException . TECHNICAL_ERROR_MESSAGE_WEBDRIVER_SET_EXECU... | Generates an ie webdriver . Unable to use it with a proxy . Causes a crash . |
3,596 | private WebDriver generateGoogleChromeDriver ( ) throws TechnicalException { final String pathWebdriver = DriverFactory . getPath ( Driver . CHROME ) ; if ( ! new File ( pathWebdriver ) . setExecutable ( true ) ) { throw new TechnicalException ( Messages . getMessage ( TechnicalException . TECHNICAL_ERROR_MESSAGE_WEBDR... | Generates a chrome webdriver . |
3,597 | private void setChromeOptions ( final DesiredCapabilities capabilities , ChromeOptions chromeOptions ) { final HashMap < String , Object > chromePrefs = new HashMap < > ( ) ; chromePrefs . put ( "download.default_directory" , System . getProperty ( USER_DIR ) + File . separator + DOWNLOADED_FILES_FOLDER ) ; chromeOptio... | Sets the target browser binary path in chromeOptions if it exists in configuration . |
3,598 | private WebDriver generateFirefoxDriver ( ) throws TechnicalException { final String pathWebdriver = DriverFactory . getPath ( Driver . FIREFOX ) ; if ( ! new File ( pathWebdriver ) . setExecutable ( true ) ) { throw new TechnicalException ( Messages . getMessage ( TechnicalException . TECHNICAL_ERROR_MESSAGE_WEBDRIVER... | Generates a firefox webdriver . |
3,599 | private WebDriver generateWebDriver ( String driverName ) throws TechnicalException { WebDriver driver ; if ( IE . equals ( driverName ) ) { driver = generateIEDriver ( ) ; } else if ( CHROME . equals ( driverName ) ) { driver = generateGoogleChromeDriver ( ) ; } else if ( FIREFOX . equals ( driverName ) ) { driver = g... | Generates a selenium webdriver following a name given in parameter . By default a chrome driver is generated . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.