@Test public void getInstances(@Injectable ServiceCombClient serviceCombClient) throws ServiceCombException { ServiceCombDiscoveryProperties serviceCombDiscoveryProperties = new ServiceCombDiscoveryProperties(); serviceCombDiscoveryProperties.setAppName("test"); serviceCombDiscoveryProperties.setServiceName("testservice"); serviceCombDiscoveryProperties.setVersion("latest"); List<ServiceInstance> serviceInstanceList = new ArrayList<>(); serviceInstanceList.add( new DefaultServiceInstance("111", "127.0.0.1", 1000, false)); Microservice microservice = new Microservice(); microservice.setServiceName("testservice"); new Expectations() { { serviceCombClient.getInstances(microservice, anyString); result = serviceInstanceList; } }; MicroserviceHandler.getInstances(microservice, serviceCombClient); }
public static List<ServiceInstance> getInstances(Microservice microservice, ServiceCombClient serviceCombClient) { String revision = "0"; if (serviceRevision.containsKey(microservice.getServiceName())) { revision = serviceRevision.get(microservice.getServiceName()); } List<ServiceInstance> instanceList = serviceCombClient.getInstances(microservice, revision); return getList(instanceList, microservice.getServiceName()); }
MicroserviceHandler { public static List<ServiceInstance> getInstances(Microservice microservice, ServiceCombClient serviceCombClient) { String revision = "0"; if (serviceRevision.containsKey(microservice.getServiceName())) { revision = serviceRevision.get(microservice.getServiceName()); } List<ServiceInstance> instanceList = serviceCombClient.getInstances(microservice, revision); return getList(instanceList, microservice.getServiceName()); } }
MicroserviceHandler { public static List<ServiceInstance> getInstances(Microservice microservice, ServiceCombClient serviceCombClient) { String revision = "0"; if (serviceRevision.containsKey(microservice.getServiceName())) { revision = serviceRevision.get(microservice.getServiceName()); } List<ServiceInstance> instanceList = serviceCombClient.getInstances(microservice, revision); return getList(instanceList, microservice.getServiceName()); }  }
MicroserviceHandler { public static List<ServiceInstance> getInstances(Microservice microservice, ServiceCombClient serviceCombClient) { String revision = "0"; if (serviceRevision.containsKey(microservice.getServiceName())) { revision = serviceRevision.get(microservice.getServiceName()); } List<ServiceInstance> instanceList = serviceCombClient.getInstances(microservice, revision); return getList(instanceList, microservice.getServiceName()); }  static List<ServiceInstance> getInstances(Microservice microservice,
      ServiceCombClient serviceCombClient); static Microservice createMicroservice(ServiceCombDiscoveryProperties serviceCombDiscoveryProperties,
      String serviceName); }
MicroserviceHandler { public static List<ServiceInstance> getInstances(Microservice microservice, ServiceCombClient serviceCombClient) { String revision = "0"; if (serviceRevision.containsKey(microservice.getServiceName())) { revision = serviceRevision.get(microservice.getServiceName()); } List<ServiceInstance> instanceList = serviceCombClient.getInstances(microservice, revision); return getList(instanceList, microservice.getServiceName()); }  static List<ServiceInstance> getInstances(Microservice microservice,
      ServiceCombClient serviceCombClient); static Microservice createMicroservice(ServiceCombDiscoveryProperties serviceCombDiscoveryProperties,
      String serviceName); static final Map<String, String> serviceRevision; static final Map<String, List<ServiceInstance>> discoveryServerList; }