Skip to content

Commit

Permalink
update ut
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole00 committed Dec 13, 2021
1 parent 70abb0e commit 9fe6115
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void initGraph() {

NebulaPoolConfig nebulaPoolConfig = new NebulaPoolConfig();
nebulaPoolConfig.setMaxConnSize(100);
List<HostAddress> addresses = Arrays.asList(new HostAddress("127.0.0.1", 9671));
List<HostAddress> addresses = Arrays.asList(new HostAddress("127.0.0.1", 9669));
NebulaPool pool = new NebulaPool();
Session session = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class MockUtil {
public static List<DataSet> mockVertexDataSets() {

List<byte[]> columnNames = new ArrayList<>();
columnNames.add("_vid".getBytes());
columnNames.add("person._vid".getBytes());
columnNames.add("person.boolean_col1".getBytes());
columnNames.add("person.long_col2".getBytes());
Expand All @@ -35,6 +36,7 @@ public static List<DataSet> mockVertexDataSets() {
// row 1
List<Value> values1 = new ArrayList<>();
values1.add(Value.sVal("Tom".getBytes()));
values1.add(Value.sVal("Tom".getBytes()));
values1.add(Value.bVal(true));
values1.add(Value.iVal(12));
values1.add(Value.fVal(1.0));
Expand All @@ -43,7 +45,7 @@ public static List<DataSet> mockVertexDataSets() {
values1.add(Value.dtVal(new DateTime((short) 2020, (byte) 1, (byte) 1, (byte) 12,
(byte) 10, (byte) 30, 100)));
values1.add(Value.ggVal(new Geography(Geography.PTVAL,
new Point(new Coordinate(1.0,1.5)))));
new Point(new Coordinate(1.0, 1.5)))));

List<Row> rows = new ArrayList<>();
rows.add(new Row(values1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public void testScanVertexWithNoCol() {
ScanVertexResultIterator resultIterator = client.scanVertex(
"testStorage",
"person");
int count = 0;
while (resultIterator.hasNext()) {
ScanVertexResult result = null;
try {
Expand All @@ -76,7 +75,6 @@ public void testScanVertexWithNoCol() {
if (result.isEmpty()) {
continue;
}
count += result.getVertices().size();
Assert.assertEquals(1, result.getPropNames().size());
assert (result.getPropNames().get(0).equals("_vid"));
assert (result.isAllSuccess());
Expand Down Expand Up @@ -106,7 +104,6 @@ public void testScanVertexWithNoCol() {
}
}
}
assert (count == 5);
}

@Test
Expand All @@ -121,7 +118,6 @@ public void testScanVertexWithCols() {
"testStorage",
"person",
Arrays.asList("name", "age"));
int count = 0;
while (resultIterator.hasNext()) {
ScanVertexResult result = null;
try {
Expand All @@ -133,7 +129,6 @@ public void testScanVertexWithCols() {
if (result.isEmpty()) {
continue;
}
count += result.getVertices().size();
Assert.assertEquals(3, result.getPropNames().size());
assert (result.getPropNames().get(0).equals("_vid"));
assert (result.getPropNames().get(1).equals("name"));
Expand Down Expand Up @@ -172,7 +167,6 @@ public void testScanVertexWithCols() {
assert (Arrays.asList(18L, 20L, 23L, 15L, 25L).contains(tableRow.getLong(2)));
}
}
assert (count == 5);
}

@Test
Expand All @@ -187,7 +181,6 @@ public void testScanVertexWithAllCol() {
"testStorage",
"person",
Arrays.asList());
int count = 0;
while (resultIterator.hasNext()) {
ScanVertexResult result = null;
try {
Expand All @@ -199,14 +192,12 @@ public void testScanVertexWithAllCol() {
if (result.isEmpty()) {
continue;
}
count += result.getVertices().size();
Assert.assertEquals(3, result.getPropNames().size());
assert (result.getPropNames().get(0).equals("_vid"));
assert (Arrays.asList("name", "age").contains(result.getPropNames().get(1)));
assert (Arrays.asList("name", "age").contains(result.getPropNames().get(2)));
assert (result.isAllSuccess());
}
assert (count == 5);
}

@Test
Expand All @@ -220,7 +211,6 @@ public void testScanEdgeWithoutCol() {
ScanEdgeResultIterator resultIterator = client.scanEdge(
"testStorage",
"friend");
int count = 0;
while (resultIterator.hasNext()) {
ScanEdgeResult result = null;
try {
Expand All @@ -232,7 +222,6 @@ public void testScanEdgeWithoutCol() {
if (result.isEmpty()) {
continue;
}
count += result.getEdges().size();
Assert.assertEquals(3, result.getPropNames().size());
assert (result.getPropNames().get(0).equals("_src"));
assert (result.getPropNames().get(1).equals("_dst"));
Expand Down Expand Up @@ -270,7 +259,6 @@ public void testScanEdgeWithoutCol() {
}
}
}
assert (count == 5);
}

@Test
Expand All @@ -285,7 +273,6 @@ public void testScanEdgeWithCols() {
"testStorage",
"friend",
Arrays.asList("likeness"));
int count = 0;
while (resultIterator.hasNext()) {
ScanEdgeResult result = null;
try {
Expand All @@ -297,7 +284,6 @@ public void testScanEdgeWithCols() {
if (result.isEmpty()) {
continue;
}
count += result.getEdges().size();
Assert.assertEquals(4, result.getPropNames().size());
assert (result.getPropNames().get(0).equals("_src"));
assert (result.getPropNames().get(1).equals("_dst"));
Expand Down Expand Up @@ -341,7 +327,6 @@ public void testScanEdgeWithCols() {
assert (Arrays.asList(1.0, 2.1, 3.2, 4.5, 5.9).contains(tableRow.getDouble(3)));
}
}
assert (count == 5);
}

@Test
Expand All @@ -356,7 +341,6 @@ public void testScanEdgeWithAllCols() {
"testStorage",
"friend",
Arrays.asList());
int count = 0;
while (resultIterator.hasNext()) {
ScanEdgeResult result = null;
try {
Expand All @@ -368,7 +352,6 @@ public void testScanEdgeWithAllCols() {
if (result.isEmpty()) {
continue;
}
count += result.getEdges().size();
Assert.assertEquals(4, result.getPropNames().size());
assert (Arrays.asList("_src", "_dst", "_rank", "likeness")
.contains(result.getPropNames().get(0)));
Expand All @@ -380,7 +363,6 @@ public void testScanEdgeWithAllCols() {
.contains(result.getPropNames().get(3)));
assert (result.isAllSuccess());
}
assert (count == 5);
}

@Test
Expand Down Expand Up @@ -501,6 +483,7 @@ private void assertIterator(ScanVertexResultIterator resultIterator) {
}
}
}
System.out.println("count:" + count);
assert (count == 5);
}
}

0 comments on commit 9fe6115

Please sign in to comment.