I have a simple test like the one hereafter:
_____________________________
public class TestSibImpl extends OSGiTestCase {
IPOJOHelper helper;
@Override
protected void setUp() throws Exception {
this.helper = new IPOJOHelper(this);
}
@Test
public void testSibAvailability() {
assertNotNull(helper.getServiceReferenceByName(
StructuralInformationBase.class.getName(), null));
}
}
_____________________________________
And added the class test in mavenn-bundle-plugin , but test fails:
with NPE on m_context in IPOJOHelper...
ANy idea ?
_________________
--
Pierre
2011/2/13 Clement Escoffier <[email protected]>
> Hi,
>
> You need to initialize the iPOJO Helper in the setUp method:
> helper = new IPOJOHelper(this);
>
> This is really important as it's how the helper get the bundle context.
>
>
> Moreover, in the tearDown method it is recommended to dispose the helper:
> helper.dispose();
>
> The disposal deletes all the instances created using the helper, release
> services...
>
> Regards,
>
> Clement
>
>
> On 12.02.11 21:38, "Pierre Henry Perret" <[email protected]> wrote:
>
> >Hi all,
> >
> >I have a junis4osgi test plugin running and that one returns a NPE when
> >trying accessing the context.
> >I have made as explained in the tutorial junit4osgi: created a plugin
> >separate test alon with the bundle to test.
> >my config is that one:
> >______________________________
> > <plugin>
> > <groupId>org.apache.felix</groupId>
> > <artifactId>maven-bundle-plugin</artifactId>
> > <extensions>true</extensions>
> > <configuration>
> > <instructions>
> > <Private-Package>services.osgi</Private-Package>
> > <Bundle-SymbolicName>
> > ${project.artifactId}
> > </Bundle-SymbolicName>
> > <Test-Suite>
> > services.osgi.StructuralInformationServicesTest
> > </Test-Suite>
> > </instructions>
> > </configuration>
> > </plugin>
> ><plugin>
> ><groupId>org.apache.felix</groupId>
> ><artifactId>maven-junit4osgi-plugin</artifactId>
> ><executions>
> ><execution>
> ><goals>
> ><goal>test</goal>
> ></goals>
> ><configuration>
> ><deployprojectartifact>false</deployprojectartifact>
> ></configuration>
> ></execution>
> ></executions>
> ></plugin>
> >____________________________________________________
> >
> >Test reports that the iPOJO helper m_context is null ...?!
> >
> >I think I havent configured well the test...
> >
> >--
> >Pierre
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>