diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2018-02-27 10:17:46 +0100 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2018-04-22 22:08:11 +0200 |
| commit | 2c980f4627309b55a160dbe7fc17156201d9dde4 (patch) | |
| tree | e7fef0c75acc1753ac1ac55736cff926b3e16182 /opendc-kernel-omega/src/test | |
| parent | 8bc180adfcbde4cd977474174b846b2fa9dfec5b (diff) | |
feat(#12): Allow closing of instrument streams
This change in Instrumentation API allows the user to close the data
stream of an instrument by introducing a new concept: Port. A user can
open a `Port` for a `Simulation` object and attach an arbitrary amount of
instruments to this port. The data streams are closed by calling
`Port#close()`.
Diffstat (limited to 'opendc-kernel-omega/src/test')
| -rw-r--r-- | opendc-kernel-omega/src/test/kotlin/com/atlarge/opendc/omega/SmokeTest.kt | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/opendc-kernel-omega/src/test/kotlin/com/atlarge/opendc/omega/SmokeTest.kt b/opendc-kernel-omega/src/test/kotlin/com/atlarge/opendc/omega/SmokeTest.kt index 42ca05ec..74d6e2de 100644 --- a/opendc-kernel-omega/src/test/kotlin/com/atlarge/opendc/omega/SmokeTest.kt +++ b/opendc-kernel-omega/src/test/kotlin/com/atlarge/opendc/omega/SmokeTest.kt @@ -28,11 +28,10 @@ import com.atlarge.opendc.simulator.Bootstrap import com.atlarge.opendc.simulator.Context import com.atlarge.opendc.simulator.Process import com.atlarge.opendc.simulator.instrumentation.Instrument -import com.atlarge.opendc.simulator.kernel.Kernel import com.atlarge.opendc.simulator.kernel.Simulation import kotlinx.coroutines.experimental.Unconfined import kotlinx.coroutines.experimental.async -import kotlinx.coroutines.experimental.channels.* +import kotlinx.coroutines.experimental.channels.consumeEach import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test @@ -159,12 +158,11 @@ internal class SmokeTest { } val simulation: Simulation<Unit> = OmegaKernel.create(Bootstrap.create { Unit }) - val stream = simulation.install(instrument) + val stream = simulation.openPort().install(instrument) val res = async(Unconfined) { stream.consumeEach { println(it) } } - simulation.run(100) } } |
