It was from a Google search. jOOQ was the first hit:
https://www.google.com/search?q=jdbc+mocking
I know about mockito, etc (we use mockito a little already in Hibernate
tests). But when I saw that jOOQ was more JDBC specific I thoguht I'd
give it a look.
On Thu 01 Aug 2013 12:41:59 PM CDT, Lukas Eder wrote:
Hi Steve,
2013/8/1 Steve Ebersole <[email protected]
<mailto:[email protected]>>
I just ran across jOOQ after searching for ways to mock JDBC access.
May I ask you how you've found jOOQ as a JDBC mock tool? From a blog post?
Specifically, I am trying to test cross-database support for
calling stored procedures. Mocking this up for unit testing makes
a lot of sense to me before I move on to functional testing on the
actual databases because there are certain baseline assumptions
within which I'd like to test my code. For background, this is
support I have developed in Hibernate both as a native API and for
JPA 2.1 stored procedure support. So there is a certain set of
parameters defined as to how the stored procedures are called and
ultimately how the results are handled.
Unfortunately, support for CallableStatements within MockConnection is
not far developed. While I think you would get the call's JDBC escape
syntax into your MockDataProvider, I'm not sure if you'd be ready to
interact with OUT parameters, for instance. Which reminds me of having
to add a feature request for it:
https://github.com/jOOQ/jOOQ/issues/2674
In general, how would you go about mocking out the calls to JDBC?
Yes I have looked at the docs, but they all refer to having a
physical schema in place and doing some form of reverse
engineering from that schema. But I'd prefer to have no schema
and just tell jOOQ exactly what to do from my mocks (aka, return a
Result here, update counts there, mixed results for this other
thing, etc). Could anyone point me to the docs that describe how
I would go about that level of mocking, if that is possible? Or
if there is no documentation for that use case yet,
There isn't, so far. Maybe, Aaron Digulla on this list might share
some experience...?
how would I go about it in general?
If I understand you correctly, you don't really want to use jOOQ, just
jOOQ's mocking capabilities? Do note that the MockConnection can be
used with any application that runs JDBC calls. This blog post shows
how you can load a test database from a file using jOOQ's
MockFileDatabase:
-
http://www.jooq.org/javadoc/latest/org/jooq/tools/jdbc/MockFileDatabase.html
- http://blog.jooq.org/2013/02/20/easy-mocking-of-your-database
<http://blog.jooq.org/2013/02/20/easy-mocking-of-your-database/>
The MockFileDatabase is just a simple example to give you another idea
how to mock your database.
Cheers
Lukas
--
You received this message because you are subscribed to the Google Groups "jOOQ User
Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.