CORDA-2877: Refactor how we create child SandboxConfiguration objects. (#76)

This commit is contained in:
Chris Rankin 2019-09-30 10:07:02 +01:00 committed by GitHub
parent ed23c4b998
commit 3d0a4aa614

View File

@ -20,6 +20,7 @@ import java.nio.file.Files.exists
import java.nio.file.Files.isDirectory
import java.nio.file.Path
import java.nio.file.Paths
import java.util.function.Consumer
import kotlin.concurrent.thread
@Suppress("unused", "MemberVisibilityCanBePrivate")
@ -93,12 +94,11 @@ abstract class TestBase(type: SandboxType) {
thread {
try {
UserPathSource(classPaths).use { userSource ->
SandboxRuntimeContext(parentConfiguration.createChild(
userSource = userSource,
newMinimumSeverityLevel = minimumSeverityLevel,
visibleAnnotations = visibleAnnotations,
sandboxOnlyAnnotations = sandboxOnlyAnnotations
)).use {
SandboxRuntimeContext(parentConfiguration.createChild(userSource, Consumer {
it.withNewMinimumSeverityLevel(minimumSeverityLevel)
.withSandboxOnlyAnnotations(sandboxOnlyAnnotations)
.withVisibleAnnotations(visibleAnnotations)
})).use {
action(this)
}
}