use of org.talend.components.salesforce.runtime.BulkResult in project components by Talend.
the class BulkResultAdapterFactoryTest method testConvertToAvro.
@Test
public void testConvertToAvro() throws IOException {
converter.setSchema(SCHEMA);
assertNotNull(converter.getSchema());
assertEquals(BulkResult.class, converter.getDatumClass());
BulkResult result = new BulkResult();
result.setValue("Id", "12345");
result.setValue("Name", "Qwerty");
result.setValue("FieldX", "42");
result.setValue("FieldY", "true");
IndexedRecord indexedRecord = converter.convertToAvro(result);
assertNotNull(indexedRecord);
assertNotNull(indexedRecord.getSchema());
assertEquals(SCHEMA, indexedRecord.getSchema());
assertEquals("12345", indexedRecord.get(0));
assertEquals("Qwerty", indexedRecord.get(1));
assertEquals(Integer.valueOf(42), indexedRecord.get(2));
assertEquals(Boolean.TRUE, indexedRecord.get(3));
}
use of org.talend.components.salesforce.runtime.BulkResult in project components by Talend.
the class BulkResultAdapterFactoryTest method testIndexedRecordUnmodifiable.
@Test(expected = IndexedRecordConverter.UnmodifiableAdapterException.class)
public void testIndexedRecordUnmodifiable() throws IOException {
converter.setSchema(SCHEMA);
BulkResult result = new BulkResult();
result.setValue("Id", "12345");
result.setValue("Name", "Qwerty");
result.setValue("FieldX", "42");
result.setValue("FieldY", "true");
IndexedRecord indexedRecord = converter.convertToAvro(result);
indexedRecord.put(1, "Asdfgh");
}
Aggregations