aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/communication/http/DummyAsyncHttpClient.java
blob: 4ef0b4daccc987f77e922e610db94a786d5018c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.utils.communication.http;

import com.yahoo.vespa.clustercontroller.utils.communication.async.AsyncOperation;
import com.yahoo.vespa.clustercontroller.utils.communication.async.AsyncOperationImpl;

public class DummyAsyncHttpClient implements AsyncHttpClient<HttpResult> {
    HttpResult result;
    HttpRequest lastRequest;

    public DummyAsyncHttpClient(HttpResult result) {
        this.result = result;
    }

    @Override
    public AsyncOperation<HttpResult> execute(HttpRequest r) {
        lastRequest = r;
        AsyncOperationImpl<HttpResult> op = new AsyncOperationImpl<>(r.toString());
        op.setResult(result);
        return op;
    }

    @Override
    public void close() {
    }
}