[jbosstools-dev] CDI Tools. What's next?

Max Rydahl Andersen max.andersen at redhat.com
Thu Aug 23 03:48:21 EDT 2012


> As I read idea #4 (diagram), I wonder if it would be possible to have some Arquillian tooling based on the CDI context to generate something like this:
> 
> package org.arquillian.example;
> 
> 
> 
> import org.jboss.arquillian.container.test.api.Deployment;
> import org.jboss.arquillian.junit.Arquillian;
> import org.jboss.shrinkwrap.api.ShrinkWrap;
> import org.jboss.shrinkwrap.api.asset.EmptyAsset;
> import org.jboss.shrinkwrap.api.spec.JavaArchive;
> import org.junit.runner.RunWith;
> 
> 
> 
> @RunWith(Arquillian.class)
> public class BasketTest {
> 
>     
> @Deployment
> 
>     
> public static JavaArchive createDeployment() {
> 
>         
> return ShrinkWrap.create(JavaArchive.class, "test.jar")
> 
>             
> .addClasses(Basket.class, OrderRepository.class, SingletonOrderRepository.class)
> 
>             
> .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
> 
>     
> }
> }
> The idea would be that from a custom Arquillian Test wizard, you could specifiy with Bean is to be tested, and then generate the proper test skeleton, including the 'createDeployment()' method.

Something like https://issues.jboss.org/browse/JBIDE-8553 ?
 
> Also, some validation tooling could report problems if other required beans (that are injected in the one to be tested) are not declared in the archive.
> I understand that it does not cover all use cases, especially when m2 dependencies should be included in the test archive, but it could be a starting point..

Sounds good, but not sure if this last one is technical feasible since you would actually need to *execute* the @deployment method to validate it....aka. run the test.

thoughts ?

/max




More information about the jbosstools-dev mailing list