diff --git a/db/test-data/execution-insert.xml b/db/test-data/execution-insert.xml
index 69e07e4fb9..8126d0be91 100644
--- a/db/test-data/execution-insert.xml
+++ b/db/test-data/execution-insert.xml
@@ -15,7 +15,7 @@
-
+
@@ -43,7 +43,7 @@
-
+
@@ -71,7 +71,7 @@
-
+
@@ -99,7 +99,7 @@
-
+
@@ -127,7 +127,7 @@
-
+
@@ -156,7 +156,7 @@
-
+
diff --git a/db/v-2/tables/lnk-contest-project.xml b/db/v-2/tables/lnk-contest-project.xml
index 7e1bb984d4..449f82a300 100644
--- a/db/v-2/tables/lnk-contest-project.xml
+++ b/db/v-2/tables/lnk-contest-project.xml
@@ -37,4 +37,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/save-api-cli/src/main/kotlin/com/saveourtool/save/apicli/ArgsParsing.kt b/save-api-cli/src/main/kotlin/com/saveourtool/save/apicli/ArgsParsing.kt
index 8f0d067a2a..872b54c69b 100644
--- a/save-api-cli/src/main/kotlin/com/saveourtool/save/apicli/ArgsParsing.kt
+++ b/save-api-cli/src/main/kotlin/com/saveourtool/save/apicli/ArgsParsing.kt
@@ -7,7 +7,7 @@
package com.saveourtool.save.apicli
import com.saveourtool.save.api.authorization.Authorization
-import com.saveourtool.save.execution.ExecutionType
+import com.saveourtool.save.execution.TestingType
import org.slf4j.LoggerFactory
@@ -22,7 +22,7 @@ private val log = LoggerFactory.getLogger(object {}.javaClass.enclosingClass::cl
*/
data class CliArguments(
val authorization: Authorization,
- val mode: ExecutionType,
+ val mode: TestingType,
)
/**
@@ -60,7 +60,7 @@ fun parseArguments(args: Array): CliArguments? {
)
val mode by parser.option(
- ArgType.Choice(),
+ ArgType.Choice(),
fullName = "mode",
shortName = "m",
description = "Mode of execution: git/standard"
diff --git a/save-api-cli/src/main/resources/evaluated-tool.properties b/save-api-cli/src/main/resources/evaluated-tool.properties
index 63cf0115bf..d94047328f 100644
--- a/save-api-cli/src/main/resources/evaluated-tool.properties
+++ b/save-api-cli/src/main/resources/evaluated-tool.properties
@@ -6,7 +6,7 @@ organizationName=saveourtool.com
# Required
# Name of project
-projectName=Diktat
+projectName=save
# Optional
# SDK
diff --git a/save-api/src/main/kotlin/com/saveourtool/save/api/SaveCloudClient.kt b/save-api/src/main/kotlin/com/saveourtool/save/api/SaveCloudClient.kt
index 6271a4ed7f..e0f9e3f17b 100644
--- a/save-api/src/main/kotlin/com/saveourtool/save/api/SaveCloudClient.kt
+++ b/save-api/src/main/kotlin/com/saveourtool/save/api/SaveCloudClient.kt
@@ -20,7 +20,7 @@ import com.saveourtool.save.entities.GitDto
import com.saveourtool.save.entities.Project
import com.saveourtool.save.execution.ExecutionDto
import com.saveourtool.save.execution.ExecutionStatus
-import com.saveourtool.save.execution.ExecutionType
+import com.saveourtool.save.execution.TestingType
import io.ktor.client.*
import io.ktor.http.*
@@ -38,7 +38,7 @@ import kotlinx.coroutines.delay
class SaveCloudClient(
webClientProperties: WebClientProperties,
private val evaluatedToolProperties: EvaluatedToolProperties,
- private val executionType: ExecutionType,
+ private val testingType: TestingType,
authorization: Authorization,
) {
private val log = LoggerFactory.getLogger(SaveCloudClient::class.java)
@@ -65,9 +65,9 @@ class SaveCloudClient(
} ?: {
"without additional files"
}
- log.info("Starting submit execution $msg, type: $executionType")
+ log.info("Starting submit execution $msg, type: $testingType")
- val executionRequest = submitExecution(executionType, additionalFileInfoList) ?: return
+ val executionRequest = submitExecution(testingType, additionalFileInfoList) ?: return
// Sending requests, which checks current state, until results will be received
// TODO: in which form do we actually need results?
@@ -81,23 +81,23 @@ class SaveCloudClient(
}
/**
- * Submit execution according [executionType]
+ * Submit execution according [testingType]
*
- * @param executionType
+ * @param testingType
* @param additionalFiles
* @return pair of organization and submitted execution request
*/
private suspend fun submitExecution(
- executionType: ExecutionType,
+ testingType: TestingType,
additionalFiles: List?
): ExecutionRequestBase? {
- val executionRequest = if (executionType == ExecutionType.GIT) {
+ val executionRequest = if (testingType == TestingType.PRIVATE_TESTS) {
buildExecutionRequest()
} else {
val userProvidedTestSuites = verifyTestSuites() ?: return null
buildExecutionRequestForStandardSuites(userProvidedTestSuites)
}
- val response = httpClient.submitExecution(executionType, executionRequest, additionalFiles)
+ val response = httpClient.submitExecution(testingType, executionRequest, additionalFiles)
if (response.status != HttpStatusCode.OK && response.status != HttpStatusCode.Accepted) {
log.error("Can't submit execution=$executionRequest! Response status: ${response.status}")
return null
diff --git a/save-api/src/main/kotlin/com/saveourtool/save/api/utils/RequestUtils.kt b/save-api/src/main/kotlin/com/saveourtool/save/api/utils/RequestUtils.kt
index 5132085fdd..fe8b452551 100644
--- a/save-api/src/main/kotlin/com/saveourtool/save/api/utils/RequestUtils.kt
+++ b/save-api/src/main/kotlin/com/saveourtool/save/api/utils/RequestUtils.kt
@@ -13,7 +13,7 @@ import com.saveourtool.save.entities.ExecutionRequestBase
import com.saveourtool.save.entities.ExecutionRequestForStandardSuites
import com.saveourtool.save.entities.Project
import com.saveourtool.save.execution.ExecutionDto
-import com.saveourtool.save.execution.ExecutionType
+import com.saveourtool.save.execution.TestingType
import com.saveourtool.save.testsuite.TestSuiteDto
import com.saveourtool.save.utils.LocalDateTimeSerializer
import com.saveourtool.save.utils.extractUserNameAndSource
@@ -118,8 +118,8 @@ suspend fun HttpClient.getStandardTestSuites(
*/
@OptIn(InternalAPI::class)
@Suppress("TOO_LONG_FUNCTION")
-suspend fun HttpClient.submitExecution(executionType: ExecutionType, executionRequest: ExecutionRequestBase, additionalFiles: List?): HttpResponse {
- val endpoint = if (executionType == ExecutionType.GIT) {
+suspend fun HttpClient.submitExecution(executionType: TestingType, executionRequest: ExecutionRequestBase, additionalFiles: List?): HttpResponse {
+ val endpoint = if (executionType == TestingType.PRIVATE_TESTS) {
"/api/$v1/submitExecutionRequest"
} else {
"/api/$v1/executionRequestStandardTests"
@@ -131,7 +131,7 @@ suspend fun HttpClient.submitExecution(executionType: ExecutionType, executionRe
append(HttpHeaders.ContentType, ContentType.Application.Json)
}
setBody(MultiPartFormDataContent(formData {
- if (executionType == ExecutionType.GIT) {
+ if (executionType == TestingType.PRIVATE_TESTS) {
append(
"executionRequest",
json.encodeToString(executionRequest as ExecutionRequest),
diff --git a/save-backend/Backend-API.md b/save-backend/Backend-API.md
index deb3f403d0..6f4b240312 100644
--- a/save-backend/Backend-API.md
+++ b/save-backend/Backend-API.md
@@ -266,7 +266,7 @@ The response format will look like:
{
"id": 42, # execution id
"status": "FINISHED", # execution status, i.e. running, finished and so on
- "type":"GIT", # execution type
+ "type":"PRIVATE_TESTS", # testing type
"version": "264e5feb8f4c6410d70536d6fc4bdf090df62287", # commit hash
"startTime": 1651856549, # start time of execution in Unix format
"endTime": 1651856797, # end time of execution in Unix format
diff --git a/save-backend/backend-api-docs.json b/save-backend/backend-api-docs.json
index 14c8d1e958..b8ab77db44 100644
--- a/save-backend/backend-api-docs.json
+++ b/save-backend/backend-api-docs.json
@@ -795,7 +795,8 @@
}
}
}
- }
+ },
+ "deprecated": true
}
},
"/api/v1/run/trigger": {
@@ -804,6 +805,21 @@
"run-execution-controller"
],
"operationId": "trigger",
+ "parameters": [
+ {
+ "name": "testingType",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "enum": [
+ "CONTEST_MODE",
+ "PRIVATE_TESTS",
+ "PUBLIC_TESTS"
+ ]
+ }
+ }
+ ],
"requestBody": {
"content": {
"application/json": {
@@ -2103,7 +2119,8 @@
}
}
}
- }
+ },
+ "deprecated": true
}
},
"/api/v1/execution/delete": {
@@ -4861,7 +4878,7 @@
],
"summary": "Get contests that can be participated.",
"description": "Get list of contest names that a given project can participate in.",
- "operationId": "getAvaliableContestsForProject",
+ "operationId": "getAvailableContestsForProject",
"parameters": [
{
"name": "organizationName",
@@ -5648,7 +5665,7 @@
],
"summary": "Get projects that can participate in contest.",
"description": "Get list of user\u0027s projects that can participate in a given contest.",
- "operationId": "getAvaliableProjectsForContest",
+ "operationId": "getAvailableProjectsForContest",
"parameters": [
{
"name": "contestName",
@@ -5668,7 +5685,7 @@
],
"responses": {
"200": {
- "description": "Successfully fetched projects avaliable for contest.",
+ "description": "Successfully fetched projects available for contest.",
"content": {
"*/*": {
"schema": {
@@ -7347,9 +7364,9 @@
"type": {
"type": "string",
"enum": [
- "CONTEST",
- "GIT",
- "STANDARD"
+ "CONTEST_MODE",
+ "PRIVATE_TESTS",
+ "PUBLIC_TESTS"
]
},
"version": {
@@ -7533,9 +7550,9 @@
"type": {
"type": "string",
"enum": [
- "CONTEST",
- "GIT",
- "STANDARD"
+ "CONTEST_MODE",
+ "PRIVATE_TESTS",
+ "PUBLIC_TESTS"
]
},
"version": {
diff --git a/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/CloneRepositoryController.kt b/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/CloneRepositoryController.kt
index d691857c63..f22a331a4e 100644
--- a/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/CloneRepositoryController.kt
+++ b/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/CloneRepositoryController.kt
@@ -6,6 +6,7 @@ import com.saveourtool.save.backend.storage.TestSuitesSourceSnapshotStorage
import com.saveourtool.save.backend.utils.blockingToMono
import com.saveourtool.save.domain.*
import com.saveourtool.save.entities.*
+import com.saveourtool.save.execution.TestingType
import com.saveourtool.save.testsuite.TestSuitesSourceSnapshotKey
import com.saveourtool.save.utils.getLogger
import com.saveourtool.save.utils.orNotFound
@@ -27,6 +28,7 @@ import reactor.kotlin.core.util.function.component2
*/
@RestController
@RequestMapping("/api")
+@Deprecated("All new logic should use RunExecutionController's endpoints")
class CloneRepositoryController(
private val testSuitesService: TestSuitesService,
private val testSuitesSourceService: TestSuitesSourceService,
@@ -50,6 +52,7 @@ class CloneRepositoryController(
): Mono =
sendToTrigger(
executionRequest,
+ TestingType.PRIVATE_TESTS,
authentication,
files,
{ true }
@@ -87,6 +90,7 @@ class CloneRepositoryController(
): Mono =
sendToTrigger(
executionRequestForStandardSuites,
+ TestingType.PUBLIC_TESTS,
authentication,
files,
{ it.name in executionRequestForStandardSuites.testSuites }
@@ -94,9 +98,15 @@ class CloneRepositoryController(
testSuitesSourceService.getStandardTestSuitesSources()
}
- @Suppress("TOO_LONG_FUNCTION", "TOO_MANY_LINES_IN_LAMBDA")
+ @Suppress(
+ "TOO_LONG_FUNCTION",
+ "TOO_MANY_LINES_IN_LAMBDA",
+ "TOO_MANY_PARAMETERS",
+ "LongParameterList",
+ )
private fun sendToTrigger(
executionRequest: T,
+ testingType: TestingType,
authentication: Authentication,
shortFiles: Flux,
testSuitesFilter: (TestSuite) -> Boolean,
@@ -143,7 +153,7 @@ class CloneRepositoryController(
)
}
.flatMap {
- runExecutionController.trigger(it, authentication)
+ runExecutionController.trigger(it, testingType, authentication)
}
}
diff --git a/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/LnkContestProjectController.kt b/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/LnkContestProjectController.kt
index 4aa537674b..92fed5dc76 100644
--- a/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/LnkContestProjectController.kt
+++ b/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/LnkContestProjectController.kt
@@ -111,8 +111,8 @@ class LnkContestProjectController(
@Parameters(
Parameter(name = "contestName", `in` = ParameterIn.PATH, description = "name of a contest", required = true),
)
- @ApiResponse(responseCode = "200", description = "Successfully fetched projects avaliable for contest.")
- fun getAvaliableProjectsForContest(
+ @ApiResponse(responseCode = "200", description = "Successfully fetched projects available for contest.")
+ fun getAvailableProjectsForContest(
@PathVariable contestName: String,
authentication: Authentication,
): Mono> = Mono.fromCallable {
@@ -138,7 +138,7 @@ class LnkContestProjectController(
Parameter(name = "projectName", `in` = ParameterIn.PATH, description = "name of a project", required = true),
)
@ApiResponse(responseCode = "200", description = "Successfully fetched contests avaliable for project.")
- fun getAvaliableContestsForProject(
+ fun getAvailableContestsForProject(
@PathVariable organizationName: String,
@PathVariable projectName: String,
authentication: Authentication,
diff --git a/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/RunExecutionController.kt b/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/RunExecutionController.kt
index 8f1198c297..2f63c8403f 100644
--- a/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/RunExecutionController.kt
+++ b/save-backend/src/main/kotlin/com/saveourtool/save/backend/controllers/RunExecutionController.kt
@@ -12,6 +12,7 @@ import com.saveourtool.save.entities.Execution
import com.saveourtool.save.entities.RunExecutionRequest
import com.saveourtool.save.execution.ExecutionStatus
import com.saveourtool.save.execution.ExecutionUpdateDto
+import com.saveourtool.save.execution.TestingType
import com.saveourtool.save.permission.Permission
import com.saveourtool.save.utils.debug
import com.saveourtool.save.utils.getLogger
@@ -63,11 +64,13 @@ class RunExecutionController(
/**
* @param request incoming request from frontend
* @param authentication
+ * @param testingType type for this execution
* @return response with ID of created [Execution]
*/
@PostMapping("/trigger")
fun trigger(
@RequestBody request: RunExecutionRequest,
+ @RequestParam testingType: TestingType,
authentication: Authentication,
): Mono = Mono.just(request.projectCoordinates)
.validateAccess(authentication) { it }
@@ -79,7 +82,8 @@ class RunExecutionController(
username = authentication.username(),
sdk = request.sdk,
execCmd = request.execCmd,
- batchSizeForAnalyzer = request.batchSizeForAnalyzer
+ batchSizeForAnalyzer = request.batchSizeForAnalyzer,
+ testingType = testingType
)
}
.subscribeOn(Schedulers.boundedElastic())
diff --git a/save-backend/src/main/kotlin/com/saveourtool/save/backend/service/ExecutionService.kt b/save-backend/src/main/kotlin/com/saveourtool/save/backend/service/ExecutionService.kt
index 5198a23926..56b6e73f15 100644
--- a/save-backend/src/main/kotlin/com/saveourtool/save/backend/service/ExecutionService.kt
+++ b/save-backend/src/main/kotlin/com/saveourtool/save/backend/service/ExecutionService.kt
@@ -7,7 +7,7 @@ import com.saveourtool.save.entities.Execution
import com.saveourtool.save.entities.Organization
import com.saveourtool.save.entities.Project
import com.saveourtool.save.execution.ExecutionStatus
-import com.saveourtool.save.execution.ExecutionType
+import com.saveourtool.save.execution.TestingType
import com.saveourtool.save.utils.debug
import com.saveourtool.save.utils.orNotFound
@@ -135,6 +135,7 @@ class ExecutionService(
* @param sdk
* @param execCmd
* @param batchSizeForAnalyzer
+ * @param testingType
* @return new [Execution] with provided values
*/
@Suppress("LongParameterList", "TOO_MANY_PARAMETERS")
@@ -147,6 +148,7 @@ class ExecutionService(
sdk: Sdk,
execCmd: String?,
batchSizeForAnalyzer: String?,
+ testingType: TestingType
): Execution {
val project = with(projectCoordinates) {
projectService.findByNameAndOrganizationName(projectName, organizationName).orNotFound {
@@ -165,6 +167,7 @@ class ExecutionService(
sdk = sdk.toString(),
execCmd = execCmd,
batchSizeForAnalyzer = batchSizeForAnalyzer,
+ testingType = testingType
)
}
@@ -187,6 +190,7 @@ class ExecutionService(
sdk = execution.sdk,
execCmd = execution.execCmd,
batchSizeForAnalyzer = execution.batchSizeForAnalyzer,
+ testingType = execution.type,
)
@Suppress("LongParameterList", "TOO_MANY_PARAMETERS", "UnsafeCallOnNullableType")
@@ -200,6 +204,7 @@ class ExecutionService(
sdk: String,
execCmd: String?,
batchSizeForAnalyzer: String?,
+ testingType: TestingType
): Execution {
val user = userRepository.findByName(username).orNotFound {
"Not found user $username"
@@ -214,8 +219,7 @@ class ExecutionService(
status = ExecutionStatus.PENDING,
testSuiteIds = formattedTestSuiteIds,
batchSize = configProperties.initialBatchSize,
- // FIXME: remove this type
- type = ExecutionType.GIT,
+ type = testingType,
version = version,
allTests = allTests,
runningTests = 0,
diff --git a/save-backend/src/main/kotlin/com/saveourtool/save/backend/service/LnkContestProjectService.kt b/save-backend/src/main/kotlin/com/saveourtool/save/backend/service/LnkContestProjectService.kt
index f6c9462c5c..82fb0958a2 100644
--- a/save-backend/src/main/kotlin/com/saveourtool/save/backend/service/LnkContestProjectService.kt
+++ b/save-backend/src/main/kotlin/com/saveourtool/save/backend/service/LnkContestProjectService.kt
@@ -54,7 +54,7 @@ class LnkContestProjectService(
fun saveLnkContestProject(project: Project, contest: Contest): Boolean = if (lnkContestProjectRepository.findByContestAndProject(contest, project).isPresent) {
false
} else {
- lnkContestProjectRepository.save(LnkContestProject(project, contest))
+ lnkContestProjectRepository.save(LnkContestProject(project, contest, null, 0))
true
}
}
diff --git a/save-backend/src/test/kotlin/com/saveourtool/save/backend/CloneRepoTest.kt b/save-backend/src/test/kotlin/com/saveourtool/save/backend/CloneRepoTest.kt
index ce65f627ab..36128b2a15 100644
--- a/save-backend/src/test/kotlin/com/saveourtool/save/backend/CloneRepoTest.kt
+++ b/save-backend/src/test/kotlin/com/saveourtool/save/backend/CloneRepoTest.kt
@@ -15,7 +15,7 @@ import com.saveourtool.save.domain.Jdk
import com.saveourtool.save.domain.ProjectCoordinates
import com.saveourtool.save.domain.toFileInfo
import com.saveourtool.save.entities.*
-import com.saveourtool.save.execution.ExecutionType
+import com.saveourtool.save.execution.TestingType
import com.saveourtool.save.testsuite.TestSuitesSourceSnapshotKey
import com.saveourtool.save.testutils.checkQueues
import com.saveourtool.save.testutils.cleanup
@@ -227,7 +227,7 @@ class CloneRepoTest {
executionRepository.findAll().shouldExist {
it.project.name == project.name &&
it.project.organization == project.organization &&
- it.type == ExecutionType.GIT &&
+ it.type == TestingType.PRIVATE_TESTS &&
it.sdk == sdk.toString()
}
}
diff --git a/save-backend/src/test/kotlin/com/saveourtool/save/backend/controller/ExecutionControllerTest.kt b/save-backend/src/test/kotlin/com/saveourtool/save/backend/controller/ExecutionControllerTest.kt
index a1f52b6957..f49deafaa8 100644
--- a/save-backend/src/test/kotlin/com/saveourtool/save/backend/controller/ExecutionControllerTest.kt
+++ b/save-backend/src/test/kotlin/com/saveourtool/save/backend/controller/ExecutionControllerTest.kt
@@ -8,7 +8,7 @@ import com.saveourtool.save.backend.utils.MySqlExtension
import com.saveourtool.save.backend.utils.mutateMockedUser
import com.saveourtool.save.execution.ExecutionDto
import com.saveourtool.save.execution.ExecutionStatus
-import com.saveourtool.save.execution.ExecutionType
+import com.saveourtool.save.execution.TestingType
import com.saveourtool.save.execution.ExecutionUpdateDto
import com.saveourtool.save.utils.debug
import com.saveourtool.save.utils.getLogger
@@ -97,7 +97,7 @@ class ExecutionControllerTest {
.expectBody()
.consumeWith {
requireNotNull(it.responseBody)
- assertEquals(ExecutionType.GIT, it.responseBody!!.type)
+ assertEquals(TestingType.PRIVATE_TESTS, it.responseBody!!.type)
}
}
diff --git a/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/execution/ExecutionDto.kt b/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/execution/ExecutionDto.kt
index ece062a365..3cb95e4ec3 100644
--- a/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/execution/ExecutionDto.kt
+++ b/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/execution/ExecutionDto.kt
@@ -25,7 +25,7 @@ import kotlinx.serialization.Serializable
data class ExecutionDto(
val id: Long,
val status: ExecutionStatus,
- val type: ExecutionType,
+ val type: TestingType,
val version: String?,
val startTime: Long,
val endTime: Long?,
@@ -44,7 +44,7 @@ data class ExecutionDto(
val empty = ExecutionDto(
id = -1,
status = ExecutionStatus.PENDING,
- type = ExecutionType.STANDARD,
+ type = TestingType.PUBLIC_TESTS,
version = null,
startTime = -1,
endTime = null,
diff --git a/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/execution/ExecutionType.kt b/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/execution/ExecutionType.kt
deleted file mode 100644
index 52a9f4e0c0..0000000000
--- a/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/execution/ExecutionType.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.saveourtool.save.execution
-
-import kotlinx.serialization.Serializable
-
-/**
- * Type oj execution
- */
-@Serializable
-enum class ExecutionType {
- /**
- * Project on contest
- */
- CONTEST,
-
- /**
- * Project from git
- */
- GIT,
-
- /**
- * Project by binary file
- */
- STANDARD,
- ;
-}
diff --git a/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/execution/TestingType.kt b/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/execution/TestingType.kt
new file mode 100644
index 0000000000..2fa7e26c7f
--- /dev/null
+++ b/save-cloud-common/src/commonMain/kotlin/com/saveourtool/save/execution/TestingType.kt
@@ -0,0 +1,14 @@
+package com.saveourtool.save.execution
+
+import kotlinx.serialization.Serializable
+
+/**
+ * Types of testing (that can be selected by user)
+ */
+@Serializable
+enum class TestingType {
+ CONTEST_MODE,
+ PRIVATE_TESTS,
+ PUBLIC_TESTS,
+ ;
+}
diff --git a/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/entities/Execution.kt b/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/entities/Execution.kt
index 3fab7ee169..0a38f8a909 100644
--- a/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/entities/Execution.kt
+++ b/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/entities/Execution.kt
@@ -4,7 +4,7 @@ import com.saveourtool.save.domain.FileKey
import com.saveourtool.save.domain.Sdk
import com.saveourtool.save.execution.ExecutionDto
import com.saveourtool.save.execution.ExecutionStatus
-import com.saveourtool.save.execution.ExecutionType
+import com.saveourtool.save.execution.TestingType
import com.saveourtool.save.utils.DATABASE_DELIMITER
import java.time.LocalDateTime
import java.time.ZoneOffset
@@ -59,7 +59,7 @@ class Execution(
var batchSize: Int?,
@Enumerated(EnumType.STRING)
- var type: ExecutionType,
+ var type: TestingType,
var version: String?,
@@ -156,7 +156,7 @@ class Execution(
status = ExecutionStatus.RUNNING,
testSuiteIds = null,
batchSize = 20,
- type = ExecutionType.GIT,
+ type = TestingType.PUBLIC_TESTS,
version = null,
allTests = 0,
runningTests = 0,
diff --git a/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/entities/LnkContestProject.kt b/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/entities/LnkContestProject.kt
index 92843c8fdd..57aefc0ba5 100644
--- a/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/entities/LnkContestProject.kt
+++ b/save-cloud-common/src/jvmMain/kotlin/com/saveourtool/save/entities/LnkContestProject.kt
@@ -3,10 +3,13 @@ package com.saveourtool.save.entities
import javax.persistence.Entity
import javax.persistence.JoinColumn
import javax.persistence.ManyToOne
+import javax.persistence.OneToOne
/**
* @property project
* @property contest
+ * @property bestExecution
+ * @property bestScore
*/
@Entity
class LnkContestProject(
@@ -18,6 +21,12 @@ class LnkContestProject(
@JoinColumn(name = "contest_id")
var contest: Contest,
+ @OneToOne
+ @JoinColumn(name = "best_execution_id")
+ var bestExecution: Execution?,
+
+ var bestScore: Int,
+
) : BaseEntity() {
/**
* Get [ContestResult]
diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/basic/TestResourcesSelection.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/basic/TestResourcesSelection.kt
index 19b12b7e47..2624733f97 100644
--- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/basic/TestResourcesSelection.kt
+++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/basic/TestResourcesSelection.kt
@@ -2,11 +2,12 @@
* Utility methods for creation of the module window for the selection of test resources
*/
-@file:Suppress("WildcardImport", "FILE_WILDCARD_IMPORTS")
+@file:Suppress("WildcardImport", "FILE_WILDCARD_IMPORTS", "FILE_NAME_MATCH_CLASS")
package com.saveourtool.save.frontend.components.basic
import com.saveourtool.save.entities.ContestDto
+import com.saveourtool.save.execution.TestingType
import com.saveourtool.save.frontend.components.basic.testsuiteselector.showPrivateTestSuitesSelectorModal
import com.saveourtool.save.frontend.components.basic.testsuiteselector.showPublicTestSuitesSelectorModal
import com.saveourtool.save.frontend.components.inputform.InputTypes
@@ -26,16 +27,6 @@ import react.dom.html.ReactHTML.select
val testResourcesSelection = prepareTestResourcesSelection()
-/**
- * Types of testing (that can be selected by user)
- */
-enum class TestingType {
- CONTEST_MODE,
- PRIVATE_TESTS,
- PUBLIC_TESTS,
- ;
-}
-
/**
* Properties for test resources
*/
diff --git a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ProjectView.kt b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ProjectView.kt
index 84dfe1bb16..58a98ba4b5 100644
--- a/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ProjectView.kt
+++ b/save-frontend/src/main/kotlin/com/saveourtool/save/frontend/components/views/ProjectView.kt
@@ -9,6 +9,7 @@ package com.saveourtool.save.frontend.components.views
import com.saveourtool.save.domain.*
import com.saveourtool.save.entities.*
import com.saveourtool.save.execution.ExecutionDto
+import com.saveourtool.save.execution.TestingType
import com.saveourtool.save.frontend.components.RequestStatusContext
import com.saveourtool.save.frontend.components.basic.*
import com.saveourtool.save.frontend.components.basic.projects.projectInfoMenu
@@ -330,14 +331,14 @@ class ProjectView : AbstractView(f
@Suppress("ComplexMethod", "TOO_LONG_FUNCTION")
private fun submitExecutionRequest() {
when (state.testingType) {
- TestingType.PRIVATE_TESTS -> submitExecutionRequestByTestSuiteIds(state.selectedPrivateTestSuiteIds)
- TestingType.PUBLIC_TESTS -> submitExecutionRequestByTestSuiteIds(state.selectedPublicTestSuiteIds)
- TestingType.CONTEST_MODE -> submitExecutionRequestByTestSuiteIds(state.selectedContest.testSuiteIds)
+ TestingType.PRIVATE_TESTS -> submitExecutionRequestByTestSuiteIds(state.selectedPrivateTestSuiteIds, state.testingType)
+ TestingType.PUBLIC_TESTS -> submitExecutionRequestByTestSuiteIds(state.selectedPublicTestSuiteIds, state.testingType)
+ TestingType.CONTEST_MODE -> submitExecutionRequestByTestSuiteIds(state.selectedContest.testSuiteIds, state.testingType)
else -> throw IllegalStateException("Not supported testing type: ${state.testingType}")
}
}
- private fun submitExecutionRequestByTestSuiteIds(selectedTestSuiteIds: List) {
+ private fun submitExecutionRequestByTestSuiteIds(selectedTestSuiteIds: List, testingType: TestingType) {
val selectedSdk = "${state.selectedSdk}:${state.selectedSdkVersion}".toSdk()
val executionRequest = RunExecutionRequest(
projectCoordinates = ProjectCoordinates(
@@ -350,7 +351,7 @@ class ProjectView : AbstractView(f
execCmd = state.execCmd,
batchSizeForAnalyzer = state.batchSizeForAnalyzer
)
- submitRequest("/run/trigger", jsonHeaders, Json.encodeToString(executionRequest))
+ submitRequest("/run/trigger?testingType=$testingType", jsonHeaders, Json.encodeToString(executionRequest))
}
private fun submitRequest(url: String, headers: Headers, body: dynamic) {
diff --git a/save-frontend/src/test/kotlin/com/saveourtool/save/frontend/components/basic/ExecutionStatisticsValuesTest.kt b/save-frontend/src/test/kotlin/com/saveourtool/save/frontend/components/basic/ExecutionStatisticsValuesTest.kt
index 81bd719c66..04a8ade36e 100644
--- a/save-frontend/src/test/kotlin/com/saveourtool/save/frontend/components/basic/ExecutionStatisticsValuesTest.kt
+++ b/save-frontend/src/test/kotlin/com/saveourtool/save/frontend/components/basic/ExecutionStatisticsValuesTest.kt
@@ -2,7 +2,7 @@ package com.saveourtool.save.frontend.components.basic
import com.saveourtool.save.execution.ExecutionDto
import com.saveourtool.save.execution.ExecutionStatus
-import com.saveourtool.save.execution.ExecutionType
+import com.saveourtool.save.execution.TestingType
import kotlin.test.Test
import kotlin.test.assertEquals
@@ -25,7 +25,7 @@ class ExecutionStatisticsValuesTest {
val executionDto = ExecutionDto(
id = -1,
status = ExecutionStatus.RUNNING,
- type = ExecutionType.GIT,
+ type = TestingType.PRIVATE_TESTS,
version = "N/A",
startTime = 0L,
endTime = null,
diff --git a/save-orchestrator/src/test/kotlin/com/saveourtool/save/orchestrator/controller/agents/AgentsControllerTest.kt b/save-orchestrator/src/test/kotlin/com/saveourtool/save/orchestrator/controller/agents/AgentsControllerTest.kt
index 93231cb00b..1dd3fbe15f 100644
--- a/save-orchestrator/src/test/kotlin/com/saveourtool/save/orchestrator/controller/agents/AgentsControllerTest.kt
+++ b/save-orchestrator/src/test/kotlin/com/saveourtool/save/orchestrator/controller/agents/AgentsControllerTest.kt
@@ -3,7 +3,7 @@ package com.saveourtool.save.orchestrator.controller.agents
import com.saveourtool.save.entities.Execution
import com.saveourtool.save.entities.Project
import com.saveourtool.save.execution.ExecutionStatus
-import com.saveourtool.save.execution.ExecutionType
+import com.saveourtool.save.execution.TestingType
import com.saveourtool.save.orchestrator.config.Beans
import com.saveourtool.save.orchestrator.config.ConfigProperties
import com.saveourtool.save.orchestrator.controller.AgentsController
@@ -75,7 +75,7 @@ class AgentsControllerTest {
fun `should build image, query backend and start containers`() {
val project = Project.stub(null)
val execution = Execution.stub(project).apply {
- type = ExecutionType.STANDARD
+ type = TestingType.PUBLIC_TESTS
status = ExecutionStatus.PENDING
testSuiteIds = "1"
id = 42L
@@ -248,7 +248,6 @@ class AgentsControllerTest {
}
companion object {
- @OptIn(ExperimentalPathApi::class)
private val volume: String by lazy {
createTempDirectory("executionLogs").toAbsolutePath().toString()
}