Skip to content

Commit

Permalink
refactor(test): migrate tests to the new query engine
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Nov 12, 2024
1 parent 0714584 commit 9edc164
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.orientechnologies.orient.core.metadata.schema.OSchema;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import com.orientechnologies.orient.core.sql.executor.OResult;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -103,17 +103,17 @@ protected void queryLineString() {
String query =
"select * from Place where location && { 'shape' : { 'type' : 'OLineString' , 'coordinates'"
+ " : [[1,2],[4,6]]} } ";
List<ODocument> docs = db.query(new OSQLSynchQuery<ODocument>(query));
List<OResult> docs = db.query(query).stream().toList();

Assert.assertEquals(docs.size(), 1);

query = "select * from Place where location && 'LINESTRING(1 2, 4 6)' ";
docs = db.query(new OSQLSynchQuery<ODocument>(query));
docs = db.query(query).stream().toList();

Assert.assertEquals(docs.size(), 1);

query = "select * from Place where location && ST_GeomFromText('LINESTRING(1 2, 4 6)') ";
docs = db.query(new OSQLSynchQuery<ODocument>(query));
docs = db.query(query).stream().toList();

Assert.assertEquals(docs.size(), 1);

Expand All @@ -122,7 +122,7 @@ protected void queryLineString() {
+ " 61.40723633876356,-149.2657470703125 61.40723633876356,-149.2657470703125"
+ " 61.05562700886678,-150.205078125 61.05562700886678,-150.205078125"
+ " 61.40723633876356))' ";
docs = db.query(new OSQLSynchQuery<ODocument>(query));
docs = db.query(query).stream().toList();

Assert.assertEquals(docs.size(), 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
import com.orientechnologies.orient.core.metadata.schema.OClass;
import com.orientechnologies.orient.core.metadata.schema.OSchema;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import com.orientechnologies.orient.core.sql.executor.OResult;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
Expand Down Expand Up @@ -247,7 +246,7 @@ public void testWithIndex() {

protected void testQueryMultiLineString() {
String query = "select * from Place where location && 'POINT(-157.9159477 21.3433168)' ";
List<ODocument> docs = db.query(new OSQLSynchQuery<ODocument>(query));
List<OResult> docs = db.query(query).stream().toList();

Assert.assertEquals(docs.size(), 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.orientechnologies.orient.core.metadata.schema.OSchema;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import com.orientechnologies.orient.core.sql.executor.OResult;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -158,7 +158,7 @@ protected void queryMultiPolygon() {
+ " 62.27814559876582,-160.77392578125 61.53316997618228,-162.53173828125"
+ " 61.4597705702975,-162.861328125 61.762728830472696,-163.14697265625"
+ " 62.12443624549497,-162.5537109375 62.11416112594049))' ";
List<ODocument> docs = db.query(new OSQLSynchQuery<ODocument>(query));
List<OResult> docs = db.query(query).stream().toList();

Assert.assertEquals(docs.size(), 1);

Expand Down Expand Up @@ -206,7 +206,7 @@ protected void queryMultiPolygon() {
+ " 19.25929414046391,-156.0113525390625 19.54943746814108,-156.192626953125"
+ " 19.766703551716972,-155.950927734375 19.921712747556207,-155.9344482421875"
+ " 20.13847031245115,-155.928955078125 20.25704380463238)))' ";
docs = db.query(new OSQLSynchQuery<ODocument>(query));
docs = db.query(query).stream().toList();

Assert.assertEquals(docs.size(), 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected void queryPoint() {
+ " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375"
+ " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594"
+ " 21.787556698550834)' ";
List<?> old = db.query(new OSQLSynchQuery<ODocument>(query));
List<?> old = db.query(query).stream().toList();

Assert.assertEquals(1, old.size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.orientechnologies.orient.core.metadata.schema.OSchema;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import com.orientechnologies.orient.core.sql.executor.OResult;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
Expand Down Expand Up @@ -57,12 +57,12 @@ public void testPolygonWithoutIndex() throws IOException {
protected void queryPolygon() {

String query = "select * from Place where location && 'POINT(13.383333 52.516667)'";
List<ODocument> docs = db.query(new OSQLSynchQuery<ODocument>(query));
List<OResult> docs = db.query(query).stream().toList();

Assert.assertEquals(docs.size(), 1);

query = "select * from Place where location && 'POINT(12.5 41.9)'";
docs = db.query(new OSQLSynchQuery<ODocument>(query));
docs = db.query(query).stream().toList();

Assert.assertEquals(docs.size(), 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.orientechnologies.orient.core.metadata.schema.OSchema;
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import com.orientechnologies.orient.core.sql.executor.OResult;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
Expand Down Expand Up @@ -65,7 +65,7 @@ public void testPointTransactionRollBack() {
+ " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375"
+ " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594"
+ " 21.787556698550834)' ";
List<ODocument> docs = db.query(new OSQLSynchQuery<ODocument>(query));
List<OResult> docs = db.query(query).stream().toList();
Assert.assertEquals(1, docs.size());
Assert.assertEquals(3, idx.getInternal().size());
db.rollback();
Expand All @@ -75,7 +75,7 @@ public void testPointTransactionRollBack() {
+ " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375"
+ " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594"
+ " 21.787556698550834)' ";
docs = db.query(new OSQLSynchQuery<ODocument>(query));
docs = db.query(query).stream().toList();
Assert.assertEquals(0, docs.size());
Assert.assertEquals(0, idx.getInternal().size());
}
Expand Down Expand Up @@ -109,7 +109,7 @@ public void testPointTransactionUpdate() {
+ " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375"
+ " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594"
+ " 21.787556698550834)' ";
List<ODocument> docs = db.query(new OSQLSynchQuery<ODocument>(query));
List<OResult> docs = db.query(query).stream().toList();
Assert.assertEquals(0, docs.size());
Assert.assertEquals(1, idx.getInternal().size());

Expand All @@ -122,7 +122,7 @@ public void testPointTransactionUpdate() {
+ " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375"
+ " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594"
+ " 21.787556698550834)' ";
docs = db.query(new OSQLSynchQuery<ODocument>(query));
docs = db.query(query).stream().toList();
Assert.assertEquals(1, docs.size());
Assert.assertEquals(1, idx.getInternal().size());

Expand All @@ -133,7 +133,7 @@ public void testPointTransactionUpdate() {
+ " 21.996535232496047,-160.1099395751953 21.94304553343818,-160.169677734375"
+ " 21.89399562866819,-160.21087646484375 21.844928843026818,-160.21018981933594"
+ " 21.787556698550834)' ";
docs = db.query(new OSQLSynchQuery<ODocument>(query));
docs = db.query(query).stream().toList();
Assert.assertEquals(1, docs.size());
Assert.assertEquals(1, idx.getInternal().size());
}
Expand Down

0 comments on commit 9edc164

Please sign in to comment.