mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/ControllerHelper.java
public static void cleanupControllerCheck(final WebDriver driver) throws InterruptedException, ExecutionException, 
        TimeoutException
    {
        //Add and set active the default controller if it isn't already available.
        if (getControllerListElement(driver, DEFAULT_CONTROLLER_NAME) == null)
        {
            createAndSetActiveController(driver);
        }
        else if (!getNameOfActiveContoller(driver).equals(DEFAULT_CONTROLLER_NAME))
        {
            setActiveControllerByName(driver, DEFAULT_CONTROLLER_NAME);
        }
        
        //Must retrieve the list every single time to receive updated size information. 
        while (ChannelsHelper.retrieveChannelsList(driver, ChannelsHelper.SOCKET_TABLE_SELECTOR).size() > 1)
        {
            final List<WebElement> channelsList = 
                    ChannelsHelper.retrieveChannelsList(driver, ChannelsHelper.SOCKET_TABLE_SELECTOR);
            for (WebElement socket: channelsList)
            {
                final List<WebElement> cells = socket.findElements(By.tagName("td"));
                if(ChannelsHelper.channelRowContainsProperty(cells, DEFAULT_CONTROLLER_NAME + " - " 
                        + DEFAULT_CONTROLLER_ID))
                {
                    continue;
                }
                else
                {
                    final WebElement removeButton = 
                            socket.findElement(By.cssSelector("button[id$='removeSocketButton']"));
                    GrowlVerifier.verifyAndWaitToDisappear(20, removeButton, "Channel Removed");
                    //Break required! Cannot remove more than one channel per iteration over the sockets due to the page
                    //being refreshed by AJAX when a channel is removed. If it is not done this way a stale element
                    //exception will occur.
                    break;
                }
            }
        }
    }
/**
     * Method that removes any additional controllers that have been added and insures that the default controller has
     * a channel. This method should be used in the {@link org.junit.AfterClass} method to verify the correct 
     * controller/channel settings before continuing testing.
     * 
     * @param driver
     *      Current web driver.
     */
Method that removes any additional controllers that have been added and insures that the default controller has
a channel. This method should be used in the  org.junit.AfterClass method to verify the correct
controller/channel settings before continuing testing.

@param driver
Current web driver.
Method that removes any additional controllers that have been added and insures that the default controller has a channel . This method should be used in the org . junit . AfterClass method to verify the correct controller / channel settings before continuing testing . @param driver Current web driver .
public static void cleanupControllerCheck(final WebDriver driver) throws InterruptedException, ExecutionException, 
        TimeoutException
    {
        if (getControllerListElement(driver, DEFAULT_CONTROLLER_NAME) == null)
        {
            createAndSetActiveController(driver);
        }
        else if (!getNameOfActiveContoller(driver).equals(DEFAULT_CONTROLLER_NAME))
        {
            setActiveControllerByName(driver, DEFAULT_CONTROLLER_NAME);
        }
        while (ChannelsHelper.retrieveChannelsList(driver, ChannelsHelper.SOCKET_TABLE_SELECTOR).size() > 1)
        {
            final List<WebElement> channelsList = 
                    ChannelsHelper.retrieveChannelsList(driver, ChannelsHelper.SOCKET_TABLE_SELECTOR);
            for (WebElement socket: channelsList)
            {
                final List<WebElement> cells = socket.findElements(By.tagName("td"));
                if(ChannelsHelper.channelRowContainsProperty(cells, DEFAULT_CONTROLLER_NAME + " - " 
                        + DEFAULT_CONTROLLER_ID))
                {
                    continue;
                }
                else
                {
                    final WebElement removeButton = 
                            socket.findElement(By.cssSelector("button[id$='removeSocketButton']"));
                    GrowlVerifier.verifyAndWaitToDisappear(20, removeButton, "Channel Removed");
                    break;
                }
            }
        }
    }
public static void cleanupControllerCheck ( final WebDriver driver ) throws InterruptedException , ExecutionException , TimeoutException { if ( getControllerListElement ( driver , DEFAULT_CONTROLLER_NAME ) == null ) { createAndSetActiveController ( driver ) ; } else if ( ! getNameOfActiveContoller ( driver ) . equals ( DEFAULT_CONTROLLER_NAME ) ) { setActiveControllerByName ( driver , DEFAULT_CONTROLLER_NAME ) ; } while ( ChannelsHelper . retrieveChannelsList ( driver , ChannelsHelper . SOCKET_TABLE_SELECTOR ) . size ( ) > 1 ) { final List < WebElement > channelsList = ChannelsHelper . retrieveChannelsList ( driver , ChannelsHelper . SOCKET_TABLE_SELECTOR ) ; for ( WebElement socket : channelsList ) { final List < WebElement > cells = socket . findElements ( By . tagName ( "td" ) ) ; if ( ChannelsHelper . channelRowContainsProperty ( cells , DEFAULT_CONTROLLER_NAME + " - " + DEFAULT_CONTROLLER_ID ) ) { continue ; } else { final WebElement removeButton = socket . findElement ( By . cssSelector ( "button[id$='removeSocketButton']" ) ) ; GrowlVerifier . verifyAndWaitToDisappear ( 20 , removeButton , "Channel Removed" ) ; break ; } } } }
Method that removes any additional controllers that have been added and insures that the default controller has
 a channel.
Method that removes any additional controllers that have been added and insures that the default controller has a channel .
//Add and set active the default controller if it isn't already available. //Must retrieve the list every single time to receive updated size information.  //Break required! Cannot remove more than one channel per iteration over the sockets due to the page //being refreshed by AJAX when a channel is removed. If it is not done this way a stale element //exception will occur.