-
-
Notifications
You must be signed in to change notification settings - Fork 608
/
MyPostgresTest.scala
30 lines (27 loc) · 1.15 KB
/
MyPostgresTest.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.example
import org.junit.runner.RunWith
import com.typesafe.slick.testkit.util.{ExternalJdbcTestDB, TestDB, ProfileTest, Testkit}
import scala.concurrent.ExecutionContext
import slick.jdbc.ResultSetAction
import slick.dbio.DBIO
import slick.jdbc.GetResult._
//#outline
@RunWith(classOf[Testkit])
class MyPostgresTest extends ProfileTest(MyPostgresTest.tdb)
object MyPostgresTest {
//#tdb
def tdb = new ExternalJdbcTestDB("mypostgres") {
//#tdb
val profile = MyPostgresProfile
override def localTables(implicit ec: ExecutionContext): DBIO[Vector[String]] =
ResultSetAction[(String,String,String, String)](_.conn.getMetaData().getTables("", "public", null, null)).map { ts =>
ts.filter(_._4.toUpperCase == "TABLE").map(_._3).sorted
}
override def localSequences(implicit ec: ExecutionContext): DBIO[Vector[String]] =
ResultSetAction[(String,String,String, String)](_.conn.getMetaData().getTables("", "public", null, null)).map { ts =>
ts.filter(_._4.toUpperCase == "SEQUENCE").map(_._3).sorted
}
override def capabilities = super.capabilities - TestDB.capabilities.jdbcMetaGetFunctions
}
}
//#outline