当前位置: 首页>>代码示例>>Java>>正文


Java IClientConfig.set方法代码示例

本文整理汇总了Java中com.netflix.client.config.IClientConfig.set方法的典型用法代码示例。如果您正苦于以下问题:Java IClientConfig.set方法的具体用法?Java IClientConfig.set怎么用?Java IClientConfig.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.netflix.client.config.IClientConfig的用法示例。


在下文中一共展示了IClientConfig.set方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testHystrixTimeoutValueRibbonTimeouts

import com.netflix.client.config.IClientConfig; //导入方法依赖的package包/类
@Test
public void testHystrixTimeoutValueRibbonTimeouts() throws Exception {
	SpringClientFactory springClientFactory = mock(SpringClientFactory.class);
	ZuulProperties zuulProperties = new ZuulProperties();
	OkHttpLoadBalancingClient loadBalancingHttpClient = mock(OkHttpLoadBalancingClient.class);
	IClientConfig clientConfig = new DefaultClientConfigImpl();
	clientConfig.set(IClientConfigKey.Keys.ConnectTimeout, 100);
	clientConfig.set(IClientConfigKey.Keys.ReadTimeout, 500);
	doReturn(loadBalancingHttpClient).when(springClientFactory).getClient(anyString(),
			eq(OkHttpLoadBalancingClient.class));
	doReturn(clientConfig).when(springClientFactory).getClientConfig(anyString());
	OkHttpRibbonCommandFactory commandFactory = new OkHttpRibbonCommandFactory(springClientFactory, zuulProperties, new HashSet<FallbackProvider>());
	RibbonCommandContext context = mock(RibbonCommandContext.class);
	doReturn("service").when(context).getServiceId();
	OkHttpRibbonCommand ribbonCommand = commandFactory.create(context);
	assertEquals(600, ribbonCommand.getProperties().executionTimeoutInMilliseconds().get().intValue());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:18,代码来源:OkHttpRibbonCommandFactoryTest.java

示例2: testHystrixTimeoutValueRibbonTimeouts

import com.netflix.client.config.IClientConfig; //导入方法依赖的package包/类
@Test
public void testHystrixTimeoutValueRibbonTimeouts() throws Exception {
	SpringClientFactory springClientFactory = mock(SpringClientFactory.class);
	ZuulProperties zuulProperties = new ZuulProperties();
	RibbonLoadBalancingHttpClient loadBalancingHttpClient = mock(RibbonLoadBalancingHttpClient.class);
	IClientConfig clientConfig = new DefaultClientConfigImpl();
	clientConfig.set(IClientConfigKey.Keys.ConnectTimeout, 100);
	clientConfig.set(IClientConfigKey.Keys.ReadTimeout, 500);
	doReturn(loadBalancingHttpClient).when(springClientFactory).getClient(anyString(),
			eq(RibbonLoadBalancingHttpClient.class));
	doReturn(clientConfig).when(springClientFactory).getClientConfig(anyString());
	HttpClientRibbonCommandFactory ribbonCommandFactory = new HttpClientRibbonCommandFactory(springClientFactory, zuulProperties, new HashSet<FallbackProvider>());
	RibbonCommandContext context = mock(RibbonCommandContext.class);
	doReturn("service").when(context).getServiceId();
	HttpClientRibbonCommand ribbonCommand = ribbonCommandFactory.create(context);
	assertEquals(600, ribbonCommand.getProperties().executionTimeoutInMilliseconds().get().intValue());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:18,代码来源:HttpClientRibbonCommandFactoryTest.java

示例3: testUpdatedTimeouts

import com.netflix.client.config.IClientConfig; //导入方法依赖的package包/类
@Test
public void testUpdatedTimeouts() throws Exception {
	SpringClientFactory factory = new SpringClientFactory();
	OkHttpClient result = getHttpClient(Timeouts.class, null, factory);
	assertThat(result.readTimeoutMillis(), is(50000));
	assertThat(result.connectTimeoutMillis(), is(60000));
	IClientConfig config = factory.getClientConfig("service");
	config.set(CommonClientConfigKey.ConnectTimeout, 60);
	config.set(CommonClientConfigKey.ReadTimeout, 50);
	result = getHttpClient(Timeouts.class, null, factory);
	assertThat(result.readTimeoutMillis(), is(50));
	assertThat(result.connectTimeoutMillis(), is(60));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:14,代码来源:OkHttpLoadBalancingClientTests.java

示例4: testUpdatedTimeouts

import com.netflix.client.config.IClientConfig; //导入方法依赖的package包/类
@Test
public void testUpdatedTimeouts()
		throws Exception {
	SpringClientFactory factory = new SpringClientFactory();
	RequestConfig result = getBuiltRequestConfig(Timeouts.class, null, factory);
	assertThat(result.getConnectTimeout(), is(60000));
	assertThat(result.getSocketTimeout(), is (50000));
	IClientConfig config = factory.getClientConfig("service");
	config.set(CommonClientConfigKey.ConnectTimeout, 60);
	config.set(CommonClientConfigKey.ReadTimeout, 50);
	result = getBuiltRequestConfig(Timeouts.class, null, factory);
	assertThat(result.getConnectTimeout(), is(60));
	assertThat(result.getSocketTimeout(), is (50));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:15,代码来源:RibbonLoadBalancingHttpClientTests.java

示例5: init

import com.netflix.client.config.IClientConfig; //导入方法依赖的package包/类
@Before
public void init() {
	MockitoAnnotations.initMocks(this);

	IClientConfig config = new DefaultClientConfigImpl();
	config.set(CommonClientConfigKey.ConnectTimeout, 1000);
	config.set(CommonClientConfigKey.ReadTimeout, 500);

	when(this.delegate.getClientConfig("client1")).thenReturn(config);
	when(this.delegate.getClientConfig("client2")).thenReturn(config);

	this.factory = new CachingSpringLoadBalancerFactory(this.delegate,
			loadBalancedRetryPolicyFactory);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:15,代码来源:CachingSpringLoadBalancerFactoryTests.java

示例6: delegateCreatesWithNoRetry

import com.netflix.client.config.IClientConfig; //导入方法依赖的package包/类
@Test
public void delegateCreatesWithNoRetry() {
	IClientConfig config = new DefaultClientConfigImpl();
	config.set(CommonClientConfigKey.ConnectTimeout, 1000);
	config.set(CommonClientConfigKey.ReadTimeout, 500);
	when(this.delegate.getClientConfig("retry")).thenReturn(config);
	CachingSpringLoadBalancerFactory factory = new CachingSpringLoadBalancerFactory(this.delegate);
	FeignLoadBalancer client = this.factory.create("retry");
	assertNotNull("client was null", client);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:11,代码来源:CachingSpringLoadBalancerFactoryTests.java

示例7: delegateCreatesWithRetry

import com.netflix.client.config.IClientConfig; //导入方法依赖的package包/类
@Test
public void delegateCreatesWithRetry() {
	IClientConfig config = new DefaultClientConfigImpl();
	config.set(CommonClientConfigKey.ConnectTimeout, 1000);
	config.set(CommonClientConfigKey.ReadTimeout, 500);
	when(this.delegate.getClientConfig("retry")).thenReturn(config);
	CachingSpringLoadBalancerFactory factory = new CachingSpringLoadBalancerFactory(
		this.delegate, loadBalancedRetryPolicyFactory, false);
	FeignLoadBalancer client = this.factory.create("retry");
	assertNotNull("client was null", client);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:12,代码来源:CachingSpringLoadBalancerFactoryTests.java

示例8: delegateCreatesWithBackOff

import com.netflix.client.config.IClientConfig; //导入方法依赖的package包/类
@Test
public void delegateCreatesWithBackOff() {
	IClientConfig config = new DefaultClientConfigImpl();
	config.set(CommonClientConfigKey.ConnectTimeout, 1000);
	config.set(CommonClientConfigKey.ReadTimeout, 500);
	when(this.delegate.getClientConfig("retry")).thenReturn(config);
	CachingSpringLoadBalancerFactory factory = new CachingSpringLoadBalancerFactory(
		this.delegate, loadBalancedRetryPolicyFactory, loadBalancedBackOffPolicyFactory);
	FeignLoadBalancer client = this.factory.create("retry");
	assertNotNull("client was null", client);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:12,代码来源:CachingSpringLoadBalancerFactoryTests.java

示例9: delegateCreatesWithRetryListener

import com.netflix.client.config.IClientConfig; //导入方法依赖的package包/类
@Test
public void delegateCreatesWithRetryListener() {
	IClientConfig config = new DefaultClientConfigImpl();
	config.set(CommonClientConfigKey.ConnectTimeout, 1000);
	config.set(CommonClientConfigKey.ReadTimeout, 500);
	when(this.delegate.getClientConfig("retry")).thenReturn(config);
	CachingSpringLoadBalancerFactory factory = new CachingSpringLoadBalancerFactory(
		this.delegate, loadBalancedRetryPolicyFactory, loadBalancedBackOffPolicyFactory, loadBalancedRetryListenerFactory);
	FeignLoadBalancer client = this.factory.create("retry");
	assertNotNull("client was null", client);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:12,代码来源:CachingSpringLoadBalancerFactoryTests.java

示例10: setUp

import com.netflix.client.config.IClientConfig; //导入方法依赖的package包/类
@Before
public void setUp() {
	IClientConfig iClientConfig = IClientConfig.Builder.newBuilder(this.serviceId)
			.withSecure(true)
			.build();
	iClientConfig.set(CommonClientConfigKey.SecurePort, 443);

	Tuple2<ApplicationDetail, InstanceDetail> tuple2 = getInstanceDetail();

	CloudFoundryService cfs = mock(CloudFoundryService.class);
	when(cfs.getApplicationInstances(this.serviceId)).thenReturn(Flux.just(tuple2));

	this.cloudFoundryServerList = new CloudFoundryServerList(cfs, new CloudFoundryDiscoveryProperties());
	this.cloudFoundryServerList.initWithNiwsConfig(iClientConfig);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry,代码行数:16,代码来源:CloudFoundryServerListTest.java


注:本文中的com.netflix.client.config.IClientConfig.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。