org.umlg.sqlg.test.TestQuery.groovy Maven / Gradle / Ivy
package org.umlg.sqlg.test
import com.fasterxml.jackson.databind.ObjectMapper
import org.junit.Assume
import org.junit.Test
import static org.junit.Assert.*
/**
* Created by pieter on 2014/07/31.
*/
class TestQuery extends BaseTest {
@Test
public void testQuery() {
Assume.assumeTrue(this.sqlgGraph.getSqlDialect().supportsFloatValues());
Assume.assumeTrue(this.sqlgGraph.getSqlDialect().supportsStringArrayValues());
String[] arrStr = ['Ananas', 'Banana', 'Kiwi']
this.sqlgGraph.addVertex("Person", [name : "Pieter", ageI: 40, ageL: 40L, ageF: 40F, ageD: 40D, ageS: (short) 1,
nameArray: arrStr]);
this.sqlgGraph.addVertex("Person", [name : "Marko", ageI: 40, ageL: 40L, ageF: 40F, ageD: 40D, ageS: (short) 1,
nameArray: arrStr]);
this.sqlgGraph.tx().commit()
assertEquals(2, this.sqlgGraph.traversal().V().count().next());
String json = this.sqlgGraph.query("select * from \"V_Person\"");
ObjectMapper mapper = new ObjectMapper();
Map jsonAsMap = mapper.readValue(json, Map.class);
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy