mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/controller/TestControllerMgrImpl.java
@Test
    public void testEncryptionEventHelperNotNewController()
    {
        int contId = 123;
        
        RemoteChannel channel = mock(RemoteChannel.class);
        Map<Integer, Set<RemoteChannel>> remoteAns = new HashMap<>();
        Set<RemoteChannel> setRC = new HashSet<>();
        setRC.add(channel);
        
        remoteAns.put(contId, setRC);
        
        when(m_ChannelLookup.getAllChannels()).thenReturn(remoteAns);
        
        Event event = createBasicChannelUpdatedEvent(channel, contId);
        
        m_ChannelHelper.handleEvent(event);
        assertThat(m_SUT.getController(contId), notNullValue());
        
        Map<String, Object> props = new HashMap<>();
        props.put(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID, contId);
        Event eventEncrypt = mockEncryptionUpdateEvent(contId);
        m_EncryptionEventHelper.handleEvent(eventEncrypt);
        
        assertThat(m_SUT.getController(contId).needsCleanupRequest(), is(false));
        
        verify(m_MessageFactory).createEventAdminMessage(EventAdminMessageType.CleanupRequest, null);
        verify(m_MessageWrapper).queue(contId, null);
        
        m_EncryptionEventHelper.handleEvent(eventEncrypt);
        
        //should still only be once. the second handle event should not cause another cleanup to happen
        verify(m_MessageFactory).createEventAdminMessage(EventAdminMessageType.CleanupRequest, null);
        verify(m_MessageWrapper).queue(contId, null);
    }
/**
     * Verify if encryption update event is sent and controller is not new a send cleanuprequest 
     * is not sent again
     */
Verify if encryption update event is sent and controller is not new a send cleanuprequest
is not sent again
Verify if encryption update event is sent and controller is not new a send cleanuprequest is not sent again
@Test
    public void testEncryptionEventHelperNotNewController()
    {
        int contId = 123;
        RemoteChannel channel = mock(RemoteChannel.class);
        Map<Integer, Set<RemoteChannel>> remoteAns = new HashMap<>();
        Set<RemoteChannel> setRC = new HashSet<>();
        setRC.add(channel);
        remoteAns.put(contId, setRC);
        when(m_ChannelLookup.getAllChannels()).thenReturn(remoteAns);
        Event event = createBasicChannelUpdatedEvent(channel, contId);
        m_ChannelHelper.handleEvent(event);
        assertThat(m_SUT.getController(contId), notNullValue());
        Map<String, Object> props = new HashMap<>();
        props.put(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID, contId);
        Event eventEncrypt = mockEncryptionUpdateEvent(contId);
        m_EncryptionEventHelper.handleEvent(eventEncrypt);
        assertThat(m_SUT.getController(contId).needsCleanupRequest(), is(false));
        verify(m_MessageFactory).createEventAdminMessage(EventAdminMessageType.CleanupRequest, null);
        verify(m_MessageWrapper).queue(contId, null);
        m_EncryptionEventHelper.handleEvent(eventEncrypt);
        verify(m_MessageFactory).createEventAdminMessage(EventAdminMessageType.CleanupRequest, null);
        verify(m_MessageWrapper).queue(contId, null);
    }
@ Test public void testEncryptionEventHelperNotNewController ( ) { int contId = 123 ; RemoteChannel channel = mock ( RemoteChannel . class ) ; Map < Integer , Set < RemoteChannel > > remoteAns = new HashMap < > ( ) ; Set < RemoteChannel > setRC = new HashSet < > ( ) ; setRC . add ( channel ) ; remoteAns . put ( contId , setRC ) ; when ( m_ChannelLookup . getAllChannels ( ) ) . thenReturn ( remoteAns ) ; Event event = createBasicChannelUpdatedEvent ( channel , contId ) ; m_ChannelHelper . handleEvent ( event ) ; assertThat ( m_SUT . getController ( contId ) , notNullValue ( ) ) ; Map < String , Object > props = new HashMap < > ( ) ; props . put ( SharedPropertyConstants . EVENT_PROP_CONTROLLER_ID , contId ) ; Event eventEncrypt = mockEncryptionUpdateEvent ( contId ) ; m_EncryptionEventHelper . handleEvent ( eventEncrypt ) ; assertThat ( m_SUT . getController ( contId ) . needsCleanupRequest ( ) , is ( false ) ) ; verify ( m_MessageFactory ) . createEventAdminMessage ( EventAdminMessageType . CleanupRequest , null ) ; verify ( m_MessageWrapper ) . queue ( contId , null ) ; m_EncryptionEventHelper . handleEvent ( eventEncrypt ) ; verify ( m_MessageFactory ) . createEventAdminMessage ( EventAdminMessageType . CleanupRequest , null ) ; verify ( m_MessageWrapper ) . queue ( contId , null ) ; }
Verify if encryption update event is sent and controller is not new a send cleanuprequest
 is not sent again
Verify if encryption update event is sent and controller is not new a send cleanuprequest is not sent again
//should still only be once. the second handle event should not cause another cleanup to happen