Skip to content

Commit f8ee27a

Browse files
[CI] Auto commit changes from spotless
1 parent d2b9544 commit f8ee27a

File tree

1 file changed

+49
-48
lines changed

1 file changed

+49
-48
lines changed

server/src/internalClusterTest/java/org/elasticsearch/synonyms/SynonymsManagementAPIServiceIT.java

+49-48
Original file line numberDiff line numberDiff line change
@@ -138,66 +138,67 @@ public void testCreateTooManySynonymsUsingRuleUpdates() throws InterruptedExcept
138138
randomBoolean(),
139139
new ActionListener<>() {
140140
@Override
141-
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
142-
// Create as many rules as should fail
143-
SynonymRule[] rules = randomSynonymsSet(atLeast(rulesToUpdate + 1));
144-
CountDownLatch updatedRulesLatch = new CountDownLatch(rulesToUpdate);
145-
for (int i = 0; i < rulesToUpdate; i++) {
146-
synonymsManagementAPIService.putSynonymRule(synonymSetId, rules[i], true, new ActionListener<>() {
147-
@Override
148-
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
149-
updatedRulesLatch.countDown();
150-
}
151-
152-
@Override
153-
public void onFailure(Exception e) {
154-
fail(e);
155-
}
156-
});
157-
}
158-
try {
159-
updatedRulesLatch.await(5, TimeUnit.SECONDS);
160-
} catch (InterruptedException e) {
161-
fail(e);
162-
}
163-
164-
// Updating more rules fails
165-
int rulesToInsert = rules.length - rulesToUpdate;
166-
CountDownLatch insertRulesLatch = new CountDownLatch(rulesToInsert);
167-
for (int i = rulesToUpdate; i < rulesToInsert; i++) {
168-
synonymsManagementAPIService.putSynonymRule(
169-
// Error here
170-
synonymSetId,
171-
rules[i],
172-
randomBoolean(),
173-
new ActionListener<>() {
141+
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
142+
// Create as many rules as should fail
143+
SynonymRule[] rules = randomSynonymsSet(atLeast(rulesToUpdate + 1));
144+
CountDownLatch updatedRulesLatch = new CountDownLatch(rulesToUpdate);
145+
for (int i = 0; i < rulesToUpdate; i++) {
146+
synonymsManagementAPIService.putSynonymRule(synonymSetId, rules[i], true, new ActionListener<>() {
174147
@Override
175148
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
176-
fail("Shouldn't have been able to update a rule");
149+
updatedRulesLatch.countDown();
177150
}
178151

179152
@Override
180153
public void onFailure(Exception e) {
181-
if (e instanceof IllegalArgumentException == false) {
182-
fail(e);
154+
fail(e);
155+
}
156+
});
157+
}
158+
try {
159+
updatedRulesLatch.await(5, TimeUnit.SECONDS);
160+
} catch (InterruptedException e) {
161+
fail(e);
162+
}
163+
164+
// Updating more rules fails
165+
int rulesToInsert = rules.length - rulesToUpdate;
166+
CountDownLatch insertRulesLatch = new CountDownLatch(rulesToInsert);
167+
for (int i = rulesToUpdate; i < rulesToInsert; i++) {
168+
synonymsManagementAPIService.putSynonymRule(
169+
// Error here
170+
synonymSetId,
171+
rules[i],
172+
randomBoolean(),
173+
new ActionListener<>() {
174+
@Override
175+
public void onResponse(SynonymsManagementAPIService.SynonymsReloadResult synonymsReloadResult) {
176+
fail("Shouldn't have been able to update a rule");
177+
}
178+
179+
@Override
180+
public void onFailure(Exception e) {
181+
if (e instanceof IllegalArgumentException == false) {
182+
fail(e);
183+
}
184+
updatedRulesLatch.countDown();
183185
}
184-
updatedRulesLatch.countDown();
185186
}
186-
}
187-
);
187+
);
188+
}
189+
try {
190+
insertRulesLatch.await(5, TimeUnit.SECONDS);
191+
} catch (InterruptedException e) {
192+
fail(e);
193+
}
188194
}
189-
try {
190-
insertRulesLatch.await(5, TimeUnit.SECONDS);
191-
} catch (InterruptedException e) {
195+
196+
@Override
197+
public void onFailure(Exception e) {
192198
fail(e);
193199
}
194200
}
195-
196-
@Override
197-
public void onFailure(Exception e) {
198-
fail(e);
199-
}
200-
});
201+
);
201202

202203
latch.await(5, TimeUnit.SECONDS);
203204
}

0 commit comments

Comments
 (0)