[
https://issues.apache.org/jira/browse/DELTASPIKE-760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gerhard Petracek updated DELTASPIKE-760:
----------------------------------------
Component/s: (was: TestControl)
CdiControl
> TestControl module creates Applicationscoped beans more than once for single
> test
> ---------------------------------------------------------------------------------
>
> Key: DELTASPIKE-760
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-760
> Project: DeltaSpike
> Issue Type: Bug
> Components: CdiControl
> Affects Versions: 1.0.3
> Reporter: Björn Schmidt
>
> I have a test that is @RunWith(CdiTestRunner.class), is @Injecting an
> @ApplicationScopedBean1 which itself @Injects another @ApplicationScopedBean2
> and then I have another @Inject directly in the test class which also
> @Injects the @ApplicationScopedBean2.
> The CDI implementation used is Weld-SE
> ApplicationScopedBean2 contains a cache.
> What's happeneing is, that ApplicationScopedBean2 gets created twice, once
> for ApplicationScopedBean1 and once for the test class.
> So when I then call ApplicationScopedBean2.invalidateMyCache() in the test
> and then ask
> ApplicationScopedBean1.getSomethingFromYourApplicationScopedBean2sCache, then
> because its two different beans I still get some cached values. Of course all
> calls are done within the same test method!
> Deployed on a server the whole thing works as expected, only one bean of type
> ApplicationScopedBean2 is being created.
> But the whole purpose of having DeltaSpike is to be able to test stuff
> exactly as it would be on the server, right?
> So I'm not sure, if this is a Bug, a known limitation (couldn't find anything
> about that) or a configuration problem with my test setup.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)