@@ -91,6 +91,7 @@ import org.eclipse.apoapsis.ortserver.api.v1.model.VulnerabilityRating
91
91
import org.eclipse.apoapsis.ortserver.api.v1.model.VulnerabilityWithIdentifier
92
92
import org.eclipse.apoapsis.ortserver.config.ConfigManager
93
93
import org.eclipse.apoapsis.ortserver.core.shouldHaveBody
94
+ import org.eclipse.apoapsis.ortserver.dao.repositories.repositoryconfiguration.RepositoryConfigurationsPackageCurationsTable
94
95
import org.eclipse.apoapsis.ortserver.dao.utils.toDatabasePrecision
95
96
import org.eclipse.apoapsis.ortserver.logaccess.LogFileCriteria
96
97
import org.eclipse.apoapsis.ortserver.logaccess.LogFileProviderFactoryForTesting
@@ -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,115 @@ 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 = "comment",
1012
+ description = "description",
1013
+ concludedLicense = "license"
1014
+ )
1015
+ )
1016
+ )
1017
+ ),
1018
+ analyzerConfig = RepositoryAnalyzerConfiguration (),
1019
+ excludes = Excludes (),
1020
+ resolutions = Resolutions (),
1021
+ packageConfigurations = listOf(),
1022
+ licenseChoices = LicenseChoices (),
1023
+ provenanceSnippetChoices = listOf()
1024
+ )
1025
+
1026
+ val package1 = Package (
1027
+ identifier1,
1028
+ purl = "pkg:maven/com.example/
[email protected] ",
1029
+ cpe = null,
1030
+ authors = setOf("Author One ", "Author Two "),
1031
+ declaredLicenses = setOf("License1 ", "License2 ", "License3 "),
1032
+ ProcessedDeclaredLicense (
1033
+ spdxExpression = "Expression ",
1034
+ mappedLicenses = mapOf(
1035
+ "License 1" to "Mapped License 1",
1036
+ "License 2" to "Mapped License 2",
1037
+ ),
1038
+ unmappedLicenses = setOf("License 1", "License 2", "License 3", "License 4")
1039
+ ),
1040
+ description = "An example package",
1041
+ homepageUrl = "https://example.com",
1042
+ binaryArtifact = RemoteArtifact (
1043
+ "https://example.com/example-1.0.jar",
1044
+ "sha1:value",
1045
+ "SHA -1"
1046
+ ),
1047
+ sourceArtifact = RemoteArtifact (
1048
+ "https://example.com/example-1.0-sources.jar",
1049
+ "sha1:value",
1050
+ "SHA -1"
1051
+ ),
1052
+ vcs = VcsInfo (
1053
+ RepositoryType ("GIT "),
1054
+ "https://example.com/git",
1055
+ "revision",
1056
+ "path"
1057
+ ),
1058
+ vcsProcessed = VcsInfo (
1059
+ RepositoryType ("GIT "),
1060
+ "https://example.com/git",
1061
+ "revision",
1062
+ "path"
1063
+ ),
1064
+ isMetadataOnly = false,
1065
+ isModified = false
1066
+ )
1067
+
1068
+ val package2 = Package (
1069
+ identifier2,
1070
+ purl = "pkg:maven/com.example/
[email protected] ",
1071
+ cpe = null,
1072
+ authors = emptySet(),
1073
+ declaredLicenses = emptySet(),
1074
+ ProcessedDeclaredLicense (
1075
+ spdxExpression = "Expression ",
1076
+ mappedLicenses = emptyMap(),
1077
+ unmappedLicenses = emptySet()
1078
+ ),
1079
+ description = "Another example package",
1080
+ homepageUrl = "https://example.com",
1081
+ binaryArtifact = RemoteArtifact (
1082
+ "https://example.com/example2-1.0.jar",
1083
+ "sha1:value",
1084
+ "SHA -1"
1085
+ ),
1086
+ sourceArtifact = RemoteArtifact (
1087
+ "https://example.com/example2-1.0-sources.jar",
1088
+ "sha1:value",
1089
+ "SHA -1"
1090
+ ),
1091
+ vcs = VcsInfo (
1092
+ RepositoryType ("GIT "),
1093
+ "https://example.com/git",
1094
+ "revision",
1095
+ "path"
1096
+ ),
1097
+ vcsProcessed = VcsInfo (
1098
+ RepositoryType ("GIT "),
1099
+ "https://example.com/git",
1100
+ "revision",
1101
+ "path"
1102
+ ),
1103
+ isMetadataOnly = false,
1104
+ isModified = false
1105
+ )
1106
+
1107
+ dbExtension.fixtures.createPackageCurationData(
1108
+ dbExtension.fixtures.getPackageCurationData(package1, "cmt1", "dsc1", "lic1")
1109
+ )
1110
+
1111
+ RepositoryConfigurationsPackageCurationsTable
1112
+
996
1113
dbExtension.fixtures.analyzerRunRepository.create(
997
1114
analyzerJobId = analyzerJob.id,
998
1115
startTime = Clock .System .now().toDatabasePrecision(),
@@ -1014,87 +1131,7 @@ class RunsRouteIntegrationTest : AbstractIntegrationTest({
1014
1131
skipExcluded = true
1015
1132
),
1016
1133
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
- ),
1134
+ packages = setOf(package1, package2),
1098
1135
issues = emptyList(),
1099
1136
dependencyGraphs = emptyMap(),
1100
1137
shortestDependencyPaths = mapOf(
@@ -1135,14 +1172,21 @@ class RunsRouteIntegrationTest : AbstractIntegrationTest({
1135
1172
it.scope shouldBe " compileClassPath"
1136
1173
it.path shouldBe emptyList()
1137
1174
}
1175
+
1176
+ curations shouldHaveSize(1)
1138
1177
}
1139
1178
1140
- last().shortestDependencyPaths.shouldBeSingleton {
1141
- it.projectIdentifier shouldBe project.identifier.mapToApi()
1142
- it.scope shouldBe " compileClassPath"
1143
- it.path shouldBe listOf(identifier1.mapToApi())
1179
+ with(last()) {
1180
+ identifier.name shouldBe " example2"
1181
+
1182
+ shortestDependencyPaths.shouldBeSingleton {
1183
+ it.projectIdentifier shouldBe project.identifier.mapToApi()
1184
+ it.scope shouldBe " compileClassPath"
1185
+ it.path shouldBe listOf(identifier1.mapToApi())
1186
+ }
1187
+
1188
+ curations shouldHaveSize(0)
1144
1189
}
1145
- last().identifier.name shouldBe " example2"
1146
1190
}
1147
1191
}
1148
1192
}
0 commit comments