Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.Client


import com.sun.jersey.client.apache.ApacheHttpClient;

public class HttpClientFactory {

    public Client createClient() {
        Client client = ApacheHttpClient.create();
        client.setFollowRedirects(true);
        client.addFilter(new HTTPBasicAuthFilter("management/admin", "Pyi1bo1r"));
        client.addFilter(new ApplicationKeyFilter());
        return client;
    }
View Full Code Here


    public TenantCreator(PlatformImpl platform) {
        this.platform = platform;
    }

    public void createTenant() {
        Client httpClient = new HttpClientFactory().createClient();
        try {
            createTenant(httpClient);
        } finally {
            httpClient.destroy();
        }
    }
View Full Code Here

        ClientResponse tr = postNewTenant(httpClient);
        assertThat(tr.getStatus(), is(201));
    }

    public void removeTenant() {
        Client httpClient = new HttpClientFactory().createClient();
        try {
            removeTenant(httpClient);
        } finally {
            httpClient.destroy();
        }
    }
View Full Code Here

    public String getApplicationId() {
        return applicationId;
    }

    public void createApplication() {
        Client httpClient = new HttpClientFactory().createClient();
        try {
            createApplication(httpClient);
        } finally {
            httpClient.destroy();
        }
    }
View Full Code Here

        MatcherAssert.assertThat(applicationResponse.getStatus(), Matchers.is(201));
        applicationId = parseApplicationId(applicationResponse);
    }

    public void removeApplication() {
        Client httpClient = new HttpClientFactory().createClient();
        try {
            removeApplication(httpClient);
        } finally {
            httpClient.destroy();
        }
    }
View Full Code Here

        this.platform = platform;
        this.applicationCreator = applicationCreator;
    }

    public void createTenant() {
        Client httpClient = new HttpClientFactory().createClient();
        try {
            createTenant(httpClient);
        } finally {
            httpClient.destroy();
        }
    }
View Full Code Here

        ClientResponse atr = addApplicationToTenant(httpClient);
        assertThat(atr.getStatus(), is(201));
    }

    public void removeTenant() {
        Client httpClient = new HttpClientFactory().createClient();
        try {
            removeTenant(httpClient);
        } finally {
            httpClient.destroy();
        }
    }
View Full Code Here

    }   
   
    protected ClientResponse makeRequest(String resource, Object requestObj, RequestVerb verb) {
        List<Server> penalized = new ArrayList<Server>();
       
        Client client = Client.create();
        ClientResponse response = null;

        // Go through queue and get servers in increasing order of penalty
        while (lipstickServers.size() > 0) {
            String serviceUrl = getServiceUrl();
            LOG.info("Trying Lipstick server "+serviceUrl);
            String resourceUrl = serviceUrl + resource;       
            WebResource webResource = client.resource(resourceUrl);                          
            response = sendRequest(webResource, requestObj, verb);
            if (response != null) {
                rebuildServers(penalized);
                return response;
            } else {
View Full Code Here

                applicationWadl.length() > 0);*/
  }

  @Test
  public void testConvertDataSourcesToJson() {
    Client client = Client.create();
    client.setFollowRedirects(false);

    WebResource webResource = client.resource("http://localhost:9999/saiku");
    String applicationWadl =
        webResource.path("/rest/saiku/bugg/org.saiku.datasources").accept("application/json").get(String.class);
    System.out.println(applicationWadl);
    assertEquals(
        "[{\"connection\":\"TestConnection1\",\"cube\":\"Quadrant Analysis\",\"catalog\":\"SampleData\",\"schema\":\"SampleData\"},{\"connection\":\"TestConnection1\",\"cube\":\"SteelWheelsSales\",\"catalog\":\"SteelWheels\",\"schema\":\"SteelWheels\"}]",
View Full Code Here


  @Ignore
  @Test
  public void testConvertDataSourcesToXML() {
    Client client = Client.create();
    client.setFollowRedirects(false);

    WebResource webResource = client.resource("http://localhost:9999/saiku");
    String applicationWadl =
        webResource.path("/rest/saiku/bugg/org.saiku.datasources").accept("application/xml").get(String.class);
    System.out.println(applicationWadl);
    assertEquals(
        "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><items><datasource connection=\"TestConnection1\" cube=\"Quadrant Analysis\" catalog=\"SampleData\" schema=\"SampleData\"/><datasource connection=\"TestConnection1\" cube=\"SteelWheelsSales\" catalog=\"SteelWheels\" schema=\"SteelWheels\"/></items>",
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.Client

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.