Re: [pax-exam] Data for tests?

2017-03-10 Thread sorok...@gmail.com
Great, could I request a Jira account to that end for "aj...@apache.org"? 
Thanks!

---
A. Soroka
The University of Virginia Library



> On Mar 10, 2017, at 3:43 AM, 'Christoph Läubrich' via OPS4J 
>  wrote:
> 
> First step would be to open an Jira ticket so you (or any other team member) 
> can pick it up to work on it.
> 
> Am 09.03.2017 13:52, schrieb sorok...@gmail.com:
>> TinyBundle and BNDlib _were_ required as options in the test setup 
>> (@Configuration method) from what I could tell, or I got errors at runtime 
>> when the OSGi framework went looking for TinyBundle classes needed by the 
>> test resource bundle. Perhaps due to the asynchronous loading in that 
>> bundle? I will double-check, though.
>> 
>> I really like the idea of an includeMavenResources() option as you describe. 
>> That's exactly what I expected and wanted. If I understood more about how 
>> the test probe is built, I would offer to work on that now. But I can do 
>> that in the future, if it seems like that's the best plan.
>> 
>> ---
>> A. Soroka
>> The University of Virginia Library
>> 
>> 
>> 
>>   
>>> On Mar 8, 2017, at 4:13 AM, 'Christoph Läubrich' via 
>>> OPS4J  wrote:
>>> 
>>> I think an option to include a resource into the test-probe is the most 
>>> generic, simple and natural way. For special and/or advanced usage 
>>> szenarios the tinybundle option can still be used.
>>> Maybe it would even be possible to have (as an extra) some sort of 
>>> includeMavenResources() option that builds on top of this feature and 
>>> fetches all resources from scr/test/resources/ and includes them since that 
>>> is what one would exspect when working with maven.
>>> 
>>> BTW: are TinyBundle and BND lib are really required in the test-runtime 
>>> (=Test Setup)? Normally they should only be needed on construction time 
>>> (=test classpath).
>>> 
>>> Am 03.03.2017 19:41, schrieb sorok...@gmail.com:
>>> 
 This was a fantastic idea! Thank you, Christoph Läubrich.
 
 I ended up building a dynamic bundle using TinyBundle containing my test 
 resources just the way I want them arranged, and injecting it like any 
 other bundle. I use a symbolic name to pick it back up inside the 
 container and use the resources.
 
 One note: I did need to put TinyBundle and BNDlib into the container to 
 support my test resource bundle, but that wasn't a big deal. I will pack 
 that part into a new Option or even pack the whole kit and kaboodle into a 
 some kind of "TestResourceOption". Would this be a useful PR, or would 
 folks rather have (as Christoph Läubrich mentions) the ability to directly 
 include resources into the test probe (which does seem a bit simpler)?
 
 Thanks, OPS4J folks!
 
 
   
>>> -- 
>>> -- 
>>> --
>>> 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.

-- 
-- 
--
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] Data for tests?

2017-03-10 Thread 'Christoph Läubrich' via OPS4J
First step would be to open an Jira ticket so you (or any other team 
member) can pick it up to work on it.


Am 09.03.2017 13:52, schrieb sorok...@gmail.com:

TinyBundle and BNDlib _were_ required as options in the test setup 
(@Configuration method) from what I could tell, or I got errors at runtime when 
the OSGi framework went looking for TinyBundle classes needed by the test 
resource bundle. Perhaps due to the asynchronous loading in that bundle? I will 
double-check, though.

I really like the idea of an includeMavenResources() option as you describe. 
That's exactly what I expected and wanted. If I understood more about how the 
test probe is built, I would offer to work on that now. But I can do that in 
the future, if it seems like that's the best plan.

---
A. Soroka
The University of Virginia Library



   

On Mar 8, 2017, at 4:13 AM, 'Christoph Läubrich' via 
OPS4J  wrote:

I think an option to include a resource into the test-probe is the most 
generic, simple and natural way. For special and/or advanced usage szenarios 
the tinybundle option can still be used.
Maybe it would even be possible to have (as an extra) some sort of 
includeMavenResources() option that builds on top of this feature and fetches 
all resources from scr/test/resources/ and includes them since that is what one 
would exspect when working with maven.

BTW: are TinyBundle and BND lib are really required in the test-runtime (=Test 
Setup)? Normally they should only be needed on construction time (=test 
classpath).

Am 03.03.2017 19:41, schrieb sorok...@gmail.com:
 

This was a fantastic idea! Thank you, Christoph Läubrich.

I ended up building a dynamic bundle using TinyBundle containing my test 
resources just the way I want them arranged, and injecting it like any other 
bundle. I use a symbolic name to pick it back up inside the container and use 
the resources.

One note: I did need to put TinyBundle and BNDlib into the container to support my test 
resource bundle, but that wasn't a big deal. I will pack that part into a new Option or 
even pack the whole kit and kaboodle into a some kind of "TestResourceOption". 
Would this be a useful PR, or would folks rather have (as Christoph Läubrich mentions) 
the ability to directly include resources into the test probe (which does seem a bit 
simpler)?

Thanks, OPS4J folks!


   

--
--
--
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] Data for tests?

2017-03-09 Thread sorok...@gmail.com
TinyBundle and BNDlib _were_ required as options in the test setup 
(@Configuration method) from what I could tell, or I got errors at runtime when 
the OSGi framework went looking for TinyBundle classes needed by the test 
resource bundle. Perhaps due to the asynchronous loading in that bundle? I will 
double-check, though.

I really like the idea of an includeMavenResources() option as you describe. 
That's exactly what I expected and wanted. If I understood more about how the 
test probe is built, I would offer to work on that now. But I can do that in 
the future, if it seems like that's the best plan.

---
A. Soroka
The University of Virginia Library



> On Mar 8, 2017, at 4:13 AM, 'Christoph Läubrich' via OPS4J 
>  wrote:
> 
> I think an option to include a resource into the test-probe is the most 
> generic, simple and natural way. For special and/or advanced usage szenarios 
> the tinybundle option can still be used.
> Maybe it would even be possible to have (as an extra) some sort of 
> includeMavenResources() option that builds on top of this feature and fetches 
> all resources from scr/test/resources/ and includes them since that is what 
> one would exspect when working with maven.
> 
> BTW: are TinyBundle and BND lib are really required in the test-runtime 
> (=Test Setup)? Normally they should only be needed on construction time 
> (=test classpath).
> 
> Am 03.03.2017 19:41, schrieb sorok...@gmail.com:
>> This was a fantastic idea! Thank you, Christoph Läubrich.
>> 
>> I ended up building a dynamic bundle using TinyBundle containing my test 
>> resources just the way I want them arranged, and injecting it like any other 
>> bundle. I use a symbolic name to pick it back up inside the container and 
>> use the resources.
>> 
>> One note: I did need to put TinyBundle and BNDlib into the container to 
>> support my test resource bundle, but that wasn't a big deal. I will pack 
>> that part into a new Option or even pack the whole kit and kaboodle into a 
>> some kind of "TestResourceOption". Would this be a useful PR, or would folks 
>> rather have (as Christoph Läubrich mentions) the ability to directly include 
>> resources into the test probe (which does seem a bit simpler)?
>> 
>> Thanks, OPS4J folks!
>> 
>>   
> 
> -- 
> -- 
> --
> 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] Data for tests?

2017-03-08 Thread 'Christoph Läubrich' via OPS4J
I think an option to include a resource into the test-probe is the most 
generic, simple and natural way. For special and/or advanced usage 
szenarios the tinybundle option can still be used.
Maybe it would even be possible to have (as an extra) some sort of 
includeMavenResources() option that builds on top of this feature and 
fetches all resources from scr/test/resources/ and includes them since 
that is what one would exspect when working with maven.


BTW: are TinyBundle and BND lib are really required in the test-runtime 
(=Test Setup)? Normally they should only be needed on construction time 
(=test classpath).


Am 03.03.2017 19:41, schrieb sorok...@gmail.com:

This was a fantastic idea! Thank you, Christoph Läubrich.

I ended up building a dynamic bundle using TinyBundle containing my test 
resources just the way I want them arranged, and injecting it like any other 
bundle. I use a symbolic name to pick it back up inside the container and use 
the resources.

One note: I did need to put TinyBundle and BNDlib into the container to support my test 
resource bundle, but that wasn't a big deal. I will pack that part into a new Option or 
even pack the whole kit and kaboodle into a some kind of "TestResourceOption". 
Would this be a useful PR, or would folks rather have (as Christoph Läubrich mentions) 
the ability to directly include resources into the test probe (which does seem a bit 
simpler)?

Thanks, OPS4J folks!

   


--
--
--
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] Data for tests?

2017-03-03 Thread sorok...@gmail.com
This was a fantastic idea! Thank you, Christoph Läubrich.

I ended up building a dynamic bundle using TinyBundle containing my test 
resources just the way I want them arranged, and injecting it like any other 
bundle. I use a symbolic name to pick it back up inside the container and use 
the resources. 

One note: I did need to put TinyBundle and BNDlib into the container to support 
my test resource bundle, but that wasn't a big deal. I will pack that part into 
a new Option or even pack the whole kit and kaboodle into a some kind of 
"TestResourceOption". Would this be a useful PR, or would folks rather have (as 
Christoph Läubrich mentions) the ability to directly include resources into the 
test probe (which does seem a bit simpler)?

Thanks, OPS4J folks!

---
A. Soroka
The University of Virginia Library



> On Mar 3, 2017, at 3:28 AM, 'Christoph Läubrich' via OPS4J 
>  wrote:
> 
> The problem is that resources are not packed inside the bundle probe.
> 
> Instead af working with classpathentries etc. directly in your test-probe, 
> you can create a "test-resource-bundle" that includes all resources needed 
> for the test, and include this in your test-setup, beside the resources, your 
> bundle should include a class or interface in a package you export. You can 
> the use MyTestResources.class.getClassloader().getResource() to fetch 
> resources from there, or even create helper methods to prepare those 
> resources (e.g. return a properties or parsed XML file or whatever). This is 
> the most generic aproach.
> 
> You can even build a bundle on-the-fly with tinyBundles() if you do not want 
> to create a new maven module.
> 
> Beside this, it might be a good idea to have a pax exam option to include 
> resources in the test-probe.
> 
> Am 02.03.2017 22:10, schrieb sorok...@gmail.com:
>> Thanks for the advice! Maybe simple is good here. :grin:
>> 
>> I may end up using some facilities that are particular to my project and 
>> unrelated to OSGi, but if I don't, I will follow out my experiments with 
>> Bundle.getEntry(). On that topic, another question:
>> 
>> I am using Maven to build my project, in a very standard setup. I have tried 
>> putting test resources in my integration test module in src/main/resources 
>> and in src/test/resources. During the operation of the Pax Exam tests, 
>> nothing in those folders appears visible to Bundle.getEntry() (I 
>> double-checked with Bundle.findEntries() ). I've also tried sticking these 
>> resources (which are not Java, of course) in the actual package folders in 
>> src/test/java next to the code that uses them, but no luck there either.
>> 
>> Is there some way I can understand how the resources of a Maven module get 
>> translated into the bundle-structure of the test probe?
>> 
>> Thanks!
>> 
> 
> -- 
> -- 
> --
> 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] Data for tests?

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

The problem is that resources are not packed inside the bundle probe.

Instead af working with classpathentries etc. directly in your 
test-probe, you can create a "test-resource-bundle" that includes all 
resources needed for the test, and include this in your test-setup, 
beside the resources, your bundle should include a class or interface in 
a package you export. You can the use 
MyTestResources.class.getClassloader().getResource() to fetch 
resources from there, or even create helper methods to prepare those 
resources (e.g. return a properties or parsed XML file or whatever). 
This is the most generic aproach.


You can even build a bundle on-the-fly with tinyBundles() if you do not 
want to create a new maven module.


Beside this, it might be a good idea to have a pax exam option to 
include resources in the test-probe.


Am 02.03.2017 22:10, schrieb sorok...@gmail.com:

Thanks for the advice! Maybe simple is good here. :grin:

I may end up using some facilities that are particular to my project and 
unrelated to OSGi, but if I don't, I will follow out my experiments with 
Bundle.getEntry(). On that topic, another question:

I am using Maven to build my project, in a very standard setup. I have tried 
putting test resources in my integration test module in src/main/resources and 
in src/test/resources. During the operation of the Pax Exam tests, nothing in 
those folders appears visible to Bundle.getEntry() (I double-checked with 
Bundle.findEntries() ). I've also tried sticking these resources (which are not 
Java, of course) in the actual package folders in src/test/java next to the 
code that uses them, but no luck there either.

Is there some way I can understand how the resources of a Maven module get 
translated into the bundle-structure of the test probe?

Thanks!



--
--
--
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] Data for tests?

2017-03-02 Thread sorok...@gmail.com
Thanks for the advice! Maybe simple is good here. :grin:

I may end up using some facilities that are particular to my project and 
unrelated to OSGi, but if I don't, I will follow out my experiments with 
Bundle.getEntry(). On that topic, another question:

I am using Maven to build my project, in a very standard setup. I have tried 
putting test resources in my integration test module in src/main/resources and 
in src/test/resources. During the operation of the Pax Exam tests, nothing in 
those folders appears visible to Bundle.getEntry() (I double-checked with 
Bundle.findEntries() ). I've also tried sticking these resources (which are not 
Java, of course) in the actual package folders in src/test/java next to the 
code that uses them, but no luck there either.

Is there some way I can understand how the resources of a Maven module get 
translated into the bundle-structure of the test probe?

Thanks! 

---
A. Soroka
The University of Virginia Library



> On Mar 2, 2017, at 3:54 PM, 'Achim Nierbeck' via OPS4J 
>  wrote:
> 
> Hi, 
> 
> this is a rather interesting problem you need to solve. 
> As your tests do run within the OSGi environment you'll need to use some OSGi 
> ways of requesting the file. 
> Best is to include it in your classpath, as you'll never know what the actual 
> location on the system path is. 
> Right now I'd consider the Bundle.getEntry approach as being the best to 
> match. 
> 
> regards, Achim 
> 
> 
> 2017-03-02 16:19 GMT+01:00 sorok...@gmail.com :
> Hi, OPS4J folks,
> 
> I'm building up some tests using Pax Exam with Apache Camel in Apache Karaf. 
> The basic form of each test is just "Make an HTTP request to a given URI with 
> a Camel route behind it, then compare the response with a known-good answer."
> 
> I'd like to include my known-good answers as data files (they are RDF and 
> have well-known serializations) instead of inline strings, but I'm not 
> totally sure about the best way to do that. I've been tinkering with adding 
> them to the source tree and using Bundle.getEntry() and so forth, but this 
> seems rather fragile.
> 
> Is there an accepted pattern for this use case, i.e. bringing data files 
> along with the code for a test probe?
> 
> I hope this is a reasonable question to ask this forum. Thanks for the 
> excellent product that is Pax Exam. It's definitely the best way to do 
> testing with Karaf!
> 
> ---
> A. Soroka
> The University of Virginia Library
> 
> 
> 
> --
> --
> --
> 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 Cookbook 
> 
> Software Architect / Project Manager / Scrum Master 
> 
> 
> -- 
> -- 
> --
> 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] Data for tests?

2017-03-02 Thread 'Achim Nierbeck' via OPS4J
Hi,

this is a rather interesting problem you need to solve.
As your tests do run within the OSGi environment you'll need to use some
OSGi ways of requesting the file.
Best is to include it in your classpath, as you'll never know what the
actual location on the system path is.
Right now I'd consider the Bundle.getEntry approach as being the best to
match.

regards, Achim


2017-03-02 16:19 GMT+01:00 sorok...@gmail.com :

> Hi, OPS4J folks,
>
> I'm building up some tests using Pax Exam with Apache Camel in Apache
> Karaf. The basic form of each test is just "Make an HTTP request to a given
> URI with a Camel route behind it, then compare the response with a
> known-good answer."
>
> I'd like to include my known-good answers as data files (they are RDF and
> have well-known serializations) instead of inline strings, but I'm not
> totally sure about the best way to do that. I've been tinkering with adding
> them to the source tree and using Bundle.getEntry() and so forth, but this
> seems rather fragile.
>
> Is there an accepted pattern for this use case, i.e. bringing data files
> along with the code for a test probe?
>
> I hope this is a reasonable question to ask this forum. Thanks for the
> excellent product that is Pax Exam. It's definitely the best way to do
> testing with Karaf!
>
> ---
> A. Soroka
> The University of Virginia Library
>
>
>
> --
> --
> --
> 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 Cookbook 

Software Architect / Project Manager / Scrum Master

-- 
-- 
--
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.


[pax-exam] Data for tests?

2017-03-02 Thread sorok...@gmail.com
Hi, OPS4J folks,

I'm building up some tests using Pax Exam with Apache Camel in Apache Karaf. 
The basic form of each test is just "Make an HTTP request to a given URI with a 
Camel route behind it, then compare the response with a known-good answer."

I'd like to include my known-good answers as data files (they are RDF and have 
well-known serializations) instead of inline strings, but I'm not totally sure 
about the best way to do that. I've been tinkering with adding them to the 
source tree and using Bundle.getEntry() and so forth, but this seems rather 
fragile.

Is there an accepted pattern for this use case, i.e. bringing data files along 
with the code for a test probe?

I hope this is a reasonable question to ask this forum. Thanks for the 
excellent product that is Pax Exam. It's definitely the best way to do testing 
with Karaf!

---
A. Soroka
The University of Virginia Library



-- 
-- 
--
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.