felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre De Rop <pierre.de...@gmail.com>
Subject Re: Some failures in SCR integration tests
Date Fri, 15 Jun 2012 17:19:28 GMT
Hi David;
I'm using jdk 1.6.0_32.

I will create a jira issue for my fix in the test.

regards;
/pierre

On Fri, Jun 15, 2012 at 6:49 PM, David Jencks <david_jencks@yahoo.com>wrote:

> I'd appreciate an issue.  I've been working mostly on a somewhat modified
> tree locally but have not seen this problem.  What jdk are you on?  I
> wonder if this is due to the changes in the latest jdks that break a lot of
> stuff like the aries proxy code.
>
> thanks
> david jencks
>
> On Jun 15, 2012, at 12:25 PM, Pierre De Rop wrote:
>
> > Hi,
> >
> > There are some failing tests in the SCR integration tests; for example:
> >
> >
> test_component_factory_newInstance_failure:ComponentFactoryTest.test_component_factory_newInstance_failure:org.ops4j.pax.exam.forked.ForkedTestContainer@4a9c05
> (org.apache.felix.scr.integration.ComponentFactoryTest):
> > Cannot get m_componentInstances from Component: factory.component (1):
> > java.lang.NoSuchFieldException: m_componentInstances
> >
> > Mainly, I think the problem comes from the ComponentTestBase.getField()
> > method, which is using Field.getDeclaredField(String);
> >
> > So in the case of the ConfigurationComponentFactoryImpl class, this is a
> > problem because the field "m_componentInstances" is declared in the
> parent
> > class (ComponentFactoryImpl); and Field.getDeclaredField(String) does not
> > introspect parent.
> >
> > So, I have committed the following patch in the scr integration test (I
> did
> > not create a jira issue, since the problem is only in the test, let me
> know
> > if I should have created one):
> >
> >
> -------------------------------------------------------------------------------------
> > class ComponentTestBase {
> >    ...
> >
> >    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);
> >    }
> >
> -------------------------------------------------------------------------------------
> >
> > best regards;
> > /pierre
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message