use of org.apache.hyracks.api.test.CountAnswer in project asterixdb by apache.
the class LogMarkerTest method create.
public static TestTupleCounterFrameWriter create(RecordDescriptor recordDescriptor, Collection<FrameWriterOperation> exceptionThrowingOperations, Collection<FrameWriterOperation> errorThrowingOperations, boolean deepCopyInputFrames) {
CountAnswer openAnswer = FrameWriterTestUtils.createAnswer(FrameWriterOperation.Open, exceptionThrowingOperations, errorThrowingOperations);
CountAnswer nextAnswer = FrameWriterTestUtils.createAnswer(FrameWriterOperation.NextFrame, exceptionThrowingOperations, errorThrowingOperations);
CountAnswer flushAnswer = FrameWriterTestUtils.createAnswer(FrameWriterOperation.Flush, exceptionThrowingOperations, errorThrowingOperations);
CountAnswer failAnswer = FrameWriterTestUtils.createAnswer(FrameWriterOperation.Fail, exceptionThrowingOperations, errorThrowingOperations);
CountAnswer closeAnswer = FrameWriterTestUtils.createAnswer(FrameWriterOperation.Close, exceptionThrowingOperations, errorThrowingOperations);
return new TestTupleCounterFrameWriter(recordDescriptor, openAnswer, nextAnswer, flushAnswer, failAnswer, closeAnswer, deepCopyInputFrames);
}
use of org.apache.hyracks.api.test.CountAnswer in project asterixdb by apache.
the class FramewriterTest method createOutputWriters.
public IFrameWriter[] createOutputWriters() throws Exception {
CountAnswer[] opens = new CountAnswer[] { openNormal, openException, openError };
CountAnswer[] nextFrames = new CountAnswer[] { nextFrameNormal, nextFrameException, nextFrameError };
CountAnswer[] fails = new CountAnswer[] { failNormal, failException, failError };
CountAnswer[] closes = new CountAnswer[] { closeNormal, closeException, closeError };
List<IFrameWriter> outputWriters = new ArrayList<>();
for (CountAnswer openAnswer : opens) {
for (CountAnswer nextFrameAnswer : nextFrames) {
for (CountAnswer failAnswer : fails) {
for (CountAnswer closeAnswer : closes) {
IFrameWriter writer = Mockito.mock(IFrameWriter.class);
Mockito.doAnswer(openAnswer).when(writer).open();
Mockito.doAnswer(nextFrameAnswer).when(writer).nextFrame(Mockito.any());
Mockito.doAnswer(failAnswer).when(writer).fail();
Mockito.doAnswer(closeAnswer).when(writer).close();
outputWriters.add(writer);
}
}
}
}
return outputWriters.toArray(new IFrameWriter[outputWriters.size()]);
}
Aggregations