mil.dod.th.ose.config/test/mil/dod/th/ose/config/loading/impl/TestOSGiConfigLoaderImpl.java
@SuppressWarnings({"rawtypes", "unchecked"})
    @Test
    public void testProcessFirstRun() throws IOException
    {
        final List<PidConfig> configs = createConfigList();
        final Dictionary<String, Object> configAdminProps1 = new Hashtable<String, Object>();
        configAdminProps1.put("existingProp", "existing-value");
        when(m_ConfigOverride.getProperties()).thenReturn(configAdminProps1);
        final Dictionary<String, Object> configAdminProps2 = new Hashtable<String, Object>();
        configAdminProps2.put("existingProp", "existing-value");
        when(m_ConfigNoOverride.getProperties()).thenReturn(configAdminProps2);
        
        m_SUT.process(configs, true);
        
        verify(m_ConfigAdmin, times(1)).getConfiguration(CONFIG_NO_OVERRIDE, null);
        verify(m_ConfigAdmin, times(1)).getConfiguration(CONFIG_OVERRIDE, null);
        verify(m_ConfigAdmin).createFactoryConfiguration(FACTORY_CONFIG_PID, null);
        
        final ArgumentCaptor<Dictionary> propsCaptor = ArgumentCaptor.forClass(Dictionary.class);
        verify(m_ConfigOverride, times(1)).update(propsCaptor.capture());
        verify(m_ConfigNoOverride).update(propsCaptor.capture());
        verify(m_FactoryConfig).update(propsCaptor.capture());
        
        Dictionary<String, Object> propList = propsCaptor.getAllValues().get(0);
        assertThat(propList.get("someInt"), is((Object)10));
        assertThat(propList.get("someString"), is((Object)"value"));
        assertThat(propList.get("someShort"), is((Object)(short)89));
        assertThat(propList.get("existingProp"), is((Object)"existing-value"));
        
        propList = propsCaptor.getAllValues().get(1);
        assertThat(propList.get("someFloat"), is((Object)12.5f));
        assertThat(propList.get("someByte"), is((Object)(byte)127));
        assertThat(propList.get("someChar"), is((Object)'A'));
        assertThat(propList.get("existingProp"), is((Object)"existing-value"));
        
        propList = propsCaptor.getAllValues().get(2);
        assertThat(propList.get("someDouble"), is((Object)15.55));
        assertThat(propList.get("someBool"), is((Object)true));
        assertThat(propList.get("someLong"), is((Object)1234567890L));
    }
/**
     * Verify that the process method calls the appropriate configuration admin methods during a first run.
     */
Verify that the process method calls the appropriate configuration admin methods during a first run.
Verify that the process method calls the appropriate configuration admin methods during a first run .
@SuppressWarnings({"rawtypes", "unchecked"})
    @Test
    public void testProcessFirstRun() throws IOException
    {
        final List<PidConfig> configs = createConfigList();
        final Dictionary<String, Object> configAdminProps1 = new Hashtable<String, Object>();
        configAdminProps1.put("existingProp", "existing-value");
        when(m_ConfigOverride.getProperties()).thenReturn(configAdminProps1);
        final Dictionary<String, Object> configAdminProps2 = new Hashtable<String, Object>();
        configAdminProps2.put("existingProp", "existing-value");
        when(m_ConfigNoOverride.getProperties()).thenReturn(configAdminProps2);
        m_SUT.process(configs, true);
        verify(m_ConfigAdmin, times(1)).getConfiguration(CONFIG_NO_OVERRIDE, null);
        verify(m_ConfigAdmin, times(1)).getConfiguration(CONFIG_OVERRIDE, null);
        verify(m_ConfigAdmin).createFactoryConfiguration(FACTORY_CONFIG_PID, null);
        final ArgumentCaptor<Dictionary> propsCaptor = ArgumentCaptor.forClass(Dictionary.class);
        verify(m_ConfigOverride, times(1)).update(propsCaptor.capture());
        verify(m_ConfigNoOverride).update(propsCaptor.capture());
        verify(m_FactoryConfig).update(propsCaptor.capture());
        Dictionary<String, Object> propList = propsCaptor.getAllValues().get(0);
        assertThat(propList.get("someInt"), is((Object)10));
        assertThat(propList.get("someString"), is((Object)"value"));
        assertThat(propList.get("someShort"), is((Object)(short)89));
        assertThat(propList.get("existingProp"), is((Object)"existing-value"));
        propList = propsCaptor.getAllValues().get(1);
        assertThat(propList.get("someFloat"), is((Object)12.5f));
        assertThat(propList.get("someByte"), is((Object)(byte)127));
        assertThat(propList.get("someChar"), is((Object)'A'));
        assertThat(propList.get("existingProp"), is((Object)"existing-value"));
        propList = propsCaptor.getAllValues().get(2);
        assertThat(propList.get("someDouble"), is((Object)15.55));
        assertThat(propList.get("someBool"), is((Object)true));
        assertThat(propList.get("someLong"), is((Object)1234567890L));
    }
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ Test public void testProcessFirstRun ( ) throws IOException { final List < PidConfig > configs = createConfigList ( ) ; final Dictionary < String , Object > configAdminProps1 = new Hashtable < String , Object > ( ) ; configAdminProps1 . put ( "existingProp" , "existing-value" ) ; when ( m_ConfigOverride . getProperties ( ) ) . thenReturn ( configAdminProps1 ) ; final Dictionary < String , Object > configAdminProps2 = new Hashtable < String , Object > ( ) ; configAdminProps2 . put ( "existingProp" , "existing-value" ) ; when ( m_ConfigNoOverride . getProperties ( ) ) . thenReturn ( configAdminProps2 ) ; m_SUT . process ( configs , true ) ; verify ( m_ConfigAdmin , times ( 1 ) ) . getConfiguration ( CONFIG_NO_OVERRIDE , null ) ; verify ( m_ConfigAdmin , times ( 1 ) ) . getConfiguration ( CONFIG_OVERRIDE , null ) ; verify ( m_ConfigAdmin ) . createFactoryConfiguration ( FACTORY_CONFIG_PID , null ) ; final ArgumentCaptor < Dictionary > propsCaptor = ArgumentCaptor . forClass ( Dictionary . class ) ; verify ( m_ConfigOverride , times ( 1 ) ) . update ( propsCaptor . capture ( ) ) ; verify ( m_ConfigNoOverride ) . update ( propsCaptor . capture ( ) ) ; verify ( m_FactoryConfig ) . update ( propsCaptor . capture ( ) ) ; Dictionary < String , Object > propList = propsCaptor . getAllValues ( ) . get ( 0 ) ; assertThat ( propList . get ( "someInt" ) , is ( ( Object ) 10 ) ) ; assertThat ( propList . get ( "someString" ) , is ( ( Object ) "value" ) ) ; assertThat ( propList . get ( "someShort" ) , is ( ( Object ) ( short ) 89 ) ) ; assertThat ( propList . get ( "existingProp" ) , is ( ( Object ) "existing-value" ) ) ; propList = propsCaptor . getAllValues ( ) . get ( 1 ) ; assertThat ( propList . get ( "someFloat" ) , is ( ( Object ) 12.5f ) ) ; assertThat ( propList . get ( "someByte" ) , is ( ( Object ) ( byte ) 127 ) ) ; assertThat ( propList . get ( "someChar" ) , is ( ( Object ) 'A' ) ) ; assertThat ( propList . get ( "existingProp" ) , is ( ( Object ) "existing-value" ) ) ; propList = propsCaptor . getAllValues ( ) . get ( 2 ) ; assertThat ( propList . get ( "someDouble" ) , is ( ( Object ) 15.55 ) ) ; assertThat ( propList . get ( "someBool" ) , is ( ( Object ) true ) ) ; assertThat ( propList . get ( "someLong" ) , is ( ( Object ) 1234567890L ) ) ; }
Verify that the process method calls the appropriate configuration admin methods during a first run.
Verify that the process method calls the appropriate configuration admin methods during a first run .