Skip to content

Commit

Permalink
chore(plugins): Use the companion object descriptors
Browse files Browse the repository at this point in the history
Use the `descriptor` properties of the companion objects of the
generated factories instead of initializing the factories.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
  • Loading branch information
mnonnenmacher committed Sep 3, 2024
1 parent 29468d0 commit 954eb96
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions plugins/advisors/oss-index/src/test/kotlin/OssIndexTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class OssIndexTest : WordSpec({
"return vulnerability information" {
server.stubComponentsRequest("response_components.json")
val ossIndex = OssIndex(
OssIndexFactory().descriptor,
OssIndexFactory.descriptor,
OssIndexConfiguration("http://localhost:${server.port()}", null, null)
)
val packages = COMPONENTS_REQUEST_IDS.mapTo(mutableSetOf()) {
Expand Down Expand Up @@ -118,7 +118,7 @@ class OssIndexTest : WordSpec({
)
)
val ossIndex = OssIndex(
OssIndexFactory().descriptor,
OssIndexFactory.descriptor,
OssIndexConfiguration("http://localhost:${server.port()}", null, null)
)
val packages = COMPONENTS_REQUEST_IDS.mapTo(mutableSetOf()) {
Expand All @@ -137,7 +137,7 @@ class OssIndexTest : WordSpec({

"provide correct details" {
val ossIndex = OssIndex(
OssIndexFactory().descriptor,
OssIndexFactory.descriptor,
OssIndexConfiguration("http://localhost:${server.port()}", null, null)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ private fun createConfig(server: WireMockServer): VulnerableCodeConfiguration {
* Create a test instance of [VulnerableCode] that communicates with the local [server].
*/
private fun createVulnerableCode(server: WireMockServer): VulnerableCode =
VulnerableCode(VulnerableCodeFactory().descriptor, createConfig(server))
VulnerableCode(VulnerableCodeFactory.descriptor, createConfig(server))

/**
* Return the test file with an analyzer result.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ClearlyDefinedPackageCurationProviderFunTest : WordSpec({
minTotalLicenseScore = 80
)
val provider = ClearlyDefinedPackageCurationProvider(
ClearlyDefinedPackageCurationProviderFactory().descriptor,
ClearlyDefinedPackageCurationProviderFactory.descriptor,
config
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ClearlyDefinedPackageCurationProviderTest : WordSpec({
}

val provider = ClearlyDefinedPackageCurationProvider(
ClearlyDefinedPackageCurationProviderFactory().descriptor,
ClearlyDefinedPackageCurationProviderFactory.descriptor,
ClearlyDefinedPackageCurationProviderConfig(serverUrl = "http://localhost:${server.port()}", 0),
client
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ open class FilePackageCurationProvider(descriptor: PluginDescriptor, vararg path
File(config.path).takeUnless { !it.exists() && !config.mustExist }
)

constructor(vararg paths: File?) : this(FilePackageCurationProviderFactory().descriptor, *paths)
constructor(vararg paths: File?) : this(FilePackageCurationProviderFactory.descriptor, *paths)

companion object {
/**
Expand Down

0 comments on commit 954eb96

Please sign in to comment.