diff --git a/server/src/main/scala/za/co/absa/atum/server/api/http/Endpoints.scala b/server/src/main/scala/za/co/absa/atum/server/api/http/Endpoints.scala index b29ce4965..a8dfb539a 100644 --- a/server/src/main/scala/za/co/absa/atum/server/api/http/Endpoints.scala +++ b/server/src/main/scala/za/co/absa/atum/server/api/http/Endpoints.scala @@ -54,7 +54,7 @@ trait Endpoints extends BaseEndpoints { .out(jsonBody[AdditionalDataSubmitDTO]) } - protected val getPartitioningCheckpointsEndpoint + protected val getPartitioningCheckpointsEndpointV2 : PublicEndpoint[CheckpointQueryDTO, ErrorResponse, Seq[CheckpointDTO], Any] = { apiV2.get .in(GetPartitioningCheckpoints) diff --git a/server/src/main/scala/za/co/absa/atum/server/api/http/Routes.scala b/server/src/main/scala/za/co/absa/atum/server/api/http/Routes.scala index 90c4ccb11..b555847ab 100644 --- a/server/src/main/scala/za/co/absa/atum/server/api/http/Routes.scala +++ b/server/src/main/scala/za/co/absa/atum/server/api/http/Routes.scala @@ -41,7 +41,7 @@ trait Routes extends Endpoints with ServerOptions { createServerEndpoint(createCheckpointEndpoint, CheckpointController.createCheckpoint), createServerEndpoint(createPartitioningEndpoint, PartitioningController.createPartitioningIfNotExists), createServerEndpoint(createOrUpdateAdditionalDataEndpoint, PartitioningController.createOrUpdateAdditionalData), - createServerEndpoint(getPartitioningCheckpointsEndpoint, PartitioningController.getPartitioningCheckpoints), + createServerEndpoint(getPartitioningCheckpointsEndpointV2, PartitioningController.getPartitioningCheckpoints), createServerEndpoint(healthEndpoint, (_: Unit) => ZIO.unit), ) ZHttp4sServerInterpreter[HttpEnv.Env](http4sServerOptions(metricsInterceptorOption)).from(endpoints).toRoutes @@ -51,7 +51,7 @@ trait Routes extends Endpoints with ServerOptions { Http4sServerInterpreter[HttpEnv.F]().toRoutes(HttpMetrics.prometheusMetrics.metricsEndpoint) private def createSwaggerRoutes: HttpRoutes[HttpEnv.F] = { - val endpoints = List(createCheckpointEndpoint, createPartitioningEndpoint, createOrUpdateAdditionalDataEndpoint, getPartitioningCheckpointsEndpoint) + val endpoints = List(createCheckpointEndpoint, createPartitioningEndpoint, createOrUpdateAdditionalDataEndpoint, getPartitioningCheckpointsEndpointV2) ZHttp4sServerInterpreter[HttpEnv.Env](http4sServerOptions(None)) .from(SwaggerInterpreter().fromEndpoints[HttpEnv.F](endpoints, SwaggerApiName, SwaggerApiVersion)) .toRoutes diff --git a/server/src/test/scala/za/co/absa/atum/server/api/controller/PartitioningControllerIntegrationTests.scala b/server/src/test/scala/za/co/absa/atum/server/api/controller/PartitioningControllerUnitTests.scala similarity index 97% rename from server/src/test/scala/za/co/absa/atum/server/api/controller/PartitioningControllerIntegrationTests.scala rename to server/src/test/scala/za/co/absa/atum/server/api/controller/PartitioningControllerUnitTests.scala index 3192843d3..269f89156 100644 --- a/server/src/test/scala/za/co/absa/atum/server/api/controller/PartitioningControllerIntegrationTests.scala +++ b/server/src/test/scala/za/co/absa/atum/server/api/controller/PartitioningControllerUnitTests.scala @@ -25,7 +25,7 @@ import zio.test.Assertion.{equalTo, failsWithA} import zio._ import zio.test._ -object PartitioningControllerIntegrationTests extends ZIOSpecDefault with TestData { +object PartitioningControllerUnitTests extends ZIOSpecDefault with TestData { private val partitioningServiceMock = mock(classOf[PartitioningService]) when(partitioningServiceMock.createPartitioningIfNotExists(partitioningSubmitDTO1)) @@ -78,7 +78,7 @@ object PartitioningControllerIntegrationTests extends ZIOSpecDefault with TestDa } ), - suite("GetPartitioningMeasuresSuite")( + suite("GetPartitioningCheckpointsSuite")( test("Returns expected Seq[MeasureDTO]") { for { result <- PartitioningController.getPartitioningCheckpoints(checkpointQueryDTO1) diff --git a/server/src/test/scala/za/co/absa/atum/server/api/database/runs/functions/GetPartitioningCheckpointsIntegrationTests.scala b/server/src/test/scala/za/co/absa/atum/server/api/database/runs/functions/GetPartitioningCheckpointsIntegrationTests.scala index 4dc10ed57..911581c9b 100644 --- a/server/src/test/scala/za/co/absa/atum/server/api/database/runs/functions/GetPartitioningCheckpointsIntegrationTests.scala +++ b/server/src/test/scala/za/co/absa/atum/server/api/database/runs/functions/GetPartitioningCheckpointsIntegrationTests.scala @@ -1,19 +1,29 @@ +/* + * Copyright 2021 ABSA Group Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package za.co.absa.atum.server.api.database.runs.functions -import doobie.util.Read import za.co.absa.atum.server.ConfigProviderTest import za.co.absa.atum.model.dto.{CheckpointQueryDTO, PartitionDTO, PartitioningDTO} import za.co.absa.atum.server.api.TestTransactorProvider import za.co.absa.atum.server.api.database.PostgresDatabaseProvider -import za.co.absa.atum.server.model.CheckpointFromDB import zio.test.Assertion.failsWithA import zio.{Scope, ZIO} import zio.test._ -import doobie.postgres.implicits._ -import doobie.postgres.circe.jsonb.implicits.jsonbGet -import za.co.absa.atum.server.api.database.DoobieImplicits.Sequence._ - object GetPartitioningCheckpointsIntegrationTests extends ConfigProviderTest { override def spec: Spec[TestEnvironment with Scope, Any] = { @@ -30,8 +40,6 @@ object GetPartitioningCheckpointsIntegrationTests extends ConfigProviderTest { limit = Some(10), checkpointName = Some("checkpointName") ) - // Read[CheckpointFromDB] implicit validation - Read[CheckpointFromDB] for { getPartitioningCheckpoints <- ZIO.service[GetPartitioningCheckpoints] diff --git a/server/src/test/scala/za/co/absa/atum/server/api/service/PartitioningServiceIntegrationTests.scala b/server/src/test/scala/za/co/absa/atum/server/api/service/PartitioningServiceUnitTests.scala similarity index 97% rename from server/src/test/scala/za/co/absa/atum/server/api/service/PartitioningServiceIntegrationTests.scala rename to server/src/test/scala/za/co/absa/atum/server/api/service/PartitioningServiceUnitTests.scala index 0c0503da4..8b2d9f0f9 100644 --- a/server/src/test/scala/za/co/absa/atum/server/api/service/PartitioningServiceIntegrationTests.scala +++ b/server/src/test/scala/za/co/absa/atum/server/api/service/PartitioningServiceUnitTests.scala @@ -17,7 +17,6 @@ package za.co.absa.atum.server.api.service -import org.junit.runner.RunWith import org.mockito.Mockito.{mock, when} import za.co.absa.atum.model.dto.{AdditionalDataDTO, CheckpointDTO, MeasureDTO} import za.co.absa.atum.server.api.TestData @@ -27,11 +26,10 @@ import za.co.absa.fadb.exceptions.ErrorInDataException import za.co.absa.fadb.status.FunctionStatus import zio.test.Assertion.failsWithA import zio.test._ -import zio.test.junit.ZTestJUnitRunner import zio._ -@RunWith(classOf[ZTestJUnitRunner]) -class PartitioningServiceIntegrationTests extends ZIOSpecDefault with TestData { + +object PartitioningServiceUnitTests extends ZIOSpecDefault with TestData { private val partitioningRepositoryMock = mock(classOf[PartitioningRepository])