mil.dod.th.ose.config/test/mil/dod/th/ose/config/loading/impl/TestOSGiConfigLoaderImpl.java
@Test
    @SuppressWarnings({"unchecked", "rawtypes"})
    public void testProcessConfigIOException() throws IOException
    {
        when(m_ConfigAdmin.getConfiguration(CONFIG_OVERRIDE, null)).thenThrow(IOException.class);
        
        final List<PidConfig> configs = createConfigList();
        
        m_SUT.process(configs, true);
        
        final ArgumentCaptor<Dictionary> propsCaptor = ArgumentCaptor.forClass(Dictionary.class);
        verify(m_ConfigOverride, never()).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("someFloat"), is((Object)12.5F));
        assertThat(propList.get("someByte"), is((Object)(byte)127));
        assertThat(propList.get("someChar"), is((Object)'A'));
        
        propList = propsCaptor.getAllValues().get(1);
        assertThat(propList.get("someDouble"), is((Object)15.55));
        assertThat(propList.get("someBool"), is((Object)true));
        assertThat(propList.get("someLong"), is((Object)1234567890L));
        
        verify(m_Logging).error(Mockito.any(IOException.class), eq("An error occurred trying to create "
                + "configuration with PID: %s"), eq(CONFIG_OVERRIDE));
    }
/**
     * Verify that an IOException is handled appropriately when thrown while trying to create/update a standard
     * OSGi configuration.
     */
Verify that an IOException is handled appropriately when thrown while trying to create/update a standard
OSGi configuration.
Verify that an IOException is handled appropriately when thrown while trying to create / update a standard OSGi configuration .
@Test
    @SuppressWarnings({"unchecked", "rawtypes"})
    public void testProcessConfigIOException() throws IOException
    {
        when(m_ConfigAdmin.getConfiguration(CONFIG_OVERRIDE, null)).thenThrow(IOException.class);
        final List<PidConfig> configs = createConfigList();
        m_SUT.process(configs, true);
        final ArgumentCaptor<Dictionary> propsCaptor = ArgumentCaptor.forClass(Dictionary.class);
        verify(m_ConfigOverride, never()).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("someFloat"), is((Object)12.5F));
        assertThat(propList.get("someByte"), is((Object)(byte)127));
        assertThat(propList.get("someChar"), is((Object)'A'));
        propList = propsCaptor.getAllValues().get(1);
        assertThat(propList.get("someDouble"), is((Object)15.55));
        assertThat(propList.get("someBool"), is((Object)true));
        assertThat(propList.get("someLong"), is((Object)1234567890L));
        verify(m_Logging).error(Mockito.any(IOException.class), eq("An error occurred trying to create "
                + "configuration with PID: %s"), eq(CONFIG_OVERRIDE));
    }
@ Test @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public void testProcessConfigIOException ( ) throws IOException { when ( m_ConfigAdmin . getConfiguration ( CONFIG_OVERRIDE , null ) ) . thenThrow ( IOException . class ) ; final List < PidConfig > configs = createConfigList ( ) ; m_SUT . process ( configs , true ) ; final ArgumentCaptor < Dictionary > propsCaptor = ArgumentCaptor . forClass ( Dictionary . class ) ; verify ( m_ConfigOverride , never ( ) ) . 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 ( "someFloat" ) , is ( ( Object ) 12.5F ) ) ; assertThat ( propList . get ( "someByte" ) , is ( ( Object ) ( byte ) 127 ) ) ; assertThat ( propList . get ( "someChar" ) , is ( ( Object ) 'A' ) ) ; propList = propsCaptor . getAllValues ( ) . get ( 1 ) ; assertThat ( propList . get ( "someDouble" ) , is ( ( Object ) 15.55 ) ) ; assertThat ( propList . get ( "someBool" ) , is ( ( Object ) true ) ) ; assertThat ( propList . get ( "someLong" ) , is ( ( Object ) 1234567890L ) ) ; verify ( m_Logging ) . error ( Mockito . any ( IOException . class ) , eq ( "An error occurred trying to create " + "configuration with PID: %s" ) , eq ( CONFIG_OVERRIDE ) ) ; }
Verify that an IOException is handled appropriately when thrown while trying to create/update a standard
 OSGi configuration.
Verify that an IOException is handled appropriately when thrown while trying to create / update a standard OSGi configuration .