Skip to content

Commit 0f243cd

Browse files
JSON serialization fixes (#405)
## What is the goal of this PR? We update the BDD test steps to reflect the changes in typedb-behaviour (typedb/typedb-behaviour#240).
1 parent 4381fbb commit 0f243cd

File tree

5 files changed

+99
-71
lines changed

5 files changed

+99
-71
lines changed

dependencies/vaticle/repositories.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def vaticle_typedb_behaviour():
5353
git_repository(
5454
name = "vaticle_typedb_behaviour",
5555
remote = "https://github.com/vaticle/typedb-behaviour",
56-
commit = "46619244d5f1773505eeacf6d5bd0ae71781f8e8" # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_typedb_behaviour
56+
commit = "ff4f58b4db2200b907c60b28a2b8ee661449e9c0" # sync-marker: do not remove this comment, this is used for sync-dependencies by @vaticle_typedb_behaviour
5757
)
5858

5959
def vaticle_factory_tracing():

test/behaviour/concept/serialization/BUILD

-63
Original file line numberDiff line numberDiff line change
@@ -19,70 +19,7 @@
1919
# under the License.
2020
#
2121

22-
package(default_visibility = ["//test/behaviour/concept/thing:__subpackages__"])
23-
2422
load("@vaticle_dependencies//tool/checkstyle:rules.bzl", "checkstyle_test")
25-
load("//test/behaviour:rules.bzl", "typedb_behaviour_java_test")
26-
27-
java_library(
28-
name = "steps",
29-
srcs = [
30-
"SerializationSteps.java",
31-
],
32-
visibility = ["//visibility:public"],
33-
deps = [
34-
# Internal Package Dependencies
35-
"//api:api",
36-
"//test/behaviour/typeql:steps",
37-
38-
# External Maven Dependencies
39-
"@maven//:com_eclipsesource_minimal_json_minimal_json",
40-
"@maven//:io_cucumber_cucumber_java",
41-
"@maven//:junit_junit",
42-
],
43-
)
44-
45-
typedb_behaviour_java_test(
46-
name = "test",
47-
srcs = [
48-
"SerializationTest.java",
49-
],
50-
test_class = "com.vaticle.typedb.client.test.behaviour.concept.serialization.SerializationTest",
51-
data = [
52-
"@vaticle_typedb_behaviour//concept:serialization.feature",
53-
],
54-
typedb_artifact_mac = "@vaticle_typedb_artifact_mac//file",
55-
typedb_artifact_linux = "@vaticle_typedb_artifact_linux//file",
56-
typedb_artifact_windows = "@vaticle_typedb_artifact_windows//file",
57-
typedb_cluster_artifact_mac = "@vaticle_typedb_cluster_artifact_mac//file",
58-
typedb_cluster_artifact_linux = "@vaticle_typedb_cluster_artifact_linux//file",
59-
typedb_cluster_artifact_windows = "@vaticle_typedb_cluster_artifact_windows//file",
60-
connection_steps_core = "//test/behaviour/connection:steps-core",
61-
connection_steps_cluster = "//test/behaviour/connection:steps-cluster",
62-
steps = [
63-
":steps",
64-
"//test/behaviour/concept/thing/attribute:steps",
65-
"//test/behaviour/concept/thing/entity:steps",
66-
"//test/behaviour/concept/thing/relation:steps",
67-
"//test/behaviour/concept/type/attributetype:steps",
68-
"//test/behaviour/concept/type/relationtype:steps",
69-
"//test/behaviour/connection:steps-base",
70-
"//test/behaviour/connection/database:steps",
71-
"//test/behaviour/connection/session:steps",
72-
"//test/behaviour/connection/transaction:steps",
73-
],
74-
deps = [
75-
# Internal Package Dependencies
76-
"//test/behaviour:behaviour",
77-
# External Maven Dependencies
78-
"@maven//:io_cucumber_cucumber_junit",
79-
],
80-
runtime_deps = [
81-
"//test/behaviour/config:parameters",
82-
],
83-
size = "small",
84-
)
85-
8623

8724
checkstyle_test(
8825
name = "checkstyle",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#
2+
# Copyright (C) 2022 Vaticle
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one
5+
# or more contributor license agreements. See the NOTICE file
6+
# distributed with this work for additional information
7+
# regarding copyright ownership. The ASF licenses this file
8+
# to you under the Apache License, Version 2.0 (the
9+
# "License"); you may not use this file except in compliance
10+
# with the License. You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing,
15+
# software distributed under the License is distributed on an
16+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
# KIND, either express or implied. See the License for the
18+
# specific language governing permissions and limitations
19+
# under the License.
20+
#
21+
22+
package(default_visibility = ["//test/behaviour:__subpackages__"])
23+
24+
load("@vaticle_dependencies//tool/checkstyle:rules.bzl", "checkstyle_test")
25+
load("//test/behaviour:rules.bzl", "typedb_behaviour_java_test")
26+
27+
java_library(
28+
name = "steps",
29+
srcs = [
30+
"JSONSteps.java",
31+
],
32+
visibility = ["//visibility:public"],
33+
deps = [
34+
# Internal Package Dependencies
35+
"//api:api",
36+
"//test/behaviour/typeql:steps",
37+
38+
# External Maven Dependencies
39+
"@maven//:com_eclipsesource_minimal_json_minimal_json",
40+
"@maven//:io_cucumber_cucumber_java",
41+
"@maven//:junit_junit",
42+
],
43+
)
44+
45+
typedb_behaviour_java_test(
46+
name = "test",
47+
srcs = [
48+
"JSONTest.java",
49+
],
50+
test_class = "com.vaticle.typedb.client.test.behaviour.concept.serialization.json.JSONTest",
51+
data = [
52+
"@vaticle_typedb_behaviour//concept/serialization:json.feature",
53+
],
54+
typedb_artifact_mac = "@vaticle_typedb_artifact_mac//file",
55+
typedb_artifact_linux = "@vaticle_typedb_artifact_linux//file",
56+
typedb_artifact_windows = "@vaticle_typedb_artifact_windows//file",
57+
typedb_cluster_artifact_mac = "@vaticle_typedb_cluster_artifact_mac//file",
58+
typedb_cluster_artifact_linux = "@vaticle_typedb_cluster_artifact_linux//file",
59+
typedb_cluster_artifact_windows = "@vaticle_typedb_cluster_artifact_windows//file",
60+
connection_steps_core = "//test/behaviour/connection:steps-core",
61+
connection_steps_cluster = "//test/behaviour/connection:steps-cluster",
62+
steps = [
63+
":steps",
64+
"//test/behaviour/concept/thing/attribute:steps",
65+
"//test/behaviour/concept/thing/entity:steps",
66+
"//test/behaviour/concept/thing/relation:steps",
67+
"//test/behaviour/concept/type/attributetype:steps",
68+
"//test/behaviour/concept/type/relationtype:steps",
69+
"//test/behaviour/connection:steps-base",
70+
"//test/behaviour/connection/database:steps",
71+
"//test/behaviour/connection/session:steps",
72+
"//test/behaviour/connection/transaction:steps",
73+
],
74+
deps = [
75+
# Internal Package Dependencies
76+
"//test/behaviour:behaviour",
77+
# External Maven Dependencies
78+
"@maven//:io_cucumber_cucumber_junit",
79+
],
80+
runtime_deps = [
81+
"//test/behaviour/config:parameters",
82+
],
83+
size = "small",
84+
)
85+
86+
87+
checkstyle_test(
88+
name = "checkstyle",
89+
include = glob(["*"]),
90+
license_type = "apache-header",
91+
)

test/behaviour/concept/serialization/SerializationSteps.java test/behaviour/concept/serialization/json/JSONSteps.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* under the License.
2020
*/
2121

22-
package com.vaticle.typedb.client.test.behaviour.concept.serialization;
22+
package com.vaticle.typedb.client.test.behaviour.concept.serialization.json;
2323

2424
import com.eclipsesource.json.Json;
2525
import com.eclipsesource.json.JsonArray;
@@ -37,8 +37,8 @@
3737
import static org.junit.Assert.assertEquals;
3838
import static org.junit.Assert.assertTrue;
3939

40-
public class SerializationSteps {
41-
@Then("JSON of answer concepts matches")
40+
public class JSONSteps {
41+
@Then("JSON serialization of answers matches")
4242
public void json_matches(String expectedJSON) {
4343
List<JsonValue> actual = TypeQLSteps.answers().stream().map(ConceptMap::toJSON).collect(Collectors.toList());
4444
List<JsonValue> expected = Json.parse(expectedJSON).asArray().values();

test/behaviour/concept/serialization/SerializationTest.java test/behaviour/concept/serialization/json/JSONTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* under the License.
2020
*/
2121

22-
package com.vaticle.typedb.client.test.behaviour.concept.serialization;
22+
package com.vaticle.typedb.client.test.behaviour.concept.serialization.json;
2323

2424
import com.vaticle.typedb.client.test.behaviour.BehaviourTest;
2525
import io.cucumber.junit.Cucumber;
@@ -31,17 +31,17 @@
3131
strict = true,
3232
plugin = "pretty",
3333
glue = "com.vaticle.typedb.client.test.behaviour",
34-
features = "external/vaticle_typedb_behaviour/concept/serialization.feature",
34+
features = "external/vaticle_typedb_behaviour/concept/serialization/json.feature",
3535
tags = "not @ignore and not @ignore-typedb"
3636
)
37-
public class SerializationTest extends BehaviourTest {
37+
public class JSONTest extends BehaviourTest {
3838
// ATTENTION:
3939
// When you click RUN from within this class through Intellij IDE, it will fail.
4040
// You can fix it by doing:
4141
//
4242
// 1) Go to 'Run'
4343
// 2) Select 'Edit Configurations...'
44-
// 3) Select 'Bazel test SerializationTest'
44+
// 3) Select 'Bazel test JSONTest'
4545
//
4646
// 4) Ensure 'Target Expression' is set correctly: '//<this>/<package>/<name>:test'
4747
//

0 commit comments

Comments
 (0)