Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-08 Thread Toni Menzel
yes, our ci.ops4j.org deploys successful builds to
oss.sonatype.org/content/repositories/ops4j-snapshots automatically.




*www.rebaze.de  | www.rebaze.com
 | @rebazeio *

On Tue, Aug 8, 2017 at 8:19 PM, 'Christoph Läubrich' via OPS4J <
ops4j@googlegroups.com> wrote:

> Hi Toni,
>
> If i see right there is some kind of snapshot repro for OPS4j maybe that
> would be an Option? I'm not very familar with this I just have seen that
> when realeasing pax-wicket.
> If thats not an option we might provide some kind of preview1 ... x
> Versions?
>
> Am 08.08.2017 09:53, schrieb Toni Menzel:
>
>>
>> Once this is done, we will look forward to a Pax Exam 5.0 Milestone 1
>> release. (Christoph, there is still a lot to be done, even breaking
>> changes.But I'd like to see early feedback on the many areas Exam 5 brings.
>> WDYT?)
>>
>> Toni
>>
>>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> --- You received this message because you are subscribed to the Google
> Groups "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ops4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-08 Thread 'Christoph Läubrich' via OPS4J

Hi Toni,

If i see right there is some kind of snapshot repro for OPS4j maybe that 
would be an Option? I'm not very familar with this I just have seen that 
when realeasing pax-wicket.
If thats not an option we might provide some kind of preview1 ... x 
Versions?


Am 08.08.2017 09:53, schrieb Toni Menzel:


Once this is done, we will look forward to a Pax Exam 5.0 Milestone 1 
release. (Christoph, there is still a lot to be done, even breaking 
changes.But I'd like to see early feedback on the many areas Exam 5 
brings. WDYT?)


Toni



--
--
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups "OPS4J" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-08 Thread Nicolas Brasey
The server mode is not enough for me, as I would like to be able to write
tests against the OSGi services directly, I don't want to use the external
REST api.

Out of curiosity, and not knowing how exactly pax-exam works in details,
what is the reason the BeforeClass and AfterClass are not implemented ?

For me, the "simplest" would be to introduce certain hooks, for example:

a) BeforeClass (called once before the tests are executed, outside of the
container)
b) Probe bundle Activate (called once before the tests are executed, inside
of the container)
c) Probe bundle Deactivate (called once after the tests, inside the
container)
d) AfterClass (called once after the tests are executed, outside of the
container)

Maybe the same for the before and after hooks. One hook called from
outside, one from inside.

My 2 cents...

Nicolas




On Tue, Aug 8, 2017 at 10:00 AM, Toni Menzel  wrote:

> This is the very simple server mode (i did that back then). If it is
> enough for you, sure. No big deal. You don't get any lifecycle integration
> with your test framework and you need to do the configuration for accessing
> your server yourself (sure, if its only rest, you have all the tools of the
> world)
>
>
>
>
> *www.rebaze.de  | www.rebaze.com
>  | @rebazeio *
>
> On Tue, Aug 8, 2017 at 9:54 AM, 'Achim Nierbeck' via OPS4J <
> ops4j@googlegroups.com> wrote:
>
>> Hi Nicolas,
>>
>> then you are looking for this:
>> https://ops4j1.jira.com/wiki/display/PAXEXAM4/Server+Mode
>>
>> @toni, it's already available ;)
>>
>> regards, Achim
>>
>>
>> 2017-08-08 9:38 GMT+02:00 Nicolas Brasey :
>>
>>> Hi Achim,
>>>
>>> No, I'm not so much interested to test the OSGi mechanics, I want to
>>> have high level business tests on our business layer which is a set of OSGi
>>> services. This requires the database and the messaging system to run as
>>> well.
>>>
>>> In fact, our app provides only rest api's from outside, and we have
>>> already a set of mocha integration tests. Mocha is fine for testing rest
>>> message structure and non-regression at the level but a little cumbersome
>>> and hard to maintain when it comes to test more complicated business
>>> scenarios. That is why I'm looking for a Java API in order to implement
>>> those tests, pax-exam is ideal for me in that context.
>>>
>>> Cheers,
>>> Nicolas
>>>
>>>
>>>
>>>
>>> On Tue, Aug 8, 2017 at 8:29 AM, 'Achim Nierbeck' via OPS4J <
>>> ops4j@googlegroups.com> wrote:
>>>
 Hi,

 just one question came to my mind, regarding your scenario.
 For your Integration tests you don't seem to rely on testing the
 internals of the OSGi container, right?
 In that case how about starting the Pax Exam tests as server tests,
 that way you only need to call externally available interfaces and can make
 sure you have neo4j started prior to that.

 regards, Achim


 2017-08-07 11:14 GMT+02:00 Nicolas Brasey :

> Hi Christoph,
>
> Yes, that is exactly what I tried already, to bundle neo4j and all the
> dependencies with the maven shade plugin (like the ones in service
> mix bundles). I realized that this is not really ideal for the
> following reasons:
>
> 1) The build time exploded, to create this huge jar takes more than
> 1minutes and 30 secs
> 2) The pom.xml is far from being straight forward to write, you need
> to have a good understanding of the internal structure of neo4j in order 
> to
> maintain it. Also, I'm afraid this is time consuming on the long term and
> will requires tricky changes for each major release of neo4j.
> 3) It was not even working! I had issues with neo4j internal way of
> loading modules with the java 6 ServiceLoader mechanism, which did not 
> find
> http services for reasons I still ignore...
>
> Anyway, I finally gave up fighting with it ;-)
>
>
>
>
>
> On Sat, Aug 5, 2017 at 1:50 PM, 'Christoph Läubrich' via OPS4J <
> ops4j@googlegroups.com> wrote:
>
>> Even though neo4j is not "osgi-friendly" (what ever that means ;-)
>> you can create abundle that embedds all that neo4j requires, add an
>> Activator that starts up your db and provide a custom service to trigger
>> "after-test-checks" in whatever way you need. In your test you can the
>> collect the service to
>>
>> a) make sure the db is up and running
>> b) fire your checks whenever needed
>>
>> Am 04.08.2017 11:59, schrieb Nicolas Brasey:
>>
>> Hi,
>>
>> Context: I want to use pax-exam for our business integration tests
>> that needs to have a database (neo4j) that is not OSGi friendly running
>> before the test are executed. we use maven.
>>
>> Also, neo4j provides a embedded server that works extremely well
>> 

Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-08 Thread Toni Menzel
This is the very simple server mode (i did that back then). If it is enough
for you, sure. No big deal. You don't get any lifecycle integration with
your test framework and you need to do the configuration for accessing your
server yourself (sure, if its only rest, you have all the tools of the
world)




*www.rebaze.de  | www.rebaze.com
 | @rebazeio *

On Tue, Aug 8, 2017 at 9:54 AM, 'Achim Nierbeck' via OPS4J <
ops4j@googlegroups.com> wrote:

> Hi Nicolas,
>
> then you are looking for this:
> https://ops4j1.jira.com/wiki/display/PAXEXAM4/Server+Mode
>
> @toni, it's already available ;)
>
> regards, Achim
>
>
> 2017-08-08 9:38 GMT+02:00 Nicolas Brasey :
>
>> Hi Achim,
>>
>> No, I'm not so much interested to test the OSGi mechanics, I want to have
>> high level business tests on our business layer which is a set of OSGi
>> services. This requires the database and the messaging system to run as
>> well.
>>
>> In fact, our app provides only rest api's from outside, and we have
>> already a set of mocha integration tests. Mocha is fine for testing rest
>> message structure and non-regression at the level but a little cumbersome
>> and hard to maintain when it comes to test more complicated business
>> scenarios. That is why I'm looking for a Java API in order to implement
>> those tests, pax-exam is ideal for me in that context.
>>
>> Cheers,
>> Nicolas
>>
>>
>>
>>
>> On Tue, Aug 8, 2017 at 8:29 AM, 'Achim Nierbeck' via OPS4J <
>> ops4j@googlegroups.com> wrote:
>>
>>> Hi,
>>>
>>> just one question came to my mind, regarding your scenario.
>>> For your Integration tests you don't seem to rely on testing the
>>> internals of the OSGi container, right?
>>> In that case how about starting the Pax Exam tests as server tests, that
>>> way you only need to call externally available interfaces and can make sure
>>> you have neo4j started prior to that.
>>>
>>> regards, Achim
>>>
>>>
>>> 2017-08-07 11:14 GMT+02:00 Nicolas Brasey :
>>>
 Hi Christoph,

 Yes, that is exactly what I tried already, to bundle neo4j and all the
 dependencies with the maven shade plugin (like the ones in service mix
 bundles). I realized that this is not really ideal for the following
 reasons:

 1) The build time exploded, to create this huge jar takes more than
 1minutes and 30 secs
 2) The pom.xml is far from being straight forward to write, you need
 to have a good understanding of the internal structure of neo4j in order to
 maintain it. Also, I'm afraid this is time consuming on the long term and
 will requires tricky changes for each major release of neo4j.
 3) It was not even working! I had issues with neo4j internal way of
 loading modules with the java 6 ServiceLoader mechanism, which did not find
 http services for reasons I still ignore...

 Anyway, I finally gave up fighting with it ;-)





 On Sat, Aug 5, 2017 at 1:50 PM, 'Christoph Läubrich' via OPS4J <
 ops4j@googlegroups.com> wrote:

> Even though neo4j is not "osgi-friendly" (what ever that means ;-) you
> can create abundle that embedds all that neo4j requires, add an Activator
> that starts up your db and provide a custom service to trigger
> "after-test-checks" in whatever way you need. In your test you can the
> collect the service to
>
> a) make sure the db is up and running
> b) fire your checks whenever needed
>
> Am 04.08.2017 11:59, schrieb Nicolas Brasey:
>
> Hi,
>
> Context: I want to use pax-exam for our business integration tests
> that needs to have a database (neo4j) that is not OSGi friendly running
> before the test are executed. we use maven.
>
> Also, neo4j provides a embedded server that works extremely well
> outside of an OSGi container, but I can't find a way to start this 
> embedded
> server with pax-exam outside of the container before the pax-exam 
> machinery
> is starting.
>
> The idea is to start the database in the non-OSGi context when the
> pax-runner is starting, something like the beforeClass, and stop the
> database after all the tests are finished ala afterClass.
>
> Does anyone has an idea how to do this ?
>
> Thanks
> Nicolas
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google
> Groups "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ops4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You 

Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-08 Thread Toni Menzel
@Nicolas, I think your use case is a prime example out-of-container tests
that will become more accessible with Exam 5. (Acceptance Test API).
Here's the status:

   - There is a way to bootstrap a Test Container using the typical Exam
   Option DSL (done)
   - There is a very simple Rest Client API based on Rest Assured. That is
   really minimal and I am not sure if we just let Rest Assured do the job or
   keep being it an implementation detail.
  - Why keep it as an implementation detail? Rest Assured is such a
  broad API, confusing at times, many ways to do the same thing.
For example,
  there is a java object mapper but also groovy expression language. Two
  approaches, to do the same thing: evaluate HTTP responses.
  - Why expose Rest Assured? It's already a broad DSL that some people
  may already be familiar with. And building abstractions over abstractions
  is an anti-pattern. Pax Exam should not fall into this trap.
   - There another client that makes OSGi Services available to Acceptance
   Tests via Tunneling the request to the container. The tunneling part is
   important because I want any OSGi service to be accessible, not just the
   ones designed for serialization. (not safe in all cases but better than no
   access at all) (in progress)

Once this is done, we will look forward to a Pax Exam 5.0 Milestone 1
release. (Christoph, there is still a lot to be done, even breaking
changes.But I'd like to see early feedback on the many areas Exam 5 brings.
WDYT?)

Toni




*www.rebaze.de  | www.rebaze.com
 | @rebazeio *

On Tue, Aug 8, 2017 at 9:38 AM, Nicolas Brasey 
wrote:

> Hi Achim,
>
> No, I'm not so much interested to test the OSGi mechanics, I want to have
> high level business tests on our business layer which is a set of OSGi
> services. This requires the database and the messaging system to run as
> well.
>
> In fact, our app provides only rest api's from outside, and we have
> already a set of mocha integration tests. Mocha is fine for testing rest
> message structure and non-regression at the level but a little cumbersome
> and hard to maintain when it comes to test more complicated business
> scenarios. That is why I'm looking for a Java API in order to implement
> those tests, pax-exam is ideal for me in that context.
>
> Cheers,
> Nicolas
>
>
>
>
> On Tue, Aug 8, 2017 at 8:29 AM, 'Achim Nierbeck' via OPS4J <
> ops4j@googlegroups.com> wrote:
>
>> Hi,
>>
>> just one question came to my mind, regarding your scenario.
>> For your Integration tests you don't seem to rely on testing the
>> internals of the OSGi container, right?
>> In that case how about starting the Pax Exam tests as server tests, that
>> way you only need to call externally available interfaces and can make sure
>> you have neo4j started prior to that.
>>
>> regards, Achim
>>
>>
>> 2017-08-07 11:14 GMT+02:00 Nicolas Brasey :
>>
>>> Hi Christoph,
>>>
>>> Yes, that is exactly what I tried already, to bundle neo4j and all the
>>> dependencies with the maven shade plugin (like the ones in service mix
>>> bundles). I realized that this is not really ideal for the following
>>> reasons:
>>>
>>> 1) The build time exploded, to create this huge jar takes more than
>>> 1minutes and 30 secs
>>> 2) The pom.xml is far from being straight forward to write, you need to
>>> have a good understanding of the internal structure of neo4j in order to
>>> maintain it. Also, I'm afraid this is time consuming on the long term and
>>> will requires tricky changes for each major release of neo4j.
>>> 3) It was not even working! I had issues with neo4j internal way of
>>> loading modules with the java 6 ServiceLoader mechanism, which did not find
>>> http services for reasons I still ignore...
>>>
>>> Anyway, I finally gave up fighting with it ;-)
>>>
>>>
>>>
>>>
>>>
>>> On Sat, Aug 5, 2017 at 1:50 PM, 'Christoph Läubrich' via OPS4J <
>>> ops4j@googlegroups.com> wrote:
>>>
 Even though neo4j is not "osgi-friendly" (what ever that means ;-) you
 can create abundle that embedds all that neo4j requires, add an Activator
 that starts up your db and provide a custom service to trigger
 "after-test-checks" in whatever way you need. In your test you can the
 collect the service to

 a) make sure the db is up and running
 b) fire your checks whenever needed

 Am 04.08.2017 11:59, schrieb Nicolas Brasey:

 Hi,

 Context: I want to use pax-exam for our business integration tests that
 needs to have a database (neo4j) that is not OSGi friendly running before
 the test are executed. we use maven.

 Also, neo4j provides a embedded server that works extremely well
 outside of an OSGi container, but I can't find a way to start this embedded
 server with pax-exam outside of the container before the pax-exam machinery
 

Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-08 Thread Nicolas Brasey
Hi Achim,

No, I'm not so much interested to test the OSGi mechanics, I want to have
high level business tests on our business layer which is a set of OSGi
services. This requires the database and the messaging system to run as
well.

In fact, our app provides only rest api's from outside, and we have already
a set of mocha integration tests. Mocha is fine for testing rest message
structure and non-regression at the level but a little cumbersome and hard
to maintain when it comes to test more complicated business scenarios. That
is why I'm looking for a Java API in order to implement those tests,
pax-exam is ideal for me in that context.

Cheers,
Nicolas




On Tue, Aug 8, 2017 at 8:29 AM, 'Achim Nierbeck' via OPS4J <
ops4j@googlegroups.com> wrote:

> Hi,
>
> just one question came to my mind, regarding your scenario.
> For your Integration tests you don't seem to rely on testing the internals
> of the OSGi container, right?
> In that case how about starting the Pax Exam tests as server tests, that
> way you only need to call externally available interfaces and can make sure
> you have neo4j started prior to that.
>
> regards, Achim
>
>
> 2017-08-07 11:14 GMT+02:00 Nicolas Brasey :
>
>> Hi Christoph,
>>
>> Yes, that is exactly what I tried already, to bundle neo4j and all the
>> dependencies with the maven shade plugin (like the ones in service mix
>> bundles). I realized that this is not really ideal for the following
>> reasons:
>>
>> 1) The build time exploded, to create this huge jar takes more than
>> 1minutes and 30 secs
>> 2) The pom.xml is far from being straight forward to write, you need to
>> have a good understanding of the internal structure of neo4j in order to
>> maintain it. Also, I'm afraid this is time consuming on the long term and
>> will requires tricky changes for each major release of neo4j.
>> 3) It was not even working! I had issues with neo4j internal way of
>> loading modules with the java 6 ServiceLoader mechanism, which did not find
>> http services for reasons I still ignore...
>>
>> Anyway, I finally gave up fighting with it ;-)
>>
>>
>>
>>
>>
>> On Sat, Aug 5, 2017 at 1:50 PM, 'Christoph Läubrich' via OPS4J <
>> ops4j@googlegroups.com> wrote:
>>
>>> Even though neo4j is not "osgi-friendly" (what ever that means ;-) you
>>> can create abundle that embedds all that neo4j requires, add an Activator
>>> that starts up your db and provide a custom service to trigger
>>> "after-test-checks" in whatever way you need. In your test you can the
>>> collect the service to
>>>
>>> a) make sure the db is up and running
>>> b) fire your checks whenever needed
>>>
>>> Am 04.08.2017 11:59, schrieb Nicolas Brasey:
>>>
>>> Hi,
>>>
>>> Context: I want to use pax-exam for our business integration tests that
>>> needs to have a database (neo4j) that is not OSGi friendly running before
>>> the test are executed. we use maven.
>>>
>>> Also, neo4j provides a embedded server that works extremely well outside
>>> of an OSGi container, but I can't find a way to start this embedded server
>>> with pax-exam outside of the container before the pax-exam machinery is
>>> starting.
>>>
>>> The idea is to start the database in the non-OSGi context when the
>>> pax-runner is starting, something like the beforeClass, and stop the
>>> database after all the tests are finished ala afterClass.
>>>
>>> Does anyone has an idea how to do this ?
>>>
>>> Thanks
>>> Nicolas
>>> --
>>> --
>>> --
>>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OPS4J" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to ops4j+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> --
>>> --
>>> --
>>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>>
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "OPS4J" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/ops4j/RlgwSX04-O8/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> ops4j+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> --
>> --
>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ops4j+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> Apache Member
> Apache Karaf  Committer & PMC
> OPS4J Pax Web  Committer &
> Project Lead
> blog 
> Co-Author of Apache Karaf 

Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-08 Thread Toni Menzel
There is already work on this for Pax Exam 5. No worries.




*www.rebaze.de  | www.rebaze.com
 | @rebazeio *

On Sun, Aug 6, 2017 at 4:19 AM, Niclas Hedhman  wrote:

>
> I thought I should chip in and point out that Junit 5 ahs received the
> entire extension mechanism, and both Rules and RunWith constructs are
> deprecated, and implemented using the new extension system.
>
> Perhaps it would make more sense for new functionality in Pax Exam to look
> forward to JUnit 5.
>
> Just my 2 sen.
>
> On Aug 4, 2017 20:39, "Nicolas Brasey"  wrote:
>
>> Hi Tony,
>>
>> Thanks a lot for your answer.
>>
>> I think what you are working on is absolutely great, and I think it would
>> also perfectly fit for our needs. Starting the OSGi container from a junit
>> rule makes the tests cleaner. I guess this would also work with Karaf,
>> right ? But, just for the curiosity, how do you plan to access the OSGi
>> service from outside the container ? And when do you plan to push your
>> local branch ? :-)
>>
>> 2) Yes I tried booting neo4j from the @Configuration method, but there 2
>> issues IMHO:
>> a) It provides only a way to start neo4j, obviously no hook to run some
>> post tests code
>> b) since the configure code is also deployed as an OSGi bundle, it forces
>> you to make sure the  does not include the neo4j
>> packages, which cannot be resolved. It is feasible, but this is hard work
>> and I'm not sure about the maintainability of this over the time
>>
>> 3) Not sure I understood your proposal with the RunWith. Do you mean
>> implementing my own Junit runner that wraps the PaxExam runner, and run my
>> tests with it ?
>>
>>
>> Cheers,
>> Nicolas
>>
>>
>> On Fri, Aug 4, 2017 at 12:47 PM, Toni Menzel 
>> wrote:
>>
>>> Hey Nicolas,
>>>
>>> I think you are looking at something like the (new) acceptance test api
>>> that runs from outside of
>>> osgi: https://github.com/ops4j/org.ops4j.pax.exam2/blob/mast
>>> er/drivers/pax-exam-acceptance/src/test/java/org/ops4j/pax/
>>> exam/acceptance/AcceptanceTestApiTest.java
>>>
>>> This is currently in active development and is lacking some features
>>> like smooth access to OSGi Services from the outside.
>>> Currently, only the rest client is available (using RestAssured), but I
>>> a new one making internal services available to the test automatically is
>>> already on my local branch.
>>>
>>> In any way, we also could think of making out-of-container setup code
>>> available in regular "@RunWith(PaxExam.class)" tests. Did you try booting
>>> Neo4j inside the @Configuration method? that is executed before the OSGi
>>> container is launched, so it does run in plain java.
>>>
>>> Another try: did you try using a Junit Rule with "@RunWith()"? this
>>> should work, too.
>>>
>>> Toni
>>>
>>>
>>>
>>>
>>> *www.rebaze.de  | www.rebaze.com
>>>  | @rebazeio *
>>>
>>> On Fri, Aug 4, 2017 at 11:59 AM, Nicolas Brasey <
>>> nicolas.bra...@gmail.com> wrote:
>>>
 Hi,

 Context: I want to use pax-exam for our business integration tests that
 needs to have a database (neo4j) that is not OSGi friendly running before
 the test are executed. we use maven.

 Also, neo4j provides a embedded server that works extremely well
 outside of an OSGi container, but I can't find a way to start this embedded
 server with pax-exam outside of the container before the pax-exam machinery
 is starting.

 The idea is to start the database in the non-OSGi context when the
 pax-runner is starting, something like the beforeClass, and stop the
 database after all the tests are finished ala afterClass.

 Does anyone has an idea how to do this ?

 Thanks
 Nicolas

 --
 --
 --
 OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

 ---
 You received this message because you are subscribed to the Google
 Groups "OPS4J" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to ops4j+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> --
>>> --
>>> --
>>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>>
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "OPS4J" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/ops4j/RlgwSX04-O8/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> ops4j+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> --
>> --
>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>
>> ---
>> You received this message because you are subscribed 

Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-07 Thread Nicolas Brasey
Hi Christoph,

Yes, that is exactly what I tried already, to bundle neo4j and all the
dependencies with the maven shade plugin (like the ones in service mix
bundles). I realized that this is not really ideal for the following
reasons:

1) The build time exploded, to create this huge jar takes more than
1minutes and 30 secs
2) The pom.xml is far from being straight forward to write, you need to
have a good understanding of the internal structure of neo4j in order to
maintain it. Also, I'm afraid this is time consuming on the long term and
will requires tricky changes for each major release of neo4j.
3) It was not even working! I had issues with neo4j internal way of loading
modules with the java 6 ServiceLoader mechanism, which did not find http
services for reasons I still ignore...

Anyway, I finally gave up fighting with it ;-)





On Sat, Aug 5, 2017 at 1:50 PM, 'Christoph Läubrich' via OPS4J <
ops4j@googlegroups.com> wrote:

> Even though neo4j is not "osgi-friendly" (what ever that means ;-) you can
> create abundle that embedds all that neo4j requires, add an Activator that
> starts up your db and provide a custom service to trigger
> "after-test-checks" in whatever way you need. In your test you can the
> collect the service to
>
> a) make sure the db is up and running
> b) fire your checks whenever needed
>
> Am 04.08.2017 11:59, schrieb Nicolas Brasey:
>
> Hi,
>
> Context: I want to use pax-exam for our business integration tests that
> needs to have a database (neo4j) that is not OSGi friendly running before
> the test are executed. we use maven.
>
> Also, neo4j provides a embedded server that works extremely well outside
> of an OSGi container, but I can't find a way to start this embedded server
> with pax-exam outside of the container before the pax-exam machinery is
> starting.
>
> The idea is to start the database in the non-OSGi context when the
> pax-runner is starting, something like the beforeClass, and stop the
> database after all the tests are finished ala afterClass.
>
> Does anyone has an idea how to do this ?
>
> Thanks
> Nicolas
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ops4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "OPS4J" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ops4j/RlgwSX04-O8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ops4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-05 Thread Niclas Hedhman
I thought I should chip in and point out that Junit 5 ahs received the
entire extension mechanism, and both Rules and RunWith constructs are
deprecated, and implemented using the new extension system.

Perhaps it would make more sense for new functionality in Pax Exam to look
forward to JUnit 5.

Just my 2 sen.

On Aug 4, 2017 20:39, "Nicolas Brasey"  wrote:

> Hi Tony,
>
> Thanks a lot for your answer.
>
> I think what you are working on is absolutely great, and I think it would
> also perfectly fit for our needs. Starting the OSGi container from a junit
> rule makes the tests cleaner. I guess this would also work with Karaf,
> right ? But, just for the curiosity, how do you plan to access the OSGi
> service from outside the container ? And when do you plan to push your
> local branch ? :-)
>
> 2) Yes I tried booting neo4j from the @Configuration method, but there 2
> issues IMHO:
> a) It provides only a way to start neo4j, obviously no hook to run some
> post tests code
> b) since the configure code is also deployed as an OSGi bundle, it forces
> you to make sure the  does not include the neo4j
> packages, which cannot be resolved. It is feasible, but this is hard work
> and I'm not sure about the maintainability of this over the time
>
> 3) Not sure I understood your proposal with the RunWith. Do you mean
> implementing my own Junit runner that wraps the PaxExam runner, and run my
> tests with it ?
>
>
> Cheers,
> Nicolas
>
>
> On Fri, Aug 4, 2017 at 12:47 PM, Toni Menzel 
> wrote:
>
>> Hey Nicolas,
>>
>> I think you are looking at something like the (new) acceptance test api
>> that runs from outside of
>> osgi: https://github.com/ops4j/org.ops4j.pax.exam2/blob/
>> master/drivers/pax-exam-acceptance/src/test/java/org/ops4j/
>> pax/exam/acceptance/AcceptanceTestApiTest.java
>>
>> This is currently in active development and is lacking some features like
>> smooth access to OSGi Services from the outside.
>> Currently, only the rest client is available (using RestAssured), but I a
>> new one making internal services available to the test automatically is
>> already on my local branch.
>>
>> In any way, we also could think of making out-of-container setup code
>> available in regular "@RunWith(PaxExam.class)" tests. Did you try booting
>> Neo4j inside the @Configuration method? that is executed before the OSGi
>> container is launched, so it does run in plain java.
>>
>> Another try: did you try using a Junit Rule with "@RunWith()"? this
>> should work, too.
>>
>> Toni
>>
>>
>>
>>
>> *www.rebaze.de  | www.rebaze.com
>>  | @rebazeio *
>>
>> On Fri, Aug 4, 2017 at 11:59 AM, Nicolas Brasey > > wrote:
>>
>>> Hi,
>>>
>>> Context: I want to use pax-exam for our business integration tests that
>>> needs to have a database (neo4j) that is not OSGi friendly running before
>>> the test are executed. we use maven.
>>>
>>> Also, neo4j provides a embedded server that works extremely well outside
>>> of an OSGi container, but I can't find a way to start this embedded server
>>> with pax-exam outside of the container before the pax-exam machinery is
>>> starting.
>>>
>>> The idea is to start the database in the non-OSGi context when the
>>> pax-runner is starting, something like the beforeClass, and stop the
>>> database after all the tests are finished ala afterClass.
>>>
>>> Does anyone has an idea how to do this ?
>>>
>>> Thanks
>>> Nicolas
>>>
>>> --
>>> --
>>> --
>>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OPS4J" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to ops4j+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> --
>> --
>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "OPS4J" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/ops4j/RlgwSX04-O8/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> ops4j+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ops4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.

Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-05 Thread 'Christoph Läubrich' via OPS4J
Even though neo4j is not "osgi-friendly" (what ever that means ;-) you 
can create abundle that embedds all that neo4j requires, add an 
Activator that starts up your db and provide a custom service to trigger 
"after-test-checks" in whatever way you need. In your test you can the 
collect the service to


a) make sure the db is up and running
b) fire your checks whenever needed

Am 04.08.2017 11:59, schrieb Nicolas Brasey:

Hi,

Context: I want to use pax-exam for our business integration tests 
that needs to have a database (neo4j) that is not OSGi friendly 
running before the test are executed. we use maven.


Also, neo4j provides a embedded server that works extremely well 
outside of an OSGi container, but I can't find a way to start this 
embedded server with pax-exam outside of the container before the 
pax-exam machinery is starting.


The idea is to start the database in the non-OSGi context when the 
pax-runner is starting, something like the beforeClass, and stop the 
database after all the tests are finished ala afterClass.


Does anyone has an idea how to do this ?

Thanks
Nicolas
--
--
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

---
You received this message because you are subscribed to the Google 
Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to ops4j+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
--
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups "OPS4J" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-04 Thread Nicolas Brasey
On Fri, Aug 4, 2017 at 3:39 PM, Toni Menzel  wrote:

> So, about the imports: yes, well there used to be an option to let you
> mark all generated imports to be optional for the probe. Have to look at
> this.
>
>
Ok I will look into this option, thanks for the tips.



> About the Acceptance Driver: yes it will work with any Pax Exam Test
> Container. Stay tuned.
>
> Amazing, looking forward!



> About the pre/post hooks: can you try implementing a Junit Rule?
> https://github.com/junit-team/junit4/wiki/Rules (see
> ExternalResourcesRule). This will give you the right amount of control.
> But, I guess you will still get superfluous (and unresolvable) imports for
> that even though they will not be really executed in-container.
> Need to update myself how to overwrite that..
>

So, do you mean the Junit rule as pre/post test is executed outside of the
container ? I thought it was executed in the container



>
>
>
>
>
> *www.rebaze.de  | www.rebaze.com
>  | @rebazeio *
>
> On Fri, Aug 4, 2017 at 2:39 PM, Nicolas Brasey 
> wrote:
>
>> Hi Tony,
>>
>> Thanks a lot for your answer.
>>
>> I think what you are working on is absolutely great, and I think it would
>> also perfectly fit for our needs. Starting the OSGi container from a junit
>> rule makes the tests cleaner. I guess this would also work with Karaf,
>> right ? But, just for the curiosity, how do you plan to access the OSGi
>> service from outside the container ? And when do you plan to push your
>> local branch ? :-)
>>
>> 2) Yes I tried booting neo4j from the @Configuration method, but there 2
>> issues IMHO:
>> a) It provides only a way to start neo4j, obviously no hook to run some
>> post tests code
>> b) since the configure code is also deployed as an OSGi bundle, it forces
>> you to make sure the  does not include the neo4j
>> packages, which cannot be resolved. It is feasible, but this is hard work
>> and I'm not sure about the maintainability of this over the time
>>
>> 3) Not sure I understood your proposal with the RunWith. Do you mean
>> implementing my own Junit runner that wraps the PaxExam runner, and run my
>> tests with it ?
>>
>>
>> Cheers,
>> Nicolas
>>
>>
>> On Fri, Aug 4, 2017 at 12:47 PM, Toni Menzel 
>> wrote:
>>
>>> Hey Nicolas,
>>>
>>> I think you are looking at something like the (new) acceptance test api
>>> that runs from outside of
>>> osgi: https://github.com/ops4j/org.ops4j.pax.exam2/blob/mast
>>> er/drivers/pax-exam-acceptance/src/test/java/org/ops4j/pax/
>>> exam/acceptance/AcceptanceTestApiTest.java
>>>
>>> This is currently in active development and is lacking some features
>>> like smooth access to OSGi Services from the outside.
>>> Currently, only the rest client is available (using RestAssured), but I
>>> a new one making internal services available to the test automatically is
>>> already on my local branch.
>>>
>>> In any way, we also could think of making out-of-container setup code
>>> available in regular "@RunWith(PaxExam.class)" tests. Did you try booting
>>> Neo4j inside the @Configuration method? that is executed before the OSGi
>>> container is launched, so it does run in plain java.
>>>
>>> Another try: did you try using a Junit Rule with "@RunWith()"? this
>>> should work, too.
>>>
>>> Toni
>>>
>>>
>>>
>>>
>>> *www.rebaze.de  | www.rebaze.com
>>>  | @rebazeio *
>>>
>>> On Fri, Aug 4, 2017 at 11:59 AM, Nicolas Brasey <
>>> nicolas.bra...@gmail.com> wrote:
>>>
 Hi,

 Context: I want to use pax-exam for our business integration tests that
 needs to have a database (neo4j) that is not OSGi friendly running before
 the test are executed. we use maven.

 Also, neo4j provides a embedded server that works extremely well
 outside of an OSGi container, but I can't find a way to start this embedded
 server with pax-exam outside of the container before the pax-exam machinery
 is starting.

 The idea is to start the database in the non-OSGi context when the
 pax-runner is starting, something like the beforeClass, and stop the
 database after all the tests are finished ala afterClass.

 Does anyone has an idea how to do this ?

 Thanks
 Nicolas

 --
 --
 --
 OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

 ---
 You received this message because you are subscribed to the Google
 Groups "OPS4J" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to ops4j+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> --
>>> --
>>> --
>>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>>
>>> ---
>>> You received this message because you are 

Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-04 Thread Toni Menzel
So, about the imports: yes, well there used to be an option to let you mark
all generated imports to be optional for the probe. Have to look at this.

About the Acceptance Driver: yes it will work with any Pax Exam Test
Container. Stay tuned.

About the pre/post hooks: can you try implementing a Junit Rule?
https://github.com/junit-team/junit4/wiki/Rules (see
ExternalResourcesRule). This will give you the right amount of control.
But, I guess you will still get superfluous (and unresolvable) imports for
that even though they will not be really executed in-container.
Need to update myself how to overwrite that..





*www.rebaze.de  | www.rebaze.com
 | @rebazeio *

On Fri, Aug 4, 2017 at 2:39 PM, Nicolas Brasey 
wrote:

> Hi Tony,
>
> Thanks a lot for your answer.
>
> I think what you are working on is absolutely great, and I think it would
> also perfectly fit for our needs. Starting the OSGi container from a junit
> rule makes the tests cleaner. I guess this would also work with Karaf,
> right ? But, just for the curiosity, how do you plan to access the OSGi
> service from outside the container ? And when do you plan to push your
> local branch ? :-)
>
> 2) Yes I tried booting neo4j from the @Configuration method, but there 2
> issues IMHO:
> a) It provides only a way to start neo4j, obviously no hook to run some
> post tests code
> b) since the configure code is also deployed as an OSGi bundle, it forces
> you to make sure the  does not include the neo4j
> packages, which cannot be resolved. It is feasible, but this is hard work
> and I'm not sure about the maintainability of this over the time
>
> 3) Not sure I understood your proposal with the RunWith. Do you mean
> implementing my own Junit runner that wraps the PaxExam runner, and run my
> tests with it ?
>
>
> Cheers,
> Nicolas
>
>
> On Fri, Aug 4, 2017 at 12:47 PM, Toni Menzel 
> wrote:
>
>> Hey Nicolas,
>>
>> I think you are looking at something like the (new) acceptance test api
>> that runs from outside of
>> osgi: https://github.com/ops4j/org.ops4j.pax.exam2/blob/
>> master/drivers/pax-exam-acceptance/src/test/java/org/ops4j/
>> pax/exam/acceptance/AcceptanceTestApiTest.java
>>
>> This is currently in active development and is lacking some features like
>> smooth access to OSGi Services from the outside.
>> Currently, only the rest client is available (using RestAssured), but I a
>> new one making internal services available to the test automatically is
>> already on my local branch.
>>
>> In any way, we also could think of making out-of-container setup code
>> available in regular "@RunWith(PaxExam.class)" tests. Did you try booting
>> Neo4j inside the @Configuration method? that is executed before the OSGi
>> container is launched, so it does run in plain java.
>>
>> Another try: did you try using a Junit Rule with "@RunWith()"? this
>> should work, too.
>>
>> Toni
>>
>>
>>
>>
>> *www.rebaze.de  | www.rebaze.com
>>  | @rebazeio *
>>
>> On Fri, Aug 4, 2017 at 11:59 AM, Nicolas Brasey > > wrote:
>>
>>> Hi,
>>>
>>> Context: I want to use pax-exam for our business integration tests that
>>> needs to have a database (neo4j) that is not OSGi friendly running before
>>> the test are executed. we use maven.
>>>
>>> Also, neo4j provides a embedded server that works extremely well outside
>>> of an OSGi container, but I can't find a way to start this embedded server
>>> with pax-exam outside of the container before the pax-exam machinery is
>>> starting.
>>>
>>> The idea is to start the database in the non-OSGi context when the
>>> pax-runner is starting, something like the beforeClass, and stop the
>>> database after all the tests are finished ala afterClass.
>>>
>>> Does anyone has an idea how to do this ?
>>>
>>> Thanks
>>> Nicolas
>>>
>>> --
>>> --
>>> --
>>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OPS4J" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to ops4j+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> --
>> --
>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "OPS4J" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/ops4j/RlgwSX04-O8/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> ops4j+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You 

Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-04 Thread Nicolas Brasey
Hi Tony,

Thanks a lot for your answer.

I think what you are working on is absolutely great, and I think it would
also perfectly fit for our needs. Starting the OSGi container from a junit
rule makes the tests cleaner. I guess this would also work with Karaf,
right ? But, just for the curiosity, how do you plan to access the OSGi
service from outside the container ? And when do you plan to push your
local branch ? :-)

2) Yes I tried booting neo4j from the @Configuration method, but there 2
issues IMHO:
a) It provides only a way to start neo4j, obviously no hook to run some
post tests code
b) since the configure code is also deployed as an OSGi bundle, it forces
you to make sure the  does not include the neo4j packages,
which cannot be resolved. It is feasible, but this is hard work and I'm not
sure about the maintainability of this over the time

3) Not sure I understood your proposal with the RunWith. Do you mean
implementing my own Junit runner that wraps the PaxExam runner, and run my
tests with it ?


Cheers,
Nicolas


On Fri, Aug 4, 2017 at 12:47 PM, Toni Menzel  wrote:

> Hey Nicolas,
>
> I think you are looking at something like the (new) acceptance test api
> that runs from outside of
> osgi: https://github.com/ops4j/org.ops4j.pax.exam2/
> blob/master/drivers/pax-exam-acceptance/src/test/java/org/
> ops4j/pax/exam/acceptance/AcceptanceTestApiTest.java
>
> This is currently in active development and is lacking some features like
> smooth access to OSGi Services from the outside.
> Currently, only the rest client is available (using RestAssured), but I a
> new one making internal services available to the test automatically is
> already on my local branch.
>
> In any way, we also could think of making out-of-container setup code
> available in regular "@RunWith(PaxExam.class)" tests. Did you try booting
> Neo4j inside the @Configuration method? that is executed before the OSGi
> container is launched, so it does run in plain java.
>
> Another try: did you try using a Junit Rule with "@RunWith()"? this should
> work, too.
>
> Toni
>
>
>
>
> *www.rebaze.de  | www.rebaze.com
>  | @rebazeio *
>
> On Fri, Aug 4, 2017 at 11:59 AM, Nicolas Brasey 
> wrote:
>
>> Hi,
>>
>> Context: I want to use pax-exam for our business integration tests that
>> needs to have a database (neo4j) that is not OSGi friendly running before
>> the test are executed. we use maven.
>>
>> Also, neo4j provides a embedded server that works extremely well outside
>> of an OSGi container, but I can't find a way to start this embedded server
>> with pax-exam outside of the container before the pax-exam machinery is
>> starting.
>>
>> The idea is to start the database in the non-OSGi context when the
>> pax-runner is starting, something like the beforeClass, and stop the
>> database after all the tests are finished ala afterClass.
>>
>> Does anyone has an idea how to do this ?
>>
>> Thanks
>> Nicolas
>>
>> --
>> --
>> --
>> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ops4j+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "OPS4J" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ops4j/RlgwSX04-O8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ops4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pax-exam] How to simulate beforeClass / afterClass hook *outside* of the OSGi container

2017-08-04 Thread Toni Menzel
Hey Nicolas,

I think you are looking at something like the (new) acceptance test api
that runs from outside of
osgi:
https://github.com/ops4j/org.ops4j.pax.exam2/blob/master/drivers/pax-exam-acceptance/src/test/java/org/ops4j/pax/exam/acceptance/AcceptanceTestApiTest.java

This is currently in active development and is lacking some features like
smooth access to OSGi Services from the outside.
Currently, only the rest client is available (using RestAssured), but I a
new one making internal services available to the test automatically is
already on my local branch.

In any way, we also could think of making out-of-container setup code
available in regular "@RunWith(PaxExam.class)" tests. Did you try booting
Neo4j inside the @Configuration method? that is executed before the OSGi
container is launched, so it does run in plain java.

Another try: did you try using a Junit Rule with "@RunWith()"? this should
work, too.

Toni




*www.rebaze.de  | www.rebaze.com
 | @rebazeio *

On Fri, Aug 4, 2017 at 11:59 AM, Nicolas Brasey 
wrote:

> Hi,
>
> Context: I want to use pax-exam for our business integration tests that
> needs to have a database (neo4j) that is not OSGi friendly running before
> the test are executed. we use maven.
>
> Also, neo4j provides a embedded server that works extremely well outside
> of an OSGi container, but I can't find a way to start this embedded server
> with pax-exam outside of the container before the pax-exam machinery is
> starting.
>
> The idea is to start the database in the non-OSGi context when the
> pax-runner is starting, something like the beforeClass, and stop the
> database after all the tests are finished ala afterClass.
>
> Does anyone has an idea how to do this ?
>
> Thanks
> Nicolas
>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ops4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.