多くの場合、devKit コネクタで非同期プロセスが完了するのを待つ必要があります (これにより、 isConnected が true を返します)。
@ValidateConnection
public boolean isConnected() {
return isConnected;
}
これが完了するまで機能単体テストを待機させるにはどうすればよいですか。単体テストは、フロー内のすべてのコネクタが「接続」されるまで待機していたと思います。
Atm 単体テストでスリープを使用して、FunctionalTestCase でこれを回避しています
Thread.sleep(5000);
assertEquals(1, targetEngineApplication.getNumberOfMessagesReveived());
編集_ _ _ _ _ _ _ _ _ _ ____ _
接続コード:
@Connect
public void connectMethod(final String configFileLocation) throws ConnectionException {
System.out.println("Connect called with config:" + configFileLocation);
try {
Engine.doInitialise(configFileLocation);
Engine.doStart();
} catch (InitialisationException e) {
throw new ConnectionException(ConnectionExceptionCode.UNKNOWN, "0", e.getCause().getMessage(), e);
} catch (StartingException e) {
throw new ConnectionException(ConnectionExceptionCode.UNKNOWN, "0", e.getCause().getMessage(), e);
}
// this will also tell the unit tests to start
isConnected = true;
}