mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/advanced/configuration/TestControllerConfigurationMgrImpl.java
@Test
    public void testUpdateEventHandler()
    {
        //Mock initial config info.
        createConfigModelInformation();
        
        ModifiableConfigMetatypeModel model = m_SUT.getConfigModelByPidAsync(25, "some PID");
        assertThat(model.getPid(), is("some PID"));
        List<ModifiablePropertyModel> propList = model.getProperties();
        assertThat(propList.size(), is(2));
        assertThat(propList.get(0).getKey(), is("key1"));
        assertThat(propList.get(1).getKey(), is("key2"));
        
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID, 25);
        props.put(ConfigurationEventConstants.EVENT_PROP_PID, "some PID");
        Event updateEvent = new Event(SystemConfigurationMgr.TOPIC_CONFIG_MODEL_UPDATED, props);
        
        //Add a value on to the configuration info.
        createUpdatedConfigModelInformation();
        
        m_UpdateEventHandler.handleEvent(updateEvent);
        
        model = m_SUT.getConfigModelByPidAsync(25, "some PID");
        assertThat(model.getPid(), is("some PID"));
        propList = model.getProperties();
        assertThat(propList.size(), is(3));
        assertThat(propList.get(0).getKey(), is("key1"));
        assertThat(propList.get(1).getKey(), is("key2"));
        assertThat(propList.get(2).getKey(), is("key3"));
        
        //Mock information for configuration does not exist.
        when(m_ConfigWrapper.getConfigurationByPidAsync(25, "some PID")).thenReturn(null);
        
        m_UpdateEventHandler.handleEvent(updateEvent);
        assertThat(m_SUT.getConfigModelByPidAsync(25, "some PID"), is(nullValue()));
    }
/**
     * Test the update event handler.
     * Verify that the handler handles events appropriately.
     */
Test the update event handler.
Verify that the handler handles events appropriately.
Test the update event handler . Verify that the handler handles events appropriately .
@Test
    public void testUpdateEventHandler()
    {
        createConfigModelInformation();
        ModifiableConfigMetatypeModel model = m_SUT.getConfigModelByPidAsync(25, "some PID");
        assertThat(model.getPid(), is("some PID"));
        List<ModifiablePropertyModel> propList = model.getProperties();
        assertThat(propList.size(), is(2));
        assertThat(propList.get(0).getKey(), is("key1"));
        assertThat(propList.get(1).getKey(), is("key2"));
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID, 25);
        props.put(ConfigurationEventConstants.EVENT_PROP_PID, "some PID");
        Event updateEvent = new Event(SystemConfigurationMgr.TOPIC_CONFIG_MODEL_UPDATED, props);
        createUpdatedConfigModelInformation();
        m_UpdateEventHandler.handleEvent(updateEvent);
        model = m_SUT.getConfigModelByPidAsync(25, "some PID");
        assertThat(model.getPid(), is("some PID"));
        propList = model.getProperties();
        assertThat(propList.size(), is(3));
        assertThat(propList.get(0).getKey(), is("key1"));
        assertThat(propList.get(1).getKey(), is("key2"));
        assertThat(propList.get(2).getKey(), is("key3"));
        when(m_ConfigWrapper.getConfigurationByPidAsync(25, "some PID")).thenReturn(null);
        m_UpdateEventHandler.handleEvent(updateEvent);
        assertThat(m_SUT.getConfigModelByPidAsync(25, "some PID"), is(nullValue()));
    }
@ Test public void testUpdateEventHandler ( ) { createConfigModelInformation ( ) ; ModifiableConfigMetatypeModel model = m_SUT . getConfigModelByPidAsync ( 25 , "some PID" ) ; assertThat ( model . getPid ( ) , is ( "some PID" ) ) ; List < ModifiablePropertyModel > propList = model . getProperties ( ) ; assertThat ( propList . size ( ) , is ( 2 ) ) ; assertThat ( propList . get ( 0 ) . getKey ( ) , is ( "key1" ) ) ; assertThat ( propList . get ( 1 ) . getKey ( ) , is ( "key2" ) ) ; Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( SharedPropertyConstants . EVENT_PROP_CONTROLLER_ID , 25 ) ; props . put ( ConfigurationEventConstants . EVENT_PROP_PID , "some PID" ) ; Event updateEvent = new Event ( SystemConfigurationMgr . TOPIC_CONFIG_MODEL_UPDATED , props ) ; createUpdatedConfigModelInformation ( ) ; m_UpdateEventHandler . handleEvent ( updateEvent ) ; model = m_SUT . getConfigModelByPidAsync ( 25 , "some PID" ) ; assertThat ( model . getPid ( ) , is ( "some PID" ) ) ; propList = model . getProperties ( ) ; assertThat ( propList . size ( ) , is ( 3 ) ) ; assertThat ( propList . get ( 0 ) . getKey ( ) , is ( "key1" ) ) ; assertThat ( propList . get ( 1 ) . getKey ( ) , is ( "key2" ) ) ; assertThat ( propList . get ( 2 ) . getKey ( ) , is ( "key3" ) ) ; when ( m_ConfigWrapper . getConfigurationByPidAsync ( 25 , "some PID" ) ) . thenReturn ( null ) ; m_UpdateEventHandler . handleEvent ( updateEvent ) ; assertThat ( m_SUT . getConfigModelByPidAsync ( 25 , "some PID" ) , is ( nullValue ( ) ) ) ; }
Test the update event handler.
Test the update event handler .
//Mock initial config info. //Add a value on to the configuration info. //Mock information for configuration does not exist.