Pierre De Rop created FELIX-3556:
------------------------------------

             Summary: some failings test from SCR integration tests
                 Key: FELIX-3556
                 URL: https://issues.apache.org/jira/browse/FELIX-3556
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services (SCR)
         Environment: java version "1.6.0_32"
linux
            Reporter: Pierre De Rop
            Assignee: Pierre De Rop
            Priority: Trivial


since FELIX-3536, the class ComponentFactoryImpl has been split and is now 
extended by the ConfigurationComponentFactoryImpl class.

The problem is that some tests are not passing anymore because they are trying 
to introspect the "m_componentInstances" field from the 
ConfigurationComponentFactoryImpl class.
However, such field is declared private in the super class ComponentFactoryImpl.

I have changed the ComponentTestBase.getField method like this and all the 
tests are now passing OK:

    protected static Field getField( Class<?> type, String fieldName ) throws 
NoSuchFieldException
    {
        Class<?> clazz = type;
        while (clazz != null)
        {
            Field[] fields = clazz.getDeclaredFields();
            for (int i = 0; i < fields.length; i++)
            {
                Field field = fields[i];
                if (field.getName().equals(fieldName))
                {
                    field.setAccessible( true );
                    return field;
                }
            }
            clazz = clazz.getSuperclass();
        }
        throw new NoSuchFieldException(fieldName);        
    }


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to