Search in sources :

Example 1 with Contract

use of feign.Contract in project feign by OpenFeign.

the class WhatShouldWeCacheBenchmarks method setup.

@Setup
public void setup() {
    feignContract = new Contract.Default();
    cachedContact = new Contract() {

        private final List<MethodMetadata> cached = new Default().parseAndValidatateMetadata(FeignTestInterface.class);

        public List<MethodMetadata> parseAndValidatateMetadata(Class<?> declaring) {
            return cached;
        }
    };
    fakeClient = new Client() {

        public Response execute(Request request, Request.Options options) throws IOException {
            Map<String, Collection<String>> headers = new LinkedHashMap<String, Collection<String>>();
            return Response.create(200, "ok", headers, (byte[]) null);
        }
    };
    cachedFakeFeign = Feign.builder().client(fakeClient).build();
    cachedFakeApi = cachedFakeFeign.newInstance(new HardCodedTarget<FeignTestInterface>(FeignTestInterface.class, "http://localhost"));
}
Also used : Request(feign.Request) HardCodedTarget(feign.Target.HardCodedTarget) IOException(java.io.IOException) Response(feign.Response) Collection(java.util.Collection) MethodMetadata(feign.MethodMetadata) List(java.util.List) Client(feign.Client) Contract(feign.Contract) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

Client (feign.Client)1 Contract (feign.Contract)1 MethodMetadata (feign.MethodMetadata)1 Request (feign.Request)1 Response (feign.Response)1 HardCodedTarget (feign.Target.HardCodedTarget)1 IOException (java.io.IOException)1 Collection (java.util.Collection)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 Setup (org.openjdk.jmh.annotations.Setup)1