Hello,

> I've started to write a new Xtend-based code generator for jOOQ 3.0. The
> main focus here is to simplify the code generator and to make it easy to
> reuse.

Great news!

> For my test cases, it would be great if I had a "MockDatabase" where I can
> define schemas, tables and columns in a unit test. Does something like that
> already exist?

jOOQ and jOOQ-codegen are integration tested against various similar
databases, containing all the weird corner-cases that can happen in
real life database designs (naming collisions, etc). For instance
Oracle:
https://github.com/jOOQ/jOOQ/blob/master/jOOQ-test/src/org/jooq/test/oracle/create.sql
https://github.com/jOOQ/jOOQ/blob/master/jOOQ-test/src/org/jooq/test/oracle/reset.sql

However, there is no such thing as a MockDatabase. The simplest way
for you to get going quickly is to use H2 and create this schema here:

https://github.com/jOOQ/jOOQ/blob/master/jOOQ-test/src/org/jooq/test/h2/create.sql
https://github.com/jOOQ/jOOQ/blob/master/jOOQ-test/src/org/jooq/test/h2/reset.sql

That wouldn't be "mocking" a schema, but fast enough, I guess.

Some side-notes:

- Beware that I have deprecated master data types and that I'm
planning to remove that functionality in jOOQ 3.0:
https://github.com/jOOQ/jOOQ/issues/1740. jOOQ should have enough
conversion features, such that these kinds of data types can be
generated transparently in client code.
- Neither jOOQ-meta nor jOOQ-codegen are "stable" APIs. This means
that unlike the jOOQ core, I do not officially support them and keep
them backwards-compatible. For jOOQ 3.0, they can be heavily changed
if you find some issues to be disturbing. Specifically, their
inter-dependency is probably an annoying issue for a bigger
refactoring.

Reply via email to