Hi Iva,

just sent you a pull request with a crud test using deltaspike and dbunit

https://bitbucket.org/iconte/tramponaweb-web/pull-requests/1/cadidato-crud-test/diff

hope it helps.

2016-02-11 6:33 GMT-02:00 Gerhard Petracek <[email protected]>:

> with ds-test-control you are in a java-se context (+ cdi).
> -> you need to create the entity-manager (and/or the
> entity-manager-factory) manually - see e.g. [1].
> or you can use a plugin for your cdi-container (in case of owb it's
> org.apache.openwebbeans:openwebbeans-resource)
>
> regards,
> gerhard
>
> [1]
>
> https://github.com/os890/IdeaFork/blob/preview/ideafork_core/src/test/java/at/irian/cdiatwork/ideafork/test/core/TestEntityManagerProducer.java
>
>
>
> 2016-02-11 8:40 GMT+01:00 Thomas Hug <[email protected]>:
>
> > Hi Iva,
> > As far as I see from your sample, the test crashes when producing the
> > EntityManager (NullPointer from the injected EntityManagerFactory). I'm
> > more familiar with Arquillian, anyone experience how this is done with
> > testcontrol?
> >
> > On Thu, Feb 11, 2016 at 4:56 AM, Ivá Conte <[email protected]> wrote:
> >
> > > Hi,
> > >    I'm trying to inject  a deltaspike data repository into my junit
> tests
> > > with no luck so far. I've got the following exception :
> > >
> > > IINFORMAÇÕES: [failed]
> > >
> > >
> >
> br.com.tramponaweb.test.service.DeltaSpikeDataTest#mustCallCandidatoRepository
> > > message: Failed calling Repository:
> > >
> > >
> >
> [Repository=br.com.tramponaweb.repository.CandidatoRepository,entity=br.com.tramponaweb.model.Candidato,method=findAll,exception=class
> > > org.apache.deltaspike.data.api.QueryInvocationException,message=Failed
> > > calling Repository:
> > >
> > >
> >
> [Repository=br.com.tramponaweb.repository.CandidatoRepository,entity=br.com.tramponaweb.model.Candidato,method=findAll,exception=class
> > > org.apache.deltaspike.data.api.QueryInvocationException,message=Failed
> > > calling Repository:
> > >
> > >
> >
> [Repository=br.com.tramponaweb.repository.CandidatoRepository,entity=br.com.tramponaweb.model.Candidato,method=findAll,exception=class
> > > java.lang.reflect.InvocationTargetException,message=null
> > >
> > > However, when I try to inject a regular class with simple methods,
> > > test-control module works as expected.
> > > Could you give me some help with it?
> > >
> > > here's a link for my test classes:
> > >
> > >
> >
> https://bitbucket.org/iconte/tramponaweb-web/src/5f75237f0ff2/src/test/java/br/com/tramponaweb/test/service/?at=master
> > >
> > > Regards,
> > > Iva Conte
> > >
> >
>



-- 
<http://www.advancedit.com.br/>Att,

Rafael M. Pestano

Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
http://rpestano.wordpress.com/
@realpestano <https://twitter.com/realpestano>

Reply via email to