Skip to content

Commit dcf14b2

Browse files
authored
#125: Move code into sub-package db (#128)
* moving code into `db` sub-package * tests are not executed in parallel * moved testing classes to own folder
1 parent d459a60 commit dcf14b2

File tree

66 files changed

+213
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+213
-204
lines changed

.github/workflows/test_filenames_check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ jobs:
3636
name-patterns: '*UnitTests.*,*IntegrationTests.*'
3737
paths: '**/src/test/scala/**'
3838
report-format: 'console'
39-
excludes: 'slick/src/test/scala/za/co/absa/fadb/slick/Actor.scala,slick/src/test/scala/za/co/absa/fadb/slick/ActorSlickConverter.scala,slick/src/test/scala/za/co/absa/fadb/slick/SlickTest.scala,doobie/src/test/scala/za/co/absa/fadb/doobie/DoobieTest.scala,slick/src/test/scala/za/co/absa/fadb/slick/OptionalActorSlickConverter.scala'
39+
excludes: '**/src/test/scala/za/co/absa/db/fadb/testing/**'
4040
verbose-logging: 'false'
4141
fail-on-violation: 'true'

build.sbt

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,20 @@ lazy val commonJacocoReportSettings: JacocoReportSettings = JacocoReportSettings
4242
)
4343

4444
/**
45-
* add `za.co.absa.fadb.naming.NamingConvention` to filter a class
46-
* or `za.co.absa.fadb.naming.NamingConvention*` to filter the class and all related objects
45+
* add `za.co.absa.db.fadb.naming.NamingConvention` to filter a class
46+
* or `za.co.absa.db.fadb.naming.NamingConvention*` to filter the class and all related objects
4747
*/
4848
lazy val commonJacocoExcludes: Seq[String] = Seq(
4949
)
5050

51+
lazy val commonSettings = Seq(
52+
javacOptions ++= commonJavacOptions,
53+
scalacOptions ++= commonScalacOptions,
54+
Test / parallelExecution := false,
55+
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value, // printScalaVersion is run with compile
56+
jacocoExcludes := commonJacocoExcludes
57+
)
58+
5159
lazy val parent = (project in file("."))
5260
.aggregate(faDbCore, faDBSlick, faDBDoobie)
5361
.settings(
@@ -59,42 +67,30 @@ lazy val parent = (project in file("."))
5967
)
6068

6169
lazy val faDbCore = (project in file("core"))
70+
.settings(commonSettings: _*)
6271
.settings(
6372
name := "core",
6473
libraryDependencies ++= coreDependencies(scalaVersion.value),
65-
javacOptions ++= commonJavacOptions,
66-
scalacOptions ++= commonScalacOptions,
67-
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value, // printScalaVersion is run with compile
68-
)
69-
.settings(
7074
jacocoReportSettings := commonJacocoReportSettings.withTitle(s"fa-db:core Jacoco Report - scala:${scalaVersion.value}"),
71-
jacocoExcludes := commonJacocoExcludes
7275
)
7376

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

8786
lazy val faDBDoobie = (project in file("doobie"))
87+
.settings(commonSettings: _*)
8888
.settings(
8989
name := "doobie",
9090
libraryDependencies ++= doobieDependencies(scalaVersion.value),
91-
javacOptions ++= commonJavacOptions,
92-
scalacOptions ++= commonScalacOptions,
93-
).dependsOn(faDbCore)
94-
.settings(
9591
jacocoReportSettings := commonJacocoReportSettings.withTitle(s"fa-db:doobie Jacoco Report - scala:${scalaVersion.value}"),
96-
jacocoExcludes := commonJacocoExcludes
9792
)
93+
.dependsOn(faDbCore)
9894

9995
lazy val flywaySettings = project
10096
.enablePlugins(FlywayPlugin)

core/src/main/scala/za/co/absa/fadb/DBEngine.scala renamed to core/src/main/scala/za/co/absa/db/fadb/DBEngine.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
package za.co.absa.fadb
17+
package za.co.absa.db.fadb
1818

1919
import cats.Monad
2020
import cats.implicits.toFunctorOps
21-
import za.co.absa.fadb.status.FailedOrRow
21+
import za.co.absa.db.fadb.status.FailedOrRow
2222

2323
import scala.language.higherKinds
2424

core/src/main/scala/za/co/absa/fadb/DBFunction.scala renamed to core/src/main/scala/za/co/absa/db/fadb/DBFunction.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17-
package za.co.absa.fadb
17+
package za.co.absa.db.fadb
1818

1919
import cats.MonadError
2020
import cats.implicits.toFlatMapOps
21-
import za.co.absa.fadb.status.aggregation.StatusAggregator
22-
import za.co.absa.fadb.status.handling.StatusHandling
23-
import za.co.absa.fadb.status.{FailedOrRows, FailedOrRow, Row}
21+
import za.co.absa.db.fadb.status.aggregation.StatusAggregator
22+
import za.co.absa.db.fadb.status.handling.StatusHandling
23+
import za.co.absa.db.fadb.status.{FailedOrRows, FailedOrRow, Row}
2424

2525
import scala.language.higherKinds
2626

core/src/main/scala/za/co/absa/fadb/DBFunctionFabric.scala renamed to core/src/main/scala/za/co/absa/db/fadb/DBFunctionFabric.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package za.co.absa.fadb
17+
package za.co.absa.db.fadb
1818

1919
/**
2020
* This trait serves the purpose of introducing functions that are common to all DB Function objects and mix-in traits

core/src/main/scala/za/co/absa/fadb/DBSchema.scala renamed to core/src/main/scala/za/co/absa/db/fadb/DBSchema.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
package za.co.absa.fadb
17+
package za.co.absa.db.fadb
1818

19-
import za.co.absa.fadb.naming.NamingConvention
19+
import za.co.absa.db.fadb.naming.NamingConvention
2020

2121
/**
2222
* An abstract class, an ancestor to represent a database schema
2323
* The database name of the schema is derived from the class name based on the provided naming convention
2424
* @param schemaNameOverride - in case the class name would not match the database schema name, this gives the
25-
* @param namingConvention - the [[za.co.absa.fadb.naming.NamingConvention NamingConvention]]
25+
* @param namingConvention - the [[za.co.absa.db.fadb.naming.NamingConvention NamingConvention]]
2626
* prescribing how to convert a class name into a db object name
2727
*/
2828
abstract class DBSchema(schemaNameOverride: Option[String] = None)(implicit val namingConvention: NamingConvention) {
@@ -46,7 +46,7 @@ abstract class DBSchema(schemaNameOverride: Option[String] = None)(implicit val
4646

4747
/**
4848
* Function to convert a class to the associated DB object name, based on the class' name. For transformation from the
49-
* class name to usual db name the schema's [[za.co.absa.fadb.naming.NamingConvention NamingConvention]] is used.
49+
* class name to usual db name the schema's [[za.co.absa.db.fadb.naming.NamingConvention NamingConvention]] is used.
5050
* @param c - class which name to use to get the DB object name
5151
* @return - the db object name
5252
*/

core/src/main/scala/za/co/absa/fadb/Query.scala renamed to core/src/main/scala/za/co/absa/db/fadb/Query.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
package za.co.absa.fadb
17+
package za.co.absa.db.fadb
1818

19-
import za.co.absa.fadb.status.{FailedOrRow, Row}
19+
import za.co.absa.db.fadb.status.{FailedOrRow, Row}
2020

2121
/**
2222
* The basis for all query types of [[DBEngine]] implementations

core/src/main/scala/za/co/absa/fadb/exceptions/NamingException.scala renamed to core/src/main/scala/za/co/absa/db/fadb/exceptions/NamingException.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package za.co.absa.fadb.exceptions
17+
package za.co.absa.db.fadb.exceptions
1818

1919
/**
2020
* Exception thrown when a naming convention is not found for a given string

core/src/main/scala/za/co/absa/fadb/exceptions/StatusException.scala renamed to core/src/main/scala/za/co/absa/db/fadb/exceptions/StatusException.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
package za.co.absa.fadb.exceptions
17+
package za.co.absa.db.fadb.exceptions
1818

19-
import za.co.absa.fadb.status.FunctionStatus
19+
import za.co.absa.db.fadb.status.FunctionStatus
2020

2121
/**
2222
* Represents an exception that is returned when the function status is not successful.

core/src/main/scala/za/co/absa/fadb/naming/ExplicitNamingRequired.scala renamed to core/src/main/scala/za/co/absa/db/fadb/naming/ExplicitNamingRequired.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
package za.co.absa.fadb.naming
17+
package za.co.absa.db.fadb.naming
1818

19-
import za.co.absa.fadb.exceptions.NamingException
19+
import za.co.absa.db.fadb.exceptions.NamingException
2020

2121
/**
2222
* `ExplicitNamingRequired` is a `NamingConvention` that throws a `NamingConvention` for any string.

0 commit comments

Comments
 (0)