uk.co.sdev.async.http.ning.Parallel2CompletableFutureClientTest.java Source code

Java tutorial

Introduction

Here is the source code for uk.co.sdev.async.http.ning.Parallel2CompletableFutureClientTest.java

Source

/**
 * Copyright 2014 Andy Godwin
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package uk.co.sdev.async.http.ning;

import com.fasterxml.jackson.core.type.TypeReference;
import uk.co.sdev.async.http.AbstractParallel2CompletableFutureTest;
import uk.co.sdev.async.http.model.Bar;
import uk.co.sdev.async.http.model.Foo;

import java.io.IOException;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;

public class Parallel2CompletableFutureClientTest extends AbstractParallel2CompletableFutureTest {

    @Override
    protected CompletableFuture<Optional<Foo>> getFoo() throws IOException {
        return completableFutureClient.get("http://localhost:9101/foo", new TypeReference<Optional<Foo>>() {
        });
    }

    @Override
    protected CompletableFuture<Optional<Bar>> getBar() throws IOException {
        return completableFutureClient.get("http://localhost:9101/bar", new TypeReference<Optional<Bar>>() {
        });
    }
}