Skip to content

Commit 004faa2

Browse files
xiangu-batwhoe-jo
authored andcommitted
add integration test case for class
1 parent 5e62d8f commit 004faa2

34 files changed

Lines changed: 889 additions & 2 deletions

validation/core/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ The current implementation supports three validation flows:
2929

3030
1. `BazelComponent`: compares the indexed Bazel build graph with the indexed
3131
PlantUML component-diagram structure.
32-
2. `ComponentClass`: compares component-diagram unit aliases with enclosing
33-
namespace IDs observed in class diagrams.
32+
2. `ComponentClass`: compares component-diagram unit IDs with enclosing
33+
namespace IDs observed in class diagrams using boundary-aware suffix
34+
matching.
3435
3. `ComponentSequence`: compares component-diagram unit aliases with
3536
caller/callee participants observed in sequence diagrams (exact match).
3637

validation/core/integration_test/BUILD

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ filegroup(
2626
],
2727
)
2828

29+
filegroup(
30+
name = "component_class_test_data",
31+
srcs = [
32+
"//validation/core/integration_test/component_class/negative_boundary_mismatch:case_data",
33+
"//validation/core/integration_test/component_class/negative_case_sensitive_mismatch:case_data",
34+
"//validation/core/integration_test/component_class/negative_missing_namespace_coverage:case_data",
35+
"//validation/core/integration_test/component_class/negative_multi_class_files_with_mismatch:case_data",
36+
"//validation/core/integration_test/component_class/positive_exact_match:case_data",
37+
"//validation/core/integration_test/component_class/positive_multi_class_files:case_data",
38+
"//validation/core/integration_test/component_class/positive_suffix_match:case_data",
39+
],
40+
)
41+
2942
rust_library(
3043
name = "test_framework",
3144
srcs = [
@@ -56,3 +69,20 @@ rust_test(
5669
"@crates//:serde_json",
5770
],
5871
)
72+
73+
rust_test(
74+
name = "component_class_integration_test",
75+
srcs = ["src/component_class_suite.rs"],
76+
crate_root = "src/component_class_suite.rs",
77+
data = [
78+
":component_class_test_data",
79+
"//validation/core:validation_cli",
80+
],
81+
deps = [
82+
":test_framework",
83+
"//tools/metamodel:class_diagram",
84+
"//validation/core:validation",
85+
"@crates//:serde",
86+
"@crates//:serde_json",
87+
],
88+
)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
load("//bazel/rules/rules_score:rules_score.bzl", "architectural_design", "unit_design")
15+
load("//validation/core/integration_test:puml_fixture.bzl", "provider_fbs_fixture_bundle")
16+
17+
architectural_design(
18+
name = "component_design",
19+
static = ["component_diagram.puml"],
20+
visibility = ["//visibility:private"],
21+
)
22+
23+
unit_design(
24+
name = "class_design",
25+
static = ["class_diagram.puml"],
26+
visibility = ["//visibility:private"],
27+
)
28+
29+
provider_fbs_fixture_bundle(
30+
name = "fbs",
31+
visibility = ["//visibility:public"],
32+
deps = [
33+
":class_design",
34+
":component_design",
35+
],
36+
)
37+
38+
filegroup(
39+
name = "case_data",
40+
srcs = [
41+
"expected.json",
42+
":fbs",
43+
],
44+
visibility = ["//visibility:public"],
45+
)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
' *******************************************************************************
2+
' Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
'
4+
' See the NOTICE file(s) distributed with this work for additional
5+
' information regarding copyright ownership.
6+
'
7+
' This program and the accompanying materials are made available under the
8+
' terms of the Apache License Version 2.0 which is available at
9+
' https://www.apache.org/licenses/LICENSE-2.0
10+
'
11+
' SPDX-License-Identifier: Apache-2.0
12+
' *******************************************************************************
13+
14+
@startuml class_diagram
15+
16+
namespace it_1 {
17+
class Foo {
18+
+ GetNumber() : uint8_t
19+
}
20+
}
21+
22+
@enduml
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
' *******************************************************************************
2+
' Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
'
4+
' See the NOTICE file(s) distributed with this work for additional
5+
' information regarding copyright ownership.
6+
'
7+
' This program and the accompanying materials are made available under the
8+
' terms of the Apache License Version 2.0 which is available at
9+
' https://www.apache.org/licenses/LICENSE-2.0
10+
'
11+
' SPDX-License-Identifier: Apache-2.0
12+
' *******************************************************************************
13+
14+
@startuml component_diagram
15+
16+
package "Package A" as package_a {
17+
component "Component A" as component_a <<component>> {
18+
component "Unit 1" as unit_1 <<unit>>
19+
}
20+
}
21+
22+
@enduml
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"should_pass": false,
3+
"error_contains": [
4+
"no enclosing namespace ID suffix match for component unit ID",
5+
"package_a.component_a.unit_1",
6+
"enclosing namespace ID is not a suffix of any component unit ID",
7+
"Namespace ID : \"it_1\""
8+
]
9+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
load("//bazel/rules/rules_score:rules_score.bzl", "architectural_design", "unit_design")
15+
load("//validation/core/integration_test:puml_fixture.bzl", "provider_fbs_fixture_bundle")
16+
17+
architectural_design(
18+
name = "component_design",
19+
static = ["component_diagram.puml"],
20+
visibility = ["//visibility:private"],
21+
)
22+
23+
unit_design(
24+
name = "class_design",
25+
static = ["class_diagram.puml"],
26+
visibility = ["//visibility:private"],
27+
)
28+
29+
provider_fbs_fixture_bundle(
30+
name = "fbs",
31+
visibility = ["//visibility:public"],
32+
deps = [
33+
":class_design",
34+
":component_design",
35+
],
36+
)
37+
38+
filegroup(
39+
name = "case_data",
40+
srcs = [
41+
"expected.json",
42+
":fbs",
43+
],
44+
visibility = ["//visibility:public"],
45+
)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
' *******************************************************************************
2+
' Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
'
4+
' See the NOTICE file(s) distributed with this work for additional
5+
' information regarding copyright ownership.
6+
'
7+
' This program and the accompanying materials are made available under the
8+
' terms of the Apache License Version 2.0 which is available at
9+
' https://www.apache.org/licenses/LICENSE-2.0
10+
'
11+
' SPDX-License-Identifier: Apache-2.0
12+
' *******************************************************************************
13+
14+
@startuml class_diagram
15+
16+
namespace unit_1 {
17+
class Foo {
18+
+ GetNumber() : uint8_t
19+
}
20+
}
21+
22+
@enduml
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
' *******************************************************************************
2+
' Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
'
4+
' See the NOTICE file(s) distributed with this work for additional
5+
' information regarding copyright ownership.
6+
'
7+
' This program and the accompanying materials are made available under the
8+
' terms of the Apache License Version 2.0 which is available at
9+
' https://www.apache.org/licenses/LICENSE-2.0
10+
'
11+
' SPDX-License-Identifier: Apache-2.0
12+
' *******************************************************************************
13+
14+
@startuml component_diagram
15+
16+
package "Package A" as package_a {
17+
component "Component A" as component_a <<component>> {
18+
component "Unit 1" as Unit_1 <<unit>>
19+
}
20+
}
21+
22+
@enduml
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"should_pass": false,
3+
"error_contains": [
4+
"no enclosing namespace ID suffix match for component unit ID",
5+
"package_a.component_a.Unit_1",
6+
"enclosing namespace ID is not a suffix of any component unit ID",
7+
"Namespace ID : \"unit_1\""
8+
]
9+
}

0 commit comments

Comments
 (0)