Skip to content

Commit

Permalink
fixed notes after self review #6
Browse files Browse the repository at this point in the history
  • Loading branch information
nulls committed Jul 26, 2022
1 parent 0456dc5 commit 5877d06
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ class TestSuitesSourceController(
fun findAsDtoByName(
@PathVariable organizationName: String,
@PathVariable name: String
): Mono<TestSuitesSourceDto> =
Mono.just(organizationName)
.flatMap {
organizationService.findByName(it).toMono()
}
.switchIfEmptyToResponseException(HttpStatus.CONFLICT) {
"Organization not found by name $name"
}
.flatMap { organization ->
testSuitesSourceService.findByName(organization, name).toMono()
}.switchIfEmptyToNotFound {
"TestSuitesSource not found by name $name for organization $organizationName"
}
.map { it.toDto() }
): Mono<TestSuitesSourceDto> = Mono.just(organizationName)
.flatMap {
organizationService.findByName(it).toMono()
}
.switchIfEmptyToResponseException(HttpStatus.CONFLICT) {
"Organization not found by name $name"
}
.flatMap { organization ->
testSuitesSourceService.findByName(organization, name).toMono()
}
.switchIfEmptyToNotFound {
"TestSuitesSource not found by name $name for organization $organizationName"
}
.map { it.toDto() }

/**
* Upload snapshot of [TestSuitesSource] with [version]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.saveourtool.save.entities.TestSuitesSource
import com.saveourtool.save.testsuite.TestSuitesSourceDto
import com.saveourtool.save.utils.getLogger
import org.slf4j.Logger
import org.springframework.http.HttpStatus
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import org.springframework.web.bind.annotation.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import com.saveourtool.save.preprocessor.config.ConfigProperties
import com.saveourtool.save.preprocessor.config.TestSuitesRepo
import com.saveourtool.save.preprocessor.service.TestsPreprocessorToBackendBridge
import com.saveourtool.save.preprocessor.utils.*
import com.saveourtool.save.testsuite.TestSuitesSourceDto
import com.saveourtool.save.utils.info

import com.fasterxml.jackson.databind.ObjectMapper
import com.saveourtool.save.testsuite.TestSuitesSourceDto
import org.slf4j.LoggerFactory
import org.springframework.boot.web.reactive.function.client.WebClientCustomizer
import org.springframework.core.io.ClassPathResource
Expand Down Expand Up @@ -198,6 +198,7 @@ class DownloadProjectController(
if (max.creationTime > next.creationTime) max else next
}
.map { it.version }

/**
* Accept execution rerun request
*
Expand Down Expand Up @@ -378,11 +379,11 @@ class DownloadProjectController(
* @return map repository to paths to test configs
*/
fun readStandardTestSuitesFile(name: String, objectMapper: ObjectMapper) =
ClassPathResource(name)
.file
.let {
objectMapper.readValue(it, TestSuitesRepo::class.java)!!
}
ClassPathResource(name)
.file
.let {
objectMapper.readValue(it, TestSuitesRepo::class.java)!!
}

/**
* @param executionId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package com.saveourtool.save.preprocessor.controllers

import com.saveourtool.save.entities.TestSuite
import com.saveourtool.save.preprocessor.service.GitPreprocessorService
import com.saveourtool.save.preprocessor.service.TestsPreprocessorToBackendBridge
import com.saveourtool.save.preprocessor.service.TestDiscoveringService
import com.saveourtool.save.preprocessor.service.TestsPreprocessorToBackendBridge
import com.saveourtool.save.preprocessor.utils.detectLatestSha1
import com.saveourtool.save.testsuite.TestSuitesSourceDto
import com.saveourtool.save.utils.getLogger
import com.saveourtool.save.utils.info

import org.slf4j.Logger
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
Expand Down

0 comments on commit 5877d06

Please sign in to comment.