File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
server/src/test/java/org/elasticsearch/action/admin/indices/mapping/get Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 18
18
import java .util .HashMap ;
19
19
import java .util .Map ;
20
20
import java .util .Objects ;
21
+ import java .util .function .Function ;
22
+ import java .util .stream .Collectors ;
23
+ import java .util .stream .IntStream ;
21
24
22
25
public class GetMappingsResponseTests extends AbstractWireSerializingTestCase <GetMappingsResponse > {
23
26
@@ -63,6 +66,22 @@ protected GetMappingsResponse createTestInstance() {
63
66
return resp ;
64
67
}
65
68
69
+ public void testChunkedXContentUsesChunkPerIndex () {
70
+ final int indexCount = randomIntBetween (1 , 10 );
71
+ final var response = new GetMappingsResponse (
72
+ IntStream .range (0 , indexCount )
73
+ .mapToObj (i -> "index-" + i )
74
+ .collect (Collectors .toUnmodifiableMap (Function .identity (), k -> createMappingsForIndex ()))
75
+ );
76
+ final var chunks = response .toXContentChunked ();
77
+ int chunkCount = 0 ;
78
+ while (chunks .hasNext ()) {
79
+ chunks .next ();
80
+ chunkCount ++;
81
+ }
82
+ assertEquals (indexCount , chunkCount );
83
+ }
84
+
66
85
// Not meant to be exhaustive
67
86
private static Map <String , Object > randomFieldMapping () {
68
87
Map <String , Object > mappings = new HashMap <>();
You can’t perform that action at this time.
0 commit comments