• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DefaultGoPluginApiRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: shouldContainFilePatternInResponseToGetConfigurationRequest

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的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


示例2: submitRequest

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
public <T> T submitRequest(String pluginId, String requestName, PluginInteractionCallback<T> pluginInteractionCallback) {
    if (!pluginManager.isPluginOfType(extensionName, pluginId)) {
        throw new PluginNotFoundException(format("Did not find '%s' plugin with id '%s'. Looks like plugin is missing", extensionName, pluginId));
    }
    try {
        String resolvedExtensionVersion = pluginManager.resolveExtensionVersion(pluginId, goSupportedVersions);
        DefaultGoPluginApiRequest apiRequest = new DefaultGoPluginApiRequest(extensionName, resolvedExtensionVersion, requestName);
        apiRequest.setRequestBody(pluginInteractionCallback.requestBody(resolvedExtensionVersion));
        apiRequest.setRequestParams(pluginInteractionCallback.requestParams(resolvedExtensionVersion));
        apiRequest.setRequestHeaders(pluginInteractionCallback.requestHeaders(resolvedExtensionVersion));
        GoPluginApiResponse response = pluginManager.submitTo(pluginId, apiRequest);
        if (response == null) {
            throw new RuntimeException("The plugin sent a null response");
        }
        if (DefaultGoApiResponse.SUCCESS_RESPONSE_CODE == response.responseCode()) {
            return pluginInteractionCallback.onSuccess(response.responseBody(), resolvedExtensionVersion);
        }
        throw new RuntimeException(format("The plugin sent a response that could not be understood by Go. Plugin returned with code '%s' and the following response: '%s'", response.responseCode(), response.responseBody()));
    } catch (Exception e) {
        throw new RuntimeException(format("Interaction with plugin with id '%s' implementing '%s' extension failed while requesting for '%s'. Reason: [%s]", pluginId, extensionName, requestName, e.getMessage()), e);
    }
}
 
开发者ID:gocd,项目名称:gocd,代码行数:23,代码来源:PluginRequestHelper.java


示例3: execute_shouldValidateTheConfiguration

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void execute_shouldValidateTheConfiguration() throws Exception {
    DefaultGoPluginApiRequest request = new DefaultGoPluginApiRequest(null, null, null);
    request.setRequestBody("{}");

    GoPluginApiResponse response = new VerifyConnectionRequestExecutor(request).execute();

    String expectedResponse = "{\"message\":\"Validation failed for the given Auth Config\",\"errors\":[{\"message\":\"PasswordFilePath must not be blank.\",\"key\":\"PasswordFilePath\"}],\"status\":\"validation-failed\"}";
    assertThat(response.responseBody(), is(expectedResponse));
}
 
开发者ID:gocd,项目名称:gocd-filebased-authentication-plugin,代码行数:11,代码来源:VerifyConnectionRequestExecutorTest.java


示例4: execute_shouldVerifyIfThePasswordFileExists

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void execute_shouldVerifyIfThePasswordFileExists() throws Exception {
    DefaultGoPluginApiRequest request = new DefaultGoPluginApiRequest(null, null, null);
    request.setRequestBody("{\"PasswordFilePath\": \"some_path\"}");

    GoPluginApiResponse response = new VerifyConnectionRequestExecutor(request).execute();

    String expectedResponse = "{\"message\":\"No password file at path `some_path`.\",\"status\":\"failure\"}";
    assertThat(response.responseBody(), is(expectedResponse));
}
 
开发者ID:gocd,项目名称:gocd-filebased-authentication-plugin,代码行数:11,代码来源:VerifyConnectionRequestExecutorTest.java


示例5: execute_shouldVerifyIfPasswordFilePathPointsToANormalFile

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void execute_shouldVerifyIfPasswordFilePathPointsToANormalFile() throws Exception {
    File folder = this.folder.newFolder("subfolder");

    DefaultGoPluginApiRequest request = new DefaultGoPluginApiRequest(null, null, null);
    request.setRequestBody(String.format("{\"PasswordFilePath\": \"%s\"}", folder.getAbsolutePath()));

    GoPluginApiResponse response = new VerifyConnectionRequestExecutor(request).execute();

    String expectedResponse = String.format("{\"message\":\"Password file path `%s` is not a normal file.\",\"status\":\"failure\"}", folder.getAbsolutePath());
    assertThat(response.responseBody(), is(expectedResponse));
}
 
开发者ID:gocd,项目名称:gocd-filebased-authentication-plugin,代码行数:13,代码来源:VerifyConnectionRequestExecutorTest.java


示例6: execute_shouldReturnASuccessResponseIfValidationAndVerificationPasses

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void execute_shouldReturnASuccessResponseIfValidationAndVerificationPasses() throws Exception {
    File passwordFile = this.folder.newFile("password.properties");

    DefaultGoPluginApiRequest request = new DefaultGoPluginApiRequest(null, null, null);
    request.setRequestBody(String.format("{\"PasswordFilePath\": \"%s\"}", passwordFile.getAbsolutePath()));

    GoPluginApiResponse response = new VerifyConnectionRequestExecutor(request).execute();

    assertThat(response.responseBody(), is("{\"message\":\"Connection ok\",\"status\":\"success\"}"));
}
 
开发者ID:gocd,项目名称:gocd-filebased-authentication-plugin,代码行数:12,代码来源:VerifyConnectionRequestExecutorTest.java


示例7: handleShouldReturnErrorResponseGivenInvalidJson

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnErrorResponseGivenInvalidJson() {
    DefaultGoPluginApiRequest request = validRequest;
    request.setRequestBody("Invalid JSON");
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.INTERNAL_ERROR));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:8,代码来源:LatestRevisionsSinceRequestHandlerTest.java


示例8: handleShouldReturnErrorResponseGivenEmptyRequestBody

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnErrorResponseGivenEmptyRequestBody() {
    DefaultGoPluginApiRequest request = validRequest;
    request.setRequestBody(null);
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.INTERNAL_ERROR));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:8,代码来源:LatestRevisionsSinceRequestHandlerTest.java


示例9: handleShouldReturnIncompleteRequestResponseOnMissingScmConfigurationField

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnIncompleteRequestResponseOnMissingScmConfigurationField() {
    String missingScmConfigurationJson = "{\"scm-data\":{},\"flyweight-folder\":\"/server/pipelines/flyweight/961e6dd6-255a-40ed-8792-1a1477b942d5\",\"previous-revision\": {\"revision\": \"revision-1\",\"timestamp\": \"2011-07-14T19:43:37.100Z\",\"data\":{}}}";
    DefaultGoPluginApiRequest request = validRequest;
    request.setRequestBody(missingScmConfigurationJson);
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.VALIDATION_FAILED));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:9,代码来源:LatestRevisionsSinceRequestHandlerTest.java


示例10: handleShouldReturnIncompleteRequestResponseOnMissingFlyweightFolderField

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnIncompleteRequestResponseOnMissingFlyweightFolderField() {
    String missingFlyweightFolderJson = "{\"scm-configuration\":{\"url\":{\"value\":\"https://github.com/kszatan/gocd-phabricator-staging-material.git\"}},\"scm-data\":{},\"previous-revision\": {\"revision\": \"revision-1\",\"timestamp\": \"2011-07-14T19:43:37.100Z\",\"data\":{}}}";
    DefaultGoPluginApiRequest request = validRequest;
    request.setRequestBody(missingFlyweightFolderJson);
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.VALIDATION_FAILED));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:9,代码来源:LatestRevisionsSinceRequestHandlerTest.java


示例11: handleShouldReturnIncompleteRequestResponseOnMissingPreviousRevisionField

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnIncompleteRequestResponseOnMissingPreviousRevisionField() {
    String missingPreviousRevisionJson = "{\"scm-configuration\":{\"url\":{\"value\":\"https://github.com/kszatan/gocd-phabricator-staging-material.git\"}},\"scm-data\":{},\"flyweight-folder\":\"/server/pipelines/flyweight/961e6dd6-255a-40ed-8792-1a1477b942d5\"}";
    DefaultGoPluginApiRequest request = validRequest;
    request.setRequestBody(missingPreviousRevisionJson);
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.VALIDATION_FAILED));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:9,代码来源:LatestRevisionsSinceRequestHandlerTest.java


示例12: handleShouldReturnIncompleteRequestResponseOnMissingScmConfigurationField

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnIncompleteRequestResponseOnMissingScmConfigurationField() {
    String missingScmConfigurationJson = "{\"flyweight-folder\":\"/tmp/repo\"}";
    DefaultGoPluginApiRequest request = validRequest;
    request.setRequestBody(missingScmConfigurationJson);
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.VALIDATION_FAILED));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:9,代码来源:LatestRevisionRequestHandlerTest.java


示例13: handleShouldReturnIncompleteRequestResponseOnMissingFlyweightFolderField

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnIncompleteRequestResponseOnMissingFlyweightFolderField() {
    String missingFlyweightFolderJson = "{\"scm-configuration\":{\"url\":{\"value\":\"[email protected]:wiki.git\"}},\"scm-data\":{}}";
    DefaultGoPluginApiRequest request = validRequest;
    request.setRequestBody(missingFlyweightFolderJson);
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.VALIDATION_FAILED));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:9,代码来源:LatestRevisionRequestHandlerTest.java


示例14: handleShouldReturnErrorResponseWhenGivenInvalidJson

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnErrorResponseWhenGivenInvalidJson() {
    DefaultGoPluginApiRequest request = new DefaultGoPluginApiRequest("scm", "1.0", "validate-scm-configuration");
    request.setRequestBody("Invalid JSON");
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.INTERNAL_ERROR));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:8,代码来源:ValidateScmConfigurationRequestHandlerTest.java


示例15: handleShouldReturnValidationFailedResponseWhenGivenIncompleteJson

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnValidationFailedResponseWhenGivenIncompleteJson() {
    DefaultGoPluginApiRequest request = new DefaultGoPluginApiRequest("scm", "1.0", "validate-scm-configuration");
    request.setRequestBody("{}");
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.VALIDATION_FAILED));
    assertThat(response.responseBody(), equalTo("Missing fields: [scm-configuration]"));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:9,代码来源:CheckScmConnectionRequestHandlerTest.java


示例16: handleShouldReturnInternalErrorResponseWhenGivenInvalidJson

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnInternalErrorResponseWhenGivenInvalidJson() {
    DefaultGoPluginApiRequest request = new DefaultGoPluginApiRequest("scm", "1.0", "validate-scm-configuration");
    request.setRequestBody("Invalid JSON");
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.INTERNAL_ERROR));
    ScmConnectionResponse scmConnectionResponse = GsonService.fromJson(response.responseBody(), ScmConnectionResponse.class);
    assertThat(scmConnectionResponse.status, equalTo("failure"));
    assertThat(scmConnectionResponse.messages.size(), equalTo(1));
    assertThat(scmConnectionResponse.messages.iterator().next(), equalTo("Malformed JSON: Invalid JSON"));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:12,代码来源:CheckScmConnectionRequestHandlerTest.java


示例17: handleShouldReturnSuccessResponseWithErrorMessageWhenGivenGitScmWithoutUrl

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnSuccessResponseWithErrorMessageWhenGivenGitScmWithoutUrl() {
    DefaultGoPluginApiRequest request = new DefaultGoPluginApiRequest("scm", "1.0", "validate-scm-configuration");
    request.setRequestBody("{\"scm-configuration\":{\"url\":{\"value\":\"\"},\"username\":{\"value\":\"kszatan\"},\"password\":{\"value\":\"hunter2\"}}}");
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.SUCCESS_RESPONSE_CODE));
    ScmConnectionResponse scmConnectionResponse = GsonService.fromJson(response.responseBody(), ScmConnectionResponse.class);
    assertThat(scmConnectionResponse.status, equalTo("failure"));
    assertThat(scmConnectionResponse.messages.size(), equalTo(1));
    assertThat(scmConnectionResponse.messages.iterator().next(), equalTo("URL is empty"));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:12,代码来源:CheckScmConnectionRequestHandlerTest.java


示例18: handleShouldReturnIncompleteRequestResponseOnMissingScmConfigurationField

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnIncompleteRequestResponseOnMissingScmConfigurationField() {
    String missingScmConfigurationJson = "{\"destination-folder\":\"/var/lib/go-agent/pipelines/pipeline-name/destination\",\"revision\": {\"revision\": \"revision-1\",\"timestamp\": \"2011-07-14T19:43:37.100Z\",\"data\":{}}}";
    DefaultGoPluginApiRequest request = validRequest;
    request.setRequestBody(missingScmConfigurationJson);
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.VALIDATION_FAILED));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:9,代码来源:CheckoutRequestHandlerTest.java


示例19: handleShouldReturnIncompleteRequestResponseOnMissingDestinationFolderField

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnIncompleteRequestResponseOnMissingDestinationFolderField() {
    String missingDestinationFolderJson = "{\"scm-configuration\":{\"url\":{\"value\":\"https://github.com/kszatan/gocd-phabricator-staging-material.git\"}},\"revision\": {\"revision\": \"revision-1\",\"timestamp\": \"2011-07-14T19:43:37.100Z\",\"data\":{}}}";
    DefaultGoPluginApiRequest request = validRequest;
    request.setRequestBody(missingDestinationFolderJson);
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.VALIDATION_FAILED));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:9,代码来源:CheckoutRequestHandlerTest.java


示例20: handleShouldReturnIncompleteRequestResponseOnMissingRevisionField

import com.thoughtworks.go.plugin.api.request.DefaultGoPluginApiRequest; //导入依赖的package包/类
@Test
public void handleShouldReturnIncompleteRequestResponseOnMissingRevisionField() {
    String missingRevisionJson = "{\"scm-configuration\":{\"url\":{\"value\":\"https://github.com/kszatan/gocd-phabricator-staging-material.git\"}},\"destination-folder\":\"/var/lib/go-agent/pipelines/pipeline-name/destination\"}";
    DefaultGoPluginApiRequest request = validRequest;
    request.setRequestBody(missingRevisionJson);
    GoPluginApiResponse response = handler.handle(request);
    assertThat(response.responseCode(), equalTo(DefaultGoPluginApiResponse.VALIDATION_FAILED));
}
 
开发者ID:kszatan,项目名称:gocd-phabricator-staging-material,代码行数:9,代码来源:CheckoutRequestHandlerTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SuggestionSpan类代码示例发布时间:2022-05-22
下一篇:
Java ClusterWritable类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap