Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ permissions:

jobs:
test:
runs-on: self-hosted
# runs-on: ubuntu-latest
# runs-on: self-hosted
runs-on: ubuntu-latest
env:
# define Java options for both official sbt and sbt-extras
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
Expand All @@ -38,6 +38,8 @@ jobs:
java-version: '8'
distribution: 'temurin'
# cache: 'sbt'
- name: Setup sbt launcher
uses: sbt/setup-sbt@v1
- name: Run tests
run: sbt test

Expand All @@ -52,5 +54,7 @@ jobs:
java-version: '8'
distribution: 'temurin'
# cache: 'sbt'
- name: Setup sbt launcher
uses: sbt/setup-sbt@v1
- name: Formatting
run: sbt scalafmtSbtCheck scalafmtCheck test:scalafmtCheck
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ permissions:

jobs:
release:
runs-on: self-hosted
# runs-on: ubuntu-latest
# runs-on: self-hosted
runs-on: ubuntu-latest
env:
# define Java options for both official sbt and sbt-extras
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
Expand All @@ -35,6 +35,8 @@ jobs:
java-version: '8'
distribution: 'temurin'
# cache: 'sbt'
- name: Setup sbt launcher
uses: sbt/setup-sbt@v1
- name: Formatting
run: sbt scalafmtSbtCheck scalafmtCheck test:scalafmtCheck
- name: Run tests & Coverage Report
Expand Down
14 changes: 2 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ThisBuild / organization := "app.softnetwork"

name := "elastic"

ThisBuild / version := "6.7.2.3"
ThisBuild / version := "7.17.29"

ThisBuild / scalaVersion := "2.12.18"

Expand Down Expand Up @@ -73,24 +73,14 @@ lazy val rest = project.in(file("rest"))
persistence % "compile->compile;test->test;it->it"
)

lazy val jest = project.in(file("jest"))
.configs(IntegrationTest)
.settings(Defaults.itSettings)
.dependsOn(
persistence % "compile->compile;test->test;it->it"
)

lazy val testKit = project.in(file("testkit"))
.configs(IntegrationTest)
.settings(Defaults.itSettings)
.dependsOn(
rest % "compile->compile;test->test;it->it"
)
.dependsOn(
jest % "compile->compile;test->test;it->it"
)

lazy val root = project.in(file("."))
.configs(IntegrationTest)
.settings(Defaults.itSettings, Publish.noPublishSettings)
.aggregate(sql, client, persistence, rest, jest, testKit)
.aggregate(sql, client, persistence, rest, testKit)
12 changes: 4 additions & 8 deletions client/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,18 @@ val configDependencies = Seq(
"com.github.kxbmap" %% "configs" % Versions.kxbmap
)

val jackson = Seq(
"com.fasterxml.jackson.core" % "jackson-databind" % Versions.jackson,
"com.fasterxml.jackson.core" % "jackson-core" % Versions.jackson,
"com.fasterxml.jackson.core" % "jackson-annotations" % Versions.jackson,
"com.fasterxml.jackson.module" % "jackson-module-scala_2.12" % Versions.jackson
)

val jacksonExclusions = Seq(
ExclusionRule(organization = "com.fasterxml.jackson.core"),
ExclusionRule(organization = "com.fasterxml.jackson.dataformat"),
ExclusionRule(organization = "com.fasterxml.jackson.datatype"),
ExclusionRule(organization = "com.fasterxml.jackson.module"),
ExclusionRule(organization = "org.codehaus.jackson")
)

val json4s = Seq(
"org.json4s" %% "json4s-jackson" % Versions.json4s,
"org.json4s" %% "json4s-ext" % Versions.json4s
).map(_.excludeAll(jacksonExclusions: _*)) ++ jackson
).map(_.excludeAll(jacksonExclusions: _*))

libraryDependencies ++= configDependencies ++ json4s :+
"app.softnetwork.persistence" %% "persistence-core" % Versions.genericPersistence :+ "com.google.code.gson" % "gson" % Versions.gson
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,16 @@ trait SettingsApi { _: IndicesApi =>
}

trait MappingApi {
def setMapping(index: String, _type: String, mapping: String): Boolean
def getMapping(index: String, _type: String): String
@deprecated("Use setMapping(index: String, mapping: String) instead", "0.7.29")
def setMapping(index: String, indexType: String, mapping: String): Boolean = {
this.setMapping(index, mapping)
}
def setMapping(index: String, mapping: String): Boolean
@deprecated("Use getMapping(index: String) instead", "0.7.29")
def getMapping(index: String, indexType: String): String = {
this.getMapping(index)
}
def getMapping(index: String): String
}

trait RefreshApi {
Expand All @@ -137,27 +145,38 @@ trait IndexApi { _: RefreshApi =>
index: Option[String] = None,
maybeType: Option[String] = None
)(implicit u: ClassTag[U], formats: Formats): Boolean = {
val _type = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
val indexType = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
this.index(
index.getOrElse(_type),
_type,
index.getOrElse(indexType),
entity.uuid,
serialization.write[U](entity)
)
}

def index(index: String, _type: String, id: String, source: String): Boolean
@deprecated("Use index(index: String, id: String, source: String) instead", "0.7.29")
def index(index: String, indexType: String, id: String, source: String): Boolean = {
this.index(index, id, source)
}

def index(index: String, id: String, source: String): Boolean

def indexAsync[U <: Timestamped](
entity: U,
index: Option[String] = None,
maybeType: Option[String] = None
)(implicit u: ClassTag[U], ec: ExecutionContext, formats: Formats): Future[Boolean] = {
val _type = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
indexAsync(index.getOrElse(_type), _type, entity.uuid, serialization.write[U](entity))
val indexType = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
indexAsync(index.getOrElse(indexType), entity.uuid, serialization.write[U](entity))
}

def indexAsync(index: String, _type: String, id: String, source: String)(implicit
@deprecated("Use indexAsync(index: String, id: String, source: String) instead", "0.7.29")
def indexAsync(index: String, indexType: String, id: String, source: String)(implicit
ec: ExecutionContext
): Future[Boolean] = {
this.indexAsync(index, id, source)
}

def indexAsync(index: String, id: String, source: String)(implicit
ec: ExecutionContext
): Future[Boolean]
}
Expand All @@ -169,37 +188,59 @@ trait UpdateApi { _: RefreshApi =>
maybeType: Option[String] = None,
upsert: Boolean = true
)(implicit u: ClassTag[U], formats: Formats): Boolean = {
val _type = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
val indexType = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
this.update(
index.getOrElse(_type),
_type,
index.getOrElse(indexType),
entity.uuid,
serialization.write[U](entity),
upsert
)
}

def update(index: String, _type: String, id: String, source: String, upsert: Boolean): Boolean
@deprecated(
"Use update(index: String, id: String, source: String, upsert: Boolean) instead",
"0.7.29"
)
def update(
index: String,
indexType: String,
id: String,
source: String,
upsert: Boolean
): Boolean = {
this.update(index, id, source, upsert)
}

def update(index: String, id: String, source: String, upsert: Boolean): Boolean

def updateAsync[U <: Timestamped](
entity: U,
index: Option[String] = None,
maybeType: Option[String] = None,
upsert: Boolean = true
)(implicit u: ClassTag[U], ec: ExecutionContext, formats: Formats): Future[Boolean] = {
val _type = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
val indexType = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
this
.updateAsync(
index.getOrElse(_type),
_type,
index.getOrElse(indexType),
entity.uuid,
serialization.write[U](entity),
upsert
)
}

def updateAsync(index: String, _type: String, id: String, source: String, upsert: Boolean)(
@deprecated(
"Use updateAsync(index: String, id: String, source: String, upsert: Boolean) instead",
"0.7.29"
)
def updateAsync(index: String, indexType: String, id: String, source: String, upsert: Boolean)(
implicit ec: ExecutionContext
): Future[Boolean] = {
this.updateAsync(index, id, source, upsert)
}

def updateAsync(index: String, id: String, source: String, upsert: Boolean)(implicit
ec: ExecutionContext
): Future[Boolean]
}

Expand All @@ -209,22 +250,34 @@ trait DeleteApi { _: RefreshApi =>
index: Option[String] = None,
maybeType: Option[String] = None
)(implicit u: ClassTag[U]): Boolean = {
val _type = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
delete(entity.uuid, index.getOrElse(_type), _type)
val indexType = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
delete(entity.uuid, index.getOrElse(indexType))
}

def delete(uuid: String, index: String, _type: String): Boolean
@deprecated("Use delete(uuid: String, index: String) instead", "0.7.29")
def delete(uuid: String, index: String, indexType: String): Boolean = {
this.delete(uuid, index)
}

def delete(uuid: String, index: String): Boolean

def deleteAsync[U <: Timestamped](
entity: U,
index: Option[String] = None,
maybeType: Option[String] = None
)(implicit u: ClassTag[U], ec: ExecutionContext): Future[Boolean] = {
val _type = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
deleteAsync(entity.uuid, index.getOrElse(_type), _type)
val indexType = maybeType.getOrElse(u.runtimeClass.getSimpleName.toLowerCase)
deleteAsync(entity.uuid, index.getOrElse(indexType))
}

@deprecated("Use deleteAsync(uuid: String, index: String) instead", "0.7.29")
def deleteAsync(uuid: String, index: String, indexType: String)(implicit
ec: ExecutionContext
): Future[Boolean] = {
this.deleteAsync(uuid, index)
}

def deleteAsync(uuid: String, index: String, _type: String)(implicit
def deleteAsync(uuid: String, index: String)(implicit
ec: ExecutionContext
): Future[Boolean]

Expand Down
21 changes: 0 additions & 21 deletions jest/build.sbt

This file was deleted.

Loading