diff options
author | vlad <vlad@driver.xyz> | 2018-01-18 15:42:50 -0800 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2018-01-18 15:42:50 -0800 |
commit | 1cda54833c6083020ba20944319e6fb03ecfd419 (patch) | |
tree | 58c32a5791ba1e318b19b4c19ecc9f51e70e8726 /src/test/scala/xyz/driver | |
parent | 39d3c6bf58d5e386fe0f354e16f487f316e86774 (diff) | |
download | rest-query-1cda54833c6083020ba20944319e6fb03ecfd419.tar.gz rest-query-1cda54833c6083020ba20944319e6fb03ecfd419.tar.bz2 rest-query-1cda54833c6083020ba20944319e6fb03ecfd419.zip |
Removing Quill completely from the pdsui-common
Diffstat (limited to 'src/test/scala/xyz/driver')
-rw-r--r-- | src/test/scala/xyz/driver/pdsuicommon/Mocks.scala | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/test/scala/xyz/driver/pdsuicommon/Mocks.scala b/src/test/scala/xyz/driver/pdsuicommon/Mocks.scala deleted file mode 100644 index 699020c..0000000 --- a/src/test/scala/xyz/driver/pdsuicommon/Mocks.scala +++ /dev/null @@ -1,61 +0,0 @@ -package xyz.driver.pdsuicommon - -import java.io.{Closeable, PrintWriter} -import java.net.URL -import java.sql.Connection -import java.util.logging.Logger -import javax.sql.DataSource - -import xyz.driver.pdsuicommon.db.SlickQueryBuilder.TableData -import xyz.driver.pdsuicommon.db._ -import xyz.driver.pdsuicommon.http.HttpFetcher - -import scala.concurrent.Future - -class MockDataSource extends DataSource with Closeable { - override def getConnection: Connection = throw new NotImplementedError("MockDataSource.getConnection") - override def getConnection(username: String, password: String): Connection = { - throw new NotImplementedError(s"MockDataSource.getConnection($username, $password)") - } - override def close(): Unit = throw new NotImplementedError("MockDataSource.close") - override def setLogWriter(out: PrintWriter): Unit = throw new NotImplementedError("MockDataSource.setLogWriter") - override def getLoginTimeout: Int = throw new NotImplementedError("MockDataSource.getLoginTimeout") - override def setLoginTimeout(seconds: Int): Unit = throw new NotImplementedError("MockDataSource.setLoginTimeout") - override def getParentLogger: Logger = throw new NotImplementedError("MockDataSource.getParentLogger") - override def getLogWriter: PrintWriter = throw new NotImplementedError("MockDataSource.getLogWriter") - override def unwrap[T](iface: Class[T]): T = throw new NotImplementedError("MockDataSource.unwrap") - override def isWrapperFor(iface: Class[_]): Boolean = throw new NotImplementedError("MockDataSource.isWrapperFor") -} - -class MockFactory()(implicit val sqlContext: PostgresContext) { - val MockHttpFetcher: HttpFetcher = { (url: URL) => - Future.successful(Array.empty[Byte]) - } -} - -object MockQueryBuilder { - - type MockRunnerIn = (SearchFilterExpr, Sorting, Option[Pagination]) - type MockRunnerOut[T] = Future[Seq[T]] - type MockCountRunnerOut = SlickQueryBuilder.CountResult - - def apply[T](matcher: PartialFunction[MockRunnerIn, MockRunnerOut[T]])( - countMatcher: PartialFunction[MockRunnerIn, MockCountRunnerOut])( - implicit context: PostgresContext): SlickQueryBuilder[T] = { - - val runner: SlickQueryBuilder.Runner[T] = { parameters => - matcher((parameters.filter, parameters.sorting, parameters.pagination)) - } - - val countRunner: SlickQueryBuilder.CountRunner = { parameters => - countMatcher((parameters.filter, parameters.sorting, parameters.pagination)) - } - - val parameters = SlickPostgresQueryBuilderParameters( - databaseName = "test", - tableData = TableData("", None, Set.empty[String]), - links = Map.empty - ) - new SlickPostgresQueryBuilder(parameters)(runner, countRunner) - } -} |