use of org.elasticsearch.plugins.PluginsService in project elasticsearch by elastic.
the class IndicesRequestIT method assertAllRequestsHaveBeenConsumed.
private static void assertAllRequestsHaveBeenConsumed() {
Iterable<PluginsService> pluginsServices = internalCluster().getInstances(PluginsService.class);
for (PluginsService pluginsService : pluginsServices) {
Set<Map.Entry<String, List<TransportRequest>>> entries = pluginsService.filterPlugins(InterceptingTransportService.TestPlugin.class).stream().findFirst().get().instance.requests.entrySet();
assertThat(entries, emptyIterable());
}
}
use of org.elasticsearch.plugins.PluginsService in project crate by crate.
the class IndexRecoveryIT method testDoNotInfinitelyWaitForMapping.
@Test
public void testDoNotInfinitelyWaitForMapping() {
internalCluster().ensureAtLeastNumDataNodes(3);
execute("CREATE ANALYZER test_analyzer (" + " TOKENIZER standard," + " TOKEN_FILTERS (test_token_filter)" + ")");
execute("CREATE TABLE test (test_field TEXT INDEX USING FULLTEXT WITH (ANALYZER='test_analyzer'))" + " CLUSTERED INTO 1 SHARDS WITH (number_of_replicas = 0)");
int numDocs = between(1, 10);
var args = new Object[numDocs][];
for (int i = 0; i < numDocs; i++) {
args[i] = new Object[] { Integer.toString(i) };
}
execute("INSERT INTO test (test_field) VALUES (?)", args);
Semaphore recoveryBlocked = new Semaphore(1);
for (DiscoveryNode node : clusterService().state().nodes()) {
MockTransportService transportService = (MockTransportService) internalCluster().getInstance(TransportService.class, node.getName());
transportService.addSendBehavior((connection, requestId, action, request, options) -> {
if (action.equals(PeerRecoverySourceService.Actions.START_RECOVERY)) {
if (recoveryBlocked.tryAcquire()) {
PluginsService pluginService = internalCluster().getInstance(PluginsService.class, node.getName());
for (TestAnalysisPlugin plugin : pluginService.filterPlugins(TestAnalysisPlugin.class)) {
plugin.throwParsingError.set(true);
}
}
}
connection.sendRequest(requestId, action, request, options);
});
}
execute("ALTER TABLE test SET (number_of_replicas = 1)");
ensureGreen();
refresh();
var searchResponse = execute("SELECT COUNT(*) FROM test");
assertThat((long) searchResponse.rows()[0][0], is((long) numDocs));
}
Aggregations