Permalink
Browse files

Add more dbms to codegen tests

  • Loading branch information...
trevorsibanda committed Jun 16, 2017
1 parent 3e7b771 commit c150be955ecf53a3d60f55c9cb1f7113b6732c17
@@ -19,8 +19,6 @@ create table "E" (
"N" VARCHAR NULL DEFAULT(NULL)
);
create table "SIMPLE_AS" ("A1" INTEGER NOT NULL,"A2" VARCHAR NOT NULL);
CREATE TABLE "PERSON"(
"ID" NUMBER(11,0) NOT NULL,
"PERSON_TYPE" CHAR(1) DEFAULT 'Y' NOT NULL
@@ -24,6 +24,8 @@ object GenerateMainSources extends TestCodeGenerator {
new Config("CG1", StandardTestDBs.H2Mem, "H2Mem", Seq("/dbs/h2.sql")),
new Config("CG2", StandardTestDBs.HsqldbMem, "HsqldbMem", Seq("/dbs/hsqldb.sql")),
new Config("CG3", StandardTestDBs.SQLiteMem, "SQLiteMem", Seq("/dbs/sqlite.sql")),
new Config("DB2", StandardTestDBs.DB2, "DB2", Seq("/dbs/db2.sql")),
new Config("DerbyMem", StandardTestDBs.DerbyMem, "DerbyMem", Seq("/dbs/derby.sql")),
new Config("CG7", StandardTestDBs.H2Mem, "H2Mem", Seq("/dbs/h2.sql")) {
override def generator = tdb.profile.createModel(ignoreInvalidDefaults=false).map(new MyGen(_) {
override def entityName = {
@@ -115,7 +117,7 @@ val SimpleA = CustomTyping.SimpleA
| ).transactionally
""".stripMargin
},
new UUIDConfig("Postgres2", StandardTestDBs.Postgres, "Postgres", Seq("/dbs/uuid-postgres.sql")),
new UUIDConfig("Postgres2", StandardTestDBs.Postgres, "Postgres", Seq("/dbs/uuid-postgres.sql")),
new Config("Postgres3", StandardTestDBs.Postgres, "Postgres", Seq("/dbs/postgres.sql")) {
override def testCode: String =
"""import slick.ast.{FieldSymbol, Select}
@@ -171,9 +171,6 @@ object StandardTestDBs {
} yield ()))
}
override def cleanUpAfter(): Unit =
await(databaseFor("adminConn").run(dropSchema))
override def dropUserArtifacts(implicit session: profile.Backend#Session) = {
session.close()
cleanUpBefore()
@@ -7,7 +7,7 @@ import com.typesafe.slick.testkit.util.{DBTest, DBTestObject, JdbcTestDB}
import com.typesafe.slick.testkit.util.StandardTestDBs._
import scala.concurrent.ExecutionContext.Implicits.global
object CodeGeneratorRoundTripTest extends DBTestObject(H2Mem, SQLiteMem, Postgres, MySQL, DerbyMem, HsqldbMem)
object CodeGeneratorRoundTripTest extends DBTestObject(H2Mem, SQLiteMem, Postgres, MySQL, DerbyMem, HsqldbMem, SQLServerJTDS, SQLServerSQLJDBC)
class CodeGeneratorRoundTripTest(val tdb: JdbcTestDB) extends DBTest {
import tdb.profile.api._
@@ -31,8 +31,15 @@ class CodeGeneratorRoundTripTest(val tdb: JdbcTestDB) extends DBTest {
Categories += CategoriesRow(2,"cat"),
Posts.length.result.zip(Posts.filter(_.title =!= "post 1").map(_.title).to[List].result).map(res => assertEquals((3,List("post 2","post 3")), res)),
sql"""select * from #${quoteIdentifier("POSTS")} where #${quoteIdentifier("id")} = 2""".as[PostsRow].head.map(res => assertEquals(PostsRow(2,"post 2",Some(1)), res)),
SelfRef.forceInsert(SelfRefRow(1,None)),
SelfRef.forceInsert(SelfRefRow(2,Some(1))),
{
import slick.jdbc.JdbcCapabilities
if(tdb.profile.capabilities.contains(JdbcCapabilities.forceInsert)){
DBIO.seq(
SelfRef.forceInsert(SelfRefRow(1,None)),
SelfRef.forceInsert(SelfRefRow(2,Some(1))))
}else
DBIO.seq()
},
SelfRef.result,
{
// Testing table larger 22 columns
@@ -8,7 +8,7 @@ import slick.codegen.SourceCodeGenerator
import com.typesafe.slick.testkit.util.{DBTest, DBTestObject, JdbcTestDB}
import com.typesafe.slick.testkit.util.StandardTestDBs._
object CodeGeneratorAllTest extends DBTestObject(H2Mem, SQLiteMem, Postgres, MySQL, DerbyMem, HsqldbMem)
object CodeGeneratorAllTest extends DBTestObject(H2Mem, SQLiteMem, Postgres, MySQL, DerbyMem, HsqldbMem, SQLServerJTDS, SQLServerSQLJDBC)
class CodeGeneratorAllTest(val tdb: JdbcTestDB) extends DBTest {
import tdb.profile.api._
@@ -154,6 +154,13 @@ object GeneratedCodeTest {
)
}
def testDerby = testEmptyDB
def testDerbyMem = testEmptyDB
def testDerbyDisk = testEmptyDB
def testMySQL = testEmptyDB
def testSqlServer = testEmptyDB
def testDB2 = testEmptyDB
def testEmptyDB = slick.dbio.DBIO.successful(())
def tableName( node:Node ) : String = {

0 comments on commit c150be9

Please sign in to comment.