diff --git a/data-model/src/main/scala/za/co/absa/enceladus/model/test/factories/DatasetFactory.scala b/data-model/src/main/scala/za/co/absa/enceladus/model/test/factories/DatasetFactory.scala index 63b55cf0f..ebe47f5cc 100644 --- a/data-model/src/main/scala/za/co/absa/enceladus/model/test/factories/DatasetFactory.scala +++ b/data-model/src/main/scala/za/co/absa/enceladus/model/test/factories/DatasetFactory.scala @@ -15,11 +15,12 @@ package za.co.absa.enceladus.model.test.factories -import java.time.ZonedDateTime import za.co.absa.enceladus.model.Dataset import za.co.absa.enceladus.model.conformanceRule._ import za.co.absa.enceladus.model.menas.MenasReference -import za.co.absa.enceladus.model.versionedModel.VersionedSummaryV2 +import za.co.absa.enceladus.model.versionedModel.VersionedSummary + +import java.time.ZonedDateTime object DatasetFactory extends EntityFactory[Dataset] { @@ -126,8 +127,8 @@ object DatasetFactory extends EntityFactory[Dataset] { MenasReference(collection, name, version) } - def toSummaryV2(dataset: Dataset): VersionedSummaryV2 = { - VersionedSummaryV2(dataset.name, dataset.version) + def toSummary(dataset: Dataset): VersionedSummary = { + VersionedSummary(dataset.name, dataset.version, Set(dataset.disabled)) } } diff --git a/rest-api/src/main/scala/za/co/absa/enceladus/rest_api/repositories/VersionedMongoRepository.scala b/rest-api/src/main/scala/za/co/absa/enceladus/rest_api/repositories/VersionedMongoRepository.scala index 149caa718..d3fe970f3 100644 --- a/rest-api/src/main/scala/za/co/absa/enceladus/rest_api/repositories/VersionedMongoRepository.scala +++ b/rest-api/src/main/scala/za/co/absa/enceladus/rest_api/repositories/VersionedMongoRepository.scala @@ -74,7 +74,7 @@ abstract class VersionedMongoRepository[C <: VersionedModel](mongoDb: MongoDatab sort(Sorts.ascending("_id")) ) collection.aggregate[VersionedSummaryV2](pipeline).toFuture() - .map(_.map(summaryV2 => VersionedSummary(summaryV2._id, summaryV2.latestVersion, Set(true)))) // because of the notDisabled filter + .map(_.map(summaryV2 => VersionedSummary(summaryV2._id, summaryV2.latestVersion, Set(false)))) // because of the notDisabled filter } def getLatestVersions(missingProperty: Option[String]): Future[Seq[C]] = { diff --git a/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/repositories/DatasetRepositoryIntegrationSuite.scala b/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/repositories/DatasetRepositoryIntegrationSuite.scala index 5919c0650..c2c535c01 100644 --- a/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/repositories/DatasetRepositoryIntegrationSuite.scala +++ b/rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/repositories/DatasetRepositoryIntegrationSuite.scala @@ -500,7 +500,7 @@ class DatasetRepositoryIntegrationSuite extends BaseRepositoryTest with Matchers datasetFixture.add(dataset2, dataset3, dataset4, dataset5) val actual = await(datasetMongoRepository.getLatestVersionsSummarySearch(Some("dataset2"))) - val expected = Seq(dataset3).map(DatasetFactory.toSummaryV2) + val expected = Seq(dataset3).map(DatasetFactory.toSummary) assert(actual == expected) } "search query is a partial match" in { @@ -512,7 +512,7 @@ class DatasetRepositoryIntegrationSuite extends BaseRepositoryTest with Matchers datasetFixture.add(dataset2, dataset3, dataset4, dataset5) val actual = await(datasetMongoRepository.getLatestVersionsSummarySearch(Some("tas"))) - val expected = Seq(dataset3, dataset4).map(DatasetFactory.toSummaryV2) + val expected = Seq(dataset3, dataset4).map(DatasetFactory.toSummary) assert(actual == expected) } @@ -548,7 +548,7 @@ class DatasetRepositoryIntegrationSuite extends BaseRepositoryTest with Matchers datasetFixture.add(dataset1ver1, dataset1ver2, dataset2ver1, abc1) val actual = await(datasetMongoRepository.getLatestVersionsSummarySearch(Some(""))) - val expected = Seq(abc1, dataset1ver2, dataset2ver1).map(DatasetFactory.toSummaryV2) + val expected = Seq(abc1, dataset1ver2, dataset2ver1).map(DatasetFactory.toSummary) assert(actual == expected) } } @@ -565,7 +565,7 @@ class DatasetRepositoryIntegrationSuite extends BaseRepositoryTest with Matchers val actual = await(datasetMongoRepository.getLatestVersionsSummarySearch(None)) - val expected = Seq(dataset1ver2, dataset2ver2).map(DatasetFactory.toSummaryV2) + val expected = Seq(dataset1ver2, dataset2ver2).map(DatasetFactory.toSummary) assert(actual == expected) } }