本文整理匯總了Java中org.elasticsearch.plugins.ActionPlugin類的典型用法代碼示例。如果您正苦於以下問題:Java ActionPlugin類的具體用法?Java ActionPlugin怎麽用?Java ActionPlugin使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ActionPlugin類屬於org.elasticsearch.plugins包,在下文中一共展示了ActionPlugin類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testPluginCantOverwriteBuiltinAction
import org.elasticsearch.plugins.ActionPlugin; //導入依賴的package包/類
public void testPluginCantOverwriteBuiltinAction() {
ActionPlugin dupsMainAction = new ActionPlugin() {
@Override
public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
return singletonList(new ActionHandler<>(MainAction.INSTANCE, TransportMainAction.class));
}
};
Exception e = expectThrows(IllegalArgumentException.class, () -> ActionModule.setupActions(singletonList(dupsMainAction)));
assertEquals("action for name [" + MainAction.NAME + "] already registered", e.getMessage());
}
示例2: testPluginCanRegisterAction
import org.elasticsearch.plugins.ActionPlugin; //導入依賴的package包/類
public void testPluginCanRegisterAction() {
class FakeRequest extends ActionRequest {
@Override
public ActionRequestValidationException validate() {
return null;
}
}
class FakeTransportAction extends TransportAction<FakeRequest, ActionResponse> {
protected FakeTransportAction(Settings settings, String actionName, ThreadPool threadPool, ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver, TaskManager taskManager) {
super(settings, actionName, threadPool, actionFilters, indexNameExpressionResolver, taskManager);
}
@Override
protected void doExecute(FakeRequest request, ActionListener<ActionResponse> listener) {
}
}
class FakeAction extends GenericAction<FakeRequest, ActionResponse> {
protected FakeAction() {
super("fake");
}
@Override
public ActionResponse newResponse() {
return null;
}
}
FakeAction action = new FakeAction();
ActionPlugin registersFakeAction = new ActionPlugin() {
@Override
public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
return singletonList(new ActionHandler<>(action, FakeTransportAction.class));
}
};
assertThat(ActionModule.setupActions(singletonList(registersFakeAction)),
hasEntry("fake", new ActionHandler<>(action, FakeTransportAction.class)));
}
示例3: setupActionFilters
import org.elasticsearch.plugins.ActionPlugin; //導入依賴的package包/類
private List<Class<? extends ActionFilter>> setupActionFilters(List<ActionPlugin> actionPlugins) {
return unmodifiableList(actionPlugins.stream().flatMap(p -> p.getActionFilters().stream()).collect(Collectors.toList()));
}