Yes, that would fix one of my problems. But my core problem now seems to be
an inability to create a dependency on the interface.

Anyway, I've been building a test driver bundle to do the actual test and
the pax exam module to start the bundles and listen for a bundle stop or a
service start so that it knows if the test succeeded or not. So far so
good. And it means my test code stays far away from pax exam. :-)


On Fri, May 17, 2013 at 8:55 PM, Achim Nierbeck <[email protected]>wrote:

> Hi William,
>
> yeah, the @Inject somehow doesn't work "always" it works for the bundle
> context, this might very well be since the features service isn't awailable
> yet.
> You should be fine if you'd add some timer to the @Inject annotation.
> Should be something like @Inject(timeout=100000) (beware this is just from
> the top of my head) you should find some documentation at pax-exam around
> the exact syntax.
>
> regards, Achim
>
>
> 2013/5/17 William la Forge <[email protected]>
>
>> Thanks Achim, that did help clarify things a little.
>>
>> I noticed in the test you referenced that there was a wait at the start
>> of the test. I tried doing the same, but apparently the test never even got
>> invoked. My guess is that this is because I am using @Inject. (In the test
>> you referenced, there is also an @Inject, but it is just for the bundle
>> context.)
>>
>> Ah. Instead of an @Inject on the desired service, a service listener is
>> employed and a notify is used to wake up the thread doing the wait. I can
>> do that, but that's pretty ugly, eh?
>>
>> OK, so I have an answer. It is nice and solid. Just don't use @Inject!
>>
>> Quitting time for me here in India. I'll check for alternative responses
>> in the morning before proceeding with this solution.
>>
>> Thanks again Achim!
>>
>>
>> On Fri, May 17, 2013 at 8:07 PM, Achim Nierbeck 
>> <[email protected]>wrote:
>>
>>> Hi,
>>>
>>> take a look at how it's used in Karaf itself, maybe you're doing
>>> something slightly different. :)
>>>
>>>
>>> http://svn.apache.org/viewvc/karaf/trunk/tooling/exam/regression/src/test/java/org/apache/karaf/tooling/exam/regression/KarafWithBundleTest.java?view=markup
>>>
>>> regards, Achim
>>>
>>>
>>> 2013/5/17 William la Forge <[email protected]>
>>>
>>>> I switched to karaf 2.3.1, but there was no change
>>>>
>>>>
>>>> On Fri, May 17, 2013 at 5:18 PM, William la Forge 
>>>> <[email protected]>wrote:
>>>>
>>>>> I have an integration test that works half the time when I set the
>>>>> logging level to DEBUG. So I figured I need to use @Before, but the method
>>>>> does not get called.
>>>>>
>>>>> org.apache.karaf 3.0.0.RC1
>>>>> org.apache.karaf.tooling.exam 3.0.0.RC1
>>>>> org.ops4j.pax.exam 2.6.0
>>>>>
>>>>> pom:
>>>>> https://github.com/laforge49/JActor2/blob/master/jactor-ktest/pom.xml
>>>>> test source:
>>>>> https://github.com/laforge49/JActor2/blob/master/jactor-ktest/src/test/java/org/apache/karaf/VersionAsInProjectKarafTest.java
>>>>>
>>>>> I modeled my test on
>>>>> http://karaf.apache.org/manual/latest-2.3.x/developers-guide/writing-tests.html
>>>>>
>>>>> I used mavenBundle in config:
>>>>>
>>>>>     @Configuration
>>>>>     public Option[] config() {
>>>>>         return new
>>>>> Option[]{karafDistributionConfiguration().frameworkUrl(
>>>>>
>>>>> maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("zip").versionAsInProject())
>>>>>                 .karafVersion("2.2.4").name("Apache Karaf"),
>>>>>
>>>>>                 logLevel(LogLevelOption.LogLevel.INFO),
>>>>>
>>>>>                 mavenBundle("org.agilewiki.jactor", "jactor-api",
>>>>> "0.0.1-SNAPSHOT"),
>>>>>                 mavenBundle("org.agilewiki.jactor", "jactor-impl",
>>>>> "0.0.1-SNAPSHOT"),
>>>>>                 mavenBundle("org.agilewiki.jactor", "jactor-util",
>>>>> "0.0.1-SNAPSHOT"),
>>>>>                 mavenBundle("org.agilewiki.jactor",
>>>>> "jactor-test-iface", "0.0.1-SNAPSHOT"),
>>>>>                 mavenBundle("org.agilewiki.jactor",
>>>>> "jactor-test-service", "0.0.1-SNAPSHOT")
>>>>>
>>>>>         };
>>>>>     }
>>>>>
>>>>> My before method is not called:
>>>>>
>>>>>     @Before
>>>>>     public void setup() throws Exception {
>>>>>         Thread.sleep(10000);
>>>>>     }
>>>>>
>>>>> The result I get without DEBUG and half the time with DEBUG set is:
>>>>>
>>>>>
>>>>> test:org.apache.karaf.VersionAsInProjectKarafTest.test:KarafTestContainer{mvn:
>>>>>
>>>>> org.apache.karaf\/apache-karaf\/3.0.0.RC1\/zip}(org.apache.karaf.VersionAsInProj
>>>>> ectKarafTest): org.agilewiki.jactor.testIface.Hello not found by
>>>>> PAXEXAM-PROBE-e
>>>>> 10f1edd-464b-4800-a783-7dcfd54a2a0d [93]
>>>>>
>>>>> I'm running on Windows 7.
>>>>>
>>>>> Any help would be appreciated. Thanks!
>>>>>
>>>>> Bill
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
>>> & Project Lead
>>> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
>>> Commiter & Project Lead
>>> blog <http://notizblog.nierbeck.de/>
>>>
>>
>>
>
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/>
>

Reply via email to