Skip to content

Commit

Permalink
#77: post-review changes - making Server only in Scala 2.12, but agen…
Browse files Browse the repository at this point in the history
…t (and model) in 2.11, 2.12, and 2.13
  • Loading branch information
lsulak committed Oct 17, 2023
1 parent c1839b5 commit cdf18c2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 67 deletions.
18 changes: 5 additions & 13 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ ThisBuild / organization := "za.co.absa"
ThisBuild / name := "atum-service"

ThisBuild / scalaVersion := Versions.scala212 // default version
ThisBuild / crossScalaVersions := Versions.supportedScalaVersions

ThisBuild / versionScheme := Some("early-semver")

Expand Down Expand Up @@ -58,6 +57,7 @@ lazy val root = (projectMatrix in file("."))
name := "atum-service-root",
javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint"),
publish / skip := true,
crossScalaVersions := Nil,
mergeStrategy
)

Expand All @@ -68,15 +68,7 @@ lazy val server = (projectMatrix in file("server"))
libraryDependencies ++= Dependencies.serverDependencies,
Compile / packageBin / publishArtifact := false,
(Compile / compile) := ((Compile / compile) dependsOn printSparkScalaVersion).value,
Compile / unmanagedSourceDirectories += {
val sourceDir = (Compile / sourceDirectory).value
if (scalaVersion.value.startsWith("2.13")) {
sourceDir / "scala_2.13+"
}
else {
sourceDir / "scala_2.12-"
}
},
crossScalaVersions := Seq(Versions.serverScalaVersion),
packageBin := (Compile / assembly).value,
artifactPath / (Compile / packageBin) := baseDirectory.value / s"target/${name.value}-${version.value}.war",
webappWebInfClasses := true,
Expand All @@ -91,7 +83,7 @@ lazy val server = (projectMatrix in file("server"))
.enablePlugins(AssemblyPlugin)
.enablePlugins(TomcatPlugin)
.enablePlugins(AutomateHeaderPlugin)
.jvmPlatform(scalaVersions = Versions.supportedScalaVersions)
.jvmPlatform(scalaVersions = Seq(Versions.serverScalaVersion))
.dependsOn(model)

lazy val agent = (projectMatrix in file("agent"))
Expand All @@ -112,7 +104,7 @@ lazy val agent = (projectMatrix in file("agent"))
)
.sparkRow(SparkVersionAxis(Versions.spark2), scalaVersions = Seq(Versions.scala211, Versions.scala212))
.sparkRow(SparkVersionAxis(Versions.spark3), scalaVersions = Seq(Versions.scala212, Versions.scala213))
.jvmPlatform(scalaVersions = Versions.supportedScalaVersions)
.jvmPlatform(scalaVersions = Versions.agentSupportedScalaVersions)
.dependsOn(model)

lazy val model = (projectMatrix in file("model"))
Expand All @@ -127,4 +119,4 @@ lazy val model = (projectMatrix in file("model"))
jacocoReportSettings := jacocoSettings(scalaVersion.value, "atum-agent: model"),
jacocoExcludes := jacocoProjectExcludes()
)
.jvmPlatform(scalaVersions = Versions.supportedScalaVersions)
.jvmPlatform(scalaVersions = Versions.agentSupportedScalaVersions)
4 changes: 3 additions & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ object Dependencies {
val scala211 = "2.11.12"
val scala212 = "2.12.18"
val scala213 = "2.13.11"
val supportedScalaVersions: Seq[String] = Seq(scala211, scala212, scala213)

val serverScalaVersion: String = scala212
val agentSupportedScalaVersions: Seq[String] = Seq(scala211, scala212, scala213)

val scalatest = "3.2.15"
val scalaMockito = "1.17.12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import java.util.UUID
import java.util.concurrent.{ConcurrentHashMap, ConcurrentMap}
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future

import scala.collection.JavaConverters._

object InMemoryApiModelDao {

Expand All @@ -39,12 +39,12 @@ object InMemoryApiModelDao {

}

class InMemoryApiModelDao[T <: BaseApiModel] extends ApiModelDao[T] with JavaConvertersWrapper {
class InMemoryApiModelDao[T <: BaseApiModel] extends ApiModelDao[T] {

private val inmemory: ConcurrentMap[UUID, T] = new ConcurrentHashMap[UUID, T]()

def getList(limit: Int, offset: Int, filter: T => Boolean): Future[List[T]] = Future {
asScala(inmemory.values)
inmemory.values.asScala
.filter(filter)
.slice(offset, offset + limit).toList // limiting, todo pagination or similar
}
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit cdf18c2

Please sign in to comment.