Skip to content

Commit

Permalink
conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
salamonpavel committed Sep 27, 2024
1 parent aa7e55e commit 1e299a8
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 209 deletions.
45 changes: 0 additions & 45 deletions server/src/main/scala/za/co/absa/atum/server/Constants.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import zio._

class FlowControllerImpl(flowService: FlowService) extends FlowController with BaseController {

// to be replaced (and moved to checkpointcontroller) with new implementation in #233
override def getFlowCheckpointsV2(
checkpointQueryDTO: CheckpointQueryDTO
): IO[ErrorResponse, MultiSuccessResponse[CheckpointDTO]] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ trait PartitioningController {
additionalDataPatchDTO: AdditionalDataPatchDTO
): IO[ErrorResponse, SingleSuccessResponse[AdditionalDataDTO]]

def getPartitioningCheckpointsV2(
checkpointQueryDTO: CheckpointQueryDTO
): IO[ErrorResponse, MultiSuccessResponse[CheckpointDTO]]

def getPartitioningByIdV2(partitioningId: Long): IO[ErrorResponse, SingleSuccessResponse[PartitioningWithIdDTO]]

def getPartitioningMeasuresV2(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import za.co.absa.atum.server.api.exception.ServiceError
import za.co.absa.atum.server.api.http.ApiPaths.V2Paths
import za.co.absa.atum.server.api.service.PartitioningService
import za.co.absa.atum.server.model.SuccessResponse._
import za.co.absa.atum.server.model.{ErrorResponse, GeneralErrorResponse, InternalServerErrorResponse}
import za.co.absa.atum.server.model.{ErrorResponse, GeneralErrorResponse, InternalServerErrorResponse, PaginatedResult}
import zio._

class PartitioningControllerImpl(partitioningService: PartitioningService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import za.co.absa.atum.server.model._
import sttp.tapir.typelevel.MatchType
import sttp.tapir.ztapir._
import sttp.tapir.{EndpointOutput, PublicEndpoint}
import za.co.absa.atum.server.Constants.Endpoints.{Api, V1, V2}
import za.co.absa.atum.server.api.http.ApiPaths._

import java.util.UUID

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ import sttp.tapir.generic.auto.schemaForCaseClass
import sttp.tapir.json.circe.jsonBody
import sttp.tapir.ztapir._
import za.co.absa.atum.model.dto._
import za.co.absa.atum.server.Constants.Endpoints._
import za.co.absa.atum.server.model.ErrorResponse
import za.co.absa.atum.server.model.SuccessResponse._
import sttp.tapir.{PublicEndpoint, Validator, endpoint}
import za.co.absa.atum.server.api.http.ApiPaths._
import za.co.absa.atum.server.api.http.ApiPaths.{Health, ZioMetrics, _}

import java.util.UUID

Expand Down Expand Up @@ -133,15 +132,6 @@ trait Endpoints extends BaseEndpoints {
.errorOutVariantPrepend(notFoundErrorOneOfVariant)
}

protected val getFlowCheckpointsEndpointV2
: PublicEndpoint[CheckpointQueryDTO, ErrorResponse, MultiSuccessResponse[CheckpointDTO], Any] = {
apiV2.post
.in(GetFlowCheckpoints)
.in(jsonBody[CheckpointQueryDTO])
.out(statusCode(StatusCode.Ok))
.out(jsonBody[MultiSuccessResponse[CheckpointDTO]])
}

protected val getPartitioningByIdEndpointV2
: PublicEndpoint[Long, ErrorResponse, SingleSuccessResponse[PartitioningWithIdDTO], Any] = {
apiV2.get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import sttp.tapir.server.interceptor.metrics.MetricsRequestInterceptor
import sttp.tapir.swagger.bundle.SwaggerInterpreter
import sttp.tapir.ztapir._
import za.co.absa.atum.model.dto.{AdditionalDataDTO, AdditionalDataPatchDTO, CheckpointV2DTO, PartitioningWithIdDTO}
import za.co.absa.atum.server.Constants.{SwaggerApiName, SwaggerApiVersion}
import za.co.absa.atum.server.api.controller.{CheckpointController, FlowController, PartitioningController}
import za.co.absa.atum.server.config.{HttpMonitoringConfig, JvmMonitoringConfig}
import za.co.absa.atum.server.model.ErrorResponse
Expand Down Expand Up @@ -91,7 +90,6 @@ trait Routes extends Endpoints with ServerOptions {
CheckpointController.getPartitioningCheckpoints(partitioningId, limit, offset, checkpointName)
}
),
createServerEndpoint(getFlowCheckpointsEndpointV2, FlowController.getFlowCheckpointsV2),
createServerEndpoint(getPartitioningByIdEndpointV2, PartitioningController.getPartitioningByIdV2),
createServerEndpoint(getPartitioningMeasuresEndpointV2, PartitioningController.getPartitioningMeasuresV2),
createServerEndpoint[
Expand Down Expand Up @@ -121,14 +119,13 @@ trait Routes extends Endpoints with ServerOptions {
patchPartitioningAdditionalDataEndpointV2,
getPartitioningCheckpointsEndpointV2,
getPartitioningCheckpointEndpointV2,
getFlowCheckpointsEndpointV2,
getPartitioningMeasuresEndpointV2,
getPartitioningEndpointV2,
getPartitioningMeasuresEndpointV2,
getFlowPartitioningsEndpointV2
)
ZHttp4sServerInterpreter[HttpEnv.Env](http4sServerOptions(None))
.from(SwaggerInterpreter().fromEndpoints[HttpEnv.F](endpoints, SwaggerApiName, SwaggerApiVersion))
.from(SwaggerInterpreter().fromEndpoints[HttpEnv.F](endpoints, "Atum API", "1.0"))
.toRoutes
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ trait PartitioningRepository {
additionalData: AdditionalDataPatchDTO
): IO[DatabaseError, AdditionalDataDTO]

def getPartitioningCheckpoints(checkpointQueryDTO: CheckpointQueryDTO): IO[DatabaseError, Seq[CheckpointFromDB]]

def getPartitioningById(partitioningId: Long): IO[DatabaseError, PartitioningWithIdDTO]

def getPartitioningMeasuresById(partitioningId: Long): IO[DatabaseError, Seq[MeasureDTO]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@
package za.co.absa.atum.server.api.repository

import za.co.absa.atum.model.dto._
import za.co.absa.atum.server.api.database.flows.functions.GetFlowPartitionings
import za.co.absa.atum.server.api.database.flows.functions.GetFlowPartitionings.{
GetFlowPartitioningsArgs,
GetFlowPartitioningsResult
}
import za.co.absa.atum.server.api.database.flows.functions.GetFlowPartitionings._
import za.co.absa.atum.server.api.database.runs.functions.CreateOrUpdateAdditionalData.CreateOrUpdateAdditionalDataArgs
import za.co.absa.atum.server.api.database.runs.functions._
import za.co.absa.atum.server.api.database.flows.functions._
import za.co.absa.atum.server.api.exception.DatabaseError
import za.co.absa.atum.server.model._
import zio._
Expand All @@ -37,11 +34,10 @@ class PartitioningRepositoryImpl(
getPartitioningMeasuresFn: GetPartitioningMeasures,
getPartitioningAdditionalDataFn: GetPartitioningAdditionalData,
createOrUpdateAdditionalDataFn: CreateOrUpdateAdditionalData,
getPartitioningByIdFn: GetPartitioningById,
getPartitioningAdditionalDataV2Fn: GetPartitioningAdditionalDataV2,
getPartitioningByIdFn: GetPartitioningById,
getPartitioningMeasuresByIdFn: GetPartitioningMeasuresById,
getPartitioningFn: GetPartitioning,
getPartitioningMeasuresByIdFn: GetPartitioningMeasuresById,
getFlowPartitioningsFn: GetFlowPartitionings
) extends PartitioningRepository
with BaseRepository {
Expand Down Expand Up @@ -173,7 +169,6 @@ object PartitioningRepositoryImpl {
with GetPartitioningById
with GetPartitioningMeasuresById
with GetPartitioning
with GetPartitioningMeasuresById
with GetFlowPartitionings,
PartitioningRepository
] = ZLayer {
Expand All @@ -183,9 +178,9 @@ object PartitioningRepositoryImpl {
getPartitioningMeasures <- ZIO.service[GetPartitioningMeasures]
getPartitioningAdditionalData <- ZIO.service[GetPartitioningAdditionalData]
createOrUpdateAdditionalData <- ZIO.service[CreateOrUpdateAdditionalData]
getPartitioningById <- ZIO.service[GetPartitioningById]
getPartitioningAdditionalDataV2 <- ZIO.service[GetPartitioningAdditionalDataV2]
getPartitioningMeasuresV2 <- ZIO.service[GetPartitioningMeasuresById]
getPartitioningById <- ZIO.service[GetPartitioningById]
getPartitioningMeasuresById <- ZIO.service[GetPartitioningMeasuresById]
getPartitioning <- ZIO.service[GetPartitioning]
getFlowPartitionings <- ZIO.service[GetFlowPartitionings]
} yield new PartitioningRepositoryImpl(
Expand All @@ -194,12 +189,12 @@ object PartitioningRepositoryImpl {
getPartitioningMeasures,
getPartitioningAdditionalData,
createOrUpdateAdditionalData,
getPartitioningById,
getPartitioningAdditionalDataV2,
getPartitioningMeasuresV2,
getFlowPartitionings,
getPartitioningMeasuresV2,
getPartitioning
getPartitioningById,
getPartitioningMeasuresById,
getPartitioning,
getFlowPartitionings
)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ trait PartitioningService {
additionalData: AdditionalDataPatchDTO
): IO[ServiceError, AdditionalDataDTO]

def getPartitioningCheckpoints(checkpointQueryDTO: CheckpointQueryDTO): IO[ServiceError, Seq[CheckpointDTO]]

def getPartitioningById(partitioningId: Long): IO[ServiceError, PartitioningWithIdDTO]

def getPartitioningMeasuresById(partitioningId: Long): IO[ServiceError, Seq[MeasureDTO]]
Expand Down
10 changes: 6 additions & 4 deletions server/src/test/scala/za/co/absa/atum/server/api/TestData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@

package za.co.absa.atum.server.api

import io.circe.{Json, parser}
import io.circe.parser
import io.circe.syntax.EncoderOps
import za.co.absa.atum.model.dto.MeasureResultDTO.TypedValue
import za.co.absa.atum.model.dto._
import za.co.absa.atum.model.{ResultValueType, dto}
import za.co.absa.atum.server.api.database.flows.functions.GetFlowPartitionings.GetFlowPartitioningsResult
import za.co.absa.atum.server.model.{CheckpointFromDB, CheckpointItemFromDB, MeasureFromDB, PartitioningFromDB}

import java.time.ZonedDateTime
import java.util.{Base64, UUID}
import MeasureResultDTO.TypedValue
import io.circe.syntax.EncoderOps
import za.co.absa.atum.model.{ResultValueType, dto}

trait TestData {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

package za.co.absa.atum.server.api.controller

import io.circe.syntax.EncoderOps
import org.mockito.Mockito.{mock, when}
import za.co.absa.atum.model.dto.{CheckpointDTO, PartitioningDTO}
import za.co.absa.atum.server.api.TestData
import za.co.absa.atum.server.api.exception.ServiceError._
import za.co.absa.atum.server.api.service.PartitioningService
Expand All @@ -29,8 +27,6 @@ import zio._
import zio.test.Assertion.failsWithA
import zio.test._

import java.util.Base64

object PartitioningControllerUnitTests extends ZIOSpecDefault with TestData {
private val partitioningServiceMock = mock(classOf[PartitioningService])

Expand Down Expand Up @@ -145,23 +141,6 @@ object PartitioningControllerUnitTests extends ZIOSpecDefault with TestData {
)
}
),
suite("GetPartitioningCheckpointsSuite")(
test("Returns expected Seq[MeasureDTO]") {
for {
result <- PartitioningController.getPartitioningCheckpointsV2(checkpointQueryDTO1)
} yield assertTrue(result.data == Seq(checkpointDTO1, checkpointDTO2))
},
test("Returns expected empty sequence") {
for {
result <- PartitioningController.getPartitioningCheckpointsV2(checkpointQueryDTO2)
} yield assertTrue(result.data == Seq.empty[CheckpointDTO])
},
test("Returns expected InternalServerErrorResponse") {
assertZIO(PartitioningController.getPartitioningCheckpointsV2(checkpointQueryDTO3).exit)(
failsWithA[InternalServerErrorResponse]
)
}
),
suite("GetPartitioningByIdSuite")(
test("Returns expected PartitioningWithIdDTO") {
for {
Expand Down

This file was deleted.

Loading

0 comments on commit 1e299a8

Please sign in to comment.