Skip to content

Commit

Permalink
#125: Move code into sub-package db
Browse files Browse the repository at this point in the history
* moving code into `db` sub-package
* tests are not executed in parallel
  • Loading branch information
benedeki committed Jun 28, 2024
1 parent d459a60 commit f56e43a
Show file tree
Hide file tree
Showing 65 changed files with 195 additions and 199 deletions.
30 changes: 13 additions & 17 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ lazy val commonJacocoReportSettings: JacocoReportSettings = JacocoReportSettings
lazy val commonJacocoExcludes: Seq[String] = Seq(
)

lazy val commonSettings = Seq(
javacOptions ++= commonJavacOptions,
scalacOptions ++= commonScalacOptions,
Test / parallelExecution := false,
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value, // printScalaVersion is run with compile
jacocoExcludes := commonJacocoExcludes
)

lazy val parent = (project in file("."))
.aggregate(faDbCore, faDBSlick, faDBDoobie)
.settings(
Expand All @@ -59,42 +67,30 @@ lazy val parent = (project in file("."))
)

lazy val faDbCore = (project in file("core"))
.settings(commonSettings: _*)
.settings(
name := "core",
libraryDependencies ++= coreDependencies(scalaVersion.value),
javacOptions ++= commonJavacOptions,
scalacOptions ++= commonScalacOptions,
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value, // printScalaVersion is run with compile
)
.settings(
jacocoReportSettings := commonJacocoReportSettings.withTitle(s"fa-db:core Jacoco Report - scala:${scalaVersion.value}"),
jacocoExcludes := commonJacocoExcludes
)

lazy val faDBSlick = (project in file("slick"))
.settings(commonSettings: _*)
.settings(
name := "slick",
libraryDependencies ++= slickDependencies(scalaVersion.value),
javacOptions ++= commonJavacOptions,
scalacOptions ++= commonScalacOptions,
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value, // printScalaVersion is run with compile
).dependsOn(faDbCore)
.settings(
jacocoReportSettings := commonJacocoReportSettings.withTitle(s"fa-db:slick Jacoco Report - scala:${scalaVersion.value}"),
jacocoExcludes := commonJacocoExcludes
)
.dependsOn(faDbCore)

lazy val faDBDoobie = (project in file("doobie"))
.settings(commonSettings: _*)
.settings(
name := "doobie",
libraryDependencies ++= doobieDependencies(scalaVersion.value),
javacOptions ++= commonJavacOptions,
scalacOptions ++= commonScalacOptions,
).dependsOn(faDbCore)
.settings(
jacocoReportSettings := commonJacocoReportSettings.withTitle(s"fa-db:doobie Jacoco Report - scala:${scalaVersion.value}"),
jacocoExcludes := commonJacocoExcludes
)
.dependsOn(faDbCore)

lazy val flywaySettings = project
.enablePlugins(FlywayPlugin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import cats.Monad
import cats.implicits.toFunctorOps
import za.co.absa.fadb.status.FailedOrRow
import za.co.absa.db.fadb.status.FailedOrRow

import scala.language.higherKinds

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import cats.MonadError
import cats.implicits.toFlatMapOps
import za.co.absa.fadb.status.aggregation.StatusAggregator
import za.co.absa.fadb.status.handling.StatusHandling
import za.co.absa.fadb.status.{FailedOrRows, FailedOrRow, Row}
import za.co.absa.db.fadb.status.aggregation.StatusAggregator
import za.co.absa.db.fadb.status.handling.StatusHandling
import za.co.absa.db.fadb.status.{FailedOrRows, FailedOrRow, Row}

import scala.language.higherKinds

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

/**
* This trait serves the purpose of introducing functions that are common to all DB Function objects and mix-in traits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import za.co.absa.fadb.naming.NamingConvention
import za.co.absa.db.fadb.naming.NamingConvention

/**
* An abstract class, an ancestor to represent a database schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import za.co.absa.fadb.status.{FailedOrRow, Row}
import za.co.absa.db.fadb.status.{FailedOrRow, Row}

/**
* The basis for all query types of [[DBEngine]] implementations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package za.co.absa.fadb.exceptions
package za.co.absa.db.fadb.exceptions

/**
* Exception thrown when a naming convention is not found for a given string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb.exceptions
package za.co.absa.db.fadb.exceptions

import za.co.absa.fadb.status.FunctionStatus
import za.co.absa.db.fadb.status.FunctionStatus

/**
* Represents an exception that is returned when the function status is not successful.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming
package za.co.absa.db.fadb.naming

import za.co.absa.fadb.exceptions.NamingException
import za.co.absa.db.fadb.exceptions.NamingException

/**
* `ExplicitNamingRequired` is a `NamingConvention` that throws a `NamingConvention` for any string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming
package za.co.absa.db.fadb.naming

/**
* `LettersCase` is a sealed trait that represents different cases of letters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming
package za.co.absa.db.fadb.naming

/**
* `NamingConvention` is a base trait that defines the interface for different naming conventions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming.implementations
package za.co.absa.db.fadb.naming.implementations

import za.co.absa.fadb.naming.{LettersCase, NamingConvention}
import za.co.absa.db.fadb.naming.{LettersCase, NamingConvention}
import LettersCase.AsIs

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming.implementations
package za.co.absa.db.fadb.naming.implementations

import za.co.absa.fadb.naming.{LettersCase, NamingConvention}
import za.co.absa.db.fadb.naming.{LettersCase, NamingConvention}
import LettersCase.LowerCase

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.aggregation
package za.co.absa.db.fadb.status.aggregation

import za.co.absa.fadb.exceptions.StatusException
import za.co.absa.fadb.status.{FailedOrRows, FailedOrRow, Row}
import za.co.absa.db.fadb.exceptions.StatusException
import za.co.absa.db.fadb.status.{FailedOrRows, FailedOrRow, Row}

/**
* `StatusAggregator` is a base trait that defines the interface for aggregating the error statuses of a function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.aggregation.implementations
package za.co.absa.db.fadb.status.aggregation.implementations

import za.co.absa.fadb.status.aggregation.StatusAggregator
import za.co.absa.fadb.status.{FailedOrRows, FailedOrRow}
import za.co.absa.db.fadb.status.aggregation.StatusAggregator
import za.co.absa.db.fadb.status.{FailedOrRows, FailedOrRow}

/**
* `ByFirstErrorStatusAggregator` is a trait that extends the `StatusAggregator` interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.aggregation.implementations
package za.co.absa.db.fadb.status.aggregation.implementations

import za.co.absa.fadb.status.aggregation.StatusAggregator
import za.co.absa.fadb.status.{FailedOrRows, FailedOrRow}
import za.co.absa.db.fadb.status.aggregation.StatusAggregator
import za.co.absa.db.fadb.status.{FailedOrRows, FailedOrRow}

/**
* `ByFirstRowStatusAggregator` is a trait that extends the `StatusAggregator` interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.aggregation.implementations
package za.co.absa.db.fadb.status.aggregation.implementations

import za.co.absa.fadb.status.aggregation.StatusAggregator
import za.co.absa.fadb.status.{FailedOrRows, FailedOrRow}
import za.co.absa.db.fadb.status.aggregation.StatusAggregator
import za.co.absa.db.fadb.status.{FailedOrRows, FailedOrRow}

/**
* `ByMajorityErrorsStatusAggregator` is a trait that extends the `StatusAggregator` interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.handling
package za.co.absa.db.fadb.status.handling

import za.co.absa.fadb.status.{FailedOrRow, Row}
import za.co.absa.db.fadb.status.{FailedOrRow, Row}

/**
* `StatusHandling` is a base trait that defines the interface for handling the status of a function invocation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.handling.implementations
package za.co.absa.db.fadb.status.handling.implementations

import za.co.absa.fadb.exceptions._
import za.co.absa.fadb.status.{FailedOrRow, Row}
import za.co.absa.fadb.status.handling.StatusHandling
import za.co.absa.db.fadb.exceptions._
import za.co.absa.db.fadb.status.{FailedOrRow, Row}
import za.co.absa.db.fadb.status.handling.StatusHandling

/**
* `StandardStatusHandling` is a trait that extends the `StatusHandling` interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.handling.implementations
package za.co.absa.db.fadb.status.handling.implementations

import za.co.absa.fadb.exceptions.OtherStatusException
import za.co.absa.fadb.status.handling.StatusHandling
import za.co.absa.fadb.status.{FailedOrRow, Row}
import za.co.absa.db.fadb.exceptions.OtherStatusException
import za.co.absa.db.fadb.status.handling.StatusHandling
import za.co.absa.db.fadb.status.{FailedOrRow, Row}

/**
* Trait represents user defined status handling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import za.co.absa.fadb.exceptions.StatusException
import za.co.absa.db.fadb.exceptions.StatusException

package object status {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package za.co.absa.fadb
package za.co.absa.db.fadb

import org.scalatest.funsuite.AnyFunSuiteLike

import za.co.absa.fadb.naming.implementations.SnakeCaseNaming.Implicits._
import za.co.absa.db.fadb.naming.implementations.SnakeCaseNaming.Implicits._

class DBFunctionFabricUnitTests extends AnyFunSuiteLike {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import cats.MonadError
import cats.implicits._
import org.scalatest.funsuite.AnyFunSuite
import za.co.absa.fadb.DBFunction.DBSingleResultFunction
import za.co.absa.fadb.naming.implementations.SnakeCaseNaming.Implicits.namingConvention
import za.co.absa.fadb.status.FailedOrRow
import za.co.absa.db.fadb.DBFunction.DBSingleResultFunction
import za.co.absa.db.fadb.naming.implementations.SnakeCaseNaming.Implicits.namingConvention
import za.co.absa.db.fadb.status.FailedOrRow

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import org.scalatest.funsuite.AnyFunSuite
import za.co.absa.fadb.naming.NamingConvention
import za.co.absa.fadb.naming.implementations.SnakeCaseNaming.Implicits.namingConvention
import za.co.absa.db.fadb.naming.NamingConvention
import za.co.absa.db.fadb.naming.implementations.SnakeCaseNaming.Implicits.namingConvention

class DBSchemaUnitTests extends AnyFunSuite {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming
package za.co.absa.db.fadb.naming

import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec
import za.co.absa.fadb.exceptions.NamingException
import za.co.absa.db.fadb.exceptions.NamingException

class ExplicitNamingRequiredPerConventionUnitTests extends AnyWordSpec with Matchers {
private val explicitNamingRequired = new ExplicitNamingRequired()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming
package za.co.absa.db.fadb.naming

import org.scalatest.funsuite.AnyFunSuiteLike
import za.co.absa.fadb.exceptions.NamingException
import za.co.absa.db.fadb.exceptions.NamingException

class ExplicitNamingRequiredUnitTests extends AnyFunSuiteLike {

Expand Down
Loading

0 comments on commit f56e43a

Please sign in to comment.