You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Pierre Henry Perret <ph...@gmail.com> on 2011/02/12 21:38:29 UTC
Test plugin
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
Re: Test plugin
Posted by Pierre Henry Perret <ph...@gmail.com>.
Please find hereafter the set of version bundles used with the
maven-bundle-plugin to deploy a OSGITestCase:
_______
<pax-logging.version>1.3.0</pax-logging.version>
<cxf.version>2.2.5</cxf.version>
<org.osgi.compendium.version>4.2.0</org.osgi.compendium.version>
<org.osgi.core>4.2.0</org.osgi.core>
<ipojo.annotations.version>1.6.2</ipojo.annotations.version>
<ipojo.version.plugin>1.6.0</ipojo.version.plugin>
<jaxws-api.version>2.1</jaxws-api.version>
<maven-bundle-plugin.version>2.1.0</maven-bundle-plugin.version>
<org.apache.felix.framework.version>3.0.8</org.apache.felix.framework.version>
___________________________
--
Pierre
2011/2/15 Clement Escoffier <cl...@gmail.com>
> Hi,
>
> It seems you're using Junit 4, which is not supported.
> Could you also give me the set of bundles you're deploying (or you're
> maven configuration if you're using the maven-junit4osgi-plugin).
>
> Regards,
>
> Clement
>
> On 15.02.11 16:18, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>
> >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 <cl...@gmail.com>
> >
> >> 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" <ph...@gmail.com> 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: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >>
> >>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
Re: Test plugin
Posted by Clement Escoffier <cl...@gmail.com>.
Hi,
It seems you're using Junit 4, which is not supported.
Could you also give me the set of bundles you're deploying (or you're
maven configuration if you're using the maven-junit4osgi-plugin).
Regards,
Clement
On 15.02.11 16:18, "Pierre Henry Perret" <ph...@gmail.com> wrote:
>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 <cl...@gmail.com>
>
>> 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" <ph...@gmail.com> 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: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Test plugin
Posted by Pierre Henry Perret <ph...@gmail.com>.
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 <cl...@gmail.com>
> 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" <ph...@gmail.com> 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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
Re: Test plugin
Posted by Pierre Henry Perret <ph...@gmail.com>.
Hi Clement,
It is what is done in my code but when I debug I see that the
IPJOHelper.getContext method returns null.
Thanks
--
Pierre
2011/2/13 Clement Escoffier <cl...@gmail.com>
> 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" <ph...@gmail.com> 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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
Re: Test plugin
Posted by Clement Escoffier <cl...@gmail.com>.
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" <ph...@gmail.com> 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: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org