use of com.orientechnologies.orient.core.record.impl.ODocument in project orientdb by orientechnologies.
the class OCSVTransformerTest method testEndingLineBreak.
@Test
public void testEndingLineBreak() {
String cfgJson = "{source: { content: { value: 'id,text,num\r\n1,my test text,1\r\n'} }, extractor : { row : {} }, transformers : [{ csv : {} }], loader : { test: {} } }";
process(cfgJson);
List<ODocument> res = getResult();
ODocument doc = res.get(0);
assertEquals(new Integer(1), (Integer) doc.field("id"));
assertEquals("my test text", (String) doc.field("text"));
assertEquals(new Integer(1), (Integer) doc.field("num"));
}
use of com.orientechnologies.orient.core.record.impl.ODocument in project orientdb by orientechnologies.
the class OCSVTransformerTest method testDoubleWithingQuotesAndCommaAsDecimalSeparator.
@Test
public void testDoubleWithingQuotesAndCommaAsDecimalSeparator() {
Double minDouble = 540282346638528870000000000000000000000.0d;
String cfgJson = "{source: { content: { value: 'secondNumber\n\"540282346638528870000000000000000000000,0\"'} }, extractor : { row: {} }, transformers : [{ csv: {} }], loader: { test: {} } }";
process(cfgJson);
List<ODocument> res = getResult();
ODocument doc = res.get(0);
assertEquals(minDouble, (Double) doc.field("secondNumber"));
}
use of com.orientechnologies.orient.core.record.impl.ODocument in project orientdb by orientechnologies.
the class OCSVTransformerTest method testNullValueInCell.
@Test
public void testNullValueInCell() {
String cfgJson = "{source: { content: { value: 'id,postId,text\n1,NULL,Hello'} }, extractor : { row : {} }, transformers : [{ csv : {nullValue: 'NULL'} }], loader : { test: {} } }";
process(cfgJson);
List<ODocument> res = getResult();
ODocument doc = res.get(0);
assertEquals(new Integer(1), (Integer) doc.field("id"));
assertNull(doc.field("postId"));
assertEquals("Hello", (String) doc.field("text"));
}
use of com.orientechnologies.orient.core.record.impl.ODocument in project orientdb by orientechnologies.
the class OCSVTransformerTest method testDouble.
@Test
public void testDouble() {
Double minDouble = 540282346638528870000000000000000000000.0d;
String cfgJson = "{source: { content: { value: 'secondNumber\n540282346638528870000000000000000000000.0'} }, extractor : { row: {} }, transformers : [{ csv: {} }], loader: { test: {} } }";
process(cfgJson);
List<ODocument> res = getResult();
ODocument doc = res.get(0);
assertEquals(minDouble, (Double) doc.field("secondNumber"));
}
use of com.orientechnologies.orient.core.record.impl.ODocument in project orientdb by orientechnologies.
the class OCSVTransformerTest method testLongWithingQuotes.
@Test
public void testLongWithingQuotes() {
String cfgJson = "{source: { content: { value: 'number\n\"3000000000\"'} }, extractor : { row : {} }, transformers : [{ csv : {} }], loader : { test: {} } }";
process(cfgJson);
List<ODocument> res = getResult();
ODocument doc = res.get(0);
assertEquals(new Long(3000000000L), (Long) doc.field("number"));
}
Aggregations