mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/advanced/configuration/TestControllerConfigurationMgrImpl.java
@Test
    public void testUpdateEventHandleUpdateAll()
    {
        //Mock initial info.
        createConfigModelInformation();
        
        //Verify initial values.
        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"));
        model = m_SUT.getConfigModelByPidAsync(25, "some PID 2");
        assertThat(model.getPid(), is("some PID 2"));
        propList = model.getProperties();
        assertThat(propList.size(), is(2));
        assertThat(propList.get(0).getKey(), is("key1"));
        assertThat(propList.get(1).getKey(), is("key2"));
        
        //Mock updated info.
        createUpdatedConfigModelInformation();
        
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID, 25);
        Event updateEvent = new Event(SystemConfigurationMgr.TOPIC_CONFIG_MODEL_UPDATED, props);
        
        m_UpdateEventHandler.handleEvent(updateEvent);
        
        //Verify updated values.
        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"));
        model = m_SUT.getConfigModelByPidAsync(25, "some PID 2");
        assertThat(model.getPid(), is("some PID 2"));
        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"));
    }
/**
     * Test that if a config/meta model updated event with no PID specified is handled correctly.
     * Verify all models are updated instead of just one when no PID is specified by the event.
     */
Test that if a config/meta model updated event with no PID specified is handled correctly.
Verify all models are updated instead of just one when no PID is specified by the event.
Test that if a config / meta model updated event with no PID specified is handled correctly . Verify all models are updated instead of just one when no PID is specified by the event .
@Test
    public void testUpdateEventHandleUpdateAll()
    {
        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"));
        model = m_SUT.getConfigModelByPidAsync(25, "some PID 2");
        assertThat(model.getPid(), is("some PID 2"));
        propList = model.getProperties();
        assertThat(propList.size(), is(2));
        assertThat(propList.get(0).getKey(), is("key1"));
        assertThat(propList.get(1).getKey(), is("key2"));
        createUpdatedConfigModelInformation();
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(SharedPropertyConstants.EVENT_PROP_CONTROLLER_ID, 25);
        Event updateEvent = new Event(SystemConfigurationMgr.TOPIC_CONFIG_MODEL_UPDATED, props);
        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"));
        model = m_SUT.getConfigModelByPidAsync(25, "some PID 2");
        assertThat(model.getPid(), is("some PID 2"));
        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"));
    }
@ Test public void testUpdateEventHandleUpdateAll ( ) { 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" ) ) ; model = m_SUT . getConfigModelByPidAsync ( 25 , "some PID 2" ) ; assertThat ( model . getPid ( ) , is ( "some PID 2" ) ) ; propList = model . getProperties ( ) ; assertThat ( propList . size ( ) , is ( 2 ) ) ; assertThat ( propList . get ( 0 ) . getKey ( ) , is ( "key1" ) ) ; assertThat ( propList . get ( 1 ) . getKey ( ) , is ( "key2" ) ) ; createUpdatedConfigModelInformation ( ) ; Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( SharedPropertyConstants . EVENT_PROP_CONTROLLER_ID , 25 ) ; Event updateEvent = new Event ( SystemConfigurationMgr . TOPIC_CONFIG_MODEL_UPDATED , props ) ; 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" ) ) ; model = m_SUT . getConfigModelByPidAsync ( 25 , "some PID 2" ) ; assertThat ( model . getPid ( ) , is ( "some PID 2" ) ) ; 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" ) ) ; }
Test that if a config/meta model updated event with no PID specified is handled correctly.
Test that if a config / meta model updated event with no PID specified is handled correctly .
//Mock initial info. //Verify initial values. //Mock updated info. //Verify updated values.