2016-08-25 16:03 GMT+02:00 Rafael Pestano <[email protected]>:

> yea agreed but he is also 'faking' with the in memory db. I use a lot this
> setup to test business logic (where db interation is not so important)
> without needing to use a mock framework to fake db calls.
>
>
With h2 compatibility mode it is not that much faking and even with hsqldb.
Issue is tx mgt and commit logic. Can behave very differently between
RESOURCE_LOCAL and JTA and also enable CDI JTA integration to work in tests.


> In practice I did not have much surprises but agree that a test which is
> closer to production gives much more confidence to make changes in code
> base but on the other hand it is more complex to maintain such setup.
>
>
>
I did - or users did - that's why I mention it ;)


>
> 2016-08-25 10:43 GMT-03:00 Romain Manni-Bucau <[email protected]>:
>
> > @Rafael: take care with this solution, using RESOURCE_LOCAL you will not
> > test your application runtime and can get surprises even with one million
> > tests green
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> > rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-08-25 15:41 GMT+02:00 Rafael Pestano <[email protected]>:
> >
> > > Hi Dmitry,
> > >
> > > another approach is to have a dedicated persistence.xml in test
> > resources,
> > > see [1].
> > >
> > > In this case (for deltaspike) you'll probably need to produce a test
> > entity
> > > manager using test persistence like in [2].
> > >
> > > Hope it helps.
> > >
> > > [1]
> > > https://github.com/rmpestano/dbunit-rules/blob/master/
> > > examples/src/test/resources/META-INF/persistence.xml
> > > [2]
> > > https://github.com/rmpestano/dbunit-rules/blob/master/
> > > examples/src/test/java/com/github/dbunit/rules/examples/
> > CdiTestConfig.java
> > >
> > >
> > > 2016-08-25 3:46 GMT-03:00 Romain Manni-Bucau <[email protected]>:
> > >
> > > > Hi
> > > >
> > > > this way to test is kind of legacy, you can have a look to
> > > > http://tomee.apache.org/ng/developer/testing/index.html
> > > >
> > > > System properties will still override the persistence unit values.
> IIRC
> > > you
> > > > can also use placeholders if you deploy in tomee too
> > > > (value="${systemproperty key}")
> > > >
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > > > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> > > > rmannibucau> |
> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > <http://www.tomitribe.com> | JavaEE Factory
> > > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > > >
> > > > 2016-08-25 1:02 GMT+02:00 dimas <[email protected]>:
> > > >
> > > > > Hi,
> > > > >
> > > > > I want to use different db dialect in my unit tests (because I want
> > to
> > > > use
> > > > > in Hsql instead of Postgres). In order to do that i have to change
> > the
> > > > > 'hibernate-dialect' persistence-unit property. Found this page:
> > > > > http://tomee.apache.org/configuring-persistenceunits-in-tests.html
> > > > >
> > > > > But I'm not sure how to initialise the InitialContext in my tests
> > (run
> > > by
> > > > > Deltaspike test control). Or may be there is a different way to
> > > approach
> > > > > this.
> > > > >
> > > > > Dmitry
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > View this message in context: http://tomee-openejb.979440.
> > > > > n4.nabble.com/persistence-xml-for-unit-tests-tp4679874.html
> > > > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Att,
> > >
> > > Rafael M. Pestano
> > >
> > > Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
> > > http://rpestano.wordpress.com/
> > > @realpestano
> > >
> >
>
>
>
> --
> Att,
>
> Rafael M. Pestano
>
> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
> http://rpestano.wordpress.com/
> @realpestano
>

Reply via email to