Skip to content

Commit

Permalink
AnalyzerConfiguration: Remove unused SW360 configuration
Browse files Browse the repository at this point in the history
The configuration was used to configure the
`Sw360PackageCurationProvider` which is now configured in a separate
section of the configuration file.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.io>
  • Loading branch information
mnonnenmacher committed Jan 10, 2023
1 parent f246d7d commit cdbe68f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 50 deletions.
10 changes: 2 additions & 8 deletions model/src/main/kotlin/config/AnalyzerConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@ data class AnalyzerConfiguration(
* Package manager specific configurations. The key needs to match the name of the package manager class, e.g.
* "NuGet" for the NuGet package manager.
*/
val packageManagers: Map<String, PackageManagerConfiguration>? = null,

/**
* Configuration of the SW360 package curation provider.
*/
val sw360Configuration: Sw360StorageConfiguration? = null
val packageManagers: Map<String, PackageManagerConfiguration>? = null
) {
/**
* A copy of [packageManagers] with case-insensitive keys.
Expand Down Expand Up @@ -110,8 +105,7 @@ data class AnalyzerConfiguration(
allowDynamicVersions = other.allowDynamicVersions,
enabledPackageManagers = other.enabledPackageManagers ?: enabledPackageManagers,
disabledPackageManagers = other.disabledPackageManagers ?: disabledPackageManagers,
packageManagers = mergedPackageManagers,
sw360Configuration = other.sw360Configuration ?: sw360Configuration
packageManagers = mergedPackageManagers
)
}
}
9 changes: 0 additions & 9 deletions model/src/main/resources/reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ ort:
# intercept requests to the registry.
disableRegistryCertificateVerification: false

sw360Configuration:
restUrl: 'https://your-sw360-rest-url'
authUrl: 'https://your-authentication-url'
username: username
password: password
clientId: clientId
clientPassword: clientPassword
token: token

advisor:
nexusIq:
serverUrl: 'https://rest-api-url-of-your-nexus-iq-server'
Expand Down
27 changes: 4 additions & 23 deletions model/src/test/kotlin/config/AnalyzerConfigurationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,31 @@ class AnalyzerConfigurationTest : WordSpec({
val self = AnalyzerConfiguration(
allowDynamicVersions = false,
enabledPackageManagers = listOf("Gradle"),
disabledPackageManagers = listOf("NPM"),
sw360Configuration = sw360Config1
disabledPackageManagers = listOf("NPM")
)

val other = AnalyzerConfiguration(
allowDynamicVersions = true,
enabledPackageManagers = listOf("Maven"),
disabledPackageManagers = listOf("SBT"),
sw360Configuration = sw360Config2
disabledPackageManagers = listOf("SBT")
)

with(self.merge(other)) {
allowDynamicVersions shouldBe true
enabledPackageManagers should containExactly("Maven")
disabledPackageManagers should containExactly("SBT")
sw360Configuration shouldBe sw360Config2
}
}

"keep values which are null in other" {
val self = AnalyzerConfiguration(
enabledPackageManagers = listOf("Gradle"),
disabledPackageManagers = listOf("NPM"),
sw360Configuration = sw360Config1
disabledPackageManagers = listOf("NPM")
)

val other = AnalyzerConfiguration(
enabledPackageManagers = null,
disabledPackageManagers = null,
sw360Configuration = null
disabledPackageManagers = null
)

self.merge(other) shouldBe self
Expand Down Expand Up @@ -132,17 +127,3 @@ class AnalyzerConfigurationTest : WordSpec({
}
}
})

private val sw360Config1 = Sw360StorageConfiguration(
restUrl = "url1",
authUrl = "auth1",
username = "user1",
clientId = "client1"
)

private val sw360Config2 = Sw360StorageConfiguration(
restUrl = "url2",
authUrl = "auth2",
username = "user2",
clientId = "client2"
)
10 changes: 0 additions & 10 deletions model/src/test/kotlin/config/OrtConfigurationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,6 @@ class OrtConfigurationTest : WordSpec({
this shouldBe get("Gradle")
}
}

sw360Configuration shouldNotBeNull {
restUrl shouldBe "https://your-sw360-rest-url"
authUrl shouldBe "https://your-authentication-url"
username shouldBe "username"
password shouldBe "password"
clientId shouldBe "clientId"
clientPassword shouldBe "clientPassword"
token shouldBe "token"
}
}

with(ortConfig.advisor) {
Expand Down

0 comments on commit cdbe68f

Please sign in to comment.