Skip to content

Commit eac2b32

Browse files
committed
sync the fetch syntax: add yield
1 parent 2b82dda commit eac2b32

File tree

1 file changed

+31
-26
lines changed

1 file changed

+31
-26
lines changed

client/src/test/java/com/vesoft/nebula/client/graph/data/TestDataFromServer.java

+31-26
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,18 @@ public void setUp() throws Exception {
109109
resp = session.execute(insertEdges);
110110
Assert.assertTrue(resp.getErrorMessage(), resp.isSucceeded());
111111

112-
String insertShape = "INSERT VERTEX any_shape(geo) VALUES 'Point':(ST_GeogFromText('POINT"
113-
+ "(3 8)'));";
112+
String insertShape =
113+
"INSERT VERTEX any_shape(geo) VALUES 'Point':(ST_GeogFromText('POINT(3 8)'));";
114114
resp = session.execute(insertShape);
115115
Assert.assertTrue(resp.getErrorMessage(), resp.isSucceeded());
116116

117-
insertShape = "INSERT VERTEX any_shape(geo) VALUES 'LString':(ST_GeogFromText('LINESTRING"
118-
+ "(3 8, 4.7 73.23)'));";
117+
insertShape = "INSERT VERTEX any_shape(geo) VALUES 'LString':"
118+
+ "(ST_GeogFromText('LINESTRING(3 8, 4.7 73.23)'));";
119119
resp = session.execute(insertShape);
120120
Assert.assertTrue(resp.getErrorMessage(), resp.isSucceeded());
121121

122-
insertShape = "INSERT VERTEX any_shape(geo) VALUES 'Polygon':(ST_GeogFromText('POLYGON((0 "
123-
+ "1, 1 2, 2 3, 0 1))'));";
122+
insertShape = "INSERT VERTEX any_shape(geo) VALUES 'Polygon':"
123+
+ "(ST_GeogFromText('POLYGON((0 1, 1 2, 2 3, 0 1))'));";
124124
resp = session.execute(insertShape);
125125
Assert.assertTrue(resp.getErrorMessage(), resp.isSucceeded());
126126
}
@@ -136,7 +136,8 @@ public void tearDown() {
136136
@Test
137137
public void testAllSchemaType() {
138138
try {
139-
ResultSet result = session.execute("FETCH PROP ON person 'Bob';");
139+
ResultSet result = session.execute(
140+
"FETCH PROP ON person 'Bob' yield vertex as vertices_;");
140141
Assert.assertTrue(result.isSucceeded());
141142
Assert.assertEquals("", result.getErrorMessage());
142143
Assert.assertFalse(result.getLatency() <= 0);
@@ -193,7 +194,8 @@ public void testAllSchemaType() {
193194
Assert.assertEquals(ValueWrapper.NullType.__NULL__,
194195
properties.get("hobby").asNull().getNullType());
195196

196-
result = session.execute("FETCH PROP ON any_shape 'Point';");
197+
result = session.execute(
198+
"FETCH PROP ON any_shape 'Point' yield vertex as vertices_;");
197199
Assert.assertTrue(result.isSucceeded());
198200
Assert.assertEquals("", result.getErrorMessage());
199201
Assert.assertFalse(result.getLatency() <= 0);
@@ -214,7 +216,8 @@ public void testAllSchemaType() {
214216
Assert.assertEquals(geographyWrapper.toString(),
215217
properties.get("geo").asGeography().toString());
216218

217-
result = session.execute("FETCH PROP ON any_shape 'LString';");
219+
result = session.execute(
220+
"FETCH PROP ON any_shape 'LString' yield vertex as vertices_;");
218221
Assert.assertTrue(result.isSucceeded());
219222
Assert.assertEquals("", result.getErrorMessage());
220223
Assert.assertFalse(result.getLatency() <= 0);
@@ -237,7 +240,8 @@ public void testAllSchemaType() {
237240
properties.get("geo").asGeography().toString());
238241

239242

240-
result = session.execute("FETCH PROP ON any_shape 'Polygon';");
243+
result = session.execute(
244+
"FETCH PROP ON any_shape 'Polygon' yield vertex as vertices_;");
241245
Assert.assertTrue(result.isSucceeded());
242246
Assert.assertEquals("", result.getErrorMessage());
243247
Assert.assertFalse(result.getLatency() <= 0);
@@ -254,12 +258,12 @@ public void testAllSchemaType() {
254258
properties = node.properties("any_shape");
255259
geographyWrapper = new GeographyWrapper(
256260
new Geography(Geography.PGVAL,
257-
new Polygon(Arrays.asList(Arrays.asList(
258-
new Coordinate(0, 1),
259-
new Coordinate(1, 2),
260-
new Coordinate(2, 3),
261-
new Coordinate(0,1))
262-
))));
261+
new Polygon(Arrays.asList(Arrays.asList(
262+
new Coordinate(0, 1),
263+
new Coordinate(1, 2),
264+
new Coordinate(2, 3),
265+
new Coordinate(0, 1))
266+
))));
263267
Assert.assertEquals(geographyWrapper, properties.get("geo").asGeography());
264268
Assert.assertEquals(geographyWrapper.toString(),
265269
properties.get("geo").asGeography().toString());
@@ -478,7 +482,8 @@ public void tesDataset() {
478482
@Test
479483
public void testErrorResult() {
480484
try {
481-
ResultSet result = session.execute("FETCH PROP ON no_exist_tag \"nobody\"");
485+
ResultSet result = session.execute(
486+
"FETCH PROP ON no_exist_tag \"nobody\" yield vertex as vertices_");
482487
Assert.assertTrue(result.toString().contains("ExecutionResponse"));
483488
} catch (IOErrorException e) {
484489
e.printStackTrace();
@@ -514,11 +519,11 @@ public void testComplexTypeForJson() {
514519
String rowData = resp.getJSONArray("results").getJSONObject(0).getJSONArray("data")
515520
.getJSONObject(0).getJSONArray("row").toJSONString();
516521
Assert.assertEquals(rowData, "[{\"person.first_out_city\":1111,\"person"
517-
+ ".book_num\":100,\"person.age\":10,\"person.expend\":100,\"person.is_girl\":"
518-
+ "false,\"person.name\":\"Bob\",\"person.grade\":3,\"person.birthday\":\"2010"
519-
+ "-09-10T02:08:02.0Z\",\"student.name\":\"Bob\",\"person.child_name\":\"Hello"
520-
+ " Worl\",\"person.property\":1000,\"person.morning\":\"23:10:00.000000Z\",\""
521-
+ "person.start_school\":\"2017-09-10\",\"person.friends\":10}]");
522+
+ ".book_num\":100,\"person.age\":10,\"person.expend\":100,\"person.is_girl\":"
523+
+ "false,\"person.name\":\"Bob\",\"person.grade\":3,\"person.birthday\":\"2010"
524+
+ "-09-10T02:08:02.0Z\",\"student.name\":\"Bob\",\"person.child_name\":\"Hello"
525+
+ " Worl\",\"person.property\":1000,\"person.morning\":\"23:10:00.000000Z\",\""
526+
+ "person.start_school\":\"2017-09-10\",\"person.friends\":10}]");
522527
} catch (IOErrorException e) {
523528
e.printStackTrace();
524529
assert false;
@@ -552,7 +557,7 @@ public void testSelfSignedSsl() {
552557
try {
553558
Runtime runtime = Runtime.getRuntime();
554559
runtime.exec("docker-compose -f src/test/resources/docker-compose"
555-
+ "-selfsigned.yaml up -d");
560+
+ "-selfsigned.yaml up -d");
556561

557562
NebulaPoolConfig nebulaSslPoolConfig = new NebulaPoolConfig();
558563
nebulaSslPoolConfig.setMaxConnSize(100);
@@ -574,7 +579,7 @@ public void testSelfSignedSsl() {
574579
Assert.assertEquals(rowData, exp);
575580

576581
runtime.exec("docker-compose -f src/test/resources/docker-compose"
577-
+ "-selfsigned.yaml down").waitFor(60,TimeUnit.SECONDS);
582+
+ "-selfsigned.yaml down").waitFor(60, TimeUnit.SECONDS);
578583
} catch (Exception e) {
579584
e.printStackTrace();
580585
assert false;
@@ -593,7 +598,7 @@ public void testCASignedSsl() {
593598
try {
594599
Runtime runtime = Runtime.getRuntime();
595600
runtime.exec("docker-compose -f src/test/resources/docker-compose"
596-
+ "-casigned.yaml up -d");
601+
+ "-casigned.yaml up -d");
597602

598603
NebulaPoolConfig nebulaSslPoolConfig = new NebulaPoolConfig();
599604
nebulaSslPoolConfig.setMaxConnSize(100);
@@ -615,7 +620,7 @@ public void testCASignedSsl() {
615620
Assert.assertEquals(rowData, exp);
616621

617622
runtime.exec("docker-compose -f src/test/resources/docker-compose"
618-
+ "-casigned.yaml down").waitFor(60,TimeUnit.SECONDS);
623+
+ "-casigned.yaml down").waitFor(60, TimeUnit.SECONDS);
619624
} catch (Exception e) {
620625
e.printStackTrace();
621626
assert false;

0 commit comments

Comments
 (0)