All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dreamhead.moco.parser.model.ResponseSetting Maven / Gradle / Ivy

Go to download

Moco is an easy setup stub framework, mainly focusing on testing and integration.

There is a newer version: 1.5.0
Show newest version
package com.github.dreamhead.moco.parser.model;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.github.dreamhead.moco.ResponseHandler;
import com.github.dreamhead.moco.parser.ResponseHandlerFactory;
import com.google.common.base.MoreObjects;

import java.util.Map;

@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
public class ResponseSetting extends BaseResourceSetting {
    private static final ResponseHandlerFactory factory = new DynamicResponseHandlerFactory();

    private String status;
    private ProxyContainer proxy;
    private Map headers;
    private Map cookies;
    private LatencyContainer latency;

    private TextContainer version;
    private AttachmentSetting attachment;
    private CollectionContainer seq;
    private CollectionContainer cycle;
    private ReplayContainer record;
    private ReplayContainer replay;

    protected final ResponseSetting asResponseSetting() {
        ResponseSetting responseSetting = asBaseResourceSetting(new ResponseSetting());
        responseSetting.status = status;
        responseSetting.proxy = proxy;
        responseSetting.headers = headers;
        responseSetting.cookies = cookies;
        responseSetting.latency = latency;
        responseSetting.version = version;
        responseSetting.attachment = attachment;
        responseSetting.seq = seq;
        responseSetting.cycle = cycle;
        responseSetting.record = record;
        responseSetting.replay = replay;

        return responseSetting;
    }

    protected MoreObjects.ToStringHelper toStringHelper() {
        return super.toStringHelper()
                .add("version", version)
                .add("status", status)
                .add("headers", headers)
                .add("cookies", cookies)
                .add("proxy", proxy)
                .add("latency", latency)
                .add("attachment", attachment)
                .add("seq", seq)
                .add("cycle", cycle)
                .add("record", record)
                .add("replay", replay);

    }

    public ResponseHandler getResponseHandler() {
        return factory.createResponseHandler(this);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy