use of feign.MethodMetadata 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"));
}
use of feign.MethodMetadata in project feign by OpenFeign.
the class JAXRSContractTest method withPathAndURIParams.
@Test
public void withPathAndURIParams() throws Exception {
MethodMetadata md = parseAndValidateMetadata(WithURIParam.class, "uriParam", String.class, URI.class, String.class);
assertThat(md.indexToName()).containsExactly(entry(0, asList("1")), // Skips 1 as it is a url index!
entry(2, asList("2")));
assertThat(md.urlIndex()).isEqualTo(1);
}
use of feign.MethodMetadata in project feign by OpenFeign.
the class JAXRSContractTest method formParamsParseIntoIndexToName.
@Test
public void formParamsParseIntoIndexToName() throws Exception {
MethodMetadata md = parseAndValidateMetadata(FormParams.class, "login", String.class, String.class, String.class);
assertThat(md.formParams()).containsExactly("customer_name", "user_name", "password");
assertThat(md.indexToName()).containsExactly(entry(0, asList("customer_name")), entry(1, asList("user_name")), entry(2, asList("password")));
}
use of feign.MethodMetadata in project feign by OpenFeign.
the class JAXRSContractTest method formParamsDoesNotSetBodyType.
/**
* Body type is only for the body param.
*/
@Test
public void formParamsDoesNotSetBodyType() throws Exception {
MethodMetadata md = parseAndValidateMetadata(FormParams.class, "login", String.class, String.class, String.class);
assertThat(md.bodyType()).isNull();
}
use of feign.MethodMetadata in project feign by OpenFeign.
the class JAXRSContractTest method pathAndQueryParams.
@Test
public void pathAndQueryParams() throws Exception {
MethodMetadata md = parseAndValidateMetadata(WithPathAndQueryParams.class, "recordsByNameAndType", int.class, String.class, String.class);
assertThat(md.template()).hasQueries(entry("name", asList("{name}")), entry("type", asList("{type}")));
assertThat(md.indexToName()).containsExactly(entry(0, asList("domainId")), entry(1, asList("name")), entry(2, asList("type")));
}
Aggregations