use of com.orientechnologies.orient.core.record.impl.ODocument in project orientdb by orientechnologies.
the class OJsonExtractorTest method testEmptyObject.
@Test
public void testEmptyObject() {
process("{source: { content: { value: {} } }, extractor : { json: {} }, loader: { test: {} } }");
assertEquals(1, getResult().size());
ODocument doc = getResult().get(0);
assertEquals(0, doc.fields());
}
use of com.orientechnologies.orient.core.record.impl.ODocument in project orientdb by orientechnologies.
the class OJsonRandomExtractorTest method testParallel.
@Test
public void testParallel() {
final int TOTAL = 2000000;
proc.getFactory().registerExtractor(OETLStubRandomExtractor.class);
process("{extractor : { random: {items: " + TOTAL + ", fields: 10, delay: 0} }, " + "loader: { orientdb: { dbURL: 'plocal:./target/OETLBaseTest', dbType:'graph', class: 'Person', useLightweightEdges:false, " + "classes: [{name: 'Person', extends: 'V', clusters: 8 }] } } }", new OBasicCommandContext().setVariable("parallel", Boolean.TRUE).setVariable("dumpEveryMs", 1000));
assertEquals(TOTAL, graph.countVertices("Person"));
int i = 0;
for (ODocument doc : graph.getRawGraph().browseClass("Person")) {
assertEquals(10, doc.fields());
i++;
}
}
use of com.orientechnologies.orient.core.record.impl.ODocument in project orientdb by orientechnologies.
the class OCSVExtractorTest method testCRLFIWithinQuotes.
@Test
public void testCRLFIWithinQuotes() {
String cfgJson = "{source: { content: { value: 'id ,text ,num \r\n1,\"my test\r\n text\",1\r\n'} }, extractor : { csv : {} }, loader : { test: {} } }";
process(cfgJson);
List<ODocument> res = getResult();
assertFalse(res.isEmpty());
ODocument doc = res.get(0);
assertThat((Integer) doc.field("id ")).isEqualTo(1);
assertThat((String) doc.field("text ")).isEqualTo("my test\r\n text");
assertThat((Integer) doc.field("num ")).isEqualTo(1);
}
use of com.orientechnologies.orient.core.record.impl.ODocument in project orientdb by orientechnologies.
the class OCSVExtractorTest method testLong.
@Test
public void testLong() {
String cfgJson = "{source: { content: { value: 'number\n3000000000'} }, extractor : { csv: {} }, loader : { test: {} } }";
process(cfgJson);
List<ODocument> res = getResult();
assertFalse(res.isEmpty());
ODocument doc = res.get(0);
assertEquals(new Long(3000000000L), (Long) doc.field("number"));
}
use of com.orientechnologies.orient.core.record.impl.ODocument in project orientdb by orientechnologies.
the class OCSVExtractorTest method testDateTypeAutodetectionWithCustomDateFormat.
@Test
public void testDateTypeAutodetectionWithCustomDateFormat() {
String cfgJson = "{source: { content: { value: 'BirthDay\n30-04-2008' } }, extractor : { csv: {dateFormat: \"dd-MM-yyyy\"} }, loader: { test: {} } }";
process(cfgJson);
List<ODocument> res = getResult();
ODocument doc = res.get(0);
Date birthday = doc.field("BirthDay");
assertEquals(2008, birthday.getYear() + 1900);
assertEquals(4, birthday.getMonth() + 1);
assertEquals(30, birthday.getDate());
}
Aggregations