9
9
import org .elasticsearch .cluster .metadata .IndexMetadata ;
10
10
import org .elasticsearch .cluster .metadata .MappingMetadata ;
11
11
import org .elasticsearch .cluster .metadata .Metadata ;
12
- import org .elasticsearch .common .collect .ImmutableOpenMap ;
13
12
import org .elasticsearch .common .io .stream .Writeable ;
14
13
import org .elasticsearch .common .util .Maps ;
15
14
import org .elasticsearch .test .AbstractWireSerializingTestCase ;
@@ -43,14 +42,13 @@ protected Writeable.Reader<GetRollupIndexCapsAction.Request> instanceReader() {
43
42
}
44
43
45
44
public void testNoIndicesByRollup () {
46
- ImmutableOpenMap <String , IndexMetadata > indices = new ImmutableOpenMap .Builder <String , IndexMetadata >().build ();
47
- Map <String , RollableIndexCaps > caps = getCapsByRollupIndex (Collections .singletonList ("foo" ), indices );
45
+ Map <String , RollableIndexCaps > caps = getCapsByRollupIndex (Collections .singletonList ("foo" ), Map .of ());
48
46
assertThat (caps .size (), equalTo (0 ));
49
47
}
50
48
51
49
public void testAllIndicesByRollupSingleRollup () throws IOException {
52
50
int num = randomIntBetween (1 , 5 );
53
- ImmutableOpenMap . Builder <String , IndexMetadata > indices = new ImmutableOpenMap . Builder <> (5 );
51
+ Map <String , IndexMetadata > indices = Maps . newMapWithExpectedSize (5 );
54
52
int indexCounter = 0 ;
55
53
for (int j = 0 ; j < 5 ; j ++) {
56
54
@@ -75,12 +73,12 @@ public void testAllIndicesByRollupSingleRollup() throws IOException {
75
73
indices .put ("foo" , meta );
76
74
}
77
75
78
- Map <String , RollableIndexCaps > caps = getCapsByRollupIndex (Collections .singletonList ("foo" ), indices . build () );
76
+ Map <String , RollableIndexCaps > caps = getCapsByRollupIndex (Collections .singletonList ("foo" ), indices );
79
77
assertThat (caps .size (), equalTo (1 ));
80
78
}
81
79
82
80
public void testAllIndicesByRollupManyRollup () throws IOException {
83
- ImmutableOpenMap . Builder <String , IndexMetadata > indices = new ImmutableOpenMap . Builder <> (5 );
81
+ Map <String , IndexMetadata > indices = Maps . newMapWithExpectedSize (5 );
84
82
int indexCounter = 0 ;
85
83
for (int j = 0 ; j < 5 ; j ++) {
86
84
@@ -103,12 +101,12 @@ public void testAllIndicesByRollupManyRollup() throws IOException {
103
101
indices .put ("rollup_" + indexName , meta );
104
102
}
105
103
106
- Map <String , RollableIndexCaps > caps = getCapsByRollupIndex (Arrays .asList (indices .keys ().toArray (new String [0 ])), indices . build () );
104
+ Map <String , RollableIndexCaps > caps = getCapsByRollupIndex (Arrays .asList (indices .keySet ().toArray (new String [0 ])), indices );
107
105
assertThat (caps .size (), equalTo (5 ));
108
106
}
109
107
110
108
public void testOneIndexByRollupManyRollup () throws IOException {
111
- ImmutableOpenMap . Builder <String , IndexMetadata > indices = new ImmutableOpenMap . Builder <> (5 );
109
+ Map <String , IndexMetadata > indices = Maps . newMapWithExpectedSize (5 );
112
110
int indexCounter = 0 ;
113
111
for (int j = 0 ; j < 5 ; j ++) {
114
112
@@ -131,14 +129,14 @@ public void testOneIndexByRollupManyRollup() throws IOException {
131
129
indices .put ("rollup_" + indexName , meta );
132
130
}
133
131
134
- Map <String , RollableIndexCaps > caps = getCapsByRollupIndex (Collections .singletonList ("rollup_1" ), indices . build () );
132
+ Map <String , RollableIndexCaps > caps = getCapsByRollupIndex (Collections .singletonList ("rollup_1" ), indices );
135
133
assertThat (caps .size (), equalTo (1 ));
136
134
assertThat (caps .get ("rollup_1" ).getIndexName (), equalTo ("rollup_1" ));
137
135
assertThat (caps .get ("rollup_1" ).getJobCaps ().size (), equalTo (1 ));
138
136
}
139
137
140
138
public void testOneIndexByRollupOneRollup () throws IOException {
141
- ImmutableOpenMap . Builder <String , IndexMetadata > indices = new ImmutableOpenMap . Builder <> (5 );
139
+ Map <String , IndexMetadata > indices = Maps . newMapWithExpectedSize (5 );
142
140
int indexCounter = 0 ;
143
141
for (int j = 0 ; j < 5 ; j ++) {
144
142
@@ -161,7 +159,7 @@ public void testOneIndexByRollupOneRollup() throws IOException {
161
159
indices .put ("rollup_foo" , meta );
162
160
}
163
161
164
- Map <String , RollableIndexCaps > caps = getCapsByRollupIndex (Collections .singletonList ("rollup_foo" ), indices . build () );
162
+ Map <String , RollableIndexCaps > caps = getCapsByRollupIndex (Collections .singletonList ("rollup_foo" ), indices );
165
163
assertThat (caps .size (), equalTo (1 ));
166
164
assertThat (caps .get ("rollup_foo" ).getIndexName (), equalTo ("rollup_foo" ));
167
165
assertThat (caps .get ("rollup_foo" ).getJobCaps ().size (), equalTo (1 ));
0 commit comments