Search in sources :

Example 6 with JacksonDecoder

use of feign.jackson.JacksonDecoder in project atlasdb by palantir.

the class TransactionRemotingTest method setup.

@Before
public void setup() {
    String uri = dropwizard.baseUri().toString();
    service = Feign.builder().decoder(new JacksonDecoder(mapper)).encoder(new JacksonEncoder(mapper)).contract(new JAXRSContract()).target(AtlasDbService.class, uri);
}
Also used : JacksonEncoder(feign.jackson.JacksonEncoder) JAXRSContract(feign.jaxrs.JAXRSContract) JacksonDecoder(feign.jackson.JacksonDecoder) AtlasDbService(com.palantir.atlasdb.api.AtlasDbService) Before(org.junit.Before)

Example 7 with JacksonDecoder

use of feign.jackson.JacksonDecoder in project nem-library by rosklyar.

the class DefaultNemClientFactory method simpleTransactionClient.

@Override
public TransactionClient simpleTransactionClient(String url, Network network) {
    FeignTransactionClient feignTransactionClient = Feign.builder().encoder(new JacksonEncoder()).decoder(new JacksonDecoder()).target(FeignTransactionClient.class, url);
    HexConverter hexConverter = new DefaultHexConverter();
    ByteSerializer byteSerializer = new DefaultByteSerializer(hexConverter);
    TransactionEncoder transactionEncoder = new ByteArrayTransactionEncoder(byteSerializer, hexConverter);
    VersionProvider versionProvider = new DefaultVersionProvider();
    FeeCalculator feeCalculator = new DefaultFeeCalculator(simpleMosaicClient(url), simpleAccountClient(url));
    return new SecureTransactionClient(network, feignTransactionClient, transactionEncoder, hexConverter, versionProvider, feeCalculator, simpleNodeClient(url));
}
Also used : DefaultFeeCalculator(com.github.rosklyar.client.transaction.fee.DefaultFeeCalculator) JacksonEncoder(feign.jackson.JacksonEncoder) DefaultVersionProvider(com.github.rosklyar.client.transaction.version.DefaultVersionProvider) VersionProvider(com.github.rosklyar.client.transaction.version.VersionProvider) JacksonDecoder(feign.jackson.JacksonDecoder) FeeCalculator(com.github.rosklyar.client.transaction.fee.FeeCalculator) DefaultFeeCalculator(com.github.rosklyar.client.transaction.fee.DefaultFeeCalculator) SecureTransactionClient(com.github.rosklyar.client.transaction.SecureTransactionClient) DefaultVersionProvider(com.github.rosklyar.client.transaction.version.DefaultVersionProvider) FeignTransactionClient(com.github.rosklyar.client.transaction.FeignTransactionClient)

Example 8 with JacksonDecoder

use of feign.jackson.JacksonDecoder in project feign by OpenFeign.

the class DecoderIteratorsBenchmark method buildDecoder.

@Setup(Level.Trial)
public void buildDecoder() {
    switch(api) {
        case "list":
            decoder = new JacksonDecoder();
            type = new TypeReference<List<Car>>() {
            }.getType();
            break;
        case "iterator":
            decoder = JacksonIteratorDecoder.create();
            type = new TypeReference<Iterator<Car>>() {
            }.getType();
            break;
        case "stream":
            decoder = StreamDecoder.create(JacksonIteratorDecoder.create());
            type = new TypeReference<Stream<Car>>() {
            }.getType();
            break;
        default:
            throw new IllegalStateException("Unknown api: " + api);
    }
}
Also used : TypeReference(com.fasterxml.jackson.core.type.TypeReference) JacksonDecoder(feign.jackson.JacksonDecoder)

Example 9 with JacksonDecoder

use of feign.jackson.JacksonDecoder in project feign by OpenFeign.

the class SpringContractTest method setup.

@Before
public void setup() throws IOException {
    mockClient = new MockClient().noContent(HttpMethod.GET, "/health").noContent(HttpMethod.GET, "/health/1").noContent(HttpMethod.GET, "/health/1?deep=true").noContent(HttpMethod.GET, "/health/1?deep=true&dryRun=true").ok(HttpMethod.GET, "/health/generic", "{}");
    resource = Feign.builder().contract(new SpringContract()).encoder(new JacksonEncoder()).decoder(new JacksonDecoder()).client(mockClient).target(new MockTarget<>(HealthResource.class));
}
Also used : JacksonEncoder(feign.jackson.JacksonEncoder) MockTarget(feign.mock.MockTarget) MockClient(feign.mock.MockClient) JacksonDecoder(feign.jackson.JacksonDecoder) Before(org.junit.Before)

Aggregations

JacksonDecoder (feign.jackson.JacksonDecoder)9 JacksonEncoder (feign.jackson.JacksonEncoder)8 Test (org.junit.Test)4 JAXRSContract (feign.jaxrs.JAXRSContract)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 FeignTransactionClient (com.github.rosklyar.client.transaction.FeignTransactionClient)2 SecureTransactionClient (com.github.rosklyar.client.transaction.SecureTransactionClient)2 DefaultFeeCalculator (com.github.rosklyar.client.transaction.fee.DefaultFeeCalculator)2 FeeCalculator (com.github.rosklyar.client.transaction.fee.FeeCalculator)2 DefaultVersionProvider (com.github.rosklyar.client.transaction.version.DefaultVersionProvider)2 VersionProvider (com.github.rosklyar.client.transaction.version.VersionProvider)2 InMemoryTimestampService (com.palantir.timestamp.InMemoryTimestampService)2 TimestampService (com.palantir.timestamp.TimestampService)2 MockResponse (okhttp3.mockwebserver.MockResponse)2 Before (org.junit.Before)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 AtlasDbService (com.palantir.atlasdb.api.AtlasDbService)1 TimestampRange (com.palantir.timestamp.TimestampRange)1 Options (feign.Request.Options)1 MockClient (feign.mock.MockClient)1