@@ -27,6 +27,7 @@ import io.kotest.assertions.ktor.client.shouldHaveStatus
27
27
import io.kotest.engine.spec.tempdir
28
28
import io.kotest.inspectors.forAll
29
29
import io.kotest.matchers.collections.shouldBeSingleton
30
+ import io.kotest.matchers.collections.shouldContain
30
31
import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder
31
32
import io.kotest.matchers.collections.shouldHaveSize
32
33
import io.kotest.matchers.file.aFile
@@ -126,6 +127,13 @@ import org.eclipse.apoapsis.ortserver.model.runs.advisor.AdvisorResult
126
127
import org.eclipse.apoapsis.ortserver.model.runs.advisor.Vulnerability
127
128
import org.eclipse.apoapsis.ortserver.model.runs.advisor.VulnerabilityReference
128
129
import org.eclipse.apoapsis.ortserver.model.runs.reporter.Report
130
+ import org.eclipse.apoapsis.ortserver.model.runs.repository.Curations
131
+ import org.eclipse.apoapsis.ortserver.model.runs.repository.Excludes
132
+ import org.eclipse.apoapsis.ortserver.model.runs.repository.LicenseChoices
133
+ import org.eclipse.apoapsis.ortserver.model.runs.repository.PackageCuration
134
+ import org.eclipse.apoapsis.ortserver.model.runs.repository.PackageCurationData
135
+ import org.eclipse.apoapsis.ortserver.model.runs.repository.RepositoryAnalyzerConfiguration
136
+ import org.eclipse.apoapsis.ortserver.model.runs.repository.Resolutions
129
137
import org.eclipse.apoapsis.ortserver.model.util.asPresent
130
138
import org.eclipse.apoapsis.ortserver.services.DefaultAuthorizationService
131
139
import org.eclipse.apoapsis.ortserver.services.OrganizationService
@@ -993,6 +1001,119 @@ class RunsRouteIntegrationTest : AbstractIntegrationTest({
993
1001
val identifier1 = Identifier ("Maven ", "com.example", "example", "1.0")
994
1002
val identifier2 = Identifier ("Maven ", "com.example", "example2", "1.0")
995
1003
1004
+ dbExtension.fixtures.repositoryConfigurationRepository.create(
1005
+ ortRunId = ortRun.id,
1006
+ curations = Curations (
1007
+ packages = listOf(
1008
+ PackageCuration (
1009
+ id = identifier1,
1010
+ data = PackageCurationData (
1011
+ comment = "comment1_a",
1012
+ description = "description1_a",
1013
+ concludedLicense = "license1_a",
1014
+ authors = setOf("auth1a_a", "auth1b_a")
1015
+ )
1016
+ ),
1017
+ PackageCuration (
1018
+ id = identifier1,
1019
+ data = PackageCurationData (
1020
+ comment = "comment1_b",
1021
+ description = "description1_b",
1022
+ concludedLicense = "license1_b",
1023
+ authors = setOf("auth1a_b", "auth1b_b")
1024
+ )
1025
+ )
1026
+ )
1027
+ ),
1028
+ analyzerConfig = RepositoryAnalyzerConfiguration (),
1029
+ excludes = Excludes (),
1030
+ resolutions = Resolutions (),
1031
+ packageConfigurations = listOf(),
1032
+ licenseChoices = LicenseChoices (),
1033
+ provenanceSnippetChoices = listOf()
1034
+ )
1035
+
1036
+ val package1 = Package (
1037
+ identifier1,
1038
+ purl = "pkg:maven/com.example/
[email protected] ",
1039
+ cpe = null,
1040
+ authors = setOf("Author One ", "Author Two "),
1041
+ declaredLicenses = setOf("License1 ", "License2 ", "License3 "),
1042
+ ProcessedDeclaredLicense (
1043
+ spdxExpression = "Expression ",
1044
+ mappedLicenses = mapOf(
1045
+ "License 1" to "Mapped License 1",
1046
+ "License 2" to "Mapped License 2",
1047
+ ),
1048
+ unmappedLicenses = setOf("License 1", "License 2", "License 3", "License 4")
1049
+ ),
1050
+ description = "An example package",
1051
+ homepageUrl = "https://example.com",
1052
+ binaryArtifact = RemoteArtifact (
1053
+ "https://example.com/example-1.0.jar",
1054
+ "sha1:value",
1055
+ "SHA -1"
1056
+ ),
1057
+ sourceArtifact = RemoteArtifact (
1058
+ "https://example.com/example-1.0-sources.jar",
1059
+ "sha1:value",
1060
+ "SHA -1"
1061
+ ),
1062
+ vcs = VcsInfo (
1063
+ RepositoryType ("GIT "),
1064
+ "https://example.com/git",
1065
+ "revision",
1066
+ "path"
1067
+ ),
1068
+ vcsProcessed = VcsInfo (
1069
+ RepositoryType ("GIT "),
1070
+ "https://example.com/git",
1071
+ "revision",
1072
+ "path"
1073
+ ),
1074
+ isMetadataOnly = false,
1075
+ isModified = false
1076
+ )
1077
+
1078
+ val package2 = Package (
1079
+ identifier2,
1080
+ purl = "pkg:maven/com.example/
[email protected] ",
1081
+ cpe = null,
1082
+ authors = emptySet(),
1083
+ declaredLicenses = emptySet(),
1084
+ ProcessedDeclaredLicense (
1085
+ spdxExpression = "Expression ",
1086
+ mappedLicenses = emptyMap(),
1087
+ unmappedLicenses = emptySet()
1088
+ ),
1089
+ description = "Another example package",
1090
+ homepageUrl = "https://example.com",
1091
+ binaryArtifact = RemoteArtifact (
1092
+ "https://example.com/example2-1.0.jar",
1093
+ "sha1:value",
1094
+ "SHA -1"
1095
+ ),
1096
+ sourceArtifact = RemoteArtifact (
1097
+ "https://example.com/example2-1.0-sources.jar",
1098
+ "sha1:value",
1099
+ "SHA -1"
1100
+ ),
1101
+ vcs = VcsInfo (
1102
+ RepositoryType ("GIT "),
1103
+ "https://example.com/git",
1104
+ "revision",
1105
+ "path"
1106
+ ),
1107
+ vcsProcessed = VcsInfo (
1108
+ RepositoryType ("GIT "),
1109
+ "https://example.com/git",
1110
+ "revision",
1111
+ "path"
1112
+ ),
1113
+ isMetadataOnly = false,
1114
+ isModified = false
1115
+ )
1116
+
996
1117
dbExtension.fixtures.analyzerRunRepository.create(
997
1118
analyzerJobId = analyzerJob.id,
998
1119
startTime = Clock .System .now().toDatabasePrecision(),
@@ -1014,87 +1135,7 @@ class RunsRouteIntegrationTest : AbstractIntegrationTest({
1014
1135
skipExcluded = true
1015
1136
),
1016
1137
projects = setOf(project),
1017
- packages = setOf(
1018
- Package (
1019
- identifier1,
1020
- purl = "pkg:maven/com.example/
[email protected] ",
1021
- cpe = null,
1022
- authors = setOf("Author One ", "Author Two "),
1023
- declaredLicenses = setOf("License1 ", "License2 ", "License3 "),
1024
- ProcessedDeclaredLicense (
1025
- spdxExpression = "Expression ",
1026
- mappedLicenses = mapOf(
1027
- "License 1" to "Mapped License 1",
1028
- "License 2" to "Mapped License 2",
1029
- ),
1030
- unmappedLicenses = setOf("License 1", "License 2", "License 3", "License 4")
1031
- ),
1032
- description = "An example package",
1033
- homepageUrl = "https://example.com",
1034
- binaryArtifact = RemoteArtifact (
1035
- "https://example.com/example-1.0.jar",
1036
- "sha1:value",
1037
- "SHA -1"
1038
- ),
1039
- sourceArtifact = RemoteArtifact (
1040
- "https://example.com/example-1.0-sources.jar",
1041
- "sha1:value",
1042
- "SHA -1"
1043
- ),
1044
- vcs = VcsInfo (
1045
- RepositoryType ("GIT "),
1046
- "https://example.com/git",
1047
- "revision",
1048
- "path"
1049
- ),
1050
- vcsProcessed = VcsInfo (
1051
- RepositoryType ("GIT "),
1052
- "https://example.com/git",
1053
- "revision",
1054
- "path"
1055
- ),
1056
- isMetadataOnly = false,
1057
- isModified = false
1058
- ),
1059
- Package (
1060
- identifier2,
1061
- purl = "pkg:maven/com.example/
[email protected] ",
1062
- cpe = null,
1063
- authors = emptySet(),
1064
- declaredLicenses = emptySet(),
1065
- ProcessedDeclaredLicense (
1066
- spdxExpression = "Expression ",
1067
- mappedLicenses = emptyMap(),
1068
- unmappedLicenses = emptySet()
1069
- ),
1070
- description = "Another example package",
1071
- homepageUrl = "https://example.com",
1072
- binaryArtifact = RemoteArtifact (
1073
- "https://example.com/example2-1.0.jar",
1074
- "sha1:value",
1075
- "SHA -1"
1076
- ),
1077
- sourceArtifact = RemoteArtifact (
1078
- "https://example.com/example2-1.0-sources.jar",
1079
- "sha1:value",
1080
- "SHA -1"
1081
- ),
1082
- vcs = VcsInfo (
1083
- RepositoryType ("GIT "),
1084
- "https://example.com/git",
1085
- "revision",
1086
- "path"
1087
- ),
1088
- vcsProcessed = VcsInfo (
1089
- RepositoryType ("GIT "),
1090
- "https://example.com/git",
1091
- "revision",
1092
- "path"
1093
- ),
1094
- isMetadataOnly = false,
1095
- isModified = false
1096
- )
1097
- ),
1138
+ packages = setOf(package1, package2),
1098
1139
issues = emptyList(),
1099
1140
dependencyGraphs = emptyMap(),
1100
1141
shortestDependencyPaths = mapOf(
@@ -1135,14 +1176,39 @@ class RunsRouteIntegrationTest : AbstractIntegrationTest({
1135
1176
it.scope shouldBe " compileClassPath"
1136
1177
it.path shouldBe emptyList()
1137
1178
}
1179
+
1180
+ curations shouldHaveSize 2
1181
+
1182
+ val curr1 = curations.find { it.comment == " comment1_a" }
1183
+ curr1.shouldNotBeNull()
1184
+ curr1.comment shouldBe " comment1_a"
1185
+ curr1.description shouldBe " description1_a"
1186
+ curr1.concludedLicense shouldBe " license1_a"
1187
+ curr1.authors shouldHaveSize 2
1188
+ curr1.authors shouldContain " auth1a_a"
1189
+ curr1.authors shouldContain " auth1b_a"
1190
+
1191
+ val curr2 = curations.find { it.comment == " comment1_b" }
1192
+ curr2.shouldNotBeNull()
1193
+ curr2.comment shouldBe " comment1_b"
1194
+ curr2.description shouldBe " description1_b"
1195
+ curr2.concludedLicense shouldBe " license1_b"
1196
+ curr2.authors shouldHaveSize 2
1197
+ curr2.authors shouldContain " auth1a_b"
1198
+ curr2.authors shouldContain " auth1b_b"
1138
1199
}
1139
1200
1140
- last().shortestDependencyPaths.shouldBeSingleton {
1141
- it.projectIdentifier shouldBe project.identifier.mapToApi()
1142
- it.scope shouldBe " compileClassPath"
1143
- it.path shouldBe listOf(identifier1.mapToApi())
1201
+ with(last()) {
1202
+ identifier.name shouldBe " example2"
1203
+
1204
+ shortestDependencyPaths.shouldBeSingleton {
1205
+ it.projectIdentifier shouldBe project.identifier.mapToApi()
1206
+ it.scope shouldBe " compileClassPath"
1207
+ it.path shouldBe listOf(identifier1.mapToApi())
1208
+ }
1209
+
1210
+ curations shouldHaveSize(0)
1144
1211
}
1145
- last().identifier.name shouldBe " example2"
1146
1212
}
1147
1213
}
1148
1214
}
0 commit comments