-
1. Re: Why CDI works with the managed container?
aslak Feb 11, 2015 8:30 AM (in response to tungtd)Not sure I understand the question. Why wouldn't it work?
Managed/Remote/Embedded containers are the 'same' in that respect. We still deploy to the container and run the test in side the container. All of them have access to CDI.
You might be mixing this with RunMode, where if you RunAsClient you won't have access to CDI because it exists in the Container only.
-
2. Re: Why CDI works with the managed container?
tungtd Feb 11, 2015 10:01 PM (in response to aslak)Because according to the guy in the video said that:"Managed container run on different JVM with the test.". I can't picture how we consumed the Java EE resource outside the container. Is that true if I said the test method without @RunAsClient is run outside the container?
-
3. Re: Why CDI works with the managed container?
aslak Feb 13, 2015 6:58 AM (in response to tungtd)1 of 1 people found this helpful"The guy in the video" is me..
And correct, ManagedContainers run in a different JVM then from where the test is launched, but.. the actual execution of the Test it self is 'forwarded' to this new JVM and are still executed incontainer with full access to the services provided by the container.
Technically when JUnit is launched from e.g. IDE the @Test method is overridden, invokes a Sevlet that is deployed in the container which again 'restarts the Test and executes the @Test method in side the new JVM and container. Then return the result back to the IDE as if it were executed in the same JVM.
-
4. Re: Why CDI works with the managed container?
tungtd Feb 13, 2015 9:51 PM (in response to aslak)I have to say "Wow". It's too complicated. Thank you Aslak