use of feign.jackson.JacksonDecoder in project atlasdb by palantir.
the class TimestampRemotingTest method testNotLeader.
@Test
public void testNotLeader() {
ObjectMapper mapper = new ObjectMapper();
String uri = notLeader.baseUri().toString();
TimestampService ts = Feign.builder().decoder(new JacksonDecoder(mapper)).encoder(new JacksonEncoder(mapper)).contract(new JAXRSContract()).retryer(new Retryer.Default(1, 1, 40)).target(TimestampService.class, notLeader.baseUri().toString());
ts.getFreshTimestamp();
}
use of feign.jackson.JacksonDecoder in project atlasdb by palantir.
the class TimestampRemotingTest method testSerializing.
@Test
public void testSerializing() {
ObjectMapper mapper = new ObjectMapper();
String uri = dropwizard.baseUri().toString();
TimestampService ts = Feign.builder().decoder(new JacksonDecoder(mapper)).encoder(new JacksonEncoder(mapper)).contract(new JAXRSContract()).target(TimestampService.class, uri);
long freshTimestamp = ts.getFreshTimestamp();
TimestampRange freshTimestamps = ts.getFreshTimestamps(100);
}
use of feign.jackson.JacksonDecoder in project feign by OpenFeign.
the class ReactiveFeignIntegrationTest method testRxJavaTarget.
@Test
public void testRxJavaTarget() throws Exception {
this.webServer.enqueue(new MockResponse().setBody("1.0"));
this.webServer.enqueue(new MockResponse().setBody("{ \"username\": \"test\" }"));
TestReactiveXService service = RxJavaFeign.builder().encoder(new JacksonEncoder()).decoder(new JacksonDecoder()).logger(new ConsoleLogger()).logLevel(Level.FULL).target(TestReactiveXService.class, this.getServerUrl());
assertThat(service).isNotNull();
StepVerifier.create(service.version()).expectNext("1.0").expectComplete().verify();
assertThat(webServer.takeRequest().getPath()).isEqualToIgnoringCase("/version");
/* test encoding and decoding */
StepVerifier.create(service.user("test")).assertNext(user -> assertThat(user).hasFieldOrPropertyWithValue("username", "test")).expectComplete().verify();
assertThat(webServer.takeRequest().getPath()).isEqualToIgnoringCase("/users/test");
}
use of feign.jackson.JacksonDecoder in project feign by OpenFeign.
the class ReactiveFeignIntegrationTest method testReactorTargetFull.
@Test
public void testReactorTargetFull() throws Exception {
this.webServer.enqueue(new MockResponse().setBody("1.0"));
this.webServer.enqueue(new MockResponse().setBody("{ \"username\": \"test\" }"));
TestReactorService service = ReactorFeign.builder().encoder(new JacksonEncoder()).decoder(new JacksonDecoder()).logger(new ConsoleLogger()).decode404().options(new Options()).logLevel(Level.FULL).target(TestReactorService.class, this.getServerUrl());
assertThat(service).isNotNull();
StepVerifier.create(service.version()).expectNext("1.0").expectComplete().verify();
assertThat(webServer.takeRequest().getPath()).isEqualToIgnoringCase("/version");
/* test encoding and decoding */
StepVerifier.create(service.user("test")).assertNext(user -> assertThat(user).hasFieldOrPropertyWithValue("username", "test")).expectComplete().verify();
assertThat(webServer.takeRequest().getPath()).isEqualToIgnoringCase("/users/test");
}
use of feign.jackson.JacksonDecoder in project nem-library by rosklyar.
the class DefaultNemClientFactory method createTransactionClient.
@Override
public TransactionClient createTransactionClient(String configurationPrefix, Network network, MosaicClient mosaicClient, AccountClient accountClient, NodeClient nodeClient) {
FeignTransactionClient feignTransactionClient = builder().client(RibbonClient.create()).encoder(new JacksonEncoder()).decoder(new JacksonDecoder()).target(FeignTransactionClient.class, format("http://%s", configurationPrefix));
HexConverter hexConverter = new DefaultHexConverter();
ByteSerializer byteSerializer = new DefaultByteSerializer(hexConverter);
TransactionEncoder transactionEncoder = new ByteArrayTransactionEncoder(byteSerializer, hexConverter);
VersionProvider versionProvider = new DefaultVersionProvider();
FeeCalculator feeCalculator = new DefaultFeeCalculator(mosaicClient, accountClient);
return new SecureTransactionClient(network, feignTransactionClient, transactionEncoder, hexConverter, versionProvider, feeCalculator, nodeClient);
}
Aggregations