refactoring: better dependency control
This commit is contained in:
parent
0e6c445a08
commit
e204e64316
|
@ -142,7 +142,7 @@ public class TestingUtils {
|
|||
long waitStartTime = System.currentTimeMillis();
|
||||
IoUtil.wait(engineChartLatch, timeoutMs);
|
||||
FileLog.MAIN.logLine("got next chart in " + (System.currentTimeMillis() - waitStartTime) + "ms for engine_type " + AutoTest.currentEngineType);
|
||||
LinkManager.engineState.replaceStringValueAction(EngineReport.ENGINE_CHART, (EngineState.ValueCallback<String>) EngineState.ValueCallback.VOID);
|
||||
commandQueue.getLinkManager().getEngineState().replaceStringValueAction(EngineReport.ENGINE_CHART, (EngineState.ValueCallback<String>) EngineState.ValueCallback.VOID);
|
||||
if (result.get() == null)
|
||||
throw new IllegalStateException("Chart timeout: " + timeoutMs);
|
||||
return result.get();
|
||||
|
|
|
@ -140,11 +140,7 @@ public class LinkManager {
|
|||
// throw new IllegalStateException("Communication on wrong thread");
|
||||
}
|
||||
|
||||
public EngineState getEngineState() {
|
||||
return engineState;
|
||||
}
|
||||
|
||||
public static EngineState engineState = new EngineState(new EngineState.EngineStateListenerImpl() {
|
||||
private EngineState engineState = new EngineState(new EngineState.EngineStateListenerImpl() {
|
||||
@Override
|
||||
public void beforeLine(String fullLine) {
|
||||
FileLog.MAIN.logLine(fullLine);
|
||||
|
@ -152,6 +148,10 @@ public class LinkManager {
|
|||
}
|
||||
});
|
||||
|
||||
public EngineState getEngineState() {
|
||||
return engineState;
|
||||
}
|
||||
|
||||
/**
|
||||
* This flag controls if mock controls are needed
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.awt.*;
|
|||
* Andrey Belomutskiy, (c) 2013-2020
|
||||
*/
|
||||
public class PortHolder {
|
||||
private static final DataListener dataListener = freshData -> LinkManager.engineState.processNewData(new String(freshData), LinkManager.ENCODER);
|
||||
private final DataListener dataListener;
|
||||
private final LinkManager linkManager;
|
||||
|
||||
public ConnectionStateListener listener;
|
||||
|
@ -30,6 +30,7 @@ public class PortHolder {
|
|||
|
||||
protected PortHolder(LinkManager linkManager) {
|
||||
this.linkManager = linkManager;
|
||||
dataListener = freshData -> linkManager.getEngineState().processNewData(new String(freshData), LinkManager.ENCODER);
|
||||
}
|
||||
|
||||
public String port;
|
||||
|
|
Loading…
Reference in New Issue