Package com.netflix.client.http

Examples of com.netflix.client.http.HttpRequest


            final String id) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("Missing required parameter: id");
        }

        final HttpRequest request = BaseGenieClient.buildRequest(
                Verb.DELETE,
                StringUtils.join(
                        new String[]{BASE_CONFIG_COMMAND_REST_URL, id, "tags"},
                        SLASH),
                null,
View Full Code Here


            final String tag) throws GenieException {
        if (StringUtils.isBlank(id)) {
            throw new GeniePreconditionException("Missing required parameter: id");
        }

        final HttpRequest request = BaseGenieClient.buildRequest(
                Verb.DELETE,
                StringUtils.join(
                        new String[]{
                                BASE_CONFIG_COMMAND_REST_URL,
                                id,
View Full Code Here

     */
    @Test
    public void testBuildRequestValidPost() throws GenieException {
        final String uri = "http://localhost:7001/genie/v2/jobs";
        final Job job = new Job();
        final HttpRequest validRequest = BaseGenieClient.buildRequest(
                HttpRequest.Verb.POST, uri, null, job);

        Assert.assertEquals(HttpRequest.Verb.POST, validRequest.getVerb());
        Assert.assertEquals(uri, validRequest.getUri().toString());
        Assert.assertEquals(job, validRequest.getEntity());
        Assert.assertEquals(1, validRequest.getHeaders().get(HttpHeaders.CONTENT_TYPE).size());
        Assert.assertTrue(validRequest.getHeaders().get(HttpHeaders.CONTENT_TYPE).contains(MediaType.APPLICATION_JSON));
        Assert.assertEquals(1, validRequest.getHeaders().get(HttpHeaders.ACCEPT).size());
        Assert.assertTrue(validRequest.getHeaders().get(HttpHeaders.ACCEPT).contains(MediaType.APPLICATION_JSON));
        Assert.assertTrue(validRequest.getQueryParams().isEmpty());
    }
View Full Code Here

     */
    @Test
    public void testBuildRequestValidGetEmptyQueryParams() throws GenieException {
        final String uri = "http://localhost:7001/genie/v2/jobs";
        final Multimap<String, String> queryParams = ArrayListMultimap.create();
        final HttpRequest validRequest = BaseGenieClient.buildRequest(
                HttpRequest.Verb.GET, uri, queryParams, null);

        Assert.assertEquals(HttpRequest.Verb.GET, validRequest.getVerb());
        Assert.assertEquals(uri, validRequest.getUri().toString());
        Assert.assertNull(validRequest.getEntity());
        Assert.assertEquals(1, validRequest.getHeaders().get(HttpHeaders.CONTENT_TYPE).size());
        Assert.assertTrue(validRequest.getHeaders().get(HttpHeaders.CONTENT_TYPE).contains(MediaType.APPLICATION_JSON));
        Assert.assertEquals(1, validRequest.getHeaders().get(HttpHeaders.ACCEPT).size());
        Assert.assertTrue(validRequest.getHeaders().get(HttpHeaders.ACCEPT).contains(MediaType.APPLICATION_JSON));
        Assert.assertTrue(validRequest.getQueryParams().isEmpty());
    }
View Full Code Here

        final String uri = "http://localhost:7001/genie/v2/jobs";
        final Multimap<String, String> queryParams = ArrayListMultimap.create();
        queryParams.put("key1", "value1");
        queryParams.put("key1", "value2");
        queryParams.put("key2", "value1");
        final HttpRequest validRequest = BaseGenieClient.buildRequest(
                HttpRequest.Verb.GET, uri, queryParams, null);

        Assert.assertEquals(HttpRequest.Verb.GET, validRequest.getVerb());
        Assert.assertEquals(uri, validRequest.getUri().toString());
        Assert.assertNull(validRequest.getEntity());
        Assert.assertEquals(1, validRequest.getHeaders().get(HttpHeaders.CONTENT_TYPE).size());
        Assert.assertTrue(validRequest.getHeaders().get(HttpHeaders.CONTENT_TYPE).contains(MediaType.APPLICATION_JSON));
        Assert.assertEquals(1, validRequest.getHeaders().get(HttpHeaders.ACCEPT).size());
        Assert.assertTrue(validRequest.getHeaders().get(HttpHeaders.ACCEPT).contains(MediaType.APPLICATION_JSON));
        Assert.assertFalse(validRequest.getQueryParams().isEmpty());
        Assert.assertEquals(2, validRequest.getQueryParams().get("key1").size());
        Assert.assertTrue(validRequest.getQueryParams().get("key1").contains("value1"));
        Assert.assertTrue(validRequest.getQueryParams().get("key1").contains("value2"));
        Assert.assertEquals(1, validRequest.getQueryParams().get("key2").size());
        Assert.assertTrue(validRequest.getQueryParams().get("key2").contains("value1"));
    }
View Full Code Here

TOP

Related Classes of com.netflix.client.http.HttpRequest

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.