當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。