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


Java BasicDataCenterInfo类代码示例

本文整理汇总了Java中com.netflix.eureka2.registry.datacenter.BasicDataCenterInfo的典型用法代码示例。如果您正苦于以下问题:Java BasicDataCenterInfo类的具体用法?Java BasicDataCenterInfo怎么用?Java BasicDataCenterInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BasicDataCenterInfo类属于com.netflix.eureka2.registry.datacenter包,在下文中一共展示了BasicDataCenterInfo类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import com.netflix.eureka2.registry.datacenter.BasicDataCenterInfo; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    List<NetworkAddress> na = Collections.singletonList(new NetworkAddress("private",
            NetworkAddress.ProtocolType.IPv4, "localhost", "myHost"));
    ServicePort sp = new ServicePort("port", 8088, false, null);
    DataCenterInfo myDataCenter = new BasicDataCenterInfo("TestDataCenter", na);

    InstanceInfo ii = new InstanceInfo.Builder()
            .withId("testDataCenterInfo")
            .withPorts(sp)
            .withDataCenterInfo(myDataCenter)
            .build();
    this.ii = ii;

    testServer.start();
}
 
开发者ID:schibsted,项目名称:triathlon,代码行数:17,代码来源:MarathonCommandTest.java

示例2: createInstanceInfo

import com.netflix.eureka2.registry.datacenter.BasicDataCenterInfo; //导入依赖的package包/类
protected InstanceInfo createInstanceInfo(int port) {
    final HashSet<ServicePort> ports = new HashSet<>(Arrays.asList(new ServicePort(port, false)));

    String hostAddress = "unknown";
    try {
        hostAddress = InetAddress.getLocalHost().getHostAddress();
    } catch (UnknownHostException e) {
        e.printStackTrace();
        hostAddress = "unknown-" + UUID.randomUUID();
    }

    return new InstanceInfo.Builder()
            .withId(hostAddress + "-" + port)
            .withApp("reactive-lab")
            .withStatus(InstanceInfo.Status.UP)
            .withVipAddress(eurekaVipAddress)
            .withPorts(ports)
            .withDataCenterInfo(BasicDataCenterInfo.fromSystemData())
            .build();
}
 
开发者ID:Netflix,项目名称:ReactiveLab,代码行数:21,代码来源:AbstractMiddleTierService.java

示例3: testInterestSubscriber

import com.netflix.eureka2.registry.datacenter.BasicDataCenterInfo; //导入依赖的package包/类
@Test
public void testInterestSubscriber() throws Exception {
    List<NetworkAddress> na = Collections.singletonList(new NetworkAddress("public",
            NetworkAddress.ProtocolType.IPv4, "192.168.0.1", "myHost"));
    DataCenterInfo myDataCenter = new BasicDataCenterInfo("TestDataCenter", na);
    InstanceInfo ii = new InstanceInfo.Builder()
            .withId("testDataCenterInfo")
            .withDataCenterInfo(myDataCenter)
            .build();
    ChangeNotification<InstanceInfo> cn = new ChangeNotification<>(ChangeNotification.Kind.Add, ii);
    InstanceInfoModel.interestSubscriber(cn);
    assert(InstanceInfoModel.getInstanceInfo().values().contains(cn.getData()));
}
 
开发者ID:schibsted,项目名称:triathlon,代码行数:14,代码来源:InstanceInfoModelTest.java

示例4: setUp

import com.netflix.eureka2.registry.datacenter.BasicDataCenterInfo; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    List<NetworkAddress> na = Collections.singletonList(new NetworkAddress("public",
            NetworkAddress.ProtocolType.IPv4, "192.168.0.1", "myHost"));
    ServicePort sp = new ServicePort("port", 8080, false, null);
    DataCenterInfo myDataCenter = new BasicDataCenterInfo("pluto-dc", na);
    InstanceInfo ii = new InstanceInfo.Builder()
            .withId("testDataCenterInfo")
            .withPorts(sp)
            .withDataCenterInfo(myDataCenter)
            .build();
    this.ii = ii;
    ChangeNotification<InstanceInfo> cn = new ChangeNotification<>(ChangeNotification.Kind.Add, ii);
    InstanceInfoModel.interestSubscriber(cn);
}
 
开发者ID:schibsted,项目名称:triathlon,代码行数:16,代码来源:ClusterOperatorTest.java

示例5: initializeInstanceInfos

import com.netflix.eureka2.registry.datacenter.BasicDataCenterInfo; //导入依赖的package包/类
private void initializeInstanceInfos(int count) {
    for (int n = 0; n < count; n++) {
        List<NetworkAddress> na = Collections.singletonList(new NetworkAddress("public",
                NetworkAddress.ProtocolType.IPv4, "192.168.0." + Integer.toString(n + 1),
                "myHost-" + Integer.toString(n)));
        DataCenterInfo dc = new BasicDataCenterInfo("datacenter-" + Integer.toString(n), na);
        InstanceInfo ii = new InstanceInfo.Builder()
                .withId("instance-info-id-" + Integer.toString(n))
                .withDataCenterInfo(dc)
                .build();

        ChangeNotification<InstanceInfo> cn = new ChangeNotification<>(ChangeNotification.Kind.Add, ii);
        InstanceInfoModel.interestSubscriber(cn);
    }
}
 
开发者ID:schibsted,项目名称:triathlon,代码行数:16,代码来源:UniqueOperatorTest.java

示例6: registerWithEureka

import com.netflix.eureka2.registry.datacenter.BasicDataCenterInfo; //导入依赖的package包/类
public static void registerWithEureka(int serverPort, EurekaClient client, String vipAddress) {
    final HashSet<ServicePort> ports = new HashSet<>(Arrays.asList(new ServicePort(serverPort, false)));

    InstanceInfo instance = new InstanceInfo.Builder()
            .withId(String.valueOf(serverPort))
            .withApp("mock_server")
            .withStatus(InstanceInfo.Status.UP)
            .withVipAddress(vipAddress)
            .withPorts(ports)
            .withDataCenterInfo(BasicDataCenterInfo.fromSystemData())
            .build();

    client.register(instance).toBlocking().lastOrDefault(null); // Wait till the registration is successful.
}
 
开发者ID:Netflix,项目名称:ReactiveLab,代码行数:15,代码来源:ClientServerWithDiscovery.java


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