You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Gerhard Petracek (JIRA)" <ji...@apache.org> on 2014/10/31 11:42:33 UTC

[jira] [Commented] (DELTASPIKE-760) TestControl module creates Applicationscoped beans more than once for single test

    [ https://issues.apache.org/jira/browse/DELTASPIKE-760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14191674#comment-14191674 ] 

Gerhard Petracek commented on DELTASPIKE-760:
---------------------------------------------

i can't reproduce it -> please provide a link to a demo-app which illustrates the issue.

> 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
>            Assignee: Mark Struberg
>
> 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)