Closed jmnarloch closed 12 years ago
I have made a quick fix to support embedded containers in general, but I'm not entirely satisfied with the implementation. Especially if you take a look at SpringRemoteInjectionEnricher or SpringClientInjectionEnricher, there must be a better way to resolve those contexts.
Could you rebase this on top of master. I got a few small merge issues, nothing major, but tests are not passing.
One problem seems to be: arquillian-service-integration-spring/src/main/java/org/jboss/arquillian/spring/integration/container/SpringContainerApplicationContextProducer
It should use InjectionProducer of type TestScopeApplicationContext not RemoteTest... for the Spring Transaction extension to find it.
When that is corrected, i'm getting a few other exceptions. EntityManager is null, Controller not injected etc..
Could you have a look ?
Could you have a look ?
Yes. Right away.
Try with this one.
awesome! Works like a charm...
squashed and pushed https://github.com/arquillian/arquillian-extension-spring/commit/7056ade4ffcf387c836edef581ecf86aaada65f4
Thanks again :)
Just some thought to share:
Considering the current implementation:
public class SpringClientInjectionEnricher extends AbstractSpringInjectionEnricher<ClientTestScopeApplicationContext> {
@Inject
private Instance<ClientTestScopeApplicationContext> testApplicationContext;
}
Do you think that it would be improvment to Arquillian if it could support injection in fallowing case:
public class AbstractSpringInjectionEnricher<T> {
@Inject
private Instance<T> testApplicationContext;
}
public class SpringClientInjectionEnricher extends AbstractSpringInjectionEnricher<ClientTestScopeApplicationContext> {
// empty
}
I've came across the typetools (https://github.com/jhalterman/typetools) that proves that such constructs could be supported as well, although it requires a bit of work to retrieve the actual type.
cc @aslakknutsen
Just some thought to share:
Considering the current implementation:
public class SpringClientInjectionEnricher extends AbstractSpringInjectionEnricher
{ @Inject private Instance<ClientTestScopeApplicationContext> testApplicationContext;
}
Do you think that it would be improvment to Arquillian if it could support injection in fallowing case:
public class AbstractSpringInjectionEnricher
{ @Inject private Instance<T> testApplicationContext;
}
public class SpringClientInjectionEnricher extends AbstractSpringInjectionEnricher
{ // empty }
I've came across the typetools (https://github.com/jhalterman/typetools) that proves that such constructs could be supported as well, although it requires a bit of work to retrieve the actual type.
I have a branch that support generics in injections using google guava's TypeToken. Currently holing it back as extracting TypeToken from guava was a lot harder then expected, it's depends more or less on the whole lib, which is 1.7mb and to big for Core.
I'm not sure I tested this specific scenario in it, but
Instance<List
For review and pull upstream.