From e558a555e42f5df478c453805e21e91d47768ab1 Mon Sep 17 00:00:00 2001 From: zyxxoo <1318247699@qq.com> Date: Fri, 25 Jun 2021 16:22:07 +0800 Subject: [PATCH] chore: improve code style --- .../traversers/AllShortestPathsAPITest.java | 36 --------- .../traversers/AllShortestPathsApiTest.java | 36 --------- .../api/traversers/CountAPITest.java | 47 ------------ .../api/traversers/CountApiTest.java | 47 ------------ .../api/traversers/CrosspointsApiTest.java | 45 ----------- .../CustomizedCrosspointsAPITest.java | 49 ------------ .../CustomizedCrosspointsApiTest.java | 49 ------------ .../api/traversers/EdgesAPITest.java | 74 ------------------ .../api/traversers/EdgesApiTest.java | 74 ------------------ .../traversers/FusiformSimilarityAPITest.java | 51 ------------- .../traversers/FusiformSimilarityApiTest.java | 51 ------------- .../traversers/JaccardSimilarityAPITest.java | 68 ----------------- .../traversers/JaccardSimilarityApiTest.java | 68 ----------------- .../api/traversers/KneighborAPITest.java | 69 ----------------- .../api/traversers/KneighborApiTest.java | 69 ----------------- .../hugegraph/api/traversers/KoutAPITest.java | 75 ------------------- .../hugegraph/api/traversers/KoutApiTest.java | 75 ------------------- .../MultiNodeShortestPathAPITest.java | 49 ------------ .../MultiNodeShortestPathApiTest.java | 49 ------------ .../api/traversers/NeighborRankAPITest.java | 42 ----------- .../api/traversers/NeighborRankApiTest.java | 42 ----------- .../api/traversers/PathsAPITest.java | 74 ------------------ .../api/traversers/PathsApiTest.java | 74 ------------------ .../api/traversers/PersonalRankAPITest.java | 42 ----------- .../api/traversers/PersonalRankApiTest.java | 42 ----------- .../hugegraph/api/traversers/RaysAPITest.java | 50 ------------- .../hugegraph/api/traversers/RaysApiTest.java | 50 ------------- .../api/traversers/RingsApiTest.java | 42 ----------- .../api/traversers/SameNeighborsApiTest.java | 46 ------------ .../api/traversers/ShortestPathApiTest.java | 6 -- .../SingleSourceShortestPathApiTest.java | 6 -- .../api/traversers/TemplatePathsApiTest.java | 6 -- .../traversers/TraversersApiTestSuite.java | 32 -------- 33 files changed, 1635 deletions(-) delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPITest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RingsApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsApiTest.java delete mode 100644 hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TraversersApiTestSuite.java diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPITest.java deleted file mode 100644 index 5903aef05f..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPITest.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class AllShortestPathsApiTest extends BaseApiTest { - - public static String path = "graphs/hugegraph/traversers/allshortestpaths"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String vadasId = name2Ids.get("vadas"); - Map entities = ImmutableMap.of("source", - id2Json(markoId), - "target", - id2Json(vadasId), - "max_depth", 100); - assertResponseStatus(200, client().get(path, entities)); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsApiTest.java deleted file mode 100644 index 5903aef05f..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsApiTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class AllShortestPathsApiTest extends BaseApiTest { - - public static String path = "graphs/hugegraph/traversers/allshortestpaths"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String vadasId = name2Ids.get("vadas"); - Map entities = ImmutableMap.of("source", - id2Json(markoId), - "target", - id2Json(vadasId), - "max_depth", 100); - assertResponseStatus(200, client().get(path, entities)); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountAPITest.java deleted file mode 100644 index 76c6260e7b..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountAPITest.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static com.baidu.hugegraph.testutil.Assert.assertEquals; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class CountApiTest extends BaseApiTest { - - public static String path = "graphs/hugegraph/traversers/count"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testCount() { - String markoId = listAllVertexName2Ids().get("marko"); - String reqBody = String.format("{ " - + "\"source\": \"%s\", " - + "\"steps\": [{ " - + " \"labels\": []," - + " \"degree\": 100," - + " \"skip_degree\": 100}," - + " { " - + " \"labels\": []," - + " \"degree\": 100," - + " \"skip_degree\": 100}, " - + " { " - + " \"labels\": []," - + " \"degree\": 100," - + " \"skip_degree\": 100}]}", markoId); - Response r = client().post(path, reqBody); - String content = assertResponseStatus(200, r); - Integer count = assertJsonContains(content, "count"); - assertEquals(3, count); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountApiTest.java deleted file mode 100644 index 76c6260e7b..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CountApiTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static com.baidu.hugegraph.testutil.Assert.assertEquals; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class CountApiTest extends BaseApiTest { - - public static String path = "graphs/hugegraph/traversers/count"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testCount() { - String markoId = listAllVertexName2Ids().get("marko"); - String reqBody = String.format("{ " - + "\"source\": \"%s\", " - + "\"steps\": [{ " - + " \"labels\": []," - + " \"degree\": 100," - + " \"skip_degree\": 100}," - + " { " - + " \"labels\": []," - + " \"degree\": 100," - + " \"skip_degree\": 100}, " - + " { " - + " \"labels\": []," - + " \"degree\": 100," - + " \"skip_degree\": 100}]}", markoId); - Response r = client().post(path, reqBody); - String content = assertResponseStatus(200, r); - Integer count = assertJsonContains(content, "count"); - assertEquals(3, count); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsApiTest.java deleted file mode 100644 index e7a6d06d72..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsApiTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static com.baidu.hugegraph.testutil.Assert.assertEquals; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class CrosspointsApiTest extends BaseApiTest { - - public static String path = "graphs/hugegraph/traversers/crosspoints"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String vadasId = name2Ids.get("vadas"); - Map params = ImmutableMap.of("source", - id2Json(markoId), - "target", - id2Json(vadasId), - "max_depth", 1000); - Response r = client().get(path, params); - String respBody = assertResponseStatus(200, r); - List> crosspoints = assertJsonContains(respBody, - "crosspoints"); - assertEquals(2, crosspoints.size()); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPITest.java deleted file mode 100644 index 323e591896..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPITest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class CustomizedCrosspointsApiTest extends BaseApiTest { - - public static String path = "graphs/hugegraph/traversers/customizedcrosspoints"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String rippleId = name2Ids.get("ripple"); - String reqBody = String.format("{ " - + "\"sources\":{ " - + " \"ids\":[\"%s\",\"%s\"]}, " - + "\"path_patterns\":[{ " - + " \"steps\":[{ " - + " \"direction\":\"BOTH\"," - + " \"labels\":[], " - + " \"degree\":-1}]}], " - + "\"with_path\":true, " - + "\"with_vertex\":true, " - + "\"capacity\":-1, " - + "\"limit\":-1}", markoId, rippleId); - Response r = client().post(path, reqBody); - String respBody = assertResponseStatus(200, r); - List paths = assertJsonContains(respBody, "paths"); - assertEquals(2, paths.size()); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java deleted file mode 100644 index 323e591896..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsApiTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class CustomizedCrosspointsApiTest extends BaseApiTest { - - public static String path = "graphs/hugegraph/traversers/customizedcrosspoints"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String rippleId = name2Ids.get("ripple"); - String reqBody = String.format("{ " - + "\"sources\":{ " - + " \"ids\":[\"%s\",\"%s\"]}, " - + "\"path_patterns\":[{ " - + " \"steps\":[{ " - + " \"direction\":\"BOTH\"," - + " \"labels\":[], " - + " \"degree\":-1}]}], " - + "\"with_path\":true, " - + "\"with_vertex\":true, " - + "\"capacity\":-1, " - + "\"limit\":-1}", markoId, rippleId); - Response r = client().post(path, reqBody); - String respBody = assertResponseStatus(200, r); - List paths = assertJsonContains(respBody, "paths"); - assertEquals(2, paths.size()); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPITest.java deleted file mode 100644 index 507884a4f7..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPITest.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableMultimap; - - -public class EdgesApiTest extends BaseApiTest { - - final static String EDGE_PATH = "graphs/hugegraph/traversers/edges"; - final static String SHARES_PATH = "graphs/hugegraph/traversers" - + "/edges/shards"; - final static String SCAN_PATH = "graphs/hugegraph/traversers/edges/scan"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testList() { - Map name2Ids = listAllVertexName2Ids(); - final String edgeGetPath = "graphs/hugegraph/graph/edges"; - String vadasId = name2Ids.get("vadas"); - Response r = client().get(edgeGetPath, - ImmutableMap.of("vertex_id", - id2Json(vadasId), - "direction", - "IN")); - String respBody = assertResponseStatus(200, r); - List edges = assertJsonContains(respBody, "edges"); - assertNotNull(edges); - assertFalse(edges.isEmpty()); - String edgeId = assertMapContains(edges.get(0), "id"); - assertNotNull(edgeId); - - r = client().get(EDGE_PATH, - ImmutableMultimap.of("ids", edgeId)); - assertResponseStatus(200, r); - } - - @Test - public void testShareAndScan() { - Response r = client().get(SHARES_PATH, ImmutableMap.of("split_size", - 1048576)); - String respBody = assertResponseStatus(200, r); - List shards = assertJsonContains(respBody, "shards"); - assertNotNull(shards); - assertFalse(shards.isEmpty()); - String start = assertMapContains(shards.get(0), "start"); - String end = assertMapContains(shards.get(0), "end"); - r = client().get(SCAN_PATH, ImmutableMap.of("start", start, - "end", end)); - respBody = assertResponseStatus(200, r); - Map entity2 = parseMap(respBody); - assertNotNull(entity2); - assertFalse(entity2.isEmpty()); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesApiTest.java deleted file mode 100644 index 507884a4f7..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/EdgesApiTest.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableMultimap; - - -public class EdgesApiTest extends BaseApiTest { - - final static String EDGE_PATH = "graphs/hugegraph/traversers/edges"; - final static String SHARES_PATH = "graphs/hugegraph/traversers" - + "/edges/shards"; - final static String SCAN_PATH = "graphs/hugegraph/traversers/edges/scan"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testList() { - Map name2Ids = listAllVertexName2Ids(); - final String edgeGetPath = "graphs/hugegraph/graph/edges"; - String vadasId = name2Ids.get("vadas"); - Response r = client().get(edgeGetPath, - ImmutableMap.of("vertex_id", - id2Json(vadasId), - "direction", - "IN")); - String respBody = assertResponseStatus(200, r); - List edges = assertJsonContains(respBody, "edges"); - assertNotNull(edges); - assertFalse(edges.isEmpty()); - String edgeId = assertMapContains(edges.get(0), "id"); - assertNotNull(edgeId); - - r = client().get(EDGE_PATH, - ImmutableMultimap.of("ids", edgeId)); - assertResponseStatus(200, r); - } - - @Test - public void testShareAndScan() { - Response r = client().get(SHARES_PATH, ImmutableMap.of("split_size", - 1048576)); - String respBody = assertResponseStatus(200, r); - List shards = assertJsonContains(respBody, "shards"); - assertNotNull(shards); - assertFalse(shards.isEmpty()); - String start = assertMapContains(shards.get(0), "start"); - String end = assertMapContains(shards.get(0), "end"); - r = client().get(SCAN_PATH, ImmutableMap.of("start", start, - "end", end)); - respBody = assertResponseStatus(200, r); - Map entity2 = parseMap(respBody); - assertNotNull(entity2); - assertFalse(entity2.isEmpty()); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPITest.java deleted file mode 100644 index 80864a3649..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPITest.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertNotNull; - -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class FusiformSimilarityApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/fusiformsimilarity"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testPost() { - Response r = client().post(path, "{ " - + "\"sources\":{ " - + " \"ids\":[], " - + " \"label\": \"person\", " - + " \"properties\": {}}, " - + "\"label\":\"created\", " - + "\"direction\":\"OUT\", " - + "\"min_neighbors\":1, " - + "\"alpha\":1, " - + "\"min_similars\":1, " - + "\"top\":0, " - + "\"group_property\":\"city\", " - + "\"min_groups\":2, " - + "\"max_degree\": 10000, " - + "\"capacity\": -1, " - + "\"limit\": -1, " - + "\"with_intermediary\": false, " - + "\"with_vertex\":true}"); - String respBody = assertResponseStatus(200, r); - Map entity = parseMap(respBody); - assertNotNull(entity); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityApiTest.java deleted file mode 100644 index 80864a3649..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityApiTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertNotNull; - -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class FusiformSimilarityApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/fusiformsimilarity"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testPost() { - Response r = client().post(path, "{ " - + "\"sources\":{ " - + " \"ids\":[], " - + " \"label\": \"person\", " - + " \"properties\": {}}, " - + "\"label\":\"created\", " - + "\"direction\":\"OUT\", " - + "\"min_neighbors\":1, " - + "\"alpha\":1, " - + "\"min_similars\":1, " - + "\"top\":0, " - + "\"group_property\":\"city\", " - + "\"min_groups\":2, " - + "\"max_degree\": 10000, " - + "\"capacity\": -1, " - + "\"limit\": -1, " - + "\"with_intermediary\": false, " - + "\"with_vertex\":true}"); - String respBody = assertResponseStatus(200, r); - Map entity = parseMap(respBody); - assertNotNull(entity); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPITest.java deleted file mode 100644 index 77176cacc1..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPITest.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; - -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class JaccardSimilarityApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/jaccardsimilarity"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String peterId = name2Ids.get("peter"); - Response r = client().get(path, ImmutableMap.of("vertex", - id2Json(markoId), - "other", - id2Json(peterId))); - String content = assertResponseStatus(200, r); - Double jaccardSimilarity = assertJsonContains(content, - "jaccard_similarity"); - assertEquals(0.25, jaccardSimilarity.doubleValue(), 0.0001); - } - - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String rippleId = name2Ids.get("ripple"); - String peterId = name2Ids.get("peter"); - String jsonId = name2Ids.get("josh"); - String reqBody = String.format("{ " - + "\"vertex\": \"%s\", " - + "\"step\": { " - + " \"direction\": \"BOTH\", " - + " \"labels\": [], " - + " \"degree\": 10000, " - + " \"skip_degree\": 100000 }, " - + "\"top\": 3}", markoId); - Response r = client().post(path, reqBody); - String respBody = assertResponseStatus(200, r); - Map entity = parseMap(respBody); - Double rippleJaccardSimilarity = assertMapContains(entity, rippleId); - Double peterJaccardSimilarity = assertMapContains(entity, peterId); - Double jsonJaccardSimilarity = assertMapContains(entity, jsonId); - assertEquals(0.3333, rippleJaccardSimilarity.doubleValue(), 0.0001); - assertEquals(0.25, peterJaccardSimilarity.doubleValue(), 0.0001); - assertEquals(0.3333, jsonJaccardSimilarity.doubleValue(), 0.0001); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityApiTest.java deleted file mode 100644 index 77176cacc1..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityApiTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; - -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class JaccardSimilarityApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/jaccardsimilarity"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String peterId = name2Ids.get("peter"); - Response r = client().get(path, ImmutableMap.of("vertex", - id2Json(markoId), - "other", - id2Json(peterId))); - String content = assertResponseStatus(200, r); - Double jaccardSimilarity = assertJsonContains(content, - "jaccard_similarity"); - assertEquals(0.25, jaccardSimilarity.doubleValue(), 0.0001); - } - - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String rippleId = name2Ids.get("ripple"); - String peterId = name2Ids.get("peter"); - String jsonId = name2Ids.get("josh"); - String reqBody = String.format("{ " - + "\"vertex\": \"%s\", " - + "\"step\": { " - + " \"direction\": \"BOTH\", " - + " \"labels\": [], " - + " \"degree\": 10000, " - + " \"skip_degree\": 100000 }, " - + "\"top\": 3}", markoId); - Response r = client().post(path, reqBody); - String respBody = assertResponseStatus(200, r); - Map entity = parseMap(respBody); - Double rippleJaccardSimilarity = assertMapContains(entity, rippleId); - Double peterJaccardSimilarity = assertMapContains(entity, peterId); - Double jsonJaccardSimilarity = assertMapContains(entity, jsonId); - assertEquals(0.3333, rippleJaccardSimilarity.doubleValue(), 0.0001); - assertEquals(0.25, peterJaccardSimilarity.doubleValue(), 0.0001); - assertEquals(0.3333, jsonJaccardSimilarity.doubleValue(), 0.0001); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPITest.java deleted file mode 100644 index f14606e1d9..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPITest.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class KneighborApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/kneighbor"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - Response r = client().get(path, - ImmutableMap.of("source", id2Json(markoId), - "max_depth", 2)); - String respBody = assertResponseStatus(200, r); - List vertices = assertJsonContains(respBody, "vertices"); - assertEquals(3, vertices.size()); - } - - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String reqBody = String.format("{ " - + "\"source\": \"%s\", " - + "\"step\": { " - + " \"direction\": \"BOTH\", " - + - " \"labels\": [\"knows\", " + - "\"created\"], " - + " \"properties\": { " - + " \"weight\": \"P.gt(0.1)\"}, " - + " \"degree\": 10000, " - + " \"skip_degree\": 100000}, " - + "\"max_depth\": 3, " - + "\"limit\": 10000, " - + "\"with_vertex\": true, " - + "\"with_path\": true}", markoId); - Response r = client().post(path, reqBody); - String content = assertResponseStatus(200, r); - Map entity = parseMap(content); - assertNotNull(entity); - assertMapContains(entity, "kneighbor"); - assertMapContains(entity, "paths"); - assertMapContains(entity, "vertices"); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborApiTest.java deleted file mode 100644 index f14606e1d9..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KneighborApiTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class KneighborApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/kneighbor"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - Response r = client().get(path, - ImmutableMap.of("source", id2Json(markoId), - "max_depth", 2)); - String respBody = assertResponseStatus(200, r); - List vertices = assertJsonContains(respBody, "vertices"); - assertEquals(3, vertices.size()); - } - - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String reqBody = String.format("{ " - + "\"source\": \"%s\", " - + "\"step\": { " - + " \"direction\": \"BOTH\", " - + - " \"labels\": [\"knows\", " + - "\"created\"], " - + " \"properties\": { " - + " \"weight\": \"P.gt(0.1)\"}, " - + " \"degree\": 10000, " - + " \"skip_degree\": 100000}, " - + "\"max_depth\": 3, " - + "\"limit\": 10000, " - + "\"with_vertex\": true, " - + "\"with_path\": true}", markoId); - Response r = client().post(path, reqBody); - String content = assertResponseStatus(200, r); - Map entity = parseMap(content); - assertNotNull(entity); - assertMapContains(entity, "kneighbor"); - assertMapContains(entity, "paths"); - assertMapContains(entity, "vertices"); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPITest.java deleted file mode 100644 index aa457fe4b9..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPITest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - -public class KoutApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/kout"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String peterId = name2Ids.get("peter"); - String joshId = name2Ids.get("josh"); - Response r = client().get(path, - ImmutableMap.of("source", id2Json(markoId), - "max_depth", 2)); - String respBody = assertResponseStatus(200, r); - List vertices = assertJsonContains(respBody, "vertices"); - assertEquals(1, vertices.size()); - assertTrue(vertices.containsAll(ImmutableList.of(peterId, joshId))); - } - - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String reqBody = String.format("{ " - + "\"source\": \"%s\", " - + "\"step\": { " - + " \"direction\": \"BOTH\", " - + - " \"labels\": [\"knows\", " + - "\"created\"], " - + " \"properties\": { " - + " \"weight\": \"P.gt(0.1)\"}, " - + " \"degree\": 10000, " - + " \"skip_degree\": 100000}, " - + "\"max_depth\": 1, " - + "\"nearest\": true, " - + "\"limit\": 10000, " - + "\"with_vertex\": true, " - + "\"with_path\": true}", markoId); - Response resp = client().post(path, reqBody); - String respBody = assertResponseStatus(200, resp); - Map entity = parseMap(respBody); - assertMapContains(entity, "size"); - assertMapContains(entity, "kout"); - assertMapContains(entity, "paths"); - assertMapContains(entity, "vertices"); - assertEquals(2, entity.get("size")); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutApiTest.java deleted file mode 100644 index aa457fe4b9..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/KoutApiTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; - -public class KoutApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/kout"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String peterId = name2Ids.get("peter"); - String joshId = name2Ids.get("josh"); - Response r = client().get(path, - ImmutableMap.of("source", id2Json(markoId), - "max_depth", 2)); - String respBody = assertResponseStatus(200, r); - List vertices = assertJsonContains(respBody, "vertices"); - assertEquals(1, vertices.size()); - assertTrue(vertices.containsAll(ImmutableList.of(peterId, joshId))); - } - - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String reqBody = String.format("{ " - + "\"source\": \"%s\", " - + "\"step\": { " - + " \"direction\": \"BOTH\", " - + - " \"labels\": [\"knows\", " + - "\"created\"], " - + " \"properties\": { " - + " \"weight\": \"P.gt(0.1)\"}, " - + " \"degree\": 10000, " - + " \"skip_degree\": 100000}, " - + "\"max_depth\": 1, " - + "\"nearest\": true, " - + "\"limit\": 10000, " - + "\"with_vertex\": true, " - + "\"with_path\": true}", markoId); - Response resp = client().post(path, reqBody); - String respBody = assertResponseStatus(200, resp); - Map entity = parseMap(respBody); - assertMapContains(entity, "size"); - assertMapContains(entity, "kout"); - assertMapContains(entity, "paths"); - assertMapContains(entity, "vertices"); - assertEquals(2, entity.get("size")); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPITest.java deleted file mode 100644 index 605284ecc7..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPITest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class MultiNodeShortestPathApiTest extends BaseApiTest { - - final String path = "graphs/hugegraph/traversers/multinodeshortestpath"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String peterId = name2Ids.get("peter"); - String joshId = name2Ids.get("josh"); - String vadasId = name2Ids.get("vadas"); - String reqBody = String.format("{ " - + "\"vertices\": { " - + " \"ids\": [\"%s\", \"%s\", \"%s\", " - + " \"%s\"]}, " - + "\"step\": { " - + " \"direction\": \"BOTH\", " - + " \"properties\": {}}, " - + "\"max_depth\": 10, " - + "\"capacity\": 100000000, " - + "\"with_vertex\": true}", - markoId, peterId, joshId, vadasId); - Response r = client().post(path, reqBody); - String respJosn = assertResponseStatus(200, r); - Map entity = parseMap(respJosn); - assertMapContains(entity, "paths"); - assertMapContains(entity, "vertices"); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java deleted file mode 100644 index 605284ecc7..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathApiTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class MultiNodeShortestPathApiTest extends BaseApiTest { - - final String path = "graphs/hugegraph/traversers/multinodeshortestpath"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String peterId = name2Ids.get("peter"); - String joshId = name2Ids.get("josh"); - String vadasId = name2Ids.get("vadas"); - String reqBody = String.format("{ " - + "\"vertices\": { " - + " \"ids\": [\"%s\", \"%s\", \"%s\", " - + " \"%s\"]}, " - + "\"step\": { " - + " \"direction\": \"BOTH\", " - + " \"properties\": {}}, " - + "\"max_depth\": 10, " - + "\"capacity\": 100000000, " - + "\"with_vertex\": true}", - markoId, peterId, joshId, vadasId); - Response r = client().post(path, reqBody); - String respJosn = assertResponseStatus(200, r); - Map entity = parseMap(respJosn); - assertMapContains(entity, "paths"); - assertMapContains(entity, "vertices"); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPITest.java deleted file mode 100644 index 6332391065..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPITest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class NeighborRankApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/neighborrank"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testNeighborRank() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String reqBody = String.format("{" - + "\"source\":\"%s\"," - + "\"steps\": [{" - + " \"direction\": \"BOTH\"}]," - + "\"alpha\":%s}", markoId, 1); - Response r = client().post(path, reqBody); - String respBody = assertResponseStatus(200, r); - List ranks = assertJsonContains(respBody, "ranks"); - assertEquals(2, ranks.size()); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankApiTest.java deleted file mode 100644 index 6332391065..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankApiTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class NeighborRankApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/neighborrank"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testNeighborRank() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String reqBody = String.format("{" - + "\"source\":\"%s\"," - + "\"steps\": [{" - + " \"direction\": \"BOTH\"}]," - + "\"alpha\":%s}", markoId, 1); - Response r = client().post(path, reqBody); - String respBody = assertResponseStatus(200, r); - List ranks = assertJsonContains(respBody, "ranks"); - assertEquals(2, ranks.size()); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPITest.java deleted file mode 100644 index 4677c6e86b..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPITest.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class PathsApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/paths"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String vadasId = name2Ids.get("vadas"); - Response r = client().get(path, ImmutableMap.of("source", - id2Json(markoId), - "target", - id2Json(vadasId), - "max_depth", 3)); - String respBody = assertResponseStatus(200, r); - Map entity = parseMap(respBody); - assertNotNull(entity); - assertMapContains(entity, "paths"); - List> paths = assertMapContains(entity, "paths"); - assertEquals(1, paths.size()); - } - - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String joshId = name2Ids.get("josh"); - String reqBody = String.format("{ " - + "\"sources\": { " - + " \"ids\": [\"%s\"] " - + "}, " - + "\"targets\": { " - + " \"ids\": [\"%s\"]}, " - + "\"step\": { " - + " \"direction\": \"BOTH\", " - + " \"properties\": { " - + " \"weight\": \"P.gt(0.01)\"}}, " - + "\"max_depth\": 10, " - + "\"capacity\": 100000000, " - + "\"limit\": 10000000, " - + "\"with_vertex\": false}", - markoId, joshId); - Response r = client().post(path, reqBody); - String respBody = assertResponseStatus(200, r); - List> paths = assertJsonContains(respBody, "paths"); - assertFalse(paths.isEmpty()); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsApiTest.java deleted file mode 100644 index 4677c6e86b..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PathsApiTest.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class PathsApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/paths"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String vadasId = name2Ids.get("vadas"); - Response r = client().get(path, ImmutableMap.of("source", - id2Json(markoId), - "target", - id2Json(vadasId), - "max_depth", 3)); - String respBody = assertResponseStatus(200, r); - Map entity = parseMap(respBody); - assertNotNull(entity); - assertMapContains(entity, "paths"); - List> paths = assertMapContains(entity, "paths"); - assertEquals(1, paths.size()); - } - - @Test - public void testPost() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String joshId = name2Ids.get("josh"); - String reqBody = String.format("{ " - + "\"sources\": { " - + " \"ids\": [\"%s\"] " - + "}, " - + "\"targets\": { " - + " \"ids\": [\"%s\"]}, " - + "\"step\": { " - + " \"direction\": \"BOTH\", " - + " \"properties\": { " - + " \"weight\": \"P.gt(0.01)\"}}, " - + "\"max_depth\": 10, " - + "\"capacity\": 100000000, " - + "\"limit\": 10000000, " - + "\"with_vertex\": false}", - markoId, joshId); - Response r = client().post(path, reqBody); - String respBody = assertResponseStatus(200, r); - List> paths = assertJsonContains(respBody, "paths"); - assertFalse(paths.isEmpty()); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPITest.java deleted file mode 100644 index 7fa9d43b23..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPITest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertNotNull; - -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class PersonalRankApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/personalrank"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testPersonalRank() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String reqBody = String.format("{" - + "\"source\":\"%s\"," - + "\"max_depth\":\"%s\"," - + "\"label\":\"%s\"," - + "\"alpha\":\"%s\"}", - markoId, 3, "created", 1); - Response r = client().post(path, reqBody); - String respBody = assertResponseStatus(200, r); - Map entity = parseMap(respBody); - assertNotNull(entity); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankApiTest.java deleted file mode 100644 index 7fa9d43b23..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankApiTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertNotNull; - -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class PersonalRankApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/personalrank"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testPersonalRank() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String reqBody = String.format("{" - + "\"source\":\"%s\"," - + "\"max_depth\":\"%s\"," - + "\"label\":\"%s\"," - + "\"alpha\":\"%s\"}", - markoId, 3, "created", 1); - Response r = client().post(path, reqBody); - String respBody = assertResponseStatus(200, r); - Map entity = parseMap(respBody); - assertNotNull(entity); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPITest.java deleted file mode 100644 index e59f8d4056..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPITest.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class RaysApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/rays"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String vadasId = name2Ids.get("vadas"); - Response r = client().get(path, ImmutableMap.of("source", - id2Json(markoId), - "max_depth", 10)); - String respBody = assertResponseStatus(200, r); - List>> rays = assertJsonContains(respBody, - "rays"); - assertNotNull(rays); - assertEquals(2, rays.size()); - Object[] valuesArray = rays.get(0).values().toArray(); - assertNotEquals(0, valuesArray.length); - List values = (List) valuesArray[0]; - assertTrue(values.contains(vadasId)); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysApiTest.java deleted file mode 100644 index e59f8d4056..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RaysApiTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class RaysApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/rays"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String vadasId = name2Ids.get("vadas"); - Response r = client().get(path, ImmutableMap.of("source", - id2Json(markoId), - "max_depth", 10)); - String respBody = assertResponseStatus(200, r); - List>> rays = assertJsonContains(respBody, - "rays"); - assertNotNull(rays); - assertEquals(2, rays.size()); - Object[] valuesArray = rays.get(0).values().toArray(); - assertNotEquals(0, valuesArray.length); - List values = (List) valuesArray[0]; - assertTrue(values.contains(vadasId)); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RingsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RingsApiTest.java deleted file mode 100644 index ca49afb80c..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/RingsApiTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertFalse; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class RingsApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/rings"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - Map params = ImmutableMap.of("source", - id2Json(markoId), - "max_depth", 10); - Response r = client().get(path, params); - String respJson = assertResponseStatus(200, r); - List>> rings = assertJsonContains(respJson, - "rings"); - assertFalse(rings.isEmpty()); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsApiTest.java deleted file mode 100644 index fd90be98dd..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsApiTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.Response; - -import org.junit.Before; -import org.junit.Test; - -import com.baidu.hugegraph.api.BaseApiTest; -import com.google.common.collect.ImmutableMap; - -public class SameNeighborsApiTest extends BaseApiTest { - - final static String path = "graphs/hugegraph/traversers/sameneighbors"; - - @Before - public void prepareSchema() { - BaseApiTest.initPropertyKey(); - BaseApiTest.initVertexLabel(); - BaseApiTest.initEdgeLabel(); - BaseApiTest.initVertex(); - BaseApiTest.initEdge(); - } - - @Test - public void testGet() { - Map name2Ids = listAllVertexName2Ids(); - String markoId = name2Ids.get("marko"); - String joshId = name2Ids.get("josh"); - String peterId = name2Ids.get("peter"); - Response r = client().get(path, - ImmutableMap.of("vertex", id2Json(markoId), - "other", id2Json(joshId))); - String respBody = assertResponseStatus(200, r); - List sameNeighbors = assertJsonContains(respBody, - "same_neighbors"); - assertFalse(sameNeighbors.isEmpty()); - assertTrue(sameNeighbors.contains(peterId)); - } -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathApiTest.java deleted file mode 100644 index 2a03b1faad..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathApiTest.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class ShortestPathApiTest extends BaseApiTest { -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java deleted file mode 100644 index c484945bc8..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathApiTest.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class SingleSourceShortestPathApiTest extends BaseApiTest { -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsApiTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsApiTest.java deleted file mode 100644 index da55c7af60..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsApiTest.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import com.baidu.hugegraph.api.BaseApiTest; - -public class TemplatePathsApiTest extends BaseApiTest { -} diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TraversersApiTestSuite.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TraversersApiTestSuite.java deleted file mode 100644 index bf80b9bbda..0000000000 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/TraversersApiTestSuite.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baidu.hugegraph.api.traversers; - -import org.junit.BeforeClass; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -import com.baidu.hugegraph.dist.RegisterUtil; - -@RunWith(Suite.class) -@Suite.SuiteClasses({ - AllShortestPathsApiTest.class, - CountApiTest.class, - CrosspointsApiTest.class, - CustomizedCrosspointsApiTest.class, - EdgesApiTest.class, - FusiformSimilarityApiTest.class, - JaccardSimilarityApiTest.class, - KneighborApiTest.class, - KoutApiTest.class, - MultiNodeShortestPathApiTest.class, - NeighborRankApiTest.class, - PathsApiTest.class, - PersonalRankApiTest.class, - RaysApiTest.class, - RingsApiTest.class, - SameNeighborsApiTest.class, - ShortestPathApiTest.class, - SingleSourceShortestPathApiTest.class, - TemplatePathsApiTest.class -}) -public class TraversersApiTestSuite { -}