Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Mongo injection conflicts when using Arquillian integration tests #53

Closed
rmarpozo opened this Issue · 1 comment

2 participants

@rmarpozo

Hi

I'm using Arquillian for my CDI integration tests and nosqlunit to test the mongodb database. The problem is that if I want mongo to be injected by nosqlunit then I've got an error from WELD because Mongo cannot be injected since is not present in CDI context.

I've seen in the documentation that you've solved the opposite problem with the @ByContainer annotation. Here, I want nosqlunit to inject mongo while WELD should ignore that injection point.

Is there any other way to access mongo instance other that using the @Inject annotation?

Thanks

@lordofthejars

Hello, first of all thank you very much for using NoSQLUnit. Well for your information in near future we are going to provide full integration with Arquillian project, using APE project. But meanwhile you are completely right that there is no way for avoiding that directly. But you can use a workaround and is calling you directly the methods used by @Inject processor. Let me explain with one example:

@Class
public MongoDbRule mongodbRule = .....

@Test
public void my_test() {

...
Mongo mongo = mongoDbRule.getDatabaseOperation().connectionManager()
...

}

Yes it is not the cleanest way but for now this workaround should work for you.

Apart from that, and meanwhile there is no integration with Arquillian, in next release I will add a new annotation which does not conflict with CDI container.

On behalf of Arquillian folks, thank you for using Arquillian and of course thank you for using NoSQLUnit.

Hope to see these integration as soon as possible.

Alex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.