diff --git a/data-model/src/main/scala/za/co/absa/enceladus/model/versionedModel/NamedLatestVersion.scala b/data-model/src/main/scala/za/co/absa/enceladus/model/versionedModel/NamedVersion.scala similarity index 91% rename from data-model/src/main/scala/za/co/absa/enceladus/model/versionedModel/NamedLatestVersion.scala rename to data-model/src/main/scala/za/co/absa/enceladus/model/versionedModel/NamedVersion.scala index 8c44eff11..74d61f2b9 100644 --- a/data-model/src/main/scala/za/co/absa/enceladus/model/versionedModel/NamedLatestVersion.scala +++ b/data-model/src/main/scala/za/co/absa/enceladus/model/versionedModel/NamedVersion.scala @@ -15,4 +15,4 @@ package za.co.absa.enceladus.model.versionedModel -case class NamedLatestVersion(name: String, version: Int) +case class NamedVersion(name: String, version: Int) diff --git a/data-model/src/main/scala/za/co/absa/enceladus/model/versionedModel/VersionedSummary.scala b/data-model/src/main/scala/za/co/absa/enceladus/model/versionedModel/VersionedSummary.scala index 909a193dc..b07e95aa3 100644 --- a/data-model/src/main/scala/za/co/absa/enceladus/model/versionedModel/VersionedSummary.scala +++ b/data-model/src/main/scala/za/co/absa/enceladus/model/versionedModel/VersionedSummary.scala @@ -16,7 +16,7 @@ package za.co.absa.enceladus.model.versionedModel case class VersionedSummary(_id: String, latestVersion: Int) { - def toNamedLatestVersion: NamedLatestVersion = NamedLatestVersion(_id, latestVersion) + def toNamedVersion: NamedVersion = NamedVersion(_id, latestVersion) } diff --git a/rest-api/src/main/scala/za/co/absa/enceladus/rest_api/controllers/v3/VersionedModelControllerV3.scala b/rest-api/src/main/scala/za/co/absa/enceladus/rest_api/controllers/v3/VersionedModelControllerV3.scala index 692d8fef7..469c3e4f9 100644 --- a/rest-api/src/main/scala/za/co/absa/enceladus/rest_api/controllers/v3/VersionedModelControllerV3.scala +++ b/rest-api/src/main/scala/za/co/absa/enceladus/rest_api/controllers/v3/VersionedModelControllerV3.scala @@ -38,7 +38,7 @@ import scala.concurrent.Future import scala.util.{Failure, Success, Try} object VersionedModelControllerV3 { - val LatestVersionKey = "latest" + final val LatestVersionKey = "latest" } abstract class VersionedModelControllerV3[C <: VersionedModel with Product @@ -51,16 +51,16 @@ abstract class VersionedModelControllerV3[C <: VersionedModel with Product // todo maybe offset/limit? @GetMapping(Array("")) @ResponseStatus(HttpStatus.OK) - def getList(@RequestParam searchQuery: Optional[String]): CompletableFuture[Seq[NamedLatestVersion]] = { + def getList(@RequestParam searchQuery: Optional[String]): CompletableFuture[Seq[NamedVersion]] = { versionedModelService.getLatestVersionsSummarySearch(searchQuery.toScalaOption) - .map(_.map(_.toNamedLatestVersion)) + .map(_.map(_.toNamedVersion)) } @GetMapping(Array("/{name}")) @ResponseStatus(HttpStatus.OK) - def getVersionSummaryForEntity(@PathVariable name: String): CompletableFuture[NamedLatestVersion] = { + def getVersionSummaryForEntity(@PathVariable name: String): CompletableFuture[NamedVersion] = { versionedModelService.getLatestVersionSummary(name) map { - case Some(entity) => entity.toNamedLatestVersion + case Some(entity) => entity.toNamedVersion case None => throw notFound() } } diff --git a/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/DatasetControllerV3IntegrationSuite.scala b/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/DatasetControllerV3IntegrationSuite.scala index 55a8ca071..c0e49cc59 100644 --- a/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/DatasetControllerV3IntegrationSuite.scala +++ b/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/DatasetControllerV3IntegrationSuite.scala @@ -28,7 +28,7 @@ import za.co.absa.enceladus.model.dataFrameFilter._ import za.co.absa.enceladus.model.properties.essentiality.Essentiality import za.co.absa.enceladus.model.properties.propertyType.EnumPropertyType import za.co.absa.enceladus.model.test.factories.{DatasetFactory, MappingTableFactory, PropertyDefinitionFactory, SchemaFactory} -import za.co.absa.enceladus.model.versionedModel.NamedLatestVersion +import za.co.absa.enceladus.model.versionedModel.NamedVersion import za.co.absa.enceladus.model.{Dataset, UsedIn, Validation} import za.co.absa.enceladus.rest_api.exceptions.EntityDisabledException import za.co.absa.enceladus.rest_api.integration.controllers.{BaseRestApiTestV3, toExpected} @@ -136,9 +136,9 @@ class DatasetControllerV3IntegrationSuite extends BaseRestApiTestV3 with BeforeA parent = Some(DatasetFactory.toParent(datasetV1))) datasetFixture.add(datasetV1, datasetV2) - val response = sendGet[NamedLatestVersion](s"$apiUrl/datasetA") + val response = sendGet[NamedVersion](s"$apiUrl/datasetA") assertOk(response) - assert(response.getBody == NamedLatestVersion("datasetA", 2)) + assert(response.getBody == NamedVersion("datasetA", 2)) } } diff --git a/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/PropertyDefinitionControllerV3IntegrationSuite.scala b/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/PropertyDefinitionControllerV3IntegrationSuite.scala index c2bd792a9..7bfec1ff0 100644 --- a/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/PropertyDefinitionControllerV3IntegrationSuite.scala +++ b/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/PropertyDefinitionControllerV3IntegrationSuite.scala @@ -28,7 +28,7 @@ import za.co.absa.enceladus.model.menas.MenasReference import za.co.absa.enceladus.model.properties.PropertyDefinition import za.co.absa.enceladus.model.properties.propertyType.{EnumPropertyType, StringPropertyType} import za.co.absa.enceladus.model.test.factories.{DatasetFactory, PropertyDefinitionFactory} -import za.co.absa.enceladus.model.versionedModel.NamedLatestVersion +import za.co.absa.enceladus.model.versionedModel.NamedVersion import za.co.absa.enceladus.rest_api.integration.controllers.{BaseRestApiTestV3, toExpected} import za.co.absa.enceladus.rest_api.integration.fixtures._ import za.co.absa.enceladus.rest_api.models.rest.DisabledPayload @@ -142,9 +142,9 @@ class PropertyDefinitionControllerV3IntegrationSuite extends BaseRestApiTestV3 w version = 2, parent = Some(PropertyDefinitionFactory.toParent(pdV1))) propertyDefinitionFixture.add(pdV1, pdV2) - val response = sendGet[NamedLatestVersion](s"$apiUrl/pdA") + val response = sendGet[NamedVersion](s"$apiUrl/pdA") assertOk(response) - assert(response.getBody == NamedLatestVersion("pdA", 2)) + assert(response.getBody == NamedVersion("pdA", 2)) } }