APISonar


org.apache.camel.model.rest.RestBindingMode.json

> org > apache > camel > model > rest > RestBindingMode > json
org APIs apache APIs camel APIs model APIs rest APIs RestBindingMode APIs json APIs

Example 1
public void shouldCreateQueryParametersFromUnusedEndpointParameters() throws Exception {
        final Map<String, Object> parameters = new HashMap<>();
        parameters.put("host", "http://localhost");
        parameters.put("bindingMode", "json");
        parameters.put("foo", "bar");

        final RestEndpoint endpoint = (RestEndpoint) restComponent
            .createEndpoint("rest:GET:/path?host=http://localhost&bindingMode=json&foo=bar", "GET:/path", parameters);

        assertEquals("http://localhost", endpoint.getHost());
        assertEquals(RestBindingMode.json, endpoint.getBindingMode());
        assertEquals("GET", endpoint.getMethod());
        assertEquals("/path", endpoint.getPath());
        assertEquals("foo=bar", endpoint.getQueryParameters());
    }
Example 2
public void shouldConfigureBindingMode() throws Exception {
        final RestEndpoint restEndpoint = new RestEndpoint("rest:GET:/path", restComponent);
        restEndpoint.setComponentName("mock-rest");
        restEndpoint.setParameters(new HashMap<>());

        restEndpoint.setBindingMode(RestBindingMode.json);

        final RestProducer producer = (RestProducer) restEndpoint.createProducer();

        Assert.assertEquals(producer.getBindingMode(), RestBindingMode.json);
    }