Package io.openems.edge.common.test
Class TestUtils
java.lang.Object
io.openems.edge.common.test.TestUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
activateNextProcessImage
(OpenemsComponent component) CallsChannel.nextProcessImage()
for every Channel of theOpenemsComponent
.static int
Finds and returns an open port.static void
Sets the value on a Channel and activates the Process Image.static void
withValue
(OpenemsComponent component, ChannelId channelId, Object value) Sets the value on a Component Channel and activates the Process Image.
-
Method Details
-
findRandomOpenPortOnAllLocalInterfaces
Finds and returns an open port.Source https://stackoverflow.com/a/26644672
- Returns:
- an open port
- Throws:
IOException
- on error
-
activateNextProcessImage
CallsChannel.nextProcessImage()
for every Channel of theOpenemsComponent
.- Parameters:
component
- theOpenemsComponent
-
withValue
Sets the value on a Component Channel and activates the Process Image.This is useful to simulate a Channel value in a Unit test, as the value becomes directly available on the Channel.
- Parameters:
component
- theOpenemsComponent
channelId
- theChannelId
value
- the new value
-
withValue
Sets the value on a Channel and activates the Process Image.This is useful to simulate a Channel value in a Unit test, as the value becomes directly available on the Channel.
- Parameters:
channel
- theChannel
value
- the new value
-