Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class MonitorServiceAspect(
value = 1.0,
labels = licensingMetricLabels,
qualifier = "call",
type = PersitentMetricType.COUNTER,
type = PersistentMetricType.COUNTER,
downSampling = true,
downSamplingAggregation = DownSamplingAggregationType.MAX,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ data class PersistentMetric(
val downSamplingBucketDuration: Long = 0,
val downSamplingAggregation: DownSamplingAggregationType = DownSamplingAggregationType.AVG,
val downSamplingSuffix: String = DEFAULT_DOWN_SAMPLING_SUFFIX,
val type: PersitentMetricType = PersitentMetricType.COUNTER,
val type: PersistentMetricType = PersistentMetricType.COUNTER,
val scope: String = DEFAULT_SCOPE,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT license.
package com.cosmotech.common.metrics

enum class PersitentMetricType {
enum class PersistentMetricType {
COUNTER,
GAUGE,
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class ApiKeyAuthenticationFilter(val csmPlatformProperties: CsmPlatformPropertie
val isUriMatching =
securedUris
.associateWith { it.split("/.*", ignoreCase = true, limit = 2) }
.filter { (securedUri, securedUriSplitted) ->
filterSecuredUriWithRequestUri(securedUriSplitted, requestUri, securedUri)
.filter { (securedUri, securedUriSplit) ->
filterSecuredUriWithRequestUri(securedUriSplit, requestUri, securedUri)
}
.isNotEmpty()

Expand Down Expand Up @@ -87,18 +87,18 @@ class ApiKeyAuthenticationFilter(val csmPlatformProperties: CsmPlatformPropertie
}

private fun filterSecuredUriWithRequestUri(
securedUriSplitted: List<String>,
securedUriSplit: List<String>,
requestUri: String,
securedUri: String,
) =
if (securedUriSplitted.size == 1 && securedUriSplitted[0] == "/") {
if (securedUriSplit.size == 1 && securedUriSplit[0] == "/") {
true
} else {
val requestUriSplitted = requestUri.split(securedUriSplitted[0])
if (requestUriSplitted.size < 2) {
val requestUriSplit = requestUri.split(securedUriSplit[0])
if (requestUriSplit.size < 2) {
false
} else {
val uriSuffix = securedUriSplitted[0] + requestUriSplitted[1]
val uriSuffix = securedUriSplit[0] + requestUriSplit[1]
securedUri.toRegex().matches(uriSuffix)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fun <T> T.convertToMap(): Map<String, Any> =
*
* @param new the new object against which comparison is performed
* @param mutateIfChanged whether to mutate the current object if for fields that have changed
* @param excludedFields an array of fields to exlude from comparison. Note that fields named 'id´
* @param excludedFields an array of fields to exclude from comparison. Note that fields named 'id´
* are automatically excluded, by convention.
* @throws UnsupportedOperationException if the object being compared are not instances of a data
* class
Expand Down Expand Up @@ -80,9 +80,9 @@ inline fun <reified T> T.compareToAndMutateIfNeeded(
membersChanged.add(member.name)
if (mutateIfChanged) {
require(member is KMutableProperty) {
"""Detected change but cannot mutate this object
"""Detected change but cannot mutate this object
because property ${member.name} (on class ${T::class}) is not mutable.
Either exclude this field or call this function with mutateIfChanged=false
Either exclude this field or call this function with mutateIfChanged=false
to view the changes detected"""
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,18 @@ class ContainerRegistryServiceTest {
val jo = JSONObject()
jo.put("name", "my-repository")
jo.put("tags", ja)
val reponseMockk = mockk<ResponseSpec>()
val responseMockk = mockk<ResponseSpec>()

every {
restClient
.get()
.uri("/v2/my-repository/tags/list")
.header(HttpHeaders.AUTHORIZATION, any())
.retrieve()
} returns reponseMockk
} returns responseMockk

every { reponseMockk.onStatus(any(), any()) } returns reponseMockk
every { reponseMockk.body(String::class.java) } returns jo.toString()
every { responseMockk.onStatus(any(), any()) } returns responseMockk
every { responseMockk.body(String::class.java) } returns jo.toString()

containerRegistryService.checkSolutionImage("my-repository", "latest")
}
Expand Down
2 changes: 1 addition & 1 deletion openapi/example_files/ADTConnector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
valueType: string
envVar: AZURE_CLIENT_ID
- id: AZURE_CLIENT_SECRET
label: Azure CLient secret
label: Azure Client secret
valueType: password
envVar: AZURE_CLIENT_SECRET
- id: parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ class OrganizationServiceIntegrationTest : CsmTestBase() {
val name = "o-connector-test-1"
val organizationRegistered =
organizationApiService.createOrganization(makeSimpleOrganizationCreateRequest(name))
organizationApiService.getOrganizationAccessControl(organizationRegistered.id, "UNKOWN")
organizationApiService.getOrganizationAccessControl(organizationRegistered.id, "UNKNOWN")
}
}

Expand Down Expand Up @@ -2000,7 +2000,7 @@ class OrganizationServiceIntegrationTest : CsmTestBase() {
val name = "o-connector-test-1"
val organizationRegistered =
organizationApiService.createOrganization(makeSimpleOrganizationCreateRequest(name))
organizationApiService.getOrganizationAccessControl(organizationRegistered.id, "UNKOWN")
organizationApiService.getOrganizationAccessControl(organizationRegistered.id, "UNKNOWN")
}
}

Expand Down
4 changes: 2 additions & 2 deletions run/src/main/kotlin/com/cosmotech/run/metrics/RunMetrics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.cosmotech.common.events.PersistentMetricEvent
import com.cosmotech.common.events.RunStart
import com.cosmotech.common.metrics.DownSamplingAggregationType
import com.cosmotech.common.metrics.PersistentMetric
import com.cosmotech.common.metrics.PersitentMetricType
import com.cosmotech.common.metrics.PersistentMetricType
import com.cosmotech.runner.domain.Runner
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.context.event.EventListener
Expand Down Expand Up @@ -73,7 +73,7 @@ internal class RunMetrics(
incrementBy = 1,
qualifier = TOTAL_QUALIFIER,
labels = labels,
type = PersitentMetricType.COUNTER,
type = PersistentMetricType.COUNTER,
downSampling = true,
downSamplingAggregation = DownSamplingAggregationType.MAX,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ class RunnerServiceIntegrationTest : CsmTestBase() {
}

@Test
fun `test AccessControls management on Runner as ressource Admin`() {
fun `test AccessControls management on Runner as resource Admin`() {
logger.info("should add an Access Control and assert it has been added")
val runnerAccessControl = RunnerAccessControl(TEST_USER_MAIL, ROLE_VIEWER)
var runnerAccessControlRegistered =
Expand Down Expand Up @@ -2295,7 +2295,7 @@ class RunnerServiceIntegrationTest : CsmTestBase() {
}

@Test
fun `test runner creation based on solution without dataset's type parameters with overrided parameter value on workspace`() {
fun `test runner creation based on solution without dataset's type parameters with overridden parameter value on workspace`() {

// 1 - Create a solution with simple solution parameter
val simpleParameterId = "my_property_name"
Expand Down Expand Up @@ -2336,15 +2336,15 @@ class RunnerServiceIntegrationTest : CsmTestBase() {
solutionCreateRequestWithDatasetParameters,
)

val simpleParameterOverridedValue = "my_override_value"
val simpleParameterOverriddenValue = "my_override_value"
workspace =
makeWorkspaceCreateRequest(
name = "Workspace",
workspaceSolution =
WorkspaceSolution(
solutionId = solutionSaved.id,
defaultParameterValues =
mutableMapOf(simpleParameterId to simpleParameterOverridedValue),
mutableMapOf(simpleParameterId to simpleParameterOverriddenValue),
),
)
workspaceSaved = workspaceApiService.createWorkspace(organizationSaved.id, workspace)
Expand Down Expand Up @@ -2381,7 +2381,7 @@ class RunnerServiceIntegrationTest : CsmTestBase() {
assertEquals(1, runnerParametersValues.size)
val runnerParameterValue = runnerParametersValues[0]
assertEquals(simpleParameterId, runnerParameterValue.parameterId)
assertEquals(simpleParameterOverridedValue, runnerParameterValue.value)
assertEquals(simpleParameterOverriddenValue, runnerParameterValue.value)
assertEquals(simpleParameterVarType, runnerParameterValue.varType)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ internal class RunnerApiServiceImpl(
override fun getRunner(organizationId: String, workspaceId: String, runnerId: String): Runner {
val runnerService = getRunnerService().inOrganization(organizationId).inWorkspace(workspaceId)
val runnerInstance = runnerService.getInstance(runnerId)
val runner = runnerInstance.getRunnerDataObjet()
val runner = runnerInstance.getRunnerDataObject()
val listDatasetParts =
datasetApiServiceInterface.listDatasetParts(
organizationId,
Expand Down Expand Up @@ -150,7 +150,7 @@ internal class RunnerApiServiceImpl(

val runnerInstance = runnerService.getInstance(runnerId).userHasPermission(PERMISSION_WRITE)

val lastRunInfo = runnerInstance.getRunnerDataObjet().lastRunInfo
val lastRunInfo = runnerInstance.getRunnerDataObject().lastRunInfo

if (
lastRunInfo.lastRunStatus in
Expand Down Expand Up @@ -244,7 +244,7 @@ internal class RunnerApiServiceImpl(
val runnerInstance =
runnerService.getInstance(runnerId).userHasPermission(PERMISSION_READ_SECURITY)

return runnerInstance.getRunnerDataObjet().security
return runnerInstance.getRunnerDataObject().security
}

override fun listRunnerPermissions(
Expand Down Expand Up @@ -284,7 +284,7 @@ internal class RunnerApiServiceImpl(
runnerInstance.setDefaultSecurity(runnerRole.role)
runnerService.saveInstance(runnerInstance.stamp())

return runnerInstance.getRunnerDataObjet().security
return runnerInstance.getRunnerDataObject().security
}

@EventListener(RunDeleted::class)
Expand All @@ -294,8 +294,8 @@ internal class RunnerApiServiceImpl(
.inOrganization(runDeleted.organizationId)
.inWorkspace(runDeleted.workspaceId)
val runnerInstance = runnerService.getInstance(runDeleted.runnerId)
if (runnerInstance.getRunnerDataObjet().lastRunInfo.lastRunId == runDeleted.runId) {
runnerInstance.getRunnerDataObjet().lastRunInfo =
if (runnerInstance.getRunnerDataObject().lastRunInfo.lastRunId == runDeleted.runId) {
runnerInstance.getRunnerDataObject().lastRunInfo =
LastRunInfo(
lastRunId = runDeleted.lastRun,
lastRunStatus = LastRunInfo.LastRunStatus.NotStarted,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class RunnerService(
}

fun deleteInstance(runnerInstance: RunnerInstance) {
val runner = runnerInstance.getRunnerDataObjet()
val runner = runnerInstance.getRunnerDataObject()

// Check there are no running runs
val hasRunningRuns = HasRunningRuns(this, runner.organizationId, runner.workspaceId, runner.id)
Expand Down Expand Up @@ -154,7 +154,7 @@ class RunnerService(
)
this.eventPublisher.publishEvent(runnerDeleted)

return runnerRepository.delete(runnerInstance.getRunnerDataObjet())
return runnerRepository.delete(runnerInstance.getRunnerDataObject())
}

private fun listAllRunnerByParentId(
Expand Down Expand Up @@ -200,7 +200,7 @@ class RunnerService(
}

fun saveInstance(runnerInstance: RunnerInstance): Runner {
return runnerRepository.save(runnerInstance.getRunnerDataObjet())
return runnerRepository.save(runnerInstance.getRunnerDataObject())
}

fun getNewInstance(): RunnerInstance {
Expand Down Expand Up @@ -280,16 +280,16 @@ class RunnerService(
}

fun startRunWith(runnerInstance: RunnerInstance): CreatedRun {
val startEvent = RunStart(this, runnerInstance.getRunnerDataObjet())
val startEvent = RunStart(this, runnerInstance.getRunnerDataObject())
this.eventPublisher.publishEvent(startEvent)
val runId = startEvent.response ?: throw IllegalStateException("Run Service did not respond")
runnerInstance.setLastRunInfo(runId)
runnerRepository.save(runnerInstance.getRunnerDataObjet())
runnerRepository.save(runnerInstance.getRunnerDataObject())
return CreatedRun(id = runId)
}

fun stopLastRunOf(runnerInstance: RunnerInstance) {
val runner = runnerInstance.getRunnerDataObjet()
val runner = runnerInstance.getRunnerDataObject()
runner.lastRunInfo.lastRunId
?: throw IllegalArgumentException("Runner ${runner.id} doesn't have a last run")
this.eventPublisher.publishEvent(RunStop(this, runner))
Expand Down Expand Up @@ -339,7 +339,7 @@ class RunnerService(
)
}

fun getRunnerDataObjet(): Runner = this.runner
fun getRunnerDataObject(): Runner = this.runner

fun userHasPermission(permission: String): RunnerInstance = apply {
csmRbac.verify(this.getRbacSecurity(), permission, this.roleDefinition)
Expand Down
8 changes: 4 additions & 4 deletions solution/src/main/openapi/solution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ components:
sdkVersion:
type: string
description: The full SDK version used to build this solution, if available
example: 11.3.0-39929.27365ede
example: 12.0.0-40296.1c163396
url:
type: string
description: An optional URL link to solution page
Expand Down Expand Up @@ -1636,7 +1636,7 @@ components:
updateInfo:
timestamp: 1621353329000
userId: john.doe@cosmotech.com
sdkVersion: "11.3.0-39929.27365ede"
sdkVersion: "12.0.0-40296.1c163396"
url: https://github.com/Cosmo-Tech/brewery_sample_solution
tags:
- brewery
Expand Down Expand Up @@ -1697,7 +1697,7 @@ components:
updateInfo:
timestamp: 1621440000000
userId: john.doe@cosmotech.com
sdkVersion: "11.3.0-39929.27365ede"
sdkVersion: "12.0.0-40296.1c163396"
url: https://github.com/Cosmo-Tech/brewery_sample_solution
tags:
- brewery
Expand Down Expand Up @@ -1762,7 +1762,7 @@ components:
updateInfo:
timestamp: 1621353329000
userId: john.doe@cosmotech.com
sdkVersion: "11.3.0-39929.27365ede"
sdkVersion: "12.0.0-40296.1c163396"
url: https://github.com/Cosmo-Tech/brewery_sample_solution
tags:
- brewery
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
sonar.exclusions=*/src/integrationTest/**,*/src/test/**,scripts/**,doc/**

# Code duplication detection settings
# sonar.cpd.exclusions=embarassing_code/**,copy_pasted_scripts/**
# sonar.cpd.exclusions=embarrassing_code/**,copy_pasted_scripts/**

# Language-specific configurations
# --------------------------------
Expand Down