All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.redhat.lightblue.rest.integration.client.LightblueRestTestClient Maven / Gradle / Ivy

There is a newer version: 2.32.0
Show newest version
package com.redhat.lightblue.rest.integration.client;

import javax.ws.rs.client.Invocation;

import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;

import com.redhat.lightblue.rest.integration.LightblueRestTestHarness;

import io.undertow.security.idm.IdentityManager;

public abstract class LightblueRestTestClient extends LightblueRestTestHarness {

    public LightblueRestTestClient() throws Exception {
        super();
        setupSystemProperties();
    }

    public LightblueRestTestClient(int httpServerPort) throws Exception {
        super(httpServerPort);
        setupSystemProperties();
    }

    public LightblueRestTestClient(IdentityManager identityManager) throws Exception {
        super(identityManager);
    }

    private void setupSystemProperties() {
        System.setProperty("client.data.url", getDataUrl());
        System.setProperty("client.metadata.url", getMetadataUrl());
    }

    protected ResteasyClient createClient() {
        return new ResteasyClientBuilder()
                .defaultProxy(getHttpHost(), getHttpPort())
                .build();
    }

    public Invocation.Builder createRequest(ResteasyWebTargetBuilder builder) {
        return builder.build(createClient()).request();
    }

    public interface ResteasyWebTargetBuilder {
        ResteasyWebTarget build(ResteasyClient client);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy