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


Java UnhandledRequestTypeException类代码示例

本文整理汇总了Java中com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException的典型用法代码示例。如果您正苦于以下问题:Java UnhandledRequestTypeException类的具体用法?Java UnhandledRequestTypeException怎么用?Java UnhandledRequestTypeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UnhandledRequestTypeException类属于com.thoughtworks.go.plugin.api.exceptions包,在下文中一共展示了UnhandledRequestTypeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
    String requestName = request.requestName();
    if (requestName.equals(PLUGIN_SETTINGS_GET_CONFIGURATION)) {
        return handleGetPluginSettingsConfiguration();
    } else if (requestName.equals(PLUGIN_SETTINGS_GET_VIEW)) {
        try {
            return handleGetPluginSettingsView();
        } catch (IOException e) {
            return renderJSON(500, String.format("Failed to find template: %s", e.getMessage()));
        }
    } else if (requestName.equals(PLUGIN_SETTINGS_VALIDATE_CONFIGURATION)) {
        return handleValidatePluginSettingsConfiguration(request);
    }
    if ("parse-directory".equals(request.requestName())) {
        return handleParseDirectoryRequest(request);
    }
    throw new UnhandledRequestTypeException(request.requestName());
}
 
开发者ID:tomzo,项目名称:gocd-yaml-config-plugin,代码行数:20,代码来源:YamlConfigPlugin.java

示例2: shouldContainFilePatternInResponseToGetConfigurationRequest

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Test
public void shouldContainFilePatternInResponseToGetConfigurationRequest() throws UnhandledRequestTypeException {
    DefaultGoPluginApiRequest getConfigRequest = new DefaultGoPluginApiRequest("configrepo", "1.0", "go.plugin-settings.get-configuration");

    GoPluginApiResponse response = plugin.handle(getConfigRequest);
    assertThat(response.responseCode(), is(DefaultGoPluginApiResponse.SUCCESS_RESPONSE_CODE));
    JsonObject responseJsonObject = getJsonObjectFromResponse(response);
    JsonElement pattern = responseJsonObject.get("file_pattern");
    assertNotNull(pattern);
    JsonObject patternAsJsonObject = pattern.getAsJsonObject();
    assertThat(patternAsJsonObject.get("display-name").getAsString(), is("Go YAML files pattern"));
    assertThat(patternAsJsonObject.get("default-value").getAsString(), is("**/*.gocd.yaml,**/*.gocd.yml"));
    assertThat(patternAsJsonObject.get("required").getAsBoolean(), is(false));
    assertThat(patternAsJsonObject.get("secure").getAsBoolean(), is(false));
    assertThat(patternAsJsonObject.get("display-order").getAsInt(), is(0));
}
 
开发者ID:tomzo,项目名称:gocd-yaml-config-plugin,代码行数:17,代码来源:YamlConfigPluginIntegrationTest.java

示例3: shouldContainValidFieldsInResponseMessage

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Test
public void shouldContainValidFieldsInResponseMessage() throws UnhandledRequestTypeException {
    GoApiResponse settingsResponse = DefaultGoApiResponse.success("{}");
    when(goAccessor.submit(any(GoApiRequest.class))).thenReturn(settingsResponse);

    GoPluginApiResponse response = parseAndGetResponseForDir(tempDir.getRoot());

    assertThat(response.responseCode(), is(DefaultGoPluginApiResponse.SUCCESS_RESPONSE_CODE));
    final JsonParser parser = new JsonParser();
    JsonElement responseObj = parser.parse(response.responseBody());
    assertTrue(responseObj.isJsonObject());
    JsonObject obj = responseObj.getAsJsonObject();
    assertTrue(obj.has("errors"));
    assertTrue(obj.has("pipelines"));
    assertTrue(obj.has("environments"));
    assertTrue(obj.has("target_version"));
}
 
开发者ID:tomzo,项目名称:gocd-yaml-config-plugin,代码行数:18,代码来源:YamlConfigPluginIntegrationTest.java

示例4: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
    try {
        switch (Request.fromString(request.requestName())) {
            case PLUGIN_SETTINGS_GET_VIEW:
                return new GetViewRequestExecutor().execute();
            case REQUEST_NOTIFICATIONS_INTERESTED_IN:
                return new NotificationInterestedInExecutor().execute();
            case REQUEST_STAGE_STATUS:
                return StageStatusRequest.fromJSON(request.requestBody()).executor(pluginRequest).execute();
            case PLUGIN_SETTINGS_GET_CONFIGURATION:
                return new GetPluginConfigurationExecutor().execute();
            case PLUGIN_SETTINGS_VALIDATE_CONFIGURATION:
                return ValidatePluginSettings.fromJSON(request.requestBody()).executor().execute();
            default:
                throw new UnhandledRequestTypeException(request.requestName());
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:gocd-contrib,项目名称:notification-skeleton-plugin,代码行数:22,代码来源:ExamplePlugin.java

示例5: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
    try {
        switch (request.requestName()) {
            case "configuration":
            case "go.plugin-settings.get-configuration":
                return handleGetConfigRequest(request);
            case "validate":
            case "go.plugin-settings.validate-configuration":
                return handleValidation(request);
            case "execute":
                return handleTaskExecution(request);
            case "view":
            case "go.plugin-settings.get-view":
                return handleTaskView(request);
            default:
                return DefaultGoPluginApiResponse.badRequest(String.format("Invalid request name %s", request.requestName()));
        }
    } catch (Throwable e) {
        return DefaultGoPluginApiResponse.error(e.getMessage());
    }
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:23,代码来源:BaseGoPlugin.java

示例6: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
    switch (request.requestName()) {
        case "configuration":
        case "go.plugin-settings.get-configuration":
            return handleGetConfigRequest();
        case "validate":
        case "go.plugin-settings.validate-configuration":
            return handleValidation();
        case "execute":
            return handleTaskExecution(request);
        case "view":
        case "go.plugin-settings.get-view":
            return handleTaskView();
        default:
            throw new UnhandledRequestTypeException(request.requestName());
    }
}
 
开发者ID:Haufe-Lexware,项目名称:gocd-plugins,代码行数:19,代码来源:NessusScanTask.java

示例7: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
    try {
        switch (Request.fromString(request.requestName())) {
            case PLUGIN_SETTINGS_GET_VIEW:
                return new GetViewRequestExecutor().execute();
            case REQUEST_NOTIFICATIONS_INTERESTED_IN:
                return new NotificationInterestedInExecutor().execute();
            case REQUEST_STAGE_STATUS:
                return StageStatusRequest.fromJSON(request.requestBody()).executor(pluginRequest).execute();
            case PLUGIN_SETTINGS_GET_CONFIGURATION:
                return new GetPluginConfigurationExecutor().execute();
            case PLUGIN_SETTINGS_VALIDATE_CONFIGURATION:
                return ValidatePluginSettingsRequest.fromJSON(request.requestBody()).executor().execute();
            default:
                throw new UnhandledRequestTypeException(request.requestName());
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:gocd-contrib,项目名称:gitter-notifier,代码行数:22,代码来源:GitterNotifierPlugin.java

示例8: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest goPluginApiRequest) throws UnhandledRequestTypeException {
    if (goPluginApiRequest.requestName().equals(REQUEST_REPOSITORY_CONFIGURATION)) {
        return handleRepositoryConfiguration();
    } else if (goPluginApiRequest.requestName().equals(REQUEST_PACKAGE_CONFIGURATION)) {
        return handlePackageConfiguration();
    } else if (goPluginApiRequest.requestName().equals(REQUEST_VALIDATE_REPOSITORY_CONFIGURATION)) {
        return handleRepositoryValidation(goPluginApiRequest);
    } else if (goPluginApiRequest.requestName().equals(REQUEST_VALIDATE_PACKAGE_CONFIGURATION)) {
        return handlePackageValidation();
    } else if (goPluginApiRequest.requestName().equals(REQUEST_CHECK_REPOSITORY_CONNECTION)) {
        return handleRepositoryCheckConnection(goPluginApiRequest);
    } else if (goPluginApiRequest.requestName().equals(REQUEST_CHECK_PACKAGE_CONNECTION)) {
        return handlePackageCheckConnection(goPluginApiRequest);
    } else if (goPluginApiRequest.requestName().equals(REQUEST_LATEST_REVISION)) {
        return handleGetLatestRevision(goPluginApiRequest);
    } else if (goPluginApiRequest.requestName().equals(REQUEST_LATEST_REVISION_SINCE)) {
        return handleLatestRevisionSince(goPluginApiRequest);
    }
    return null;
}
 
开发者ID:indix,项目名称:gocd-s3-artifacts,代码行数:22,代码来源:S3PackageMaterialPoller.java

示例9: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
    if ("configuration".equals(request.requestName())) {
        return handleGetConfigRequest();
    } else if ("validate".equals(request.requestName())) {
        return handleValidation(request);
    } else if ("execute".equals(request.requestName())) {
        return handleTaskExecution(request);
    } else if ("view".equals(request.requestName())) {
        try {
            return handleView();
        } catch (IOException e) {
            String message = "Failed to find template: " + e.getMessage();
            return renderJSON(500, message);
        }
    }
    throw new UnhandledRequestTypeException(request.requestName());
}
 
开发者ID:tispr,项目名称:gocd-opsworks-plugin,代码行数:19,代码来源:GoPluginBase.java

示例10: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
    try {
        if ("configuration".equals(request.requestName())) {
            return handleGetConfigRequest();
        } else if ("validate".equals(request.requestName())) {
            return handleValidation(request);
        } else if ("execute".equals(request.requestName())) {
            return handleTaskExecution(request);
        } else if ("view".equals(request.requestName())) {
            return handleTaskView();
        }
    } catch (IOException e) {
        logError(e, "error when serializing");
        throw new UnhandledRequestTypeException(request.requestName());
    }
    throw new UnhandledRequestTypeException(request.requestName());
}
 
开发者ID:tsathishkumar,项目名称:gocd-git-release-tagger,代码行数:19,代码来源:ReleaseTaggerTask.java

示例11: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest goPluginApiRequest) throws UnhandledRequestTypeException {
    if (goPluginApiRequest.requestName().equals(REQUEST_CONFIGURATION) || goPluginApiRequest.requestName().equals(REQUEST_CONFIGURATION_2)) {
        return handleConfiguration();
    } else if (goPluginApiRequest.requestName().equals(REQUEST_VALIDATION) || goPluginApiRequest.requestName().equals(REQUEST_VALIDATION_2)) {
        return handleValidation(goPluginApiRequest);
    } else if (goPluginApiRequest.requestName().equals(REQUEST_TASK_VIEW) || goPluginApiRequest.requestName().equals(REQUEST_TASK_VIEW_2)) {
        try {
            return handleView();
        } catch (IOException e) {
            String message = "Failed to find template: " + e.getMessage();
            return renderJSON(500, message);
        }
    } else if (goPluginApiRequest.requestName().equals(REQUEST_EXECUTION)) {
        return handleExecute(goPluginApiRequest);
    }
    return null;
}
 
开发者ID:gocd-contrib,项目名称:script-executor-task,代码行数:19,代码来源:GoPluginImpl.java

示例12: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest goPluginApiRequest) throws UnhandledRequestTypeException {
    return new GoPluginApiResponse() {
        @Override
        public int responseCode() {
            return 200;
        }

        @Override
        public Map<String, String> responseHeaders() {
            return null;
        }

        @Override
        public String responseBody() {
            return "{}";
        }
    };
}
 
开发者ID:gocd,项目名称:go-plugins,代码行数:20,代码来源:InvalidXmlPlugin.java

示例13: submitTo

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse submitTo(final String pluginId, final GoPluginApiRequest apiRequest) {
    return goPluginOSGiFramework.doOn(GoPlugin.class, pluginId, new ActionWithReturn<GoPlugin, GoPluginApiResponse>() {
        @Override
        public GoPluginApiResponse execute(GoPlugin plugin, GoPluginDescriptor pluginDescriptor) {
            ensureInitializerInvoked(pluginDescriptor, plugin);
            try {
                return plugin.handle(apiRequest);
            } catch (UnhandledRequestTypeException e) {
                LOGGER.error(e.getMessage());
                LOGGER.debug(e.getMessage(), e);
                throw new RuntimeException(e);
            }
        }
    });
}
 
开发者ID:gocd,项目名称:gocd,代码行数:17,代码来源:DefaultPluginManager.java

示例14: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
    try {
        switch (Request.fromString(request.requestName())) {
            case REQUEST_GET_CAPABILITIES:
                return new GetCapabilitiesExecutor().execute();
            case PLUGIN_SETTINGS_GET_ICON:
                return new GetPluginSettingsIconExecutor().execute();
            case PLUGIN_SETTINGS_GET_CONFIGURATION:
                return new GetPluginConfigurationExecutor().execute();
            case PLUGIN_SETTINGS_GET_VIEW:
                return new GetViewRequestExecutor().execute();
            case PLUGIN_SETTINGS_VALIDATE_CONFIGURATION:
                return ValidatePluginSettings.fromJSON(request.requestBody()).executor(pluginRequest).execute();
            case REQUEST_GET_PROFILE_METADATA:
                return new GetProfileMetadataExecutor().execute();
            case REQUEST_GET_PROFILE_VIEW:
                return new GetProfileViewExecutor().execute();
            case REQUEST_VALIDATE_PROFILE:
                return ProfileValidateRequest.fromJSON(request.requestBody()).executor().execute();
            case REQUEST_CREATE_AGENT:
                refreshInstances();
                return CreateAgentRequest.fromJSON(request.requestBody()).executor(agentInstances, pluginRequest).execute();
            case REQUEST_SHOULD_ASSIGN_WORK:
                return ShouldAssignWorkRequest.fromJSON(request.requestBody()).executor(agentInstances).execute();
            case REQUEST_SERVER_PING:
                refreshInstances();
                return new ServerPingRequestExecutor(agentInstances, pluginRequest).execute();
            case REQUEST_STATUS_REPORT:
                return new StatusReportExecutor(pluginRequest).execute();
            default:
                throw new UnhandledRequestTypeException(request.requestName());
        }
    } catch (Exception e) {
        LOG.error("Failed to handle request " + request.requestName(), e);
        return DefaultGoPluginApiResponse.error("Failed to handle request " + request.requestName());
    }
}
 
开发者ID:gocd,项目名称:kubernetes-elastic-agents,代码行数:39,代码来源:KubernetesPlugin.java

示例15: handle

import com.thoughtworks.go.plugin.api.exceptions.UnhandledRequestTypeException; //导入依赖的package包/类
@Override
public GoPluginApiResponse handle(GoPluginApiRequest request) throws UnhandledRequestTypeException {
    try {
        switch (Request.fromString(request.requestName())) {
            case REQUEST_SHOULD_ASSIGN_WORK:
                refreshInstances();
                return ShouldAssignWorkRequest.fromJSON(request.requestBody()).executor(agentInstances, pluginRequest).execute();
            case REQUEST_CREATE_AGENT:
                refreshInstances();
                return CreateAgentRequest.fromJSON(request.requestBody()).executor(agentInstances, pluginRequest).execute();
            case REQUEST_SERVER_PING:
                refreshInstances();
                return new ServerPingRequestExecutor(agentInstances, pluginRequest).execute();
            case PLUGIN_SETTINGS_GET_VIEW:
                return new GetViewRequestExecutor().execute();
            case REQUEST_GET_PROFILE_METADATA:
                return new GetProfileMetadataExecutor().execute();
            case REQUEST_GET_PROFILE_VIEW:
                return new GetProfileViewExecutor().execute();
            case REQUEST_VALIDATE_PROFILE:
                return ProfileValidateRequest.fromJSON(request.requestBody()).executor().execute();
            case PLUGIN_SETTINGS_GET_ICON:
                return new GetPluginSettingsIconExecutor().execute();
            case PLUGIN_SETTINGS_GET_CONFIGURATION:
                return new GetPluginConfigurationExecutor().execute();
            case PLUGIN_SETTINGS_VALIDATE_CONFIGURATION:
                return ValidatePluginSettings.fromJSON(request.requestBody()).executor().execute();
            default:
                throw new UnhandledRequestTypeException(request.requestName());
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:pikselpalette,项目名称:gocd-elastic-agent-marathon,代码行数:35,代码来源:MarathonPlugin.java


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