mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/webapp/base/TestControllerSideBar.java
@Test
    public void testRemoveThenAddController() throws NumberFormatException, InterruptedException, ExecutionException, 
        TimeoutException
    {
        WebDriverWait wait = new WebDriverWait(m_Driver, 5);
        
        //Checks which controller is active. This is important since the active controller will cause an additional
        //growl message to appear. So it is easier if the same controller is active every time. In this case the 
        //gui is always made the active controller if it is not already.
        String activeControllerName = ControllerHelper.getNameOfActiveContoller(m_Driver);
        if (activeControllerName != null && activeControllerName.equals("THarvest"))
        {
            ControllerHelper.setActiveControllerByName(m_Driver, ControllerHelper.DEFAULT_GUI_NAME);
        }
        
        NavigationHelper.collapseRightSideBarOnly(m_Driver);
        
        NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_CHANNELS);
        wait.until(ExpectedConditions.presenceOfElementLocated(ChannelsHelper.SOCKET_TABLE_SELECTOR));
        
        //---disconnect from controllers---
        ChannelsHelper.removeSocketChannel(m_Driver, ControllerHelper.DEFAULT_CONTROLLER_ID,
                ControllerHelper.DEFAULT_CONTROLLER_NAME, ChannelsHelper.HOST_NAME, "4000", false);
        
        ChannelsHelper.removeSocketChannel(m_Driver, ControllerHelper.DEFAULT_GUI_ID,
                ControllerHelper.DEFAULT_GUI_NAME, ChannelsHelper.HOST_NAME, "4001", true);
        
        //verify that if not controller is set that the upper region 'active' controller 
        //area displays the correct information
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("span[id$='noController']")));
        WebElement noController = m_Driver.findElement(By.cssSelector("span[id$='noController']"));
        assertThat(noController.getText(), is("No Controller"));
        
        //---reconnect a controller---
        NavigationHelper.expandRightSideBarOnly(m_Driver);
        ControllerHelper.createController(m_Driver);
        
        wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.cssSelector("table[class='controller']")));
        assertThat(m_Driver.findElements(By.cssSelector("table[class='controller']")).size(), is(1));
       
        //verify again that if a controller is added that the newly added controller is automatically set
        //as the active controller
        activeControllerName = ControllerHelper.getNameOfActiveContoller(m_Driver);
        assertThat(activeControllerName, is(ControllerHelper.DEFAULT_CONTROLLER_NAME));
    }
/**
     * Verify removing and adding a controller.
     * Verify that if there is only one controller known that it is made the 'active' controller automatically.
     */
Verify removing and adding a controller.
Verify that if there is only one controller known that it is made the 'active' controller automatically.
Verify removing and adding a controller . Verify that if there is only one controller known that it is made the ' active ' controller automatically .
@Test
    public void testRemoveThenAddController() throws NumberFormatException, InterruptedException, ExecutionException, 
        TimeoutException
    {
        WebDriverWait wait = new WebDriverWait(m_Driver, 5);
        String activeControllerName = ControllerHelper.getNameOfActiveContoller(m_Driver);
        if (activeControllerName != null && activeControllerName.equals("THarvest"))
        {
            ControllerHelper.setActiveControllerByName(m_Driver, ControllerHelper.DEFAULT_GUI_NAME);
        }
        NavigationHelper.collapseRightSideBarOnly(m_Driver);
        NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_CHANNELS);
        wait.until(ExpectedConditions.presenceOfElementLocated(ChannelsHelper.SOCKET_TABLE_SELECTOR));
        ChannelsHelper.removeSocketChannel(m_Driver, ControllerHelper.DEFAULT_CONTROLLER_ID,
                ControllerHelper.DEFAULT_CONTROLLER_NAME, ChannelsHelper.HOST_NAME, "4000", false);
        ChannelsHelper.removeSocketChannel(m_Driver, ControllerHelper.DEFAULT_GUI_ID,
                ControllerHelper.DEFAULT_GUI_NAME, ChannelsHelper.HOST_NAME, "4001", true);
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("span[id$='noController']")));
        WebElement noController = m_Driver.findElement(By.cssSelector("span[id$='noController']"));
        assertThat(noController.getText(), is("No Controller"));
        NavigationHelper.expandRightSideBarOnly(m_Driver);
        ControllerHelper.createController(m_Driver);
        wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.cssSelector("table[class='controller']")));
        assertThat(m_Driver.findElements(By.cssSelector("table[class='controller']")).size(), is(1));
        activeControllerName = ControllerHelper.getNameOfActiveContoller(m_Driver);
        assertThat(activeControllerName, is(ControllerHelper.DEFAULT_CONTROLLER_NAME));
    }
@ Test public void testRemoveThenAddController ( ) throws NumberFormatException , InterruptedException , ExecutionException , TimeoutException { WebDriverWait wait = new WebDriverWait ( m_Driver , 5 ) ; String activeControllerName = ControllerHelper . getNameOfActiveContoller ( m_Driver ) ; if ( activeControllerName != null && activeControllerName . equals ( "THarvest" ) ) { ControllerHelper . setActiveControllerByName ( m_Driver , ControllerHelper . DEFAULT_GUI_NAME ) ; } NavigationHelper . collapseRightSideBarOnly ( m_Driver ) ; NavigationHelper . navigateToPage ( m_Driver , NavigationButtonNameConstants . NAVBUT_PROP_CHANNELS ) ; wait . until ( ExpectedConditions . presenceOfElementLocated ( ChannelsHelper . SOCKET_TABLE_SELECTOR ) ) ; ChannelsHelper . removeSocketChannel ( m_Driver , ControllerHelper . DEFAULT_CONTROLLER_ID , ControllerHelper . DEFAULT_CONTROLLER_NAME , ChannelsHelper . HOST_NAME , "4000" , false ) ; ChannelsHelper . removeSocketChannel ( m_Driver , ControllerHelper . DEFAULT_GUI_ID , ControllerHelper . DEFAULT_GUI_NAME , ChannelsHelper . HOST_NAME , "4001" , true ) ; wait . until ( ExpectedConditions . presenceOfElementLocated ( By . cssSelector ( "span[id$='noController']" ) ) ) ; WebElement noController = m_Driver . findElement ( By . cssSelector ( "span[id$='noController']" ) ) ; assertThat ( noController . getText ( ) , is ( "No Controller" ) ) ; NavigationHelper . expandRightSideBarOnly ( m_Driver ) ; ControllerHelper . createController ( m_Driver ) ; wait . until ( ExpectedConditions . presenceOfAllElementsLocatedBy ( By . cssSelector ( "table[class='controller']" ) ) ) ; assertThat ( m_Driver . findElements ( By . cssSelector ( "table[class='controller']" ) ) . size ( ) , is ( 1 ) ) ; activeControllerName = ControllerHelper . getNameOfActiveContoller ( m_Driver ) ; assertThat ( activeControllerName , is ( ControllerHelper . DEFAULT_CONTROLLER_NAME ) ) ; }
Verify removing and adding a controller.
Verify removing and adding a controller .
//Checks which controller is active. This is important since the active controller will cause an additional //growl message to appear. So it is easier if the same controller is active every time. In this case the  //gui is always made the active controller if it is not already. //---disconnect from controllers--- //verify that if not controller is set that the upper region 'active' controller  //area displays the correct information //---reconnect a controller--- //verify again that if a controller is added that the newly added controller is automatically set //as the active controller