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


Java Expectation.getHttpResponse方法代码示例

本文整理汇总了Java中org.mockserver.mock.Expectation.getHttpResponse方法的典型用法代码示例。如果您正苦于以下问题:Java Expectation.getHttpResponse方法的具体用法?Java Expectation.getHttpResponse怎么用?Java Expectation.getHttpResponse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mockserver.mock.Expectation的用法示例。


在下文中一共展示了Expectation.getHttpResponse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ApiExpectation

import org.mockserver.mock.Expectation; //导入方法依赖的package包/类
public ApiExpectation(ApiSpecification specification, Expectation expectation) {
    this.specification = specification;
    this.request = expectation.getHttpRequest();
    this.response = expectation.getHttpResponse(false);
}
 
开发者ID:ozwolf-software,项目名称:raml-mock-server,代码行数:6,代码来源:ApiExpectation.java

示例2: serialize

import org.mockserver.mock.Expectation; //导入方法依赖的package包/类
@Override
public String serialize(int numberOfSpacesToIndent, Expectation expectation) {
    StringBuffer output = new StringBuffer();
    if (expectation != null) {
        appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append("new MockServerClient(\"localhost\", 1080)");
        appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(".when(");
        output.append(new HttpRequestToJavaSerializer().serialize(numberOfSpacesToIndent + 1, expectation.getHttpRequest()));
        if (expectation.getTimeToLive() != null) {
            output.append(",").append(new TimesToJavaSerializer().serialize(numberOfSpacesToIndent + 1, expectation.getTimes()));
        }
        if (expectation.getTimeToLive() != null) {
            output.append(",").append(new TimeToLiveToJavaSerializer().serialize(numberOfSpacesToIndent + 1, expectation.getTimeToLive()));
        }
        appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(")");
        if (expectation.getHttpResponse() != null) {
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(".respond(");
            output.append(new HttpResponseToJavaSerializer().serialize(numberOfSpacesToIndent + 1, expectation.getHttpResponse()));
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(")");
        }
        if (expectation.getHttpResponseTemplate() != null) {
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(".respond(");
            output.append(new HttpTemplateToJavaSerializer().serialize(numberOfSpacesToIndent + 1, expectation.getHttpResponseTemplate()));
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(")");
        }
        if (expectation.getHttpResponseClassCallback() != null) {
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(".respond(");
            output.append(new HttpClassCallbackToJavaSerializer().serialize(numberOfSpacesToIndent + 1, expectation.getHttpResponseClassCallback()));
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(")");
        }
        if (expectation.getHttpResponseObjectCallback() != null) {
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append("/*NOT POSSIBLE TO GENERATE CODE FOR OBJECT CALLBACK*/");
        }
        if (expectation.getHttpForward() != null) {
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(".forward(");
            output.append(new HttpForwardToJavaSerializer().serialize(numberOfSpacesToIndent + 1, expectation.getHttpForward()));
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(")");
        }
        if (expectation.getHttpForwardTemplate() != null) {
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(".forward(");
            output.append(new HttpTemplateToJavaSerializer().serialize(numberOfSpacesToIndent + 1, expectation.getHttpForwardTemplate()));
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(")");
        }
        if (expectation.getHttpForwardClassCallback() != null) {
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(".forward(");
            output.append(new HttpClassCallbackToJavaSerializer().serialize(numberOfSpacesToIndent + 1, expectation.getHttpForwardClassCallback()));
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(")");
        }
        if (expectation.getHttpForwardObjectCallback() != null) {
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append("/*NOT POSSIBLE TO GENERATE CODE FOR OBJECT CALLBACK*/");
        }
        if (expectation.getHttpError() != null) {
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(".error(");
            output.append(new HttpErrorToJavaSerializer().serialize(numberOfSpacesToIndent + 1, expectation.getHttpError()));
            appendNewLineAndIndent(numberOfSpacesToIndent * INDENT_SIZE, output).append(")");
        }
        output.append(";");
    }
    return output.toString();
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:60,代码来源:ExpectationToJavaSerializer.java

示例3: ExpectationDTO

import org.mockserver.mock.Expectation; //导入方法依赖的package包/类
public ExpectationDTO(Expectation expectation) {
    if (expectation != null) {
        HttpRequest httpRequest = expectation.getHttpRequest();
        if (httpRequest != null) {
            this.httpRequest = new HttpRequestDTO(httpRequest, httpRequest.getNot());
        }
        HttpResponse httpResponse = expectation.getHttpResponse();
        if (httpResponse != null) {
            this.httpResponse = new HttpResponseDTO(httpResponse);
        }
        HttpTemplate httpResponseTemplate = expectation.getHttpResponseTemplate();
        if (httpResponseTemplate != null) {
            this.httpResponseTemplate = new HttpTemplateDTO(httpResponseTemplate);
        }
        HttpClassCallback httpResponseClassCallback = expectation.getHttpResponseClassCallback();
        if (httpResponseClassCallback != null) {
            this.httpResponseClassCallback = new HttpClassCallbackDTO(httpResponseClassCallback);
        }
        HttpObjectCallback httpResponseObjectCallback = expectation.getHttpResponseObjectCallback();
        if (httpResponseObjectCallback != null) {
            this.httpResponseObjectCallback = new HttpObjectCallbackDTO(httpResponseObjectCallback);
        }
        HttpForward httpForward = expectation.getHttpForward();
        if (httpForward != null) {
            this.httpForward = new HttpForwardDTO(httpForward);
        }
        HttpTemplate httpForwardTemplate = expectation.getHttpForwardTemplate();
        if (httpForwardTemplate != null) {
            this.httpForwardTemplate = new HttpTemplateDTO(httpForwardTemplate);
        }
        HttpClassCallback httpForwardClassCallback = expectation.getHttpForwardClassCallback();
        if (httpForwardClassCallback != null) {
            this.httpForwardClassCallback = new HttpClassCallbackDTO(httpForwardClassCallback);
        }
        HttpObjectCallback httpForwardObjectCallback = expectation.getHttpForwardObjectCallback();
        if (httpForwardObjectCallback != null) {
            this.httpForwardObjectCallback = new HttpObjectCallbackDTO(httpForwardObjectCallback);
        }
        HttpOverrideForwardedRequest httpOverrideForwardedRequest = expectation.getHttpOverrideForwardedRequest();
        if (httpOverrideForwardedRequest != null) {
            this.httpOverrideForwardedRequest = new HttpOverrideForwardedRequestDTO(httpOverrideForwardedRequest);
        }
        HttpError httpError = expectation.getHttpError();
        if (httpError != null) {
            this.httpError = new HttpErrorDTO(httpError);
        }
        Times times = expectation.getTimes();
        if (times != null) {
            this.times = new org.mockserver.client.serialization.model.TimesDTO(times);
        }
        TimeToLive timeToLive = expectation.getTimeToLive();
        if (timeToLive != null) {
            this.timeToLive = new TimeToLiveDTO(timeToLive);
        }
    }
}
 
开发者ID:jamesdbloom,项目名称:mockserver,代码行数:57,代码来源:ExpectationDTO.java


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