How to use getEndpoint method of com.consol.citrus.http.client.HttpClientBuilder class

Best Citrus code snippet using com.consol.citrus.http.client.HttpClientBuilder.getEndpoint

Source:HttpClientBuilder.java Github

copy

Full Screen

...35public class HttpClientBuilder extends AbstractEndpointBuilder<HttpClient> {36 /** Endpoint target */37 private HttpClient endpoint = new HttpClient();38 @Override39 protected HttpClient getEndpoint() {40 return endpoint;41 }42 /**43 * Sets the requestUrl property.44 * @param uri45 * @return46 */47 public HttpClientBuilder requestUrl(String uri) {48 endpoint.getEndpointConfiguration().setRequestUrl(uri);49 return this;50 }51 /**52 * Sets the rest template.53 * @param restTemplate54 * @return55 */56 public HttpClientBuilder restTemplate(RestTemplate restTemplate) {57 endpoint.getEndpointConfiguration().setRestTemplate(restTemplate);58 return this;59 }60 /**61 * Sets the request factory.62 * @param requestFactory63 * @return64 */65 public HttpClientBuilder requestFactory(ClientHttpRequestFactory requestFactory) {66 endpoint.getEndpointConfiguration().setRequestFactory(requestFactory);67 return this;68 }69 /**70 * Sets the request method.71 * @param requestMethod72 * @return73 */74 public HttpClientBuilder requestMethod(HttpMethod requestMethod) {75 endpoint.getEndpointConfiguration().setRequestMethod(requestMethod);76 return this;77 }78 /**79 * Sets the message converter.80 * @param messageConverter81 * @return82 */83 public HttpClientBuilder messageConverter(HttpMessageConverter messageConverter) {84 endpoint.getEndpointConfiguration().setMessageConverter(messageConverter);85 return this;86 }87 /**88 * Sets the message correlator.89 * @param correlator90 * @return91 */92 public HttpClientBuilder correlator(MessageCorrelator correlator) {93 endpoint.getEndpointConfiguration().setCorrelator(correlator);94 return this;95 }96 /**97 * Sets the endpoint uri resolver.98 * @param resolver99 * @return100 */101 public HttpClientBuilder endpointResolver(EndpointUriResolver resolver) {102 endpoint.getEndpointConfiguration().setEndpointUriResolver(resolver);103 return this;104 }105 /**106 * Sets the default charset.107 * @param charset108 * @return109 */110 public HttpClientBuilder charset(String charset) {111 endpoint.getEndpointConfiguration().setCharset(charset);112 return this;113 }114 /**115 * Sets the default accept header.116 * @param flag117 * @return118 */119 public HttpClientBuilder defaultAcceptHeader(boolean flag) {120 endpoint.getEndpointConfiguration().setDefaultAcceptHeader(flag);121 return this;122 }123 /**124 * Sets the handleCookies property.125 * @param flag126 * @return127 */128 public HttpClientBuilder handleCookies(boolean flag) {129 endpoint.getEndpointConfiguration().setHandleCookies(flag);130 return this;131 }132 /**133 * Sets the content type.134 * @param contentType135 * @return136 */137 public HttpClientBuilder contentType(String contentType) {138 endpoint.getEndpointConfiguration().setContentType(contentType);139 return this;140 }141 /**142 * Sets the polling interval.143 * @param pollingInterval144 * @return145 */146 public HttpClientBuilder pollingInterval(int pollingInterval) {147 endpoint.getEndpointConfiguration().setPollingInterval(pollingInterval);148 return this;149 }150 /**151 * Sets the error handling strategy.152 * @param errorStrategy153 * @return154 */155 public HttpClientBuilder errorHandlingStrategy(ErrorHandlingStrategy errorStrategy) {156 endpoint.getEndpointConfiguration().setErrorHandlingStrategy(errorStrategy);157 return this;158 }159 /**160 * Sets the error handler.161 * @param errorHandler162 * @return163 */164 public HttpClientBuilder errorHandler(ResponseErrorHandler errorHandler) {165 endpoint.getEndpointConfiguration().setErrorHandler(errorHandler);166 return this;167 }168 /**169 * Sets the client interceptors.170 * @param interceptors171 * @return172 */173 public HttpClientBuilder interceptors(List<ClientHttpRequestInterceptor> interceptors) {174 endpoint.getEndpointConfiguration().setClientInterceptors(interceptors);175 return this;176 }177 /**178 * Sets the binaryMediaTypes.179 * @param binaryMediaTypes180 * @return181 */182 public HttpClientBuilder binaryMediaTypes(List<MediaType> binaryMediaTypes) {183 endpoint.getEndpointConfiguration().setBinaryMediaTypes(binaryMediaTypes);184 return this;185 }186 /**187 * Sets a client single interceptor.188 * @param interceptor189 * @return190 */191 public HttpClientBuilder interceptor(ClientHttpRequestInterceptor interceptor) {192 if (endpoint.getEndpointConfiguration().getClientInterceptors() == null) {193 endpoint.getEndpointConfiguration().setClientInterceptors(new ArrayList<ClientHttpRequestInterceptor>());194 }195 endpoint.getEndpointConfiguration().getClientInterceptors().add(interceptor);196 return this;197 }198 /**199 * Sets the header mapper.200 * @param headerMapper201 * @return202 */203 public HttpClientBuilder headerMapper(DefaultHttpHeaderMapper headerMapper) {204 endpoint.getEndpointConfiguration().setHeaderMapper(headerMapper);205 return this;206 }207 /**208 * Sets the default timeout.209 * @param timeout210 * @return211 */212 public HttpClientBuilder timeout(long timeout) {213 endpoint.getEndpointConfiguration().setTimeout(timeout);214 return this;215 }216}...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful