Hi all,
I have merged initial support for the embedded profile to the master branch.
The basic setup is the same as the IronJacamar 1.x series, just a package name change, so not a lot of news in that area.
However, I have added a JUnit4 testing extension which supports all stages of our bootstrap:
https://github.com/ironjacamar/ironjacamar/blob/master/testsuite/src/test/java/org/ironjacamar/embeddded/junit4/JUnit4TestCase.javaStep 1: @Configuration
The org.ironjacamar.embedded.Configuration annotation is read (if present), and the embedded environment is setup based on the specified settings.
Currently it supports 'full' attribute which specifies if a full profile of the IronJacamar container with all its dependencies should be activated. A value of 'false' will just give the kernel environment.
We can add more settings in future versions which interacts with the deployed beans.
Step 2: Static @Deployment
Static org.ironjacamar.embedded.Deployment annotations are read, and the deployments are processed in the order defined.
The deployment method can take parameters, which can be initialized with the javax.inject.Inject and javax.inject.Named annotations. If no @Named annotation exists the simple class name is used as a name lookup in the kernel.
Step 3: Static @Inject
Static javax.inject.Inject annotations are processed, and the values are injected. A javax.inject.Named annotation can be used to specify the bean name, otherwise the simple class name will be used as a name lookup in the kernel.
Step 4: Static @Resource
Static javax.annotation.Resource annotations are processed, and the values are injected based on JNDI lookups through the 'mappedName' attribute.
Step 5: @BeforeClass
JUnit4's @BeforeClass annotation(s) is executed.
Here we can do pre-condition checks on the environment.
Step 6: Non-static @Deployment
Non-static org.ironjacamar.embedded.Deployment annotations are read, and the deployments are processed in the order defined.
The
deployment method can take parameters, which can be initialized with
the javax.inject.Inject and javax.inject.Named annotations. If no @Named
annotation exists the simple class name is used as a name lookup in the kernel.
Step 7: Non-static @Inject
Non-static
javax.inject.Inject annotations are processed, and the values are
injected. A javax.inject.Named annotation can be used to specify the
bean name, otherwise the simple class name will be used as a name lookup
in the kernel.
Step 8: Non-static @Resource
Non-static
javax.annotation.Resource annotations are processed, and the values are
injected based on JNDI lookups through the 'mappedName' attribute.
Step 9: @Before
JUnit4's @Before annotation(s) is executed.
Step 10: @Test
The JUnit4 test method executes.
Step 11: @After
JUnit4's @After annotation(s) is executed.
Step 12: Non-static cleanup
Fields related to step 8 and 7 are cleared. Deployments defined in step 6 are undeployed.
Step 6 through 12 are repeated for each test.Step 13: @AfterClass
JUnit4's @AfterClass is executed, and post-conditions on the environment can be performed.
Step 14: Static cleanup
Fields related to step 4 and 3 are cleared, and deployments defined in step 2 are undeployed.
So, this gives a very fine grained lifecycle, and give us options to verify the environment and deployments at various levels. It goes without saying (right?) that this setup should be used for all test cases that aren't strictly POJO based.
The API will improve over time based on requirements, and ease of use. F.ex. the API for the XSDs is missing atm, but will show up in a later commit.
Hope this gives an idea of where future resource adapter testing is heading :)