Hi Christiano,
if I understand correctly you are using Blueprint annotation (or xml) for your
test bundle !?
I haven't seen any one do that and I doubt that would work since the test class
would be instantiated by the test runtime and not the Blueprint runtime, so
they would live in the wrong container unless there is some bridging mechanism
you have defined yourself.
Usually, in an integration test people consume services provided by other
bundles, which often are blueprint managed, rather than having the test being
blueprint managed (although that would be nice :).
Does that makes sense for the symptoms you are seeing?
Regards,
Valentin
On 14 Jun 2011, at 11:15, Cristiano Gavião wrote:
> Please, could someone, at least, tell me if I'm using the blueprint
> annotations in the right way on my test class?
>
> thanks
>
> On 10/06/11 19:15, Cristiano Gavião wrote:
>> Hi guys,
>>
>> I need a little help here.
>>
>> I'm using Aries Blueprint on my Equinox project. Everything is running well
>> except my integration tests.
>>
>> I'm using Tycho as building system and tycho-surefire-plugin to run the
>> tests.
>>
>> I can start the integration tests properly, Aries is being activated and the
>> beans and services is being created properly.
>>
>>> 18:43:53.459 [Blueprint Extender: 1] DEBUG o.a.a.b.c.BlueprintContainerImpl
>>> - Running blueprint container for bundle org.jbehave.osgi.equinox.commands
>>> in state Create
>>> 18:43:53.748 [Blueprint Extender: 2] DEBUG o.a.a.b.c.BlueprintContainerImpl
>>> - Running blueprint container for bundle org.jbehave.osgi.services in state
>>> Created
>>
>> But I can't make my test pass :(
>>
>>
>> this is the context.xml for one service:
>>
>>> <reference id="embedderService"
>>> interface="org.jbehave.osgi.services.EmbedderService" />
>>>
>>> <bean id="commandProviderImpl"
>>> class="org.jbehave.osgi.equinox.commands.CoreCommandProvider">
>>> <property name="embedderService" ref="embedderService" />
>>> <property name="injectedBundleContext" ref="blueprintBundleContext" />
>>> </bean>
>>>
>>> <service id="commandService" ref="commandProviderImpl"
>>> interface="org.eclipse.osgi.framework.console.CommandProvider">
>>> </service>
>>
>>
>> And that is my test (I've tried configuration with xml and now with
>> annotations withou success):
>>
>>> @Bean(id="CoreCommandProviderTest")
>>> public class CoreCommandProviderTest {
>>>
>>> @Inject(ref="commandProviderImpl")
>>> private CoreCommandProvider commandProvider;
>>>
>>> @Test
>>> public void ensureCommandServiceIsRegistered() {
>>> // assert bundle is not null
>>> Bundle bundle = FrameworkUtil.getBundle(CoreCommandProvider.class);
>>> assertThat("CoreCommand bundle is not installed", bundle,
>>> is(notNullValue()));
>>>
>>> // asserts that test bundle is installed
>>> assertThat("CoreCommand was not inject by Blueprint DI",
>>> commandProvider,
>>> is(notNullValue()));
>>>
>>>
>>> } ....
>>
>> what I'm doing wrong ?
>>
>> thanks a lot
>>
>> Cristiano
>>
>