Search in sources :

Example 1 with InMemoryCompiler

use of org.libj.jci.InMemoryCompiler in project jaxdb by jaxdb.

the class JSqlTest method createEntities.

static void createEntities(final String name) throws CompilationException, GeneratorExecutionException, IOException, SAXException, TransformerException {
    final URL url = assertNotNull(ClassLoader.getSystemClassLoader().getResource(name + ".ddlx"));
    final File destDir = new File("target/generated-test-sources/jaxdb");
    Generator.generate(url, name, destDir);
    final InMemoryCompiler compiler = new InMemoryCompiler();
    Files.walk(destDir.toPath()).filter(p -> p.getFileName().toString().endsWith(".java")).forEach(rethrow((Path p) -> compiler.addSource(new String(Files.readAllBytes(p)))));
    compiler.compile(destDir, "-g");
}
Also used : Bindings(org.jaxsb.runtime.Bindings) Connection(java.sql.Connection) DDLx(org.jaxdb.ddlx.DDLx) InMemoryCompiler(org.libj.jci.InMemoryCompiler) TransformerException(javax.xml.transform.TransformerException) Files(java.nio.file.Files) URL(java.net.URL) org.jaxdb.www.sqlx_0_5.xLygluGCXAA.$Database(org.jaxdb.www.sqlx_0_5.xLygluGCXAA.$Database) IOException(java.io.IOException) File(java.io.File) SQLException(java.sql.SQLException) GeneratorExecutionException(org.jaxdb.ddlx.GeneratorExecutionException) DML(org.jaxdb.jsql.DML) Schemas(org.jaxdb.ddlx.Schemas) Generator(org.jaxdb.jsql.generator.Generator) SAXException(org.xml.sax.SAXException) DBVendor(org.jaxdb.vendor.DBVendor) Throwing(org.libj.util.function.Throwing) CompilationException(org.libj.jci.CompilationException) Assert(org.junit.Assert) Path(java.nio.file.Path) Assertions.assertNotNull(org.libj.lang.Assertions.assertNotNull) Path(java.nio.file.Path) InMemoryCompiler(org.libj.jci.InMemoryCompiler) File(java.io.File) URL(java.net.URL)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 URL (java.net.URL)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 TransformerException (javax.xml.transform.TransformerException)1 DDLx (org.jaxdb.ddlx.DDLx)1 GeneratorExecutionException (org.jaxdb.ddlx.GeneratorExecutionException)1 Schemas (org.jaxdb.ddlx.Schemas)1 DML (org.jaxdb.jsql.DML)1 Generator (org.jaxdb.jsql.generator.Generator)1 DBVendor (org.jaxdb.vendor.DBVendor)1 org.jaxdb.www.sqlx_0_5.xLygluGCXAA.$Database (org.jaxdb.www.sqlx_0_5.xLygluGCXAA.$Database)1 Bindings (org.jaxsb.runtime.Bindings)1 Assert (org.junit.Assert)1 CompilationException (org.libj.jci.CompilationException)1 InMemoryCompiler (org.libj.jci.InMemoryCompiler)1 Assertions.assertNotNull (org.libj.lang.Assertions.assertNotNull)1