|
|
@@ -14,6 +14,7 @@ import org.elasticsearch.xpack.ml.job.process.autodetect.params.TimeRange;
|
|
|
import org.elasticsearch.xpack.ml.job.process.autodetect.writer.AutodetectControlMsgWriter;
|
|
|
import org.elasticsearch.xpack.ml.job.results.AutodetectResult;
|
|
|
import org.elasticsearch.xpack.ml.process.ProcessResultsParser;
|
|
|
+import org.elasticsearch.xpack.ml.process.NativeController;
|
|
|
import org.junit.Assert;
|
|
|
import org.junit.Before;
|
|
|
|
|
|
@@ -57,7 +58,7 @@ public class NativeAutodetectProcessTests extends ESTestCase {
|
|
|
when(logStream.read(new byte[1024])).thenReturn(-1);
|
|
|
InputStream outputStream = mock(InputStream.class);
|
|
|
when(outputStream.read(new byte[512])).thenReturn(-1);
|
|
|
- try (NativeAutodetectProcess process = new NativeAutodetectProcess("foo", logStream,
|
|
|
+ try (NativeAutodetectProcess process = new NativeAutodetectProcess("foo", mock(NativeController.class), logStream,
|
|
|
mock(OutputStream.class), outputStream, mock(OutputStream.class),
|
|
|
NUMBER_FIELDS, null,
|
|
|
new ProcessResultsParser<>(AutodetectResult.PARSER), mock(Consumer.class))) {
|
|
|
@@ -80,7 +81,7 @@ public class NativeAutodetectProcessTests extends ESTestCase {
|
|
|
when(outputStream.read(new byte[512])).thenReturn(-1);
|
|
|
String[] record = {"r1", "r2", "r3", "r4", "r5"};
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
|
|
|
- try (NativeAutodetectProcess process = new NativeAutodetectProcess("foo", logStream,
|
|
|
+ try (NativeAutodetectProcess process = new NativeAutodetectProcess("foo", mock(NativeController.class), logStream,
|
|
|
bos, outputStream, mock(OutputStream.class), NUMBER_FIELDS, Collections.emptyList(),
|
|
|
new ProcessResultsParser<>(AutodetectResult.PARSER), mock(Consumer.class))) {
|
|
|
process.start(executorService, mock(AutodetectStateProcessor.class), mock(InputStream.class));
|
|
|
@@ -114,7 +115,7 @@ public class NativeAutodetectProcessTests extends ESTestCase {
|
|
|
InputStream outputStream = mock(InputStream.class);
|
|
|
when(outputStream.read(new byte[512])).thenReturn(-1);
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream(AutodetectControlMsgWriter.FLUSH_SPACES_LENGTH + 1024);
|
|
|
- try (NativeAutodetectProcess process = new NativeAutodetectProcess("foo", logStream,
|
|
|
+ try (NativeAutodetectProcess process = new NativeAutodetectProcess("foo", mock(NativeController.class), logStream,
|
|
|
bos, outputStream, mock(OutputStream.class), NUMBER_FIELDS, Collections.emptyList(),
|
|
|
new ProcessResultsParser<>(AutodetectResult.PARSER), mock(Consumer.class))) {
|
|
|
process.start(executorService, mock(AutodetectStateProcessor.class), mock(InputStream.class));
|
|
|
@@ -147,7 +148,7 @@ public class NativeAutodetectProcessTests extends ESTestCase {
|
|
|
String json = "some string of data";
|
|
|
ByteArrayInputStream processOutStream = new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
|
- try (NativeAutodetectProcess process = new NativeAutodetectProcess("foo", logStream,
|
|
|
+ try (NativeAutodetectProcess process = new NativeAutodetectProcess("foo", mock(NativeController.class), logStream,
|
|
|
processInStream, processOutStream, mock(OutputStream.class), NUMBER_FIELDS, Collections.emptyList(),
|
|
|
new ProcessResultsParser<AutodetectResult>(AutodetectResult.PARSER), mock(Consumer.class))) {
|
|
|
|
|
|
@@ -162,7 +163,7 @@ public class NativeAutodetectProcessTests extends ESTestCase {
|
|
|
InputStream outputStream = mock(InputStream.class);
|
|
|
when(outputStream.read(new byte[512])).thenReturn(-1);
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
|
|
|
- try (NativeAutodetectProcess process = new NativeAutodetectProcess("foo", logStream,
|
|
|
+ try (NativeAutodetectProcess process = new NativeAutodetectProcess("foo", mock(NativeController.class), logStream,
|
|
|
bos, outputStream, mock(OutputStream.class), NUMBER_FIELDS, Collections.emptyList(),
|
|
|
new ProcessResultsParser<>(AutodetectResult.PARSER), mock(Consumer.class))) {
|
|
|
process.start(executorService, mock(AutodetectStateProcessor.class), mock(InputStream.class));
|