当前位置: 首页>>代码示例>>Java>>正文


Java ActionPlugin类代码示例

本文整理汇总了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());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:ActionModuleTests.java

示例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)));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:38,代码来源:ActionModuleTests.java

示例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()));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:ActionModule.java


注:本文中的org.elasticsearch.plugins.ActionPlugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。