mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/channel/TestChannelMgrImpl.java
@Test
    public void testGetTransportChannel()
    {
        //behavior for remote lookup
        TransportChannel remoteChan = createMockTransportChannel("transport", "localaddr-diff", 
                "remoteaddr", ChannelStatus.Unknown);
        when(remoteChan.getBytesTransmitted()).thenReturn(2L);
        when(remoteChan.getBytesReceived()).thenReturn(50L);
        when(remoteChan.getQueuedMessageCount()).thenReturn(40);
        
        TransportChannel remoteChan1 = createMockTransportChannel("transport", "localaddr", 
                "remoteaddr-diff", ChannelStatus.Unknown);
        when(remoteChan1.getBytesTransmitted()).thenReturn(921L);
        when(remoteChan1.getBytesReceived()).thenReturn(8382L);
        when(remoteChan1.getQueuedMessageCount()).thenReturn(41);
         
        TransportChannel remoteChan2 = createMockTransportChannel("transport", "localaddr", 
                "remoteaddr", ChannelStatus.Unknown);
                
        when(remoteChan2.getBytesTransmitted()).thenReturn(991L);
        when(remoteChan2.getBytesReceived()).thenReturn(402L);
        when(remoteChan2.getQueuedMessageCount()).thenReturn(42);
        
        Set<RemoteChannel> setChans = new HashSet<RemoteChannel>();
        setChans.add(remoteChan);
        setChans.add(remoteChan1);
        setChans.add(remoteChan2);
        
        Map<Integer, Set<RemoteChannel>> channels = new HashMap<Integer, Set<RemoteChannel>>();
        channels.put(1596, setChans);
        when(m_RemoteChannelLookup.getAllChannels()).thenReturn(channels);
        
        // replay
        TransportChannelModel model = m_SUT.getTransportLayerChannel("transport", "localaddr", "remoteaddr");
        
        // verify correct channel is returned
        assertThat(model.getChannelType(), is(RemoteChannelTypeEnum.TRANSPORT));
        assertThat(model.getName(), is("transport"));
        assertThat(model.getLocalMessageAddress(), is("localaddr"));
        assertThat(model.getRemoteMessageAddress(), is("remoteaddr"));
        assertThat(model.getBytesTransmitted(), is(991L));
        assertThat(model.getBytesReceived(), is(402L));
        assertThat(model.getQueuedMessageCount(), is(42));
        
        // replay for other channel
        TransportChannelModel model2 = m_SUT.getTransportLayerChannel("transport", "localaddr", "remoteaddr-diff");
        
        // verify correct channel is returned
        assertThat(model2.getChannelType(), is(RemoteChannelTypeEnum.TRANSPORT));
        assertThat(model2.getName(), is("transport"));
        assertThat(model2.getLocalMessageAddress(), is("localaddr"));
        assertThat(model2.getRemoteMessageAddress(), is("remoteaddr-diff"));
        assertThat(model2.getBytesTransmitted(), is(921L));
        assertThat(model2.getBytesReceived(), is(8382L));
        assertThat(model2.getQueuedMessageCount(), is(41));
    }
/**
     * Test that all transport channel model contain all info from the actual transport channels.
     */
Test that all transport channel model contain all info from the actual transport channels.
Test that all transport channel model contain all info from the actual transport channels .
@Test
    public void testGetTransportChannel()
    {
        TransportChannel remoteChan = createMockTransportChannel("transport", "localaddr-diff", 
                "remoteaddr", ChannelStatus.Unknown);
        when(remoteChan.getBytesTransmitted()).thenReturn(2L);
        when(remoteChan.getBytesReceived()).thenReturn(50L);
        when(remoteChan.getQueuedMessageCount()).thenReturn(40);
        TransportChannel remoteChan1 = createMockTransportChannel("transport", "localaddr", 
                "remoteaddr-diff", ChannelStatus.Unknown);
        when(remoteChan1.getBytesTransmitted()).thenReturn(921L);
        when(remoteChan1.getBytesReceived()).thenReturn(8382L);
        when(remoteChan1.getQueuedMessageCount()).thenReturn(41);
        TransportChannel remoteChan2 = createMockTransportChannel("transport", "localaddr", 
                "remoteaddr", ChannelStatus.Unknown);
        when(remoteChan2.getBytesTransmitted()).thenReturn(991L);
        when(remoteChan2.getBytesReceived()).thenReturn(402L);
        when(remoteChan2.getQueuedMessageCount()).thenReturn(42);
        Set<RemoteChannel> setChans = new HashSet<RemoteChannel>();
        setChans.add(remoteChan);
        setChans.add(remoteChan1);
        setChans.add(remoteChan2);
        Map<Integer, Set<RemoteChannel>> channels = new HashMap<Integer, Set<RemoteChannel>>();
        channels.put(1596, setChans);
        when(m_RemoteChannelLookup.getAllChannels()).thenReturn(channels);
        TransportChannelModel model = m_SUT.getTransportLayerChannel("transport", "localaddr", "remoteaddr");
        assertThat(model.getChannelType(), is(RemoteChannelTypeEnum.TRANSPORT));
        assertThat(model.getName(), is("transport"));
        assertThat(model.getLocalMessageAddress(), is("localaddr"));
        assertThat(model.getRemoteMessageAddress(), is("remoteaddr"));
        assertThat(model.getBytesTransmitted(), is(991L));
        assertThat(model.getBytesReceived(), is(402L));
        assertThat(model.getQueuedMessageCount(), is(42));
         for other channel
        TransportChannelModel model2 = m_SUT.getTransportLayerChannel("transport", "localaddr", "remoteaddr-diff");
        assertThat(model2.getChannelType(), is(RemoteChannelTypeEnum.TRANSPORT));
        assertThat(model2.getName(), is("transport"));
        assertThat(model2.getLocalMessageAddress(), is("localaddr"));
        assertThat(model2.getRemoteMessageAddress(), is("remoteaddr-diff"));
        assertThat(model2.getBytesTransmitted(), is(921L));
        assertThat(model2.getBytesReceived(), is(8382L));
        assertThat(model2.getQueuedMessageCount(), is(41));
    }
@ Test public void testGetTransportChannel ( ) { TransportChannel remoteChan = createMockTransportChannel ( "transport" , "localaddr-diff" , "remoteaddr" , ChannelStatus . Unknown ) ; when ( remoteChan . getBytesTransmitted ( ) ) . thenReturn ( 2L ) ; when ( remoteChan . getBytesReceived ( ) ) . thenReturn ( 50L ) ; when ( remoteChan . getQueuedMessageCount ( ) ) . thenReturn ( 40 ) ; TransportChannel remoteChan1 = createMockTransportChannel ( "transport" , "localaddr" , "remoteaddr-diff" , ChannelStatus . Unknown ) ; when ( remoteChan1 . getBytesTransmitted ( ) ) . thenReturn ( 921L ) ; when ( remoteChan1 . getBytesReceived ( ) ) . thenReturn ( 8382L ) ; when ( remoteChan1 . getQueuedMessageCount ( ) ) . thenReturn ( 41 ) ; TransportChannel remoteChan2 = createMockTransportChannel ( "transport" , "localaddr" , "remoteaddr" , ChannelStatus . Unknown ) ; when ( remoteChan2 . getBytesTransmitted ( ) ) . thenReturn ( 991L ) ; when ( remoteChan2 . getBytesReceived ( ) ) . thenReturn ( 402L ) ; when ( remoteChan2 . getQueuedMessageCount ( ) ) . thenReturn ( 42 ) ; Set < RemoteChannel > setChans = new HashSet < RemoteChannel > ( ) ; setChans . add ( remoteChan ) ; setChans . add ( remoteChan1 ) ; setChans . add ( remoteChan2 ) ; Map < Integer , Set < RemoteChannel > > channels = new HashMap < Integer , Set < RemoteChannel > > ( ) ; channels . put ( 1596 , setChans ) ; when ( m_RemoteChannelLookup . getAllChannels ( ) ) . thenReturn ( channels ) ; TransportChannelModel model = m_SUT . getTransportLayerChannel ( "transport" , "localaddr" , "remoteaddr" ) ; assertThat ( model . getChannelType ( ) , is ( RemoteChannelTypeEnum . TRANSPORT ) ) ; assertThat ( model . getName ( ) , is ( "transport" ) ) ; assertThat ( model . getLocalMessageAddress ( ) , is ( "localaddr" ) ) ; assertThat ( model . getRemoteMessageAddress ( ) , is ( "remoteaddr" ) ) ; assertThat ( model . getBytesTransmitted ( ) , is ( 991L ) ) ; assertThat ( model . getBytesReceived ( ) , is ( 402L ) ) ; assertThat ( model . getQueuedMessageCount ( ) , is ( 42 ) ) ; TransportChannelModel model2 = m_SUT . getTransportLayerChannel ( "transport" , "localaddr" , "remoteaddr-diff" ) ; assertThat ( model2 . getChannelType ( ) , is ( RemoteChannelTypeEnum . TRANSPORT ) ) ; assertThat ( model2 . getName ( ) , is ( "transport" ) ) ; assertThat ( model2 . getLocalMessageAddress ( ) , is ( "localaddr" ) ) ; assertThat ( model2 . getRemoteMessageAddress ( ) , is ( "remoteaddr-diff" ) ) ; assertThat ( model2 . getBytesTransmitted ( ) , is ( 921L ) ) ; assertThat ( model2 . getBytesReceived ( ) , is ( 8382L ) ) ; assertThat ( model2 . getQueuedMessageCount ( ) , is ( 41 ) ) ; }
Test that all transport channel model contain all info from the actual transport channels.
Test that all transport channel model contain all info from the actual transport channels .
//behavior for remote lookup // replay // verify correct channel is returned // replay for other channel // verify correct channel is returned