mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/webapp/channel/TestChannelSetup.java
@Test
    public void testRemoveSocketChannel() throws InterruptedException, ExecutionException, TimeoutException
    {
        NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_CHANNELS);
        //collapse side bars for next test
        NavigationHelper.collapseRightSideBarOnly(m_Driver);
        
        //Verify the channel exists and has the correct information.
        List<WebElement> channelsList = ChannelsHelper.retrieveChannelsList(m_Driver, 
                ChannelsHelper.SOCKET_TABLE_SELECTOR);
        assertThat(channelsList.size(), is(1));
        WebElement channel = channelsList.get(0);
        List<WebElement> channelInfo = channel.findElements(By.cssSelector("div[class='ui-dt-c']"));
        WebElement hexId = channelInfo.get(0).findElement(By.cssSelector("span[id*='hexId']"));
        assertThat(hexId.getText(), is("0x0000007D"));
        WebElement hostName = channelInfo.get(1);
        assertThat(hostName.getText(), is(ChannelsHelper.HOST_NAME));
        WebElement hostPort = channelInfo.get(2);
        assertThat(hostPort.getText(), is(ChannelsHelper.DEFAULT_REMOTE_CONNECTION_PORT));
        
        //Remove the channel.
        ChannelsHelper.removeSocketChannel(m_Driver, "localhost", "4000", true);
        
        //get table again. confirm that there is only two tr now (th and no records found row)
        WebElement socketTable = m_Driver.findElement(By.xpath("//div[contains(@id, 'tcps')]"));
        
        List<WebElement> rowsAfter = socketTable.findElements(By.tagName("tr"));
        
        int size = rowsAfter.size();
        assertThat(size, is(2));
        
        WebElement noRecords = rowsAfter.get(1);
        
        WebElement div = noRecords.findElement(By.tagName("div"));
        assertThat(div, is(notNullValue()));
        assertThat(div.getText(), is("No records found."));
        
        //make sure that controller side bar is empty by verifying that no table elements can be found.
        WebElement controllerList = m_Driver.findElement(By.cssSelector("div[id*='controllerList_content']"));
        assertThat(controllerList, is(notNullValue()));
        
        List<WebElement> elements = controllerList.findElements(By.cssSelector("table[class='controller']"));
        
        assertThat(elements.size(), is(0));
    }
/**
     * Verify that a socket channel exists and that it can be removed. This test assume that a socket is already there
     * when the test starts. It is safe to assume this because a socket is added before integration tests begin running
     * and any integration test that removes a socket should at add the socket back before the end of the test.
     */
Verify that a socket channel exists and that it can be removed. This test assume that a socket is already there
when the test starts. It is safe to assume this because a socket is added before integration tests begin running
and any integration test that removes a socket should at add the socket back before the end of the test.
Verify that a socket channel exists and that it can be removed . This test assume that a socket is already there when the test starts . It is safe to assume this because a socket is added before integration tests begin running and any integration test that removes a socket should at add the socket back before the end of the test .
@Test
    public void testRemoveSocketChannel() throws InterruptedException, ExecutionException, TimeoutException
    {
        NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_CHANNELS);
        NavigationHelper.collapseRightSideBarOnly(m_Driver);
        List<WebElement> channelsList = ChannelsHelper.retrieveChannelsList(m_Driver, 
                ChannelsHelper.SOCKET_TABLE_SELECTOR);
        assertThat(channelsList.size(), is(1));
        WebElement channel = channelsList.get(0);
        List<WebElement> channelInfo = channel.findElements(By.cssSelector("div[class='ui-dt-c']"));
        WebElement hexId = channelInfo.get(0).findElement(By.cssSelector("span[id*='hexId']"));
        assertThat(hexId.getText(), is("0x0000007D"));
        WebElement hostName = channelInfo.get(1);
        assertThat(hostName.getText(), is(ChannelsHelper.HOST_NAME));
        WebElement hostPort = channelInfo.get(2);
        assertThat(hostPort.getText(), is(ChannelsHelper.DEFAULT_REMOTE_CONNECTION_PORT));
        ChannelsHelper.removeSocketChannel(m_Driver, "localhost", "4000", true);
        WebElement socketTable = m_Driver.findElement(By.xpath("//div[contains(@id, 'tcps')]"));
        List<WebElement> rowsAfter = socketTable.findElements(By.tagName("tr"));
        int size = rowsAfter.size();
        assertThat(size, is(2));
        WebElement noRecords = rowsAfter.get(1);
        WebElement div = noRecords.findElement(By.tagName("div"));
        assertThat(div, is(notNullValue()));
        assertThat(div.getText(), is("No records found."));
        WebElement controllerList = m_Driver.findElement(By.cssSelector("div[id*='controllerList_content']"));
        assertThat(controllerList, is(notNullValue()));
        List<WebElement> elements = controllerList.findElements(By.cssSelector("table[class='controller']"));
        assertThat(elements.size(), is(0));
    }
@ Test public void testRemoveSocketChannel ( ) throws InterruptedException , ExecutionException , TimeoutException { NavigationHelper . navigateToPage ( m_Driver , NavigationButtonNameConstants . NAVBUT_PROP_CHANNELS ) ; NavigationHelper . collapseRightSideBarOnly ( m_Driver ) ; List < WebElement > channelsList = ChannelsHelper . retrieveChannelsList ( m_Driver , ChannelsHelper . SOCKET_TABLE_SELECTOR ) ; assertThat ( channelsList . size ( ) , is ( 1 ) ) ; WebElement channel = channelsList . get ( 0 ) ; List < WebElement > channelInfo = channel . findElements ( By . cssSelector ( "div[class='ui-dt-c']" ) ) ; WebElement hexId = channelInfo . get ( 0 ) . findElement ( By . cssSelector ( "span[id*='hexId']" ) ) ; assertThat ( hexId . getText ( ) , is ( "0x0000007D" ) ) ; WebElement hostName = channelInfo . get ( 1 ) ; assertThat ( hostName . getText ( ) , is ( ChannelsHelper . HOST_NAME ) ) ; WebElement hostPort = channelInfo . get ( 2 ) ; assertThat ( hostPort . getText ( ) , is ( ChannelsHelper . DEFAULT_REMOTE_CONNECTION_PORT ) ) ; ChannelsHelper . removeSocketChannel ( m_Driver , "localhost" , "4000" , true ) ; WebElement socketTable = m_Driver . findElement ( By . xpath ( "//div[contains(@id, 'tcps')]" ) ) ; List < WebElement > rowsAfter = socketTable . findElements ( By . tagName ( "tr" ) ) ; int size = rowsAfter . size ( ) ; assertThat ( size , is ( 2 ) ) ; WebElement noRecords = rowsAfter . get ( 1 ) ; WebElement div = noRecords . findElement ( By . tagName ( "div" ) ) ; assertThat ( div , is ( notNullValue ( ) ) ) ; assertThat ( div . getText ( ) , is ( "No records found." ) ) ; WebElement controllerList = m_Driver . findElement ( By . cssSelector ( "div[id*='controllerList_content']" ) ) ; assertThat ( controllerList , is ( notNullValue ( ) ) ) ; List < WebElement > elements = controllerList . findElements ( By . cssSelector ( "table[class='controller']" ) ) ; assertThat ( elements . size ( ) , is ( 0 ) ) ; }
Verify that a socket channel exists and that it can be removed.
Verify that a socket channel exists and that it can be removed .
//collapse side bars for next test //Verify the channel exists and has the correct information. //Remove the channel. //get table again. confirm that there is only two tr now (th and no records found row) //make sure that controller side bar is empty by verifying that no table elements can be found.