happy that it works for you and hth ;) kind regards, andreas
On Wed, Jan 26, 2011 at 7:35 PM, Luca Stancapiano <[email protected]> wrote: > I missed this dependency in the pom.xml of the testing project: > <dependency> > > <groupId>org.apache.felix</groupId> > > <artifactId>org.apache.felix.scr</artifactId> > > <version>1.6.0</version> > > <scope>provided</scope> > > </dependency> > > Thanks you! > > On Wed, Jan 26, 2011 at 7:14 PM, Andreas Pieber <[email protected]> wrote: >> >> btw it is possible that only the service is not exported; better to >> use a servicetracker and add a timeout >> >> On Wed, Jan 26, 2011 at 6:23 PM, Toni Menzel <[email protected]> wrote: >> > Can you first check if the bundles you expect are in the correct state ? >> > Just iterate over the bundles via BundleContext and check stuff is there >> > and >> > in correct state. >> > At best share the @Configuration section. >> > Toni >> > >> > On Wed, Jan 26, 2011 at 6:03 PM, Luca Stancapiano >> > <[email protected]> wrote: >> >> >> >> Sorry, the doc doesn't help me...... I have this test: >> >> >> >> @Test >> >> >> >> public void shouldBeNotNull(BundleContext bundleContext) >> >> >> >> throws Exception { >> >> >> >> ServiceReference ssrr = bundleContext >> >> >> >> .getServiceReference(ProvaService.class.getName()); >> >> >> >> assertNotNull(ssrr); >> >> >> >> } >> >> >> >> ssrr returns null. I expect it returns the serviceReference I >> >> implemented >> >> in my bundle. Here there is the service: >> >> >> >> /** >> >> >> >> * @scr.component >> >> >> >> * @scr.service >> >> >> >> * >> >> >> >> * @scr.property name="service.vendor" value="Sourcesense" >> >> >> >> * @scr.property name="service.description" value="Example" >> >> >> >> */ >> >> >> >> public class RepositoryProvaService implements ProvaService { >> >> >> >> } >> >> >> >> public interface ProvaService { >> >> >> >> } >> >> >> >> >> >> This service is in a bundle that I import in my pom.xml as dependency: >> >> >> >> <dependency> >> >> >> >> <groupId>com.sourcesense</groupId> >> >> >> >> <artifactId>example</artifactId> >> >> >> >> <version>${project.version}</version> >> >> >> >> <scope>provided</scope> >> >> >> >> </dependency> >> >> >> >> The bundle project is configured as a 'bundle' project so: >> >> >> >> ........ >> >> >> >> <artifactId>example</artifactId> >> >> >> >> <packaging>bundle</packaging> >> >> >> >> ...... >> >> >> >> <build> >> >> >> >> <plugins> >> >> >> >> <plugin> >> >> >> >> <groupId>org.apache.felix</groupId> >> >> >> >> <artifactId>maven-scr-plugin</artifactId> >> >> >> >> </plugin> >> >> >> >> ......... >> >> >> >> If I add this row: >> >> >> >> bundleContext.registerService( >> >> >> >> RepositoryProvaService.class.getName(), >> >> >> >> new RepositoryProvaService(), null); >> >> >> >> in the test method before I call the getServiceReference() , I get the >> >> serviceReference........so the question is: >> >> why the service is not registered automatically? >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Tue, Jan 25, 2011 at 8:05 PM, Andreas Pieber <[email protected]> >> >> wrote: >> >>> >> >>> ah ok, slowly we're getting to the core of the problem :) (see inline >> >>> for >> >>> further answers) >> >>> >> >>> On Tue, Jan 25, 2011 at 07:46:29PM +0100, Luca Stancapiano wrote: >> >>> > Right... I need to create a osgi service that extends an existent >> >>> > service. This existent service incapsulates many osgi components. >> >>> > The >> >>> > questions are: >> >>> > >> >>> > 1 - how test my service inside pax-exam? Am I forced to add >> >>> > manually >> >>> > all osgi components or can I simulate a complete deploy as for >> >>> > felix? >> >>> >> >>> yep, basically you are. You've to re-setup the environment as it is in >> >>> reality; >> >>> well pax-exam is a full integration-test framework; if you want to >> >>> simply >> >>> test >> >>> single components you may be better using a plain mocking framework or >> >>> spring-dm-mock or something like this >> >>> >> >>> > 2 - if I can emulate a complete deploy , how? >> >>> >> >>> @ how this should help: >> >>> >> >>> http://wiki.ops4j.org/display/paxexam/User+guide >> >>> >> >>> if you have more explicit questions don't hestiate to ask again >> >>> >> >>> kind regards, >> >>> andreas >> >>> >> >>> > I'm using a plain osgi. >> >>> > On Tue, Jan 25, 2011 at 7:24 PM, Andreas Pieber >> >>> > <[1][email protected]> >> >>> > wrote: >> >>> > >> >>> > mhm, I'm still not completely sure where's exactly your >> >>> > problem. >> >>> > To recapitulate: >> >>> > you have a ServiceInterface and you want to make this public >> >>> > via >> >>> > osgi to a) use >> >>> > it in the "final" osgi runtime environment and in pax-exam?! >> >>> > Right? >> >>> > Are you >> >>> > using "plain" osgi or spring-dm/blueprint? >> >>> > kind regards, >> >>> > andreas >> >>> > >> >>> > On Tue, Jan 25, 2011 at 07:18:35PM +0100, Luca Stancapiano wrote: >> >>> > > Thanks Andreas..... >> >>> > > >> >>> > > my goal is testing an existent service inside a bundle. This >> >>> > service >> >>> > > incapsulates many other components so I don't want configure >> >>> > manually >> >>> > > all the dependencies. May you give me some configuration >> >>> > example >> >>> > to >> >>> > > deploy this service? >> >>> > >> >>> > > On Tue, Jan 25, 2011 at 7:03 PM, Andreas Pieber >> >>> > <[1][2][email protected]> >> >>> > >> >>> > > wrote: >> >>> > > >> >>> > > I'm not completely sure y pax-exam should do this. You >> >>> > have >> >>> > to >> >>> > > options: >> >>> > > 1) you want to deploy a service in a real/runtime >> >>> > environment: >> >>> > > then you have to export it anyhow, otherwise it wont run >> >>> > in >> >>> > your >> >>> > > "real" >> >>> > > environment afterwards >> >>> > > 2) you dont want to deploy a service in a real/runtime >> >>> > environmetn: >> >>> > > then the service should not be tested and isn't a service >> >>> > in >> >>> > fact >> >>> > > (not really at >> >>> > > least :)) >> >>> > > kind regards, >> >>> > > andreas >> >>> > > >> >>> > > On Tue, Jan 25, 2011 at 06:55:26PM +0100, Luca Stancapiano >> >>> > wrote: >> >>> > > > Hi all.... >> >>> > > > >> >>> > > > Reading the documentation seems that I need to >> >>> > configure >> >>> > manually >> >>> > > the >> >>> > > > services of a bundle that I would test. Can I simply >> >>> > put >> >>> > the >> >>> > > bundle >> >>> > > > information in PAX so it execute the whole deploy >> >>> > inside >> >>> > felix >> >>> > > > (included services and components)? >> >>> > > >> >>> > > > _______________________________________________ >> >>> > > > general mailing list >> >>> > >> >>> > > > [2][3][email protected] >> >>> > > > [3][4]http://lists.ops4j.org/mailman/listinfo/general >> >>> > > _______________________________________________ >> >>> > > general mailing list >> >>> > > [4][5][email protected] >> >>> > > [5][6]http://lists.ops4j.org/mailman/listinfo/general >> >>> > > >> >>> > > References >> >>> > > >> >>> > > 1. mailto:[7][email protected] >> >>> > > 2. mailto:[8][email protected] >> >>> > > 3. [9]http://lists.ops4j.org/mailman/listinfo/general >> >>> > > 4. mailto:[10][email protected] >> >>> > > 5. [11]http://lists.ops4j.org/mailman/listinfo/general >> >>> > >> >>> > > _______________________________________________ >> >>> > > general mailing list >> >>> > > [12][email protected] >> >>> > > [13]http://lists.ops4j.org/mailman/listinfo/general >> >>> > >> >>> > _______________________________________________ >> >>> > general mailing list >> >>> > [14][email protected] >> >>> > [15]http://lists.ops4j.org/mailman/listinfo/general >> >>> > >> >>> > References >> >>> > >> >>> > 1. mailto:[email protected] >> >>> > 2. mailto:[email protected] >> >>> > 3. mailto:[email protected] >> >>> > 4. http://lists.ops4j.org/mailman/listinfo/general >> >>> > 5. mailto:[email protected] >> >>> > 6. http://lists.ops4j.org/mailman/listinfo/general >> >>> > 7. mailto:[email protected] >> >>> > 8. mailto:[email protected] >> >>> > 9. http://lists.ops4j.org/mailman/listinfo/general >> >>> > 10. mailto:[email protected] >> >>> > 11. http://lists.ops4j.org/mailman/listinfo/general >> >>> > 12. mailto:[email protected] >> >>> > 13. http://lists.ops4j.org/mailman/listinfo/general >> >>> > 14. mailto:[email protected] >> >>> > 15. http://lists.ops4j.org/mailman/listinfo/general >> >>> >> >>> > _______________________________________________ >> >>> > general mailing list >> >>> > [email protected] >> >>> > http://lists.ops4j.org/mailman/listinfo/general >> >>> >> >>> >> >>> _______________________________________________ >> >>> general mailing list >> >>> [email protected] >> >>> http://lists.ops4j.org/mailman/listinfo/general >> >>> >> >> >> >> >> >> _______________________________________________ >> >> general mailing list >> >> [email protected] >> >> http://lists.ops4j.org/mailman/listinfo/general >> >> >> > >> > >> > >> > -- >> > Toni Menzel - http://www.okidokiteam.com >> > >> > _______________________________________________ >> > general mailing list >> > [email protected] >> > http://lists.ops4j.org/mailman/listinfo/general >> > >> > >> >> _______________________________________________ >> general mailing list >> [email protected] >> http://lists.ops4j.org/mailman/listinfo/general > > > _______________________________________________ > general mailing list > [email protected] > http://lists.ops4j.org/mailman/listinfo/general > > _______________________________________________ general mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/general
