Skip to content

Commit

Permalink
Fixes #120 - Fixing repository test cases bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
TebaleloS committed Apr 17, 2024
1 parent c4f2aaa commit 5bfe34b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ class PartitioningControllerImpl(partitioningService: PartitioningService)
override def createPartitioningIfNotExists(partitioningSubmitDTO: PartitioningSubmitDTO): IO[ErrorResponse, AtumContextDTO] = {
for {
_ <- partitioningService.createPartitioningIfNotExists(partitioningSubmitDTO)
.mapError(error => InternalServerErrorResponse(error.message))
measures <- partitioningService.getPartitioningMeasures(partitioningSubmitDTO.partitioning).mapError { serviceError: ServiceError =>
.mapError(serviceError => InternalServerErrorResponse(serviceError.message))
measures <- partitioningService.getPartitioningMeasures(partitioningSubmitDTO.partitioning)
.mapError { serviceError: ServiceError =>
InternalServerErrorResponse(serviceError.message)
}
additionalData <- partitioningService.getPartitioningAdditionalData(partitioningSubmitDTO.partitioning).mapError { serviceError: ServiceError =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@

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

import za.co.absa.atum.model.dto.{AdditionalDataDTO, AdditionalDataSubmitDTO, MeasureDTO, PartitioningDTO, PartitioningSubmitDTO}
import za.co.absa.atum.model.dto.{
AdditionalDataDTO,
AdditionalDataSubmitDTO,
MeasureDTO,
PartitioningDTO,
PartitioningSubmitDTO
}
import za.co.absa.atum.server.api.exception.ServiceError
import za.co.absa.atum.server.api.repository.PartitioningRepository
import za.co.absa.fadb.exceptions.StatusException
Expand Down
15 changes: 8 additions & 7 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,16 +16,21 @@

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

import za.co.absa.atum.model.dto.{AdditionalDataDTO, AdditionalDataSubmitDTO, AtumContextDTO, CheckpointDTO, MeasureDTO, PartitioningDTO, PartitioningSubmitDTO}
import za.co.absa.atum.model.dto.{AdditionalDataDTO, AdditionalDataSubmitDTO, AtumContextDTO, CheckpointDTO, MeasureDTO, PartitionDTO, PartitioningDTO, PartitioningSubmitDTO}

import java.time.ZonedDateTime
import java.util.UUID

trait TestData {

// Partitioning
// Partitioning DTO
protected val partitioningDTO1: PartitioningDTO = Seq(PartitionDTO("key1", "val1"), PartitionDTO("key2", "val2"))
protected val partitioningDTO2: PartitioningDTO = Seq(PartitionDTO("Invali", "invalid"), PartitionDTO("invalid", "invalid"))
protected val partitioningDTO3: PartitioningDTO = Seq.empty

// Partitioning submit DTO
protected val partitioningSubmitDTO1: PartitioningSubmitDTO = PartitioningSubmitDTO(
partitioning = Seq.empty,
partitioning = partitioningDTO1,
parentPartitioning = None,
authorIfNew = ""
)
Expand All @@ -40,10 +45,6 @@ trait TestData {
"key2" -> None,
"key3" -> Some("value3")
)
// Partitioning DTO
protected val partitioningDTO1: PartitioningDTO = Seq.empty
protected val partitioningDTO2: PartitioningDTO = Seq.empty
protected val partitioningDTO3: PartitioningDTO = Seq.empty

// Measure
protected val measureDTO1: MeasureDTO = MeasureDTO("count", Seq("1"))
Expand Down

0 comments on commit 5bfe34b

Please sign in to comment.