Skip to content

Commit 814bdf8

Browse files
authored
Format AbstractFilteringTestCase (backport of #77217) (#77254)
`AbstractFilteringTestCase` had a ton of carefully formatted `XContentBuilder` calls that would have been totally unreadable after the formatter worked its magic. So I formatted a bunch of them by hand and extracted the rest to json files.
1 parent d7f992b commit 814bdf8

25 files changed

+1336
-1405
lines changed

build-tools-internal/src/main/groovy/elasticsearch.formatting.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ subprojects {
205205
if (project.path == ':server') {
206206
target 'src/*/java/org/elasticsearch/action/admin/cluster/repositories/**/*.java',
207207
'src/*/java/org/elasticsearch/action/admin/cluster/snapshots/**/*.java',
208+
'src/test/java/org/elasticsearch/common/xcontent/support/AbstractFilteringTestCase.java',
209+
'src/test/java/org/elasticsearch/common/xcontent/support/XContentMapValuesTests.java',
208210
'src/*/java/org/elasticsearch/index/snapshots/**/*.java',
209211
'src/*/java/org/elasticsearch/repositories/**/*.java',
210212
'src/*/java/org/elasticsearch/search/aggregations/**/*.java',

server/src/test/java/org/elasticsearch/common/xcontent/support/AbstractFilteringTestCase.java

Lines changed: 180 additions & 1171 deletions
Large diffs are not rendered by default.

server/src/test/java/org/elasticsearch/common/xcontent/support/XContentMapValuesTests.java

Lines changed: 208 additions & 234 deletions
Large diffs are not rendered by default.

server/src/test/java/org/elasticsearch/common/xcontent/support/filtering/AbstractXContentFilteringTestCase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ protected final void testFilter(Builder expected, Builder actual, Set<String> in
3838

3939
protected abstract XContentType getXContentType();
4040

41+
@Override
42+
protected boolean removesEmptyArrays() {
43+
return true;
44+
}
45+
4146
private XContentBuilder createBuilder() throws IOException {
4247
return XContentBuilder.builder(getXContentType().xContent());
4348
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"title" : "My awesome book",
3+
"pages" : 456,
4+
"price" : 27.99,
5+
"timestamp" : 1428582942867,
6+
"default" : null,
7+
"tags" : [
8+
"elasticsearch",
9+
"java"
10+
],
11+
"authors" : [
12+
{
13+
"name" : "John Doe",
14+
"lastname" : "John",
15+
"firstname" : "Doe"
16+
},
17+
{
18+
"name" : "William Smith",
19+
"lastname" : "William",
20+
"firstname" : "Smith"
21+
}
22+
],
23+
"properties" : {
24+
"weight" : 0.8,
25+
"language" : {
26+
"en" : {
27+
"lang" : "English",
28+
"available" : true,
29+
"distributors" : [
30+
{
31+
"name" : "The Book Shop",
32+
"addresses" : [
33+
{
34+
"name" : "address #1",
35+
"street" : "Hampton St",
36+
"city" : "London"
37+
},
38+
{
39+
"name" : "address #2",
40+
"street" : "Queen St",
41+
"city" : "Stornoway"
42+
}
43+
]
44+
},
45+
{
46+
"name" : "Sussex Books House"
47+
}
48+
]
49+
},
50+
"fr" : {
51+
"lang" : "French",
52+
"available" : false,
53+
"distributors" : [
54+
{
55+
"name" : "La Maison du Livre",
56+
"addresses" : [
57+
{
58+
"name" : "address #1",
59+
"street" : "Rue Mouffetard",
60+
"city" : "Paris"
61+
}
62+
]
63+
},
64+
{
65+
"name" : "Thetra"
66+
}
67+
]
68+
}
69+
}
70+
}
71+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"authors" : [
3+
{
4+
"name" : "John Doe",
5+
"lastname" : "John",
6+
"firstname" : "Doe"
7+
},
8+
{
9+
"name" : "William Smith",
10+
"lastname" : "William",
11+
"firstname" : "Smith"
12+
}
13+
]
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"authors" : [
3+
{
4+
"lastname" : "John"
5+
},
6+
{
7+
"lastname" : "William"
8+
}
9+
]
10+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"authors" : [
3+
{
4+
"name" : "John Doe"
5+
},
6+
{
7+
"name" : "William Smith"
8+
}
9+
],
10+
"properties" : {
11+
"language" : {
12+
"en" : {
13+
"distributors" : [
14+
{
15+
"name" : "The Book Shop",
16+
"addresses" : [
17+
{
18+
"name" : "address #1"
19+
},
20+
{
21+
"name" : "address #2"
22+
}
23+
]
24+
},
25+
{
26+
"name" : "Sussex Books House"
27+
}
28+
]
29+
},
30+
"fr" : {
31+
"distributors" : [
32+
{
33+
"name" : "La Maison du Livre",
34+
"addresses" : [
35+
{
36+
"name" : "address #1"
37+
}
38+
]
39+
},
40+
{
41+
"name" : "Thetra"
42+
}
43+
]
44+
}
45+
}
46+
}
47+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"price" : 27.99,
3+
"properties" : {
4+
"weight" : 0.8,
5+
"language" : {
6+
"en" : {
7+
"lang" : "English",
8+
"available" : true,
9+
"distributors" : [
10+
{
11+
"name" : "The Book Shop",
12+
"addresses" : [
13+
{
14+
"name" : "address #1",
15+
"street" : "Hampton St",
16+
"city" : "London"
17+
},
18+
{
19+
"name" : "address #2",
20+
"street" : "Queen St",
21+
"city" : "Stornoway"
22+
}
23+
]
24+
},
25+
{
26+
"name" : "Sussex Books House"
27+
}
28+
]
29+
},
30+
"fr" : {
31+
"lang" : "French",
32+
"available" : false,
33+
"distributors" : [
34+
{
35+
"name" : "La Maison du Livre",
36+
"addresses" : [
37+
{
38+
"name" : "address #1",
39+
"street" : "Rue Mouffetard",
40+
"city" : "Paris"
41+
}
42+
]
43+
},
44+
{
45+
"name" : "Thetra"
46+
}
47+
]
48+
}
49+
}
50+
}
51+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"properties" : {
3+
"language" : {
4+
"en" : {
5+
"distributors" : [
6+
{
7+
"name" : "The Book Shop"
8+
},
9+
{
10+
"name" : "Sussex Books House"
11+
}
12+
]
13+
},
14+
"fr" : {
15+
"distributors" : [
16+
{
17+
"name" : "La Maison du Livre"
18+
},
19+
{
20+
"name" : "Thetra"
21+
}
22+
]
23+
}
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)