I think this is okay, even though in most cases if someone uses tinybundles there will be a point where it is required to include tinybundles as a bundle in the test.

We migth circumvent the problem in the future since I'm working on a feature that allows the seperation of Test-Class + Configure Method, this ill then also break the runtime dependencies between classes in the configure method and the test it self.

A similar problem arises if you use the pax-cm module, even though it is not required for the run of the test you have to include it because of the usage in the configure method.

Am 19.10.2017 um 07:20 schrieb Christian Schneider:
Hi Christoph,

I now experimented a bit more with the problem of .ClassNotFoundException: org.ops4j.pax.tinybundles.core.BuildStrategy.
It seems the problem occurs when I use:
InputStream inp = bundle().add(DsService.class).build(withBnd());

It seems the problem is that build(strategey) has a reference to BuildStrategy. So if we had .buildWithBnd() there would be no problem. Does it make sense to add this? (Even if I know it pollutes the nice abstraction a bit).

Another possible solution would be to switch the default builder to bnd .. but this would create compatibility problems.

Christian

2017-10-05 9:58 GMT+02:00 'Christoph Läubrich' via OPS4J <[email protected] <mailto:[email protected]>>:

    > I only use this in the @Configuration so my test should not require
    > TinyBundles at runtime.

    Even though you does not require the code to run in @Configure you
    still have an (class-import) dependecy to that code.

    Is it a real problem to include tiny-bundles in your test?
    If yes you have to put your code into a Utilmethod in a seperate
    class (e.g. with static method returning just the Inputstream) and
    reference that class with FQN.

    Besides that, isn't there already a "withBND()" Option?




    Am 05.10.2017 um 09:14 schrieb Christian Schneider:

        I am trying to tune TinyBundles to create DS xml for standard DS
        annotations.
        To achieve this I created my own BuildStrategy that adds the bnd
        plugin for DS.

        I only use this in the @Configuration so my test should not
        require TinyBundles at runtime.
        Still I get a ClassNotFoundException when I run the test (see
        below).

        So my question is how can I use TinyBundles and a BuildStrategy
        in pax exam without creating a runtime dependency to TinyBundles?

        Christian

        java.lang.ClassNotFoundException:
        org.ops4j.pax.tinybundles.core.BuildStrategy not found by
        PAXEXAM-PROBE-800674a4-e6a6-456d-9eb4-0d184e5abb1e [18]
        at
        
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
        at
        
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
        at
        
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.privateGetPublicMethods(Class.java:2902)
        at java.lang.Class.getMethods(Class.java:1615)
        at
        
org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.findAndInvoke(JUnitProbeInvoker.java:94)
        at
        
org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.call(JUnitProbeInvoker.java:73)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
        
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
        
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)


-- -- Christian Schneider
        http://www.liquid-reality.de
        
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de
        
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>>

        Computer Scientist
        http://www.adobe.com

-- -- ------------------
        OPS4J - http://www.ops4j.org - [email protected]
        <mailto:[email protected]>

        ---
        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 [email protected]
        <mailto:ops4j%[email protected]>
        <mailto:[email protected]
        <mailto:ops4j%[email protected]>>.
        For more options, visit https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>.


-- -- ------------------
    OPS4J - http://www.ops4j.org - [email protected]
    <mailto:[email protected]>

    --- 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 [email protected]
    <mailto:ops4j%[email protected]>.
    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.




--
--
Christian Schneider
http://www.liquid-reality.de <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Computer Scientist
http://www.adobe.com

--
--
------------------
OPS4J - http://www.ops4j.org - [email protected]

---
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 [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
--
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to