mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/BundleManagerUtil.java
private static MultipleByChain waitForBundleFilter(WebDriver driver, 
            final Function<Collection<String>, Boolean> expectedCondition)
    {
        Wait<WebDriver> fwait = new FluentWait<WebDriver>(driver).withTimeout(15, TimeUnit.SECONDS).
                pollingEvery(2, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class, 
                        NoSuchElementException.class);
        
        final MultipleByChain bundleRowsChain = ByChain.newBuilder()
                .single(By.cssSelector("tbody[id$='bundleTable_data']"))
                .multiple(By.tagName("tr"))
                .build();
        
        fwait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                List<WebElement> bundles = bundleRowsChain.findElements();
                
                List<String> bundleSymbolicNames = Lists.transform(bundles, new Function<WebElement, String>()
                {
                    @Override
                    public String apply(WebElement bundleRow)
                    {
                        List<WebElement> spans = bundleRow.findElements(By.tagName("span"));
                        if (spans.size() >= 2)  // sometimes there will be a table row that is empty with no spans
                        {
                            // remove parenthesis
                            return spans.get(2).getText().replace("(", "").replace(")", "");
                        }
                        else
                        {
                            return "";
                        }
                    }
                });
                Collection<String> filteredNames = Collections2.filter(bundleSymbolicNames, new Predicate<String>() 
                {
                    @Override
                    public boolean apply(String input)
                    {
                        return !Strings.isNullOrEmpty(input); // sometimes there will be a table row that is empty
                    }
                });
                
                return expectedCondition.apply(filteredNames);
            }
        });
        
        return bundleRowsChain;
    }
/**
     * Helper method used to verify that a bundle had been found after using the the search bar to filter bundles. 
     * @param driver
     *      Instance of the {@link WebDriver} which controls the navigation
     */
Helper method used to verify that a bundle had been found after using the the search bar to filter bundles.
@param driver
Instance of the  WebDriver which controls the navigation
Helper method used to verify that a bundle had been found after using the the search bar to filter bundles . @param driver Instance of the WebDriver which controls the navigation
private static MultipleByChain waitForBundleFilter(WebDriver driver, 
            final Function<Collection<String>, Boolean> expectedCondition)
    {
        Wait<WebDriver> fwait = new FluentWait<WebDriver>(driver).withTimeout(15, TimeUnit.SECONDS).
                pollingEvery(2, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class, 
                        NoSuchElementException.class);
        final MultipleByChain bundleRowsChain = ByChain.newBuilder()
                .single(By.cssSelector("tbody[id$='bundleTable_data']"))
                .multiple(By.tagName("tr"))
                .build();
        fwait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                List<WebElement> bundles = bundleRowsChain.findElements();
                List<String> bundleSymbolicNames = Lists.transform(bundles, new Function<WebElement, String>()
                {
                    @Override
                    public String apply(WebElement bundleRow)
                    {
                        List<WebElement> spans = bundleRow.findElements(By.tagName("span"));
                        if (spans.size() >= 2)  
                        {
                            return spans.get(2).getText().replace("(", "").replace(")", "");
                        }
                        else
                        {
                            return "";
                        }
                    }
                });
                Collection<String> filteredNames = Collections2.filter(bundleSymbolicNames, new Predicate<String>() 
                {
                    @Override
                    public boolean apply(String input)
                    {
                        return !Strings.isNullOrEmpty(input); 
                    }
                });
                return expectedCondition.apply(filteredNames);
            }
        });
        return bundleRowsChain;
    }
private static MultipleByChain waitForBundleFilter ( WebDriver driver , final Function < Collection < String > , Boolean > expectedCondition ) { Wait < WebDriver > fwait = new FluentWait < WebDriver > ( driver ) . withTimeout ( 15 , TimeUnit . SECONDS ) . pollingEvery ( 2 , TimeUnit . SECONDS ) . ignoring ( StaleElementReferenceException . class , NoSuchElementException . class ) ; final MultipleByChain bundleRowsChain = ByChain . newBuilder ( ) . single ( By . cssSelector ( "tbody[id$='bundleTable_data']" ) ) . multiple ( By . tagName ( "tr" ) ) . build ( ) ; fwait . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver driver ) { List < WebElement > bundles = bundleRowsChain . findElements ( ) ; List < String > bundleSymbolicNames = Lists . transform ( bundles , new Function < WebElement , String > ( ) { @ Override public String apply ( WebElement bundleRow ) { List < WebElement > spans = bundleRow . findElements ( By . tagName ( "span" ) ) ; if ( spans . size ( ) >= 2 ) { return spans . get ( 2 ) . getText ( ) . replace ( "(" , "" ) . replace ( ")" , "" ) ; } else { return "" ; } } } ) ; Collection < String > filteredNames = Collections2 . filter ( bundleSymbolicNames , new Predicate < String > ( ) { @ Override public boolean apply ( String input ) { return ! Strings . isNullOrEmpty ( input ) ; } } ) ; return expectedCondition . apply ( filteredNames ) ; } } ) ; return bundleRowsChain ; }
Helper method used to verify that a bundle had been found after using the the search bar to filter bundles.
Helper method used to verify that a bundle had been found after using the the search bar to filter bundles .
// sometimes there will be a table row that is empty with no spans // remove parenthesis // sometimes there will be a table row that is empty