Search in sources :

Example 11 with EurekaServiceInstance

use of org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient.EurekaServiceInstance in project coffeenet-starter by coffeenet.

the class IntegrationCoffeeNetAppService method toApp.

private static CoffeeNetApp toApp(ServiceInstance serviceInstance) {
    if (!(serviceInstance instanceof EurekaServiceInstance)) {
        return null;
    }
    EurekaServiceInstance eurekaServiceInstance = (EurekaServiceInstance) serviceInstance;
    InstanceInfo instanceInfo = eurekaServiceInstance.getInstanceInfo();
    Set<String> allowedAuthorities = commaDelimitedListToSet(instanceInfo.getMetadata().get("allowedAuthorities")).stream().map(String::trim).collect(toSet());
    return new CoffeeNetApp(instanceInfo.getVIPAddress(), instanceInfo.getHomePageUrl(), allowedAuthorities);
}
Also used : EurekaServiceInstance(org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient.EurekaServiceInstance) InstanceInfo(com.netflix.appinfo.InstanceInfo)

Aggregations

EurekaServiceInstance (org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient.EurekaServiceInstance)11 Test (org.junit.Test)8 InstanceInfo (com.netflix.appinfo.InstanceInfo)6 Arrays.asList (java.util.Arrays.asList)5 Collections.emptyList (java.util.Collections.emptyList)5 Collections.singletonList (java.util.Collections.singletonList)5 List (java.util.List)5 Application (de.codecentric.boot.admin.model.Application)3