From 47f6768713990bef5c69096c28c7932d46d40a86 Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Thu, 3 Jun 2021 11:58:59 +0800 Subject: [PATCH] fix ttl tests with start time error by using graph.now() Change-Id: I27579319df0f732c9a5ee580e47144a63566fb0a --- .../src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java | 3 +-- .../main/java/com/baidu/hugegraph/core/VertexCoreTest.java | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java index c5c2692708..b51f49344b 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java @@ -76,7 +76,6 @@ import com.baidu.hugegraph.type.HugeType; import com.baidu.hugegraph.type.define.Directions; import com.baidu.hugegraph.type.define.HugeKeys; -import com.baidu.hugegraph.util.DateUtil; import com.baidu.hugegraph.util.Events; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -726,7 +725,7 @@ public void testAddEdgeWithTtlAndTtlStartTime() { Vertex java = graph().addVertex(T.label, "book", "name", "Java in action"); Edge edge = baby.addEdge("borrow", java, "place", "library of school", - "date", DateUtil.now().getTime() - 2000L); + "date", graph().now() - 2000L); graph().tx().commit(); Iterator edges = graph().edges(edge); diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java index 3355650105..3fcbc9f74c 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java @@ -21,7 +21,6 @@ import java.math.BigDecimal; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.HashSet; @@ -55,7 +54,6 @@ import com.baidu.hugegraph.backend.id.SnowflakeIdGenerator; import com.baidu.hugegraph.backend.id.SplicingIdGenerator; import com.baidu.hugegraph.backend.page.PageInfo; -import com.baidu.hugegraph.backend.page.PageState; import com.baidu.hugegraph.backend.query.Condition; import com.baidu.hugegraph.backend.query.ConditionQuery; import com.baidu.hugegraph.backend.query.Query; @@ -79,7 +77,6 @@ import com.baidu.hugegraph.type.define.HugeKeys; import com.baidu.hugegraph.util.Blob; import com.baidu.hugegraph.util.CollectionUtil; -import com.baidu.hugegraph.util.DateUtil; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -933,7 +930,7 @@ public void testAddVertexWithTtlAndTtlStartTime() { Vertex vertex = graph().addVertex( T.label, "follower", "name", "Baby", "age", 3, "city", "Beijing", - "birth", DateUtil.now().getTime() - 1000L); + "birth", graph().now() - 1000L); graph().tx().commit(); Iterator vertices = graph().vertices(vertex);