use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class AzureStorageGetReaderTestIT method testBlobGetAllInvalidPrefixFailure.
@SuppressWarnings("rawtypes")
@Test
public void testBlobGetAllInvalidPrefixFailure() throws Exception {
cleanupLists();
prefixes.add("bizarre-bizarre/");
includes.add(true);
creates.add(true);
BoundedReader reader = createGetReader(false);
assertFalse(reader.start());
reader.close();
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class AzureStorageGetReaderTestIT method testBlobGetAllMakeParentDirectoriesFailure.
@SuppressWarnings("rawtypes")
@Test(expected = FileNotFoundException.class)
public void testBlobGetAllMakeParentDirectoriesFailure() throws Exception {
cleanupLists();
prefixes.add("");
includes.add(true);
creates.add(false);
BoundedReader reader = createGetReader(true);
assertFalse(reader.start());
reader.close();
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class TAzureStorageOuputTableTestIT method testMerge.
@SuppressWarnings("rawtypes")
@Test
public void testMerge() throws Throwable {
currentTable = tbl_test + "Merge";
insertTestValues(currentTable);
properties.schema.schema.setValue(getMergeSchema());
properties.actionOnData.setValue(ActionOnData.Merge);
properties.schemaListener.afterSchema();
Writer<?> writer = createWriter(properties);
writer.open("test-uid");
for (String p : partitions) {
for (String r : rows) {
IndexedRecord entity = new GenericData.Record(getMergeSchema());
assertEquals(3, entity.getSchema().getFields().size());
entity.put(0, p);
entity.put(1, r);
entity.put(2, 1000000L * 2);
writer.write(entity);
}
}
writer.close();
// check results...
BoundedReader reader = createReader(currentTable, filter, false);
int counted = 0;
assertTrue(reader.start());
do {
counted++;
IndexedRecord current = (IndexedRecord) reader.getCurrent();
assertEquals(1000000L * 2, current.get(current.getSchema().getField("longy").pos()));
// checks that other fields remained the sames...
assertEquals(current.get(current.getSchema().getField("daty").pos()), testTimestamp);
assertEquals(current.get(current.getSchema().getField("inty").pos()), 1000);
assertEquals(current.get(current.getSchema().getField("stringy").pos()), testString);
assertEquals(current.get(current.getSchema().getField("doubly").pos()), 100.5562);
assertEquals(new String((byte[]) current.get(current.getSchema().getField("bytys").pos())), "ABCDEFGH");
assertEquals(10, current.getSchema().getFields().size());
} while (reader.advance());
reader.close();
// we should have read 9 rows...
assertEquals(9, counted);
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class TAzureStorageOuputTableTestIT method testDelete.
@SuppressWarnings("rawtypes")
@Test
public void testDelete() throws Throwable {
currentTable = tbl_test + "Delete";
//
insertTestValues(currentTable);
//
cleanupEntities(currentTable);
BoundedReader reader = createReader(currentTable, filter, false);
assertFalse(reader.start());
reader.close();
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class TAzureStorageOuputTableTestIT method testReplace.
@SuppressWarnings("rawtypes")
@Test
public void testReplace() throws Throwable {
currentTable = tbl_test + "Replace";
insertTestValues(currentTable);
properties.schema.schema.setValue(getSimpleTestSchema());
properties.actionOnData.setValue(ActionOnData.Replace);
properties.schemaListener.afterSchema();
Writer<?> writer = createWriter(properties);
writer.open("test-uid");
for (String p : partitions) {
for (String r : rows) {
// IndexedRecord entity = new GenericData.Record(getWriteSchema());
IndexedRecord entity = new GenericData.Record(getSimpleTestSchema());
entity.put(0, p);
entity.put(1, r);
entity.put(2, "NewValue");
writer.write(entity);
}
}
writer.close();
// check results...
BoundedReader reader = createReader(currentTable, filter, false);
int counted = 0;
assertTrue(reader.start());
do {
counted++;
IndexedRecord current = (IndexedRecord) reader.getCurrent();
assertEquals(current.get(current.getSchema().getField("StringValue").pos()), "NewValue");
assertEquals(4, current.getSchema().getFields().size());
} while (reader.advance());
reader.close();
// we should have read 9 rows...
assertEquals(9, counted);
}
Aggregations