hi,

it's possible with openejb + deltaspike-cdictrl-openejb (just limit both to
scope: test).
you can have a look e.g. at [1].

regards,
gerhard

[1] https://github.com/os890/javaee_cdi_ejb_ds_project_template



2016-02-10 10:48 GMT+01:00 alebu <[email protected]>:

> Hi all,
> I am trying to use deltaspike for testing business logic. The idea is run
> CDI container inside the junit test replacing some beans with alternatives.
> Before I tried cdi-unit but stack with bean-validation (I was not able to
> enforce method parameter validation to work as it is expected by JEE
> container). So I decided to use deltaspike for that. I succesfully
> connected hivernate-bean-validator-cdi for bean-validation, created entity
> manager that uses embedded in-memory database which is recreated on each
> test, but ran into the problem with transations. The problem is that I am
> testing code which have no idea about deltaspike and I want to keep it this
> way. I am testing class which is annotated as 'javax.ejb.Stateless' and I
> expect it to be transactional. But in my tests it not. Annotating such
> class as 'org.apache.deltaspike.jpa.api.transaction.Transactional' solves
> the problem but I can't use it becase as I said before, code under test
> should not know about deltaspike. Is there a way to force it somehow? Or
> maybe someone else uses deltaspike for testing JEE EJBs and they know some
> better strategy? Or I am overoptimistic in my expectations from deltaspike
> and I ask too much of it?
>

Reply via email to