Skip to content

Commit cec7bfd

Browse files
committed
feat(test): Add a helper function to Fixtures
The helper function simplifies testing of search service. Signed-off-by: Jyrki Keisala <[email protected]>
1 parent 1b6f13a commit cec7bfd

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

dao/src/testFixtures/kotlin/Fixtures.kt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import org.eclipse.apoapsis.ortserver.model.EvaluatorJobConfiguration
4848
import org.eclipse.apoapsis.ortserver.model.JobConfigurations
4949
import org.eclipse.apoapsis.ortserver.model.Jobs
5050
import org.eclipse.apoapsis.ortserver.model.NotifierJobConfiguration
51+
import org.eclipse.apoapsis.ortserver.model.OrtRun
5152
import org.eclipse.apoapsis.ortserver.model.PluginConfig
5253
import org.eclipse.apoapsis.ortserver.model.ReporterJobConfiguration
5354
import org.eclipse.apoapsis.ortserver.model.RepositoryType
@@ -196,6 +197,33 @@ class Fixtures(private val db: Database) {
196197
return Jobs(analyzerJob, advisorJob, scannerJob, evaluatorJob, reporterJob, notifierJob)
197198
}
198199

200+
fun createAnalyzerRunWithPackages(
201+
packages: Set<Package>,
202+
repositoryId: Long = createRepository().id,
203+
projects: Set<Project> = emptySet(),
204+
shortestPaths: Map<Identifier, List<ShortestDependencyPath>> = emptyMap()
205+
): OrtRun {
206+
val ortRun = createOrtRun(
207+
repositoryId = repositoryId,
208+
revision = "revision",
209+
jobConfigurations = JobConfigurations()
210+
)
211+
212+
val analyzerJob = createAnalyzerJob(
213+
ortRunId = ortRun.id,
214+
configuration = AnalyzerJobConfiguration(),
215+
)
216+
217+
createAnalyzerRun(
218+
analyzerJobId = analyzerJob.id,
219+
projects = projects,
220+
packages = packages,
221+
shortestDependencyPaths = shortestPaths
222+
)
223+
224+
return ortRun
225+
}
226+
199227
fun createIdentifier(
200228
identifier: Identifier = Identifier(
201229
"identifier_type",

0 commit comments

Comments
 (0)