use of io.netty.channel.embedded.Plc4xEmbeddedChannel in project plc4x by apache.
the class ConnectionManager method getEmbeddedChannel.
public Plc4xEmbeddedChannel getEmbeddedChannel(PlcConnection plcConnection) {
if (!(plcConnection instanceof ChannelExposingConnection)) {
throw new PlcRuntimeException("Expecting ChannelExposingConnection");
}
ChannelExposingConnection connection = (ChannelExposingConnection) plcConnection;
Channel channel = connection.getChannel();
if (!(channel instanceof Plc4xEmbeddedChannel)) {
throw new PlcRuntimeException("Expecting EmbeddedChannel");
}
return (Plc4xEmbeddedChannel) channel;
}
use of io.netty.channel.embedded.Plc4xEmbeddedChannel in project plc4x by apache.
the class Testcase method run.
public void run() throws DriverTestsuiteException {
assert driverTestsuite != null;
LOGGER.info("Starting testcase: {}", name);
final PlcConnection plcConnection = connectionManager.getConnection(driverTestsuite.getDriverTestsuiteConfiguration().getDriverName(), driverTestsuite.getDriverTestsuiteConfiguration().getDriverParameters());
final Plc4xEmbeddedChannel embeddedChannel = connectionManager.getEmbeddedChannel(plcConnection);
final ByteOrder byteOrder = driverTestsuite.getDriverTestsuiteConfiguration().getByteOrder();
// Be sure this is reset, just in case a previous testcase failed.
synchronizer.responseFuture = null;
if (!driverTestsuite.getSetupSteps().isEmpty()) {
LOGGER.info("Running setup steps");
for (TestStep setupStep : driverTestsuite.getSetupSteps()) {
setupStep.execute(plcConnection, embeddedChannel, byteOrder);
}
LOGGER.info("Finished setup steps");
}
LOGGER.info("Running test steps");
for (TestStep step : steps) {
step.execute(plcConnection, embeddedChannel, byteOrder);
}
LOGGER.info("Finished test steps");
if (!driverTestsuite.getTeardownSteps().isEmpty()) {
LOGGER.info("Running teardown steps");
for (TestStep teardownStep : driverTestsuite.getTeardownSteps()) {
teardownStep.execute(plcConnection, embeddedChannel, byteOrder);
}
LOGGER.info("Finished teardown steps");
}
try {
plcConnection.close();
} catch (Exception e) {
LOGGER.warn("Error closing connection", e);
}
LOGGER.info("Finished testcase: {}", driverTestsuite.getName());
}
Aggregations