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

change http return code of property create&update #1584

Merged
merged 2 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -69,7 +69,7 @@ public class PropertyKeyAPI extends API {

@POST
@Timed
@Status(Status.CREATED)
@Status(Status.ACCEPTED)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner=$graph $action=property_key_write"})
Expand All @@ -88,6 +88,7 @@ public String create(@Context GraphManager manager,

@PUT
@Timed
@Status(Status.ACCEPTED)
@Path("{name}")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,49 +202,49 @@ protected static void initPropertyKey() {
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"age\",\n"
+ "\"data_type\": \"INT\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"city\",\n"
+ "\"data_type\": \"TEXT\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"lang\",\n"
+ "\"data_type\": \"TEXT\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"date\",\n"
+ "\"data_type\": \"TEXT\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"price\",\n"
+ "\"data_type\": \"INT\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"weight\",\n"
+ "\"data_type\": \"DOUBLE\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
}

protected static void initVertexLabel() {
Expand Down Expand Up @@ -427,8 +427,13 @@ protected static void initVertex() {
}

protected static Response createAndAssert(String path, String body) {
return createAndAssert(path, body, 201);
}

protected static Response createAndAssert(String path, String body,
int status) {
Response r = client.post(path, body);
assertResponseStatus(201, r);
assertResponseStatus(status, r);
return r;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ public void testSetVertexProperty() {
+ "\"cardinality\": \"SINGLE\","
+ "\"properties\":[]"
+ "}";
assertResponseStatus(201, client().post(pkPath, foo));
assertResponseStatus(202, client().post(pkPath, foo));
// Cardinality list
String bar = "{"
+ "\"name\": \"bar\","
+ "\"data_type\": \"TEXT\","
+ "\"cardinality\": \"LIST\","
+ "\"properties\":[]"
+ "}";
assertResponseStatus(201, client().post(pkPath, bar));
assertResponseStatus(202, client().post(pkPath, bar));

String vlPath = "/graphs/hugegraph/schema/vertexlabels/";
String vertexLabel = "{"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void testCreate() {
+ "\"properties\":[]"
+ "}";
Response r = client().post(path, propertyKey);
assertResponseStatus(201, r);
assertResponseStatus(202, r);
}

@Test
Expand All @@ -50,7 +50,7 @@ public void testGet() {
+ "\"properties\":[]"
+ "}";
Response r = client().post(path, propertyKey);
assertResponseStatus(201, r);
assertResponseStatus(202, r);

String name = "id";
r = client().get(path, name);
Expand All @@ -66,7 +66,7 @@ public void testList() {
+ "\"properties\":[]"
+ "}";
Response r = client().post(path, propertyKey);
assertResponseStatus(201, r);
assertResponseStatus(202, r);

r = client().get(path);
assertResponseStatus(200, r);
Expand All @@ -81,7 +81,7 @@ public void testDelete() {
+ "\"properties\":[]"
+ "}";
Response r = client().post(path, propertyKey);
assertResponseStatus(201, r);
assertResponseStatus(202, r);

String name = "id";
r = client().delete(path, name);
Expand Down