Skip to content

Commit

Permalink
Implementing GitHub comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TebaleloS committed Jun 11, 2024
1 parent 55b83bf commit b6b35b6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -78,7 +78,7 @@ object PartitioningControllerIntegrationTests extends ZIOSpecDefault with TestDa
}
),

suite("GetPartitioningMeasuresSuite")(
suite("GetPartitioningCheckpointsSuite")(
test("Returns expected Seq[MeasureDTO]") {
for {
result <- PartitioningController.getPartitioningCheckpoints(checkpointQueryDTO1)
Expand Down
Original file line number Diff line number Diff line change
@@ -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] = {
Expand All @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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])

Expand Down

0 comments on commit b6b35b6

Please sign in to comment.