mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/advanced/configuration/TestSystemMetatypeMgrImpl.java
@SuppressWarnings({"rawtypes", "unchecked"})
    @Test
    public void testTopicAndFilterRegistration()
    {
        ArgumentCaptor<Dictionary> dictCaptor = ArgumentCaptor.forClass(Dictionary.class);
        
        verify(m_BundleContext, times(3)).registerService(eq(EventHandler.class), Mockito.any(EventHandler.class), 
                dictCaptor.capture());
        
        Dictionary bundleHandlerDict = dictCaptor.getAllValues().get(0);
        Dictionary controllerHandlerDict = dictCaptor.getAllValues().get(1);
        Dictionary metaTypeHandlerDict = dictCaptor.getAllValues().get(2);
        
        //Test bundle event handler
        String[] topics = (String[])bundleHandlerDict.get(EventConstants.EVENT_TOPIC);
        assertThat(topics[0], 
                is(RemoteMetatypeConstants.TOPIC_METATYPE_INFORMATION_AVAILABLE + RemoteConstants.REMOTE_TOPIC_SUFFIX));
        assertThat(topics[1], is(BundleMgr.TOPIC_BUNDLE_INFO_REMOVED));
        assertThat(topics[2], is(BundleMgr.TOPIC_BUNDLE_INFO_RECEIVED));
        
        //Test controller event handler
        String topic = (String)controllerHandlerDict.get(EventConstants.EVENT_TOPIC);
        assertThat(topic, is(ControllerMgr.TOPIC_CONTROLLER_REMOVED));
        
        //Test metatype event handler
        topic = (String)metaTypeHandlerDict.get(EventConstants.EVENT_TOPIC);
        assertThat(topic, is(RemoteConstants.TOPIC_MESSAGE_RECEIVED));
        String filterString = String.format("(&(%s=%s)(%s=%s))", 
                RemoteConstants.EVENT_PROP_NAMESPACE, Namespace.MetaType.toString(),
                RemoteConstants.EVENT_PROP_MESSAGE_TYPE, MetaTypeMessageType.GetMetaTypeInfoResponse.toString());
        String filter = (String)metaTypeHandlerDict.get(EventConstants.EVENT_FILTER);
        assertThat(filter, is(filterString));
    }
/**
     * Test that each Event Helper has correctly registered for the appropriate topics and
     * filters.
     */
Test that each Event Helper has correctly registered for the appropriate topics and
filters.
Test that each Event Helper has correctly registered for the appropriate topics and filters .
@SuppressWarnings({"rawtypes", "unchecked"})
    @Test
    public void testTopicAndFilterRegistration()
    {
        ArgumentCaptor<Dictionary> dictCaptor = ArgumentCaptor.forClass(Dictionary.class);
        verify(m_BundleContext, times(3)).registerService(eq(EventHandler.class), Mockito.any(EventHandler.class), 
                dictCaptor.capture());
        Dictionary bundleHandlerDict = dictCaptor.getAllValues().get(0);
        Dictionary controllerHandlerDict = dictCaptor.getAllValues().get(1);
        Dictionary metaTypeHandlerDict = dictCaptor.getAllValues().get(2);
        String[] topics = (String[])bundleHandlerDict.get(EventConstants.EVENT_TOPIC);
        assertThat(topics[0], 
                is(RemoteMetatypeConstants.TOPIC_METATYPE_INFORMATION_AVAILABLE + RemoteConstants.REMOTE_TOPIC_SUFFIX));
        assertThat(topics[1], is(BundleMgr.TOPIC_BUNDLE_INFO_REMOVED));
        assertThat(topics[2], is(BundleMgr.TOPIC_BUNDLE_INFO_RECEIVED));
        String topic = (String)controllerHandlerDict.get(EventConstants.EVENT_TOPIC);
        assertThat(topic, is(ControllerMgr.TOPIC_CONTROLLER_REMOVED));
        topic = (String)metaTypeHandlerDict.get(EventConstants.EVENT_TOPIC);
        assertThat(topic, is(RemoteConstants.TOPIC_MESSAGE_RECEIVED));
        String filterString = String.format("(&(%s=%s)(%s=%s))", 
                RemoteConstants.EVENT_PROP_NAMESPACE, Namespace.MetaType.toString(),
                RemoteConstants.EVENT_PROP_MESSAGE_TYPE, MetaTypeMessageType.GetMetaTypeInfoResponse.toString());
        String filter = (String)metaTypeHandlerDict.get(EventConstants.EVENT_FILTER);
        assertThat(filter, is(filterString));
    }
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ Test public void testTopicAndFilterRegistration ( ) { ArgumentCaptor < Dictionary > dictCaptor = ArgumentCaptor . forClass ( Dictionary . class ) ; verify ( m_BundleContext , times ( 3 ) ) . registerService ( eq ( EventHandler . class ) , Mockito . any ( EventHandler . class ) , dictCaptor . capture ( ) ) ; Dictionary bundleHandlerDict = dictCaptor . getAllValues ( ) . get ( 0 ) ; Dictionary controllerHandlerDict = dictCaptor . getAllValues ( ) . get ( 1 ) ; Dictionary metaTypeHandlerDict = dictCaptor . getAllValues ( ) . get ( 2 ) ; String [ ] topics = ( String [ ] ) bundleHandlerDict . get ( EventConstants . EVENT_TOPIC ) ; assertThat ( topics [ 0 ] , is ( RemoteMetatypeConstants . TOPIC_METATYPE_INFORMATION_AVAILABLE + RemoteConstants . REMOTE_TOPIC_SUFFIX ) ) ; assertThat ( topics [ 1 ] , is ( BundleMgr . TOPIC_BUNDLE_INFO_REMOVED ) ) ; assertThat ( topics [ 2 ] , is ( BundleMgr . TOPIC_BUNDLE_INFO_RECEIVED ) ) ; String topic = ( String ) controllerHandlerDict . get ( EventConstants . EVENT_TOPIC ) ; assertThat ( topic , is ( ControllerMgr . TOPIC_CONTROLLER_REMOVED ) ) ; topic = ( String ) metaTypeHandlerDict . get ( EventConstants . EVENT_TOPIC ) ; assertThat ( topic , is ( RemoteConstants . TOPIC_MESSAGE_RECEIVED ) ) ; String filterString = String . format ( "(&(%s=%s)(%s=%s))" , RemoteConstants . EVENT_PROP_NAMESPACE , Namespace . MetaType . toString ( ) , RemoteConstants . EVENT_PROP_MESSAGE_TYPE , MetaTypeMessageType . GetMetaTypeInfoResponse . toString ( ) ) ; String filter = ( String ) metaTypeHandlerDict . get ( EventConstants . EVENT_FILTER ) ; assertThat ( filter , is ( filterString ) ) ; }
Test that each Event Helper has correctly registered for the appropriate topics and
 filters.
Test that each Event Helper has correctly registered for the appropriate topics and filters .
//Test bundle event handler //Test controller event handler //Test metatype event handler