Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.Client.resource()


        super.setUp();
       
        threadSelector = Main.startServer();

        Client c = Client.create();
        r = c.resource(Main.BASE_URI);
    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
View Full Code Here


      pattern = "http://localhost:%s/";
      url = String.format(pattern, configuration.getClientApiPort());
    }

    this.ambariClient = client;
    this.ambariWebResource = client.resource(url);

    //Install auth filters
    ClientFilter csrfFilter = new CsrfProtectionFilter("RequestSchedule");
    ClientFilter tokenFilter = new InternalTokenClientFilter(tokenStorage);
    ambariClient.addFilter(csrfFilter);
View Full Code Here

    this.doAs = doAs;
    this.context = context;
    ClientConfig config = new DefaultClientConfig();
    config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    Client client = Client.create(config);
    this.service = client.resource(api);
  }

  /**
   * @see #TempletonApi(String,String,String,ViewContext)
   */
 
View Full Code Here

        // 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

  @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

  @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

     * workspace again and ensures it's no longer available.
     */
    public void testCreateAndDestroyRESTSession() throws Exception {
        Client client = createClient();
        try {
            WebResource r = client.resource(HOST.concat("/client/work"));
            try {
                r.post(String.class, "");
                fail("We should have been redirected to a new workspace.");
            }
            catch (UniformInterfaceException e) {
View Full Code Here

            }
            catch (UniformInterfaceException e) {
                ClientResponse response = e.getResponse();
                URI location = response.getLocation();
                assertTrue(location.toString().startsWith(HOST.concat("/client/work/rest-")));
                WebResource r2 = client.resource(location);
                r2.get(String.class);
                r2.delete();
                try {
                    r2.get(String.class);
                }
View Full Code Here

                createDistribution(client, w2, "dist-" + i);
                createAssociationD2T(client, w2, "dist-" + i, "bar.t1");
                w2.post();
                w2.delete();
            }
            WebResource t1versions = client.resource(HOST.concat("/deployment/bar.t1/versions"));
            assertEquals("1.0.0\n", t1versions.get(String.class));
        }
        catch (Exception e) {
            showBundles();
            showLog();
View Full Code Here

            assertResources(gson, w2, "distribution2target", 1);
            assertResources(gson, w2, "target", 1);
            w2.post();
            w2.delete();

            WebResource t1versions = client.resource(HOST.concat("/deployment/foo.t1/versions"));
            assertEquals("1.0.0\n", t1versions.get(String.class));
        }
        catch (Exception e) {
            showBundles();
            showLog();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.