Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update common version and remove jersey code #538

Merged
merged 60 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
884166c
Update client-ci.yml
zhenyuT Aug 13, 2023
cf729d5
replace jersey with okhttp
Aug 14, 2023
74f92dc
Merge remote-tracking branch 'origin/master'
Aug 14, 2023
3c10111
fix test error
Aug 14, 2023
1eabd9a
fix the problem that mockito can't mock final class
Aug 14, 2023
ab2f917
fix error
Aug 14, 2023
3fe0244
Update BaseClientTest.java
zhenyuT Aug 15, 2023
cb79e56
https support && add licence header
Aug 16, 2023
552a108
fix licence check error
Aug 16, 2023
9d211f8
fix error
Aug 16, 2023
a9c6c88
fix licence check error
Aug 16, 2023
bd5e5e7
fix error
Aug 17, 2023
277fe04
rename rest class && remove jersey dependency
Aug 17, 2023
1975bfd
add workflow_dispatch
Aug 17, 2023
ae9de53
add workflow_dispatch
Aug 17, 2023
41be461
Merge branch 'master' into release-removejersey
Aug 17, 2023
ecc5580
hubble error fix
Aug 17, 2023
5740701
update okhttp version of hubble
Aug 17, 2023
ef7846f
refactor class name
Aug 17, 2023
aff4455
add workflow_dispatch
Aug 17, 2023
d3d3daf
fix licence dependency check error
Aug 17, 2023
57a2144
Merge remote-tracking branch 'origin/master'
zhenyuT Nov 22, 2023
389431a
feat: merge request
zhenyuT Nov 22, 2023
93f83ab
chore(ci): add stage profile settings
zhenyuT Nov 22, 2023
a314397
Merge branch 'visit-stage'
zhenyuT Nov 22, 2023
9c52320
update common version and fix code
zhenyuT Nov 22, 2023
6bc34d6
fix
zhenyuT Nov 22, 2023
b855f62
Merge branch 'visit-stage'
zhenyuT Nov 22, 2023
c637fcd
fix
zhenyuT Nov 22, 2023
f45f176
update version
zhenyuT Nov 22, 2023
150bb0e
fix spark-connector-ci
zhenyuT Nov 22, 2023
75ff6d1
fix spark-connector-ci
zhenyuT Nov 22, 2023
57e4d76
fix spark-connector-ci
zhenyuT Nov 22, 2023
fcd0735
update client version
zhenyuT Nov 22, 2023
82b401a
update client version
zhenyuT Nov 22, 2023
164a50a
Merge remote-tracking branch 'upstream/master'
zhenyuT Nov 23, 2023
ea06f2c
fix license-checker
zhenyuT Nov 23, 2023
49a2343
code optimize
zhenyuT Nov 23, 2023
f0db02a
remove useless dependency
zhenyuT Nov 23, 2023
e593008
remove useless code
zhenyuT Nov 23, 2023
3eb6c42
fix licence check
zhenyuT Nov 23, 2023
cda3e28
fix import & update api version
imbajin Nov 24, 2023
e03074c
remove redundant common import in hubble
imbajin Nov 24, 2023
76a85ee
remove redundant lombok version
zhenyuT Nov 24, 2023
cdd1012
remove useless code
zhenyuT Nov 24, 2023
30396fb
add comment
zhenyuT Nov 24, 2023
d9603c0
rename id
zhenyuT Nov 25, 2023
0a09aac
add encode test case
zhenyuT Nov 26, 2023
3f8b42d
add encode test case and fix code issue
zhenyuT Nov 27, 2023
7e2f5ae
fix test error
zhenyuT Nov 28, 2023
bba55b8
fix test error
zhenyuT Nov 28, 2023
acc65e0
fix code issue
zhenyuT Nov 29, 2023
bb79524
fix code issue
zhenyuT Nov 29, 2023
4441ac8
fix code issue
zhenyuT Nov 29, 2023
0d215a4
update hg server commitId
zhenyuT Nov 29, 2023
e65644b
debug ci error
zhenyuT Nov 30, 2023
142192a
revert commit ID & let it pass 100
imbajin Dec 4, 2023
a18802b
Update client-ci.yml
imbajin Dec 4, 2023
4f1622c
Merge branch 'master' into master
imbajin Dec 5, 2023
a3b4423
tiny fix
imbajin Dec 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public User get(Object id) {
}

public UserRole getUserRole(Object id) {
String idEncoded = formatEntityId(id);
String path = String.join("/", this.path(), idEncoded, "role");
String formattedId = formatEntityId(id);
String path = String.join("/", this.path(), formattedId, "role");
RestResult result = this.client.get(path);
return result.readObject(UserRole.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,6 @@ public static MetricsManager metrics() {
return client.metrics();
}

@Before
public void setup() {
// this.clearData();
}

@After
public void teardown() throws Exception {
// pass
}

protected static Object getVertexId(String label, String key,
String value) {
return getVertex(label, key, value).id();
Expand Down Expand Up @@ -185,6 +175,7 @@ protected static void initPropertyKey() {
schema.propertyKey("city").asText().ifNotExist().create();
schema.propertyKey("lang").asText().ifNotExist().create();
schema.propertyKey("date").asDate().ifNotExist().create();
schema.propertyKey("date 2&@").asDate().ifNotExist().create();
schema.propertyKey("price").asInt().ifNotExist().create();
schema.propertyKey("weight").asDouble().ifNotExist().create();
}
Expand Down Expand Up @@ -230,8 +221,8 @@ protected static void initEdgeLabel() {
schema.edgeLabel("created")
.sourceLabel("person")
.targetLabel("software")
.properties("date", "city")
.nullableKeys("city")
.properties("date", "date 2&@", "city")
.nullableKeys("city", "date 2&@")
.ifNotExist()
.create();
}
Expand Down Expand Up @@ -294,7 +285,7 @@ protected static void initEdge() {
graph().addEdge(markoId, "knows", vadasId, "date", "2012-01-10");
graph().addEdge(markoId, "knows", joshId, "date", "2013-01-10");
graph().addEdge(markoId, "created", lopId,
"date", "2014-01-10", "city", "Shanghai");
"date", "2014-01-10", "city", "Shanghai", "date 2&@", "2014-01-10");
graph().addEdge(joshId, "created", rippleId,
"date", "2015-01-10", "city", "Beijing");
graph().addEdge(joshId, "created", lopId,
Expand All @@ -303,6 +294,16 @@ protected static void initEdge() {
"date", "2017-01-10", "city", "Hongkong");
}

@Before
public void setup() {
// this.clearData();
}

@After
public void teardown() throws Exception {
// pass
}
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved

protected List<Vertex> create100PersonBatch() {
List<Vertex> vertices = new ArrayList<>(100);
for (int i = 0; i < 100; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ public static void clear() {
}
}

protected static User createUser(String name, String password) {
User user = new User();
user.name(name);
user.password(password);
user.email("[email protected]");
user.phone("16812345678");
user.avatar("image.jpg");
return api.create(user);
}
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved

@Override
@After
public void teardown() {
Expand Down Expand Up @@ -136,15 +146,19 @@ public void testGet() {
public void testGetUserRole() {
User user1 = createUser("test1", "psw1");
User user2 = createUser("test2", "psw2");
User user3 = createUser("test3 aaa", "psw3");
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved

Assert.assertEquals("test1", user1.name());
Assert.assertEquals("test2", user2.name());
Assert.assertContains("test3 aaa", user3.name());//test special character
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved

UserRole role1 = api.getUserRole(user1.id());
UserRole role2 = api.getUserRole(user2.id());
UserRole role3 = api.getUserRole(user3.id());

Assert.assertEquals("{\"roles\":{}}", role1.toString());
Assert.assertEquals("{\"roles\":{}}", role2.toString());
Assert.assertEquals("{\"roles\":{}}", role3.toString());
}

@Test
Expand Down Expand Up @@ -256,14 +270,4 @@ public void testDelete() {
Assert.assertContains("Invalid user id: fake-id", e.getMessage());
});
}

protected static User createUser(String name, String password) {
User user = new User();
user.name(name);
user.password(password);
user.email("[email protected]");
user.phone("16812345678");
user.avatar("image.jpg");
return api.create(user);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@

public class EdgeTest extends BaseFuncTest {

private static void assertContains(List<Edge> edges, Object source,
String label, Object target,
Object... keyValues) {
Map<String, Object> properties = Utils.asMap(keyValues);

Edge edge = new Edge(label);
edge.sourceId(source);
edge.targetId(target);
for (String key : properties.keySet()) {
edge.property(key, properties.get(key));
}

Assert.assertTrue(Utils.contains(edges, edge));
}
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved

@Override
@Before
public void setup() {
Expand Down Expand Up @@ -80,7 +95,7 @@ public void testAddEdgeProperty() {
Edge created = graph().addEdge(peterId, "created", lopId,
"date", "2017-03-24");
Map<String, Object> props = ImmutableMap.of(
"date", Utils.formatDate("2017-03-24"));
"date", Utils.formatDate("2017-03-24"));
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved
Assert.assertEquals(props, created.properties());

created.property("city", "HongKong");
Expand All @@ -97,7 +112,7 @@ public void testUpdateEdgeProperty() {
Edge created = graph().addEdge(peterId, "created", lopId,
"date", "2017-03-24");
Map<String, Object> props = ImmutableMap.of(
"date", Utils.formatDate("2017-03-24"));
"date", Utils.formatDate("2017-03-24"));
Assert.assertEquals(props, created.properties());

created.property("date", "2017-08-08");
Expand Down Expand Up @@ -125,16 +140,16 @@ public void testAddEdgePropertyValueList() {
"time", "2012-10-10");

Map<String, Object> props = ImmutableMap.of(
"date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10")));
"date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10")));
Assert.assertEquals(props, created.properties());

created.property("time", "2014-02-14");
props = ImmutableMap.of("date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10"),
Utils.formatDate("2014-02-14")));
Utils.formatDate("2012-10-10"),
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved
Utils.formatDate("2014-02-14")));
Assert.assertEquals(props, created.properties());
}

Expand All @@ -158,16 +173,16 @@ public void testAddEdgePropertyValueSet() {
"time", "2012-10-10");

Map<String, Object> props = ImmutableMap.of(
"date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10")));
"date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10")));
Assert.assertEquals(props, created.properties());

created.property("time", "2014-02-14");
props = ImmutableMap.of("date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10"),
Utils.formatDate("2014-02-14")));
Utils.formatDate("2012-10-10"),
Utils.formatDate("2014-02-14")));
Assert.assertEquals(props, created.properties());
}

Expand All @@ -191,16 +206,16 @@ public void testAddEdgePropertyValueListWithSameValue() {
"time", "2012-10-10");

Map<String, Object> props = ImmutableMap.of(
"date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10")));
"date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10")));
Assert.assertEquals(props, created.properties());

created.property("time", "2012-10-10");
props = ImmutableMap.of("date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10"),
Utils.formatDate("2012-10-10")));
Utils.formatDate("2012-10-10"),
Utils.formatDate("2012-10-10")));
Assert.assertEquals(props, created.properties());
}

Expand All @@ -224,15 +239,15 @@ public void testAddEdgePropertyValueSetWithSameValue() {
"time", "2012-10-10");

Map<String, Object> props = ImmutableMap.of(
"date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10")));
"date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10")));
Assert.assertEquals(props, created.properties());

created.property("time", "2012-10-10");
props = ImmutableMap.of("date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10")));
Utils.formatDate("2012-10-10")));
Assert.assertEquals(props, created.properties());
}

Expand All @@ -245,8 +260,8 @@ public void testAddEdgeWithMapProperties() {
"city", "HongKong");
Edge created = graph().addEdge(peter, "created", lop, properties);
Map<String, Object> props = ImmutableMap.of(
"date", Utils.formatDate("2017-03-24"),
"city", "HongKong");
"date", Utils.formatDate("2017-03-24"),
"city", "HongKong");
Assert.assertEquals(props, created.properties());
}

Expand All @@ -270,9 +285,9 @@ public void testRemoveEdgeProperty() {
"time", "2012-10-10");

Map<String, Object> props = ImmutableMap.of(
"date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10")));
"date", Utils.formatDate("2017-03-24"),
"time", ImmutableList.of(
Utils.formatDate("2012-10-10")));
Assert.assertEquals(props, created.properties());

created.removeProperty("time");
Expand All @@ -288,7 +303,7 @@ public void testRemoveEdgePropertyNotExist() {
Edge created = graph().addEdge(peterId, "created", lopId,
"date", "2017-03-24");
Map<String, Object> props = ImmutableMap.of(
"date", Utils.formatDate("2017-03-24"));
"date", Utils.formatDate("2017-03-24"));
Assert.assertEquals(props, created.properties());

Assert.assertThrows(InvalidOperationException.class, () -> {
Expand Down Expand Up @@ -511,8 +526,8 @@ public void testGetEdgesByVertexIdDirectionLabelProperties() {
Object rippleId = getVertexId("software", "name", "ripple");

Map<String, Object> properties = ImmutableMap.of(
"date",
Utils.formatDate("2015-01-10"));
"date",
Utils.formatDate("2015-01-10"));
List<Edge> edges = graph().getEdges(joshId, Direction.OUT,
"created", properties);
Assert.assertEquals(1, edges.size());
Expand All @@ -534,8 +549,8 @@ public void testGetEdgesByVertexIdDirectionLabelPropertiesWithLimit1() {
Object joshId = getVertexId("person", "name", "josh");

Map<String, Object> properties = ImmutableMap.of(
"date",
Utils.formatDate("2015-01-10"));
"date",
Utils.formatDate("2015-01-10"));
List<Edge> edges = graph().getEdges(joshId, Direction.OUT,
"created", properties);
Assert.assertEquals(1, edges.size());
Expand All @@ -555,7 +570,7 @@ public void testGetEdgesByVertexIdDirectionLabelPropertiesWithLimit1() {

@Test
public void testGetEdgesByLabelAndPropertiesWithRangeCondition()
throws ParseException {
throws ParseException {
schema().indexLabel("knowsByDate").range()
.onE("knows").by("date").create();
schema().indexLabel("createdByDate").range()
Expand All @@ -567,7 +582,7 @@ public void testGetEdgesByLabelAndPropertiesWithRangeCondition()
Date expected2 = DateUtil.parse("2016-01-10");

Map<String, Object> properties = ImmutableMap.of(
"date", "P.eq(\"2014-1-10\")");
"date", "P.eq(\"2014-1-10\")");
List<Edge> edges = graph().listEdges("created", properties);

Date time;
Expand Down Expand Up @@ -649,19 +664,29 @@ public void testGetEdgesByLabelAndPropertiesWithRangeCondition()

@Test
public void testGetEdgesByLabelAndPropertiesWithKeepP()
throws ParseException {
throws ParseException {
schema().indexLabel("createdByCity").secondary()
.onE("created").by("city").create();
schema().indexLabel("createdByDate").secondary()
.onE("created").by("date").create();
.onE("created").by("date 2&@").create();

BaseClientTest.initEdge();

{
//test special character
Map<String, Object> properties = ImmutableMap.of(
"date 2&@", "P.eq(\"2014-1-10\")");
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved
List<Edge> edges = graph().listEdges("created", properties, false);
Assert.assertEquals(1, edges.size());
}
zhenyuT marked this conversation as resolved.
Show resolved Hide resolved


Map<String, Object> properties = ImmutableMap.of(
"date", "P.eq(\"2014-1-10\")");
"date", "P.eq(\"2014-1-10\")");
List<Edge> edges = graph().listEdges("created", properties, false);
Assert.assertEquals(1, edges.size());


Assert.assertThrows(ServerException.class, () -> {
graph().listEdges("created", properties, true);
}, e -> {
Expand Down Expand Up @@ -779,19 +804,4 @@ public void testQueryByPagingAndFiltering() {
e.getMessage());
});
}

private static void assertContains(List<Edge> edges, Object source,
String label, Object target,
Object... keyValues) {
Map<String, Object> properties = Utils.asMap(keyValues);

Edge edge = new Edge(label);
edge.sourceId(source);
edge.targetId(target);
for (String key : properties.keySet()) {
edge.property(key, properties.get(key));
}

Assert.assertTrue(Utils.contains(edges, edge));
}
}
Loading