Search in sources :

Example 6 with TestingRowConsumer

use of io.crate.testing.TestingRowConsumer in project crate by crate.

the class FileReadingCollectorTest method testCollectWithEmptyLine.

@Test
public void testCollectWithEmptyLine() throws Throwable {
    TestingRowConsumer consumer = getObjects(Paths.get(tmpFileEmptyLine.toURI()).toUri().toString());
    assertCorrectResult(consumer.getBucket());
}
Also used : TestingRowConsumer(io.crate.testing.TestingRowConsumer) Test(org.junit.Test)

Example 7 with TestingRowConsumer

use of io.crate.testing.TestingRowConsumer in project crate by crate.

the class FileReadingCollectorTest method testDoCollectRaw.

@Test
public void testDoCollectRaw() throws Throwable {
    TestingRowConsumer consumer = getObjects(Paths.get(tmpFile.toURI()).toUri().toString());
    assertCorrectResult(consumer.getBucket());
}
Also used : TestingRowConsumer(io.crate.testing.TestingRowConsumer) Test(org.junit.Test)

Example 8 with TestingRowConsumer

use of io.crate.testing.TestingRowConsumer in project crate by crate.

the class FileReadingCollectorTest method testMultipleUriSupport.

@Test
public void testMultipleUriSupport() throws Throwable {
    List<String> fileUris = new ArrayList<>();
    fileUris.add(Paths.get(tmpFile.toURI()).toUri().toString());
    fileUris.add(Paths.get(tmpFileEmptyLine.toURI()).toUri().toString());
    TestingRowConsumer consumer = getObjects(fileUris, null);
    Iterator<Row> it = consumer.getBucket().iterator();
    assertThat(it.next(), isRow("{\"name\": \"Arthur\", \"id\": 4, \"details\": {\"age\": 38}}"));
    assertThat(it.next(), isRow("{\"id\": 5, \"name\": \"Trillian\", \"details\": {\"age\": 33}}"));
    assertThat(it.next(), isRow("{\"name\": \"Arthur\", \"id\": 4, \"details\": {\"age\": 38}}"));
    assertThat(it.next(), isRow("{\"id\": 5, \"name\": \"Trillian\", \"details\": {\"age\": 33}}"));
}
Also used : ArrayList(java.util.ArrayList) TestingHelpers.isRow(io.crate.testing.TestingHelpers.isRow) Row(io.crate.data.Row) TestingRowConsumer(io.crate.testing.TestingRowConsumer) Test(org.junit.Test)

Example 9 with TestingRowConsumer

use of io.crate.testing.TestingRowConsumer in project crate by crate.

the class FileReadingCollectorTest method testCollectFromUriWithGlob.

@Test
public void testCollectFromUriWithGlob() throws Throwable {
    TestingRowConsumer projector = getObjects(Paths.get(tmpFile.getParentFile().toURI()).toUri().toString() + "file*.json");
    assertCorrectResult(projector.getBucket());
}
Also used : TestingRowConsumer(io.crate.testing.TestingRowConsumer) Test(org.junit.Test)

Example 10 with TestingRowConsumer

use of io.crate.testing.TestingRowConsumer in project crate by crate.

the class FileReadingCollectorTest method testRelativeImport.

@Test(expected = IllegalArgumentException.class)
public void testRelativeImport() throws Throwable {
    TestingRowConsumer projector = getObjects("xy");
    assertCorrectResult(projector.getBucket());
}
Also used : TestingRowConsumer(io.crate.testing.TestingRowConsumer) Test(org.junit.Test)

Aggregations

TestingRowConsumer (io.crate.testing.TestingRowConsumer)64 Test (org.junit.Test)55 Row (io.crate.data.Row)24 CollectionBucket (io.crate.data.CollectionBucket)11 Bucket (io.crate.data.Bucket)10 CrateDummyClusterServiceUnitTest (io.crate.test.integration.CrateDummyClusterServiceUnitTest)10 InputColumn (io.crate.expression.symbol.InputColumn)6 BatchSimulatingIterator (io.crate.testing.BatchSimulatingIterator)6 ArrayBucket (io.crate.data.ArrayBucket)5 TestingHelpers.isRow (io.crate.testing.TestingHelpers.isRow)5 Streamer (io.crate.Streamer)4 Projector (io.crate.data.Projector)4 GroupingProjector (io.crate.execution.engine.aggregation.GroupingProjector)4 SortingProjector (io.crate.execution.engine.sort.SortingProjector)4 SortingTopNProjector (io.crate.execution.engine.sort.SortingTopNProjector)4 DistResultRXTask (io.crate.execution.jobs.DistResultRXTask)4 ArrayList (java.util.ArrayList)4 RowAccounting (io.crate.breaker.RowAccounting)3 CombinedRow (io.crate.data.join.CombinedRow)3 CompletionException (java.util.concurrent.CompletionException)3