mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/channel/TestChannelMgrImpl.java
@Test
    public void testGetAllChannels()
    {
        Set<RemoteChannel> setChans = new HashSet<RemoteChannel>();
        setChans.add(createMockSocketChannel("localhost", 4444, ChannelStatus.Unknown));
        setChans.add(createMockTransportChannel("transportName", "localAddr", "remoteAddr", ChannelStatus.Unknown));
        
        Map<Integer, Set<RemoteChannel>> channels = new HashMap<Integer, Set<RemoteChannel>>();
        channels.put(1957, setChans);
        when(m_RemoteChannelLookup.getAllChannels()).thenReturn(channels);
        
        List<Channel> returnedChannels = m_SUT.getAllChannels();
        
        assertThat(returnedChannels, notNullValue());
        assertThat(returnedChannels.size(), is(2));
        
        for(Channel aChannel : returnedChannels)
        {
            if (aChannel.getChannelType() == RemoteChannelTypeEnum.SOCKET)
            {
                SocketChannelModel sChannel = (SocketChannelModel)aChannel;
                assertThat(sChannel.getHost(), is("localhost"));
                assertThat(sChannel.getPort(), is(4444));
            }
            else
            {
                TransportChannelModel tChannel = (TransportChannelModel)aChannel;
                assertThat(tChannel.getName(), is("transportName"));
                assertThat(tChannel.getLocalMessageAddress(), is("localAddr"));
                assertThat(tChannel.getRemoteMessageAddress(), is("remoteAddr"));
            }
        }
    }
/**
     * Verify that with known channels in the remote channel lookup, all channels are returned.
     */
Verify that with known channels in the remote channel lookup, all channels are returned.
Verify that with known channels in the remote channel lookup all channels are returned .
@Test
    public void testGetAllChannels()
    {
        Set<RemoteChannel> setChans = new HashSet<RemoteChannel>();
        setChans.add(createMockSocketChannel("localhost", 4444, ChannelStatus.Unknown));
        setChans.add(createMockTransportChannel("transportName", "localAddr", "remoteAddr", ChannelStatus.Unknown));
        Map<Integer, Set<RemoteChannel>> channels = new HashMap<Integer, Set<RemoteChannel>>();
        channels.put(1957, setChans);
        when(m_RemoteChannelLookup.getAllChannels()).thenReturn(channels);
        List<Channel> returnedChannels = m_SUT.getAllChannels();
        assertThat(returnedChannels, notNullValue());
        assertThat(returnedChannels.size(), is(2));
        for(Channel aChannel : returnedChannels)
        {
            if (aChannel.getChannelType() == RemoteChannelTypeEnum.SOCKET)
            {
                SocketChannelModel sChannel = (SocketChannelModel)aChannel;
                assertThat(sChannel.getHost(), is("localhost"));
                assertThat(sChannel.getPort(), is(4444));
            }
            else
            {
                TransportChannelModel tChannel = (TransportChannelModel)aChannel;
                assertThat(tChannel.getName(), is("transportName"));
                assertThat(tChannel.getLocalMessageAddress(), is("localAddr"));
                assertThat(tChannel.getRemoteMessageAddress(), is("remoteAddr"));
            }
        }
    }
@ Test public void testGetAllChannels ( ) { Set < RemoteChannel > setChans = new HashSet < RemoteChannel > ( ) ; setChans . add ( createMockSocketChannel ( "localhost" , 4444 , ChannelStatus . Unknown ) ) ; setChans . add ( createMockTransportChannel ( "transportName" , "localAddr" , "remoteAddr" , ChannelStatus . Unknown ) ) ; Map < Integer , Set < RemoteChannel > > channels = new HashMap < Integer , Set < RemoteChannel > > ( ) ; channels . put ( 1957 , setChans ) ; when ( m_RemoteChannelLookup . getAllChannels ( ) ) . thenReturn ( channels ) ; List < Channel > returnedChannels = m_SUT . getAllChannels ( ) ; assertThat ( returnedChannels , notNullValue ( ) ) ; assertThat ( returnedChannels . size ( ) , is ( 2 ) ) ; for ( Channel aChannel : returnedChannels ) { if ( aChannel . getChannelType ( ) == RemoteChannelTypeEnum . SOCKET ) { SocketChannelModel sChannel = ( SocketChannelModel ) aChannel ; assertThat ( sChannel . getHost ( ) , is ( "localhost" ) ) ; assertThat ( sChannel . getPort ( ) , is ( 4444 ) ) ; } else { TransportChannelModel tChannel = ( TransportChannelModel ) aChannel ; assertThat ( tChannel . getName ( ) , is ( "transportName" ) ) ; assertThat ( tChannel . getLocalMessageAddress ( ) , is ( "localAddr" ) ) ; assertThat ( tChannel . getRemoteMessageAddress ( ) , is ( "remoteAddr" ) ) ; } } }
Verify that with known channels in the remote channel lookup, all channels are returned.
Verify that with known channels in the remote channel lookup all channels are returned .