本文整理汇总了Java中org.springframework.cloud.commons.util.InetUtilsProperties类的典型用法代码示例。如果您正苦于以下问题:Java InetUtilsProperties类的具体用法?Java InetUtilsProperties怎么用?Java InetUtilsProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InetUtilsProperties类属于org.springframework.cloud.commons.util包,在下文中一共展示了InetUtilsProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: eurekaClientNotShutdownInDeregister
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
@Test
public void eurekaClientNotShutdownInDeregister() {
EurekaServiceRegistry registry = new EurekaServiceRegistry();
CloudEurekaClient eurekaClient = mock(CloudEurekaClient.class);
ApplicationInfoManager applicationInfoManager = mock(ApplicationInfoManager.class);
when(applicationInfoManager.getInfo()).thenReturn(mock(InstanceInfo.class));
EurekaRegistration registration = EurekaRegistration.builder(new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties())))
.with(eurekaClient)
.with(applicationInfoManager)
.with(new EurekaClientConfigBean(), mock(ApplicationEventPublisher.class))
.build();
registry.deregister(registration);
verifyZeroInteractions(eurekaClient);
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:20,代码来源:EurekaServiceRegistryTests.java
示例2: DefaultEndpointLocator
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
public DefaultEndpointLocator(Registration registration, ServerProperties serverProperties,
Environment environment, ZipkinProperties zipkinProperties, InetUtils inetUtils) {
this.registration = registration;
this.serverProperties = serverProperties;
this.environment = environment;
this.zipkinProperties = zipkinProperties;
if (inetUtils == null) {
this.inetUtils = new InetUtils(new InetUtilsProperties());
} else {
this.inetUtils = inetUtils;
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:13,代码来源:DefaultEndpointLocator.java
示例3: ServerPropertiesHostLocator
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
public ServerPropertiesHostLocator(ServerProperties serverProperties,
Environment environment, ZipkinProperties zipkinProperties, InetUtils inetUtils) {
this.serverProperties = serverProperties;
this.environment = environment;
this.zipkinProperties = zipkinProperties;
if (inetUtils == null) {
this.inetUtils = new InetUtils(new InetUtilsProperties());
} else {
this.inetUtils = inetUtils;
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:12,代码来源:ServerPropertiesHostLocator.java
示例4: should_escape_root
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
@Test
public void should_escape_root() {
// given:
ZookeeperDiscoveryProperties zookeeperDiscoveryProperties = new ZookeeperDiscoveryProperties(new InetUtils(new InetUtilsProperties()));
// when:
zookeeperDiscoveryProperties.setRoot(root);
// then:
then(zookeeperDiscoveryProperties.getRoot()).isEqualTo("/es");
}
开发者ID:spring-cloud,项目名称:spring-cloud-zookeeper,代码行数:10,代码来源:ZookeeperDiscoveryPropertiesTest.java
示例5: getFirstNonLoopbackHostInfo
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
private HostInfo getFirstNonLoopbackHostInfo(ConfigurableEnvironment environment) {
InetUtilsProperties target = new InetUtilsProperties();
ConfigurationPropertySources.attach(environment);
Binder.get(environment).bind(InetUtilsProperties.PREFIX,
Bindable.ofInstance(target));
try (InetUtils utils = new InetUtils(target)) {
return utils.findFirstNonLoopbackHostInfo();
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:10,代码来源:HostInfoEnvironmentPostProcessor.java
示例6: eurekaClientGetStatus
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
@Test
public void eurekaClientGetStatus() {
EurekaServiceRegistry registry = new EurekaServiceRegistry();
EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties()));
config.setAppname("myapp");
config.setInstanceId("1234");
CloudEurekaClient eurekaClient = mock(CloudEurekaClient.class);
InstanceInfo instanceInfo = InstanceInfo.Builder.newBuilder()
.setAppName("myapp")
.setInstanceId("1234")
.setStatus(DOWN)
.setOverriddenStatus(UNKNOWN)
.build();
when(eurekaClient.getInstanceInfo("myapp", "1234"))
.thenReturn(instanceInfo);
EurekaRegistration registration = EurekaRegistration.builder(config)
.with(eurekaClient)
.with(mock(ApplicationInfoManager.class))
.with(new EurekaClientConfigBean(), mock(ApplicationEventPublisher.class))
.build();
Object status = registry.getStatus(registration);
assertThat(status).isInstanceOf(Map.class);
Map<Object, Object> map = (Map<Object, Object>) status;
assertThat(map).hasSize(2)
.containsEntry("status", DOWN.toString())
.containsEntry("overriddenStatus", UNKNOWN.toString());
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:36,代码来源:EurekaServiceRegistryTests.java
示例7: eurekaClientGetStatusNoInstance
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
@Test
public void eurekaClientGetStatusNoInstance() {
EurekaServiceRegistry registry = new EurekaServiceRegistry();
EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties()));
config.setAppname("myapp");
config.setInstanceId("1234");
CloudEurekaClient eurekaClient = mock(CloudEurekaClient.class);
when(eurekaClient.getInstanceInfo("myapp", "1234"))
.thenReturn(null);
EurekaRegistration registration = EurekaRegistration.builder(config)
.with(eurekaClient)
.with(mock(ApplicationInfoManager.class))
.with(new EurekaClientConfigBean(), mock(ApplicationEventPublisher.class))
.build();
Object status = registry.getStatus(registration);
assertThat(status).isInstanceOf(Map.class);
Map<Object, Object> map = (Map<Object, Object>) status;
assertThat(map).hasSize(1)
.containsEntry("status", UNKNOWN.toString());
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:29,代码来源:EurekaServiceRegistryTests.java
示例8: instanceIdIsHostNameByDefault
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
@Test
public void instanceIdIsHostNameByDefault() throws IOException {
InstanceInfo instanceInfo = setupInstance();
try (InetUtils utils = new InetUtils(new InetUtilsProperties())) {
assertEquals(utils.findFirstNonLoopbackHostInfo().getHostname(),
instanceInfo.getId());
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:9,代码来源:InstanceInfoFactoryTests.java
示例9: init
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
@Before
public void init() throws Exception {
try (InetUtils utils = new InetUtils(new InetUtilsProperties())) {
InetUtils.HostInfo hostInfo = utils.findFirstNonLoopbackHostInfo();
this.hostName = hostInfo.getHostname();
this.ipAddress = hostInfo.getIpAddress();
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:9,代码来源:EurekaInstanceConfigBeanTests.java
示例10: eurekaInstanceConfigBean
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
@Bean
public EurekaInstanceConfigBean eurekaInstanceConfigBean() {
EurekaInstanceConfigBean configBean = new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties()));
String springAppName = this.env.getProperty("spring.application.name", "");
if(StringUtils.hasText(springAppName)) {
configBean.setSecureVirtualHostName(springAppName);
configBean.setVirtualHostName(springAppName);
configBean.setAppname(springAppName);
}
return configBean;
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:12,代码来源:EurekaInstanceConfigBeanTests.java
示例11: setUp
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
properties = new ConsulDiscoveryProperties(new InetUtils(new InetUtilsProperties()));
properties.setDefaultQueryTag(DEFAULT_TAG);
properties.setServerListQueryTags(serverListQueryTags);
properties.setDatacenters(datacenters);
}
开发者ID:spring-cloud,项目名称:spring-cloud-consul,代码行数:8,代码来源:ConsulDiscoveryPropertiesTests.java
示例12: localAddress
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
private InetUtils localAddress(byte[] address) throws UnknownHostException {
InetUtils mocked = Mockito.spy(new InetUtils(new InetUtilsProperties()));
Mockito.when(mocked.findFirstNonLoopbackAddress())
.thenReturn(InetAddress.getByAddress(address));
return mocked;
}
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:7,代码来源:DefaultEndpointLocatorConfigurationTest.java
示例13: getEurekaInstanceConfigBean
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
private EurekaInstanceConfigBean getEurekaInstanceConfigBean() {
return new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties()));
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:4,代码来源:EurekaRibbonClientConfigurationTests.java
示例14: getEurekaInstanceConfigBean
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
@Bean
public EurekaInstanceConfigBean getEurekaInstanceConfigBean() {
EurekaInstanceConfigBean bean = new EurekaInstanceConfigBean(new InetUtils(
new InetUtilsProperties()));
return bean;
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:7,代码来源:RibbonClientPreprocessorIntegrationTests.java
示例15: eurekaInstanceConfigBean
import org.springframework.cloud.commons.util.InetUtilsProperties; //导入依赖的package包/类
@Bean
public EurekaInstanceConfigBean eurekaInstanceConfigBean() {
return new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties()));
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:5,代码来源:InstanceInfoFactoryTests.java
注:本文中的org.springframework.cloud.commons.util.InetUtilsProperties类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论