mil.dod.th.ose.config/test/mil/dod/th/ose/config/loading/impl/TestOSGiConfigLoaderImpl.java
private void mockMetaTypeData()
    {
        final Bundle bundle = mock(Bundle.class);
        final Bundle bundle2 = mock(Bundle.class);
        when(m_Context.getBundles()).thenReturn(new Bundle[]{bundle, bundle2});
        
        final MetaTypeInformation metaInfo = mock(MetaTypeInformation.class);
        when(m_MetaTypeService.getMetaTypeInformation(bundle)).thenReturn(metaInfo);
        when(m_MetaTypeService.getMetaTypeInformation(bundle2)).thenReturn(null);
        
        when(metaInfo.getPids()).thenReturn(new String[]{CONFIG_NO_OVERRIDE, CONFIG_OVERRIDE});
        when(metaInfo.getFactoryPids()).thenReturn(new String[]{FACTORY_CONFIG_PID});
        
        final AttributeDefinition intAttr = mock(AttributeDefinition.class);
        when(intAttr.getID()). thenReturn("someInt");
        when(intAttr.getType()).thenReturn(AttributeDefinition.INTEGER);
        final AttributeDefinition stringAttr = mock(AttributeDefinition.class);
        when(stringAttr.getID()).thenReturn("someString");
        when(stringAttr.getType()).thenReturn(AttributeDefinition.STRING);
        final AttributeDefinition shortAttr = mock(AttributeDefinition.class);
        when(shortAttr.getID()).thenReturn("someShort");
        when(shortAttr.getType()).thenReturn(AttributeDefinition.SHORT);
        final AttributeDefinition floatAttr = mock(AttributeDefinition.class);
        when(floatAttr.getID()).thenReturn("someFloat");
        when(floatAttr.getType()).thenReturn(AttributeDefinition.FLOAT);
        final AttributeDefinition byteAttr = mock(AttributeDefinition.class);
        when(byteAttr.getID()).thenReturn("someByte");
        when(byteAttr.getType()).thenReturn(AttributeDefinition.BYTE);
        final AttributeDefinition charAttr = mock(AttributeDefinition.class);
        when(charAttr.getID()).thenReturn("someChar");
        when(charAttr.getType()).thenReturn(AttributeDefinition.CHARACTER);
        final AttributeDefinition doubleAttr = mock(AttributeDefinition.class);
        when(doubleAttr.getID()).thenReturn("someDouble");
        when(doubleAttr.getType()).thenReturn(AttributeDefinition.DOUBLE);
        final AttributeDefinition boolAttr = mock(AttributeDefinition.class);
        when(boolAttr.getID()).thenReturn("someBool");
        when(boolAttr.getType()).thenReturn(AttributeDefinition.BOOLEAN);
        final AttributeDefinition longAttr = mock(AttributeDefinition.class);
        when(longAttr.getID()).thenReturn("someLong");
        when(longAttr.getType()).thenReturn(AttributeDefinition.LONG);
        
        m_TestConfig1 = mock(ObjectClassDefinition.class);
        when(m_TestConfig1.getAttributeDefinitions(ObjectClassDefinition.ALL)).thenReturn(
                new AttributeDefinition[]{intAttr, stringAttr, shortAttr});
        
        final ObjectClassDefinition testConfig2 = mock(ObjectClassDefinition.class);
        when(testConfig2.getAttributeDefinitions(ObjectClassDefinition.ALL)).thenReturn(
                new AttributeDefinition[]{floatAttr, byteAttr, charAttr});
        
        final ObjectClassDefinition testFactoryConfig = mock(ObjectClassDefinition.class);
        when(testFactoryConfig.getAttributeDefinitions(ObjectClassDefinition.ALL)).thenReturn(
                new AttributeDefinition[]{doubleAttr, boolAttr, longAttr});
        
        when(metaInfo.getObjectClassDefinition(CONFIG_OVERRIDE, null)).thenReturn(m_TestConfig1);
        when(metaInfo.getObjectClassDefinition(CONFIG_NO_OVERRIDE, null)).thenReturn(testConfig2);
        when(metaInfo.getObjectClassDefinition(FACTORY_CONFIG_PID, null)).thenReturn(testFactoryConfig);
    }
/**
     * Method that mocks the needed bundle and meta type information.
     */
Method that mocks the needed bundle and meta type information.
Method that mocks the needed bundle and meta type information .
private void mockMetaTypeData()
    {
        final Bundle bundle = mock(Bundle.class);
        final Bundle bundle2 = mock(Bundle.class);
        when(m_Context.getBundles()).thenReturn(new Bundle[]{bundle, bundle2});
        final MetaTypeInformation metaInfo = mock(MetaTypeInformation.class);
        when(m_MetaTypeService.getMetaTypeInformation(bundle)).thenReturn(metaInfo);
        when(m_MetaTypeService.getMetaTypeInformation(bundle2)).thenReturn(null);
        when(metaInfo.getPids()).thenReturn(new String[]{CONFIG_NO_OVERRIDE, CONFIG_OVERRIDE});
        when(metaInfo.getFactoryPids()).thenReturn(new String[]{FACTORY_CONFIG_PID});
        final AttributeDefinition intAttr = mock(AttributeDefinition.class);
        when(intAttr.getID()). thenReturn("someInt");
        when(intAttr.getType()).thenReturn(AttributeDefinition.INTEGER);
        final AttributeDefinition stringAttr = mock(AttributeDefinition.class);
        when(stringAttr.getID()).thenReturn("someString");
        when(stringAttr.getType()).thenReturn(AttributeDefinition.STRING);
        final AttributeDefinition shortAttr = mock(AttributeDefinition.class);
        when(shortAttr.getID()).thenReturn("someShort");
        when(shortAttr.getType()).thenReturn(AttributeDefinition.SHORT);
        final AttributeDefinition floatAttr = mock(AttributeDefinition.class);
        when(floatAttr.getID()).thenReturn("someFloat");
        when(floatAttr.getType()).thenReturn(AttributeDefinition.FLOAT);
        final AttributeDefinition byteAttr = mock(AttributeDefinition.class);
        when(byteAttr.getID()).thenReturn("someByte");
        when(byteAttr.getType()).thenReturn(AttributeDefinition.BYTE);
        final AttributeDefinition charAttr = mock(AttributeDefinition.class);
        when(charAttr.getID()).thenReturn("someChar");
        when(charAttr.getType()).thenReturn(AttributeDefinition.CHARACTER);
        final AttributeDefinition doubleAttr = mock(AttributeDefinition.class);
        when(doubleAttr.getID()).thenReturn("someDouble");
        when(doubleAttr.getType()).thenReturn(AttributeDefinition.DOUBLE);
        final AttributeDefinition boolAttr = mock(AttributeDefinition.class);
        when(boolAttr.getID()).thenReturn("someBool");
        when(boolAttr.getType()).thenReturn(AttributeDefinition.BOOLEAN);
        final AttributeDefinition longAttr = mock(AttributeDefinition.class);
        when(longAttr.getID()).thenReturn("someLong");
        when(longAttr.getType()).thenReturn(AttributeDefinition.LONG);
        m_TestConfig1 = mock(ObjectClassDefinition.class);
        when(m_TestConfig1.getAttributeDefinitions(ObjectClassDefinition.ALL)).thenReturn(
                new AttributeDefinition[]{intAttr, stringAttr, shortAttr});
        final ObjectClassDefinition testConfig2 = mock(ObjectClassDefinition.class);
        when(testConfig2.getAttributeDefinitions(ObjectClassDefinition.ALL)).thenReturn(
                new AttributeDefinition[]{floatAttr, byteAttr, charAttr});
        final ObjectClassDefinition testFactoryConfig = mock(ObjectClassDefinition.class);
        when(testFactoryConfig.getAttributeDefinitions(ObjectClassDefinition.ALL)).thenReturn(
                new AttributeDefinition[]{doubleAttr, boolAttr, longAttr});
        when(metaInfo.getObjectClassDefinition(CONFIG_OVERRIDE, null)).thenReturn(m_TestConfig1);
        when(metaInfo.getObjectClassDefinition(CONFIG_NO_OVERRIDE, null)).thenReturn(testConfig2);
        when(metaInfo.getObjectClassDefinition(FACTORY_CONFIG_PID, null)).thenReturn(testFactoryConfig);
    }
private void mockMetaTypeData ( ) { final Bundle bundle = mock ( Bundle . class ) ; final Bundle bundle2 = mock ( Bundle . class ) ; when ( m_Context . getBundles ( ) ) . thenReturn ( new Bundle [ ] { bundle , bundle2 } ) ; final MetaTypeInformation metaInfo = mock ( MetaTypeInformation . class ) ; when ( m_MetaTypeService . getMetaTypeInformation ( bundle ) ) . thenReturn ( metaInfo ) ; when ( m_MetaTypeService . getMetaTypeInformation ( bundle2 ) ) . thenReturn ( null ) ; when ( metaInfo . getPids ( ) ) . thenReturn ( new String [ ] { CONFIG_NO_OVERRIDE , CONFIG_OVERRIDE } ) ; when ( metaInfo . getFactoryPids ( ) ) . thenReturn ( new String [ ] { FACTORY_CONFIG_PID } ) ; final AttributeDefinition intAttr = mock ( AttributeDefinition . class ) ; when ( intAttr . getID ( ) ) . thenReturn ( "someInt" ) ; when ( intAttr . getType ( ) ) . thenReturn ( AttributeDefinition . INTEGER ) ; final AttributeDefinition stringAttr = mock ( AttributeDefinition . class ) ; when ( stringAttr . getID ( ) ) . thenReturn ( "someString" ) ; when ( stringAttr . getType ( ) ) . thenReturn ( AttributeDefinition . STRING ) ; final AttributeDefinition shortAttr = mock ( AttributeDefinition . class ) ; when ( shortAttr . getID ( ) ) . thenReturn ( "someShort" ) ; when ( shortAttr . getType ( ) ) . thenReturn ( AttributeDefinition . SHORT ) ; final AttributeDefinition floatAttr = mock ( AttributeDefinition . class ) ; when ( floatAttr . getID ( ) ) . thenReturn ( "someFloat" ) ; when ( floatAttr . getType ( ) ) . thenReturn ( AttributeDefinition . FLOAT ) ; final AttributeDefinition byteAttr = mock ( AttributeDefinition . class ) ; when ( byteAttr . getID ( ) ) . thenReturn ( "someByte" ) ; when ( byteAttr . getType ( ) ) . thenReturn ( AttributeDefinition . BYTE ) ; final AttributeDefinition charAttr = mock ( AttributeDefinition . class ) ; when ( charAttr . getID ( ) ) . thenReturn ( "someChar" ) ; when ( charAttr . getType ( ) ) . thenReturn ( AttributeDefinition . CHARACTER ) ; final AttributeDefinition doubleAttr = mock ( AttributeDefinition . class ) ; when ( doubleAttr . getID ( ) ) . thenReturn ( "someDouble" ) ; when ( doubleAttr . getType ( ) ) . thenReturn ( AttributeDefinition . DOUBLE ) ; final AttributeDefinition boolAttr = mock ( AttributeDefinition . class ) ; when ( boolAttr . getID ( ) ) . thenReturn ( "someBool" ) ; when ( boolAttr . getType ( ) ) . thenReturn ( AttributeDefinition . BOOLEAN ) ; final AttributeDefinition longAttr = mock ( AttributeDefinition . class ) ; when ( longAttr . getID ( ) ) . thenReturn ( "someLong" ) ; when ( longAttr . getType ( ) ) . thenReturn ( AttributeDefinition . LONG ) ; m_TestConfig1 = mock ( ObjectClassDefinition . class ) ; when ( m_TestConfig1 . getAttributeDefinitions ( ObjectClassDefinition . ALL ) ) . thenReturn ( new AttributeDefinition [ ] { intAttr , stringAttr , shortAttr } ) ; final ObjectClassDefinition testConfig2 = mock ( ObjectClassDefinition . class ) ; when ( testConfig2 . getAttributeDefinitions ( ObjectClassDefinition . ALL ) ) . thenReturn ( new AttributeDefinition [ ] { floatAttr , byteAttr , charAttr } ) ; final ObjectClassDefinition testFactoryConfig = mock ( ObjectClassDefinition . class ) ; when ( testFactoryConfig . getAttributeDefinitions ( ObjectClassDefinition . ALL ) ) . thenReturn ( new AttributeDefinition [ ] { doubleAttr , boolAttr , longAttr } ) ; when ( metaInfo . getObjectClassDefinition ( CONFIG_OVERRIDE , null ) ) . thenReturn ( m_TestConfig1 ) ; when ( metaInfo . getObjectClassDefinition ( CONFIG_NO_OVERRIDE , null ) ) . thenReturn ( testConfig2 ) ; when ( metaInfo . getObjectClassDefinition ( FACTORY_CONFIG_PID , null ) ) . thenReturn ( testFactoryConfig ) ; }
Method that mocks the needed bundle and meta type information.
Method that mocks the needed bundle and meta type information .