org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalancerClient Java Examples

The following examples show how to use org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalancerClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FeignHttpClientTests.java    From spring-cloud-openfeign with Apache License 2.0 5 votes vote down vote up
@Test
public void testFeignClientType() throws IllegalAccessException {
	assertThat(this.feignClient).isInstanceOf(FeignBlockingLoadBalancerClient.class);
	FeignBlockingLoadBalancerClient client = (FeignBlockingLoadBalancerClient) this.feignClient;
	Client delegate = client.getDelegate();
	assertThat(delegate).isInstanceOf(feign.httpclient.ApacheHttpClient.class);
}
 
Example #2
Source File: FeignOkHttpTests.java    From spring-cloud-openfeign with Apache License 2.0 5 votes vote down vote up
@Test
public void testFeignClientType() throws IllegalAccessException {
	assertThat(this.feignClient).isInstanceOf(FeignBlockingLoadBalancerClient.class);
	FeignBlockingLoadBalancerClient client = (FeignBlockingLoadBalancerClient) this.feignClient;
	Client delegate = client.getDelegate();
	assertThat(delegate).isInstanceOf(feign.okhttp.OkHttpClient.class);
}
 
Example #3
Source File: ValidFeignClientTests.java    From spring-cloud-openfeign with Apache License 2.0 5 votes vote down vote up
@Test
public void testFeignClientType() throws IllegalAccessException {
	assertThat(this.feignClient).isInstanceOf(FeignBlockingLoadBalancerClient.class);
	FeignBlockingLoadBalancerClient client = (FeignBlockingLoadBalancerClient) this.feignClient;
	Client delegate = client.getDelegate();
	assertThat(delegate).isInstanceOf(Client.Default.class);
}
 
Example #4
Source File: TraceFeignObjectWrapper.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
Object wrap(Object bean) {
	if (bean instanceof Client && !(bean instanceof TracingFeignClient)) {
		if (loadBalancerPresent && bean instanceof FeignBlockingLoadBalancerClient
				&& !(bean instanceof TraceFeignBlockingLoadBalancerClient)) {
			return instrumentedFeignLoadBalancerClient(bean);
		}
		return new LazyTracingFeignClient(this.beanFactory, (Client) bean);
	}
	return bean;
}
 
Example #5
Source File: TracingFeignObjectWrapperTests.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
@Test
public void should_wrap_feign_loadbalancer_client() {
	Client delegate = mock(Client.class);
	BlockingLoadBalancerClient loadBalancerClient = mock(
			BlockingLoadBalancerClient.class);
	when(beanFactory.getBean(LoadBalancerClient.class))
			.thenReturn(loadBalancerClient);

	Object wrapped = traceFeignObjectWrapper
			.wrap(new FeignBlockingLoadBalancerClient(delegate, loadBalancerClient));

	assertThat(wrapped).isInstanceOf(TraceFeignBlockingLoadBalancerClient.class);
}
 
Example #6
Source File: TraceFeignBlockingLoadBalancerClient.java    From spring-cloud-sleuth with Apache License 2.0 4 votes vote down vote up
private boolean delegateIsALoadBalancer() {
	return getDelegate() instanceof FeignBlockingLoadBalancerClient;
}
 
Example #7
Source File: DependencyFeignClientAutoConfiguration.java    From spring-cloud-zookeeper with Apache License 2.0 4 votes vote down vote up
public DependencyFeignClientAutoConfiguration(@Autowired(required = false) FeignBlockingLoadBalancerClient feignLoadBalancerClient,
		ZookeeperDependencies zookeeperDependencies, BlockingLoadBalancerClient loadBalancerClient) {
	this.feignLoadBalancerClient = feignLoadBalancerClient;
	this.zookeeperDependencies = zookeeperDependencies;
	this.loadBalancerClient = loadBalancerClient;
}