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


Reply via email to