Skip to content

Commit

Permalink
refactor(logaccess): Move LogLevel and LogSource to the model module
Browse files Browse the repository at this point in the history
Make the enums accessible from other modules that don't depend on the
`logaccess` module.

Signed-off-by: Marcel Bochtler <[email protected]>
  • Loading branch information
MarcelBochtler authored and sschuberth committed Jan 17, 2025
1 parent 329e098 commit d8b13f0
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 12 deletions.
4 changes: 2 additions & 2 deletions core/src/main/kotlin/api/RunsRoute.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ import org.eclipse.apoapsis.ortserver.core.utils.requireIdParameter
import org.eclipse.apoapsis.ortserver.core.utils.requireParameter
import org.eclipse.apoapsis.ortserver.dao.QueryParametersException
import org.eclipse.apoapsis.ortserver.logaccess.LogFileService
import org.eclipse.apoapsis.ortserver.logaccess.LogLevel
import org.eclipse.apoapsis.ortserver.logaccess.LogSource
import org.eclipse.apoapsis.ortserver.model.JobStatus
import org.eclipse.apoapsis.ortserver.model.LogLevel
import org.eclipse.apoapsis.ortserver.model.LogSource
import org.eclipse.apoapsis.ortserver.model.OrtRun
import org.eclipse.apoapsis.ortserver.model.VulnerabilityWithIdentifier
import org.eclipse.apoapsis.ortserver.model.authorization.RepositoryPermission
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/kotlin/apiDocs/RunsDocs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ import org.eclipse.apoapsis.ortserver.api.v1.model.Vulnerability
import org.eclipse.apoapsis.ortserver.api.v1.model.VulnerabilityRating
import org.eclipse.apoapsis.ortserver.api.v1.model.VulnerabilityReference
import org.eclipse.apoapsis.ortserver.api.v1.model.VulnerabilityWithIdentifier
import org.eclipse.apoapsis.ortserver.logaccess.LogLevel
import org.eclipse.apoapsis.ortserver.logaccess.LogSource
import org.eclipse.apoapsis.ortserver.model.LogLevel
import org.eclipse.apoapsis.ortserver.model.LogSource

val getOrtRunById: OpenApiRoute.() -> Unit = {
operationId = "getOrtRunById"
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/api/RunsRouteIntegrationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ import org.eclipse.apoapsis.ortserver.core.shouldHaveBody
import org.eclipse.apoapsis.ortserver.dao.utils.toDatabasePrecision
import org.eclipse.apoapsis.ortserver.logaccess.LogFileCriteria
import org.eclipse.apoapsis.ortserver.logaccess.LogFileProviderFactoryForTesting
import org.eclipse.apoapsis.ortserver.logaccess.LogLevel
import org.eclipse.apoapsis.ortserver.logaccess.LogSource
import org.eclipse.apoapsis.ortserver.model.AdvisorJobConfiguration
import org.eclipse.apoapsis.ortserver.model.AnalyzerJobConfiguration
import org.eclipse.apoapsis.ortserver.model.EvaluatorJobConfiguration
import org.eclipse.apoapsis.ortserver.model.JobConfigurations
import org.eclipse.apoapsis.ortserver.model.JobStatus
import org.eclipse.apoapsis.ortserver.model.LogLevel
import org.eclipse.apoapsis.ortserver.model.LogSource
import org.eclipse.apoapsis.ortserver.model.OrtRun
import org.eclipse.apoapsis.ortserver.model.OrtRunStatus
import org.eclipse.apoapsis.ortserver.model.PluginConfiguration
Expand Down
1 change: 1 addition & 0 deletions logaccess/loki/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies {
api(libs.typesafeConfig)

implementation(projects.logaccess.logaccessSpi)
implementation(projects.model)
implementation(projects.utils.config)

implementation(libs.ktorClientAuth)
Expand Down
4 changes: 2 additions & 2 deletions logaccess/loki/src/main/kotlin/LokiLogFileProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import kotlinx.datetime.Instant
import kotlinx.serialization.json.Json

import org.eclipse.apoapsis.ortserver.logaccess.LogFileProvider
import org.eclipse.apoapsis.ortserver.logaccess.LogLevel
import org.eclipse.apoapsis.ortserver.logaccess.LogSource
import org.eclipse.apoapsis.ortserver.model.LogLevel
import org.eclipse.apoapsis.ortserver.model.LogSource

import org.slf4j.LoggerFactory

Expand Down
4 changes: 2 additions & 2 deletions logaccess/loki/src/test/kotlin/LokiLogFileProviderTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ import kotlinx.datetime.Instant

import org.eclipse.apoapsis.ortserver.config.ConfigManager
import org.eclipse.apoapsis.ortserver.logaccess.LogFileService
import org.eclipse.apoapsis.ortserver.logaccess.LogLevel
import org.eclipse.apoapsis.ortserver.logaccess.LogSource
import org.eclipse.apoapsis.ortserver.model.LogLevel
import org.eclipse.apoapsis.ortserver.model.LogSource

class LokiLogFileProviderTest : StringSpec() {
private val server = WireMockServer(WireMockConfiguration.options().dynamicPort())
Expand Down
3 changes: 3 additions & 0 deletions logaccess/spi/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ group = "org.eclipse.apoapsis.ortserver.logaccess"

dependencies {
api(projects.config.configSpi)
api(projects.model)

api(libs.kotlinxDatetime)

implementation(projects.model)
implementation(projects.utils.config)

implementation(libs.kotlinxCoroutines)
Expand All @@ -46,5 +48,6 @@ dependencies {
testImplementation(libs.kotestRunnerJunit5)
testImplementation(libs.mockk)

testFixturesImplementation(projects.model)
testFixturesImplementation(projects.utils.config)
}
3 changes: 3 additions & 0 deletions logaccess/spi/src/main/kotlin/LogFileProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import java.io.File

import kotlinx.datetime.Instant

import org.eclipse.apoapsis.ortserver.model.LogLevel
import org.eclipse.apoapsis.ortserver.model.LogSource

/**
* The Service Provider Interface for the log file provider abstraction.
*
Expand Down
2 changes: 2 additions & 0 deletions logaccess/spi/src/main/kotlin/LogFileService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import kotlinx.datetime.Instant

import org.eclipse.apoapsis.ortserver.config.ConfigManager
import org.eclipse.apoapsis.ortserver.config.Path as ConfigPath
import org.eclipse.apoapsis.ortserver.model.LogLevel
import org.eclipse.apoapsis.ortserver.model.LogSource
import org.eclipse.apoapsis.ortserver.utils.config.getStringOrNull

import org.ossreviewtoolkit.utils.common.packZip
Expand Down
2 changes: 2 additions & 0 deletions logaccess/spi/src/test/kotlin/LogFileServiceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import java.util.EnumSet
import kotlinx.datetime.Instant

import org.eclipse.apoapsis.ortserver.config.ConfigManager
import org.eclipse.apoapsis.ortserver.model.LogLevel
import org.eclipse.apoapsis.ortserver.model.LogSource

import org.ossreviewtoolkit.utils.common.unpack

Expand Down
2 changes: 2 additions & 0 deletions logaccess/spi/src/test/kotlin/LogLevelTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ package org.eclipse.apoapsis.ortserver.logaccess
import io.kotest.core.spec.style.WordSpec
import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder

import org.eclipse.apoapsis.ortserver.model.LogLevel

class LogLevelTest : WordSpec({
"levelOrHigher" should {
"return a correct set for the ERROR level" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import java.util.EnumSet
import kotlinx.datetime.Instant

import org.eclipse.apoapsis.ortserver.config.ConfigManager
import org.eclipse.apoapsis.ortserver.model.LogLevel
import org.eclipse.apoapsis.ortserver.model.LogSource

/**
* An implementation of [LogFileProviderFactory] that can be used to test interactions with log file providers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.eclipse.apoapsis.ortserver.logaccess
package org.eclipse.apoapsis.ortserver.model

import java.util.EnumSet

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.eclipse.apoapsis.ortserver.logaccess
package org.eclipse.apoapsis.ortserver.model

/**
* An enumeration class that defines the different sources for which log files can be downloaded. The sources
Expand Down

0 comments on commit d8b13f0

Please sign in to comment.