@Test public void getSubscribersWithTrue() { String serviceName = "test"; String namespaceId = "public"; boolean aggregation = Boolean.TRUE; try { List<Subscriber> clients = new ArrayList<Subscriber>(); Subscriber subscriber = new Subscriber("127.0.0.1:8080", "test", "app", "127.0.0.1", namespaceId, serviceName); clients.add(subscriber); List<Member> healthyServers = new ArrayList<>(); for (int i = 0; i <= 2; i++) { Member server = new Member(); server.setIp("127.0.0.1"); server.setPort(8080 + i); server.setState(NodeState.UP); server.setExtendVal(MemberMetaDataConstants.AD_WEIGHT, 10); server.setExtendVal(MemberMetaDataConstants.SITE_KEY, "site"); server.setExtendVal(MemberMetaDataConstants.WEIGHT, 1); server.setExtendVal(MemberMetaDataConstants.RAFT_PORT, 8000 + i); healthyServers.add(server); } Mockito.when(memberManager.allMembers()).thenReturn(healthyServers); List<Subscriber> list = subscribeManager.getSubscribers(serviceName, namespaceId, aggregation); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); Assert.assertEquals("public", list.get(0).getNamespaceId()); } catch (Exception ignored) { } }
private List<Subscriber> getSubscribers(String serviceName, String namespaceId) { return pushService.getClients(serviceName, namespaceId); }
SubscribeManager { private List<Subscriber> getSubscribers(String serviceName, String namespaceId) { return pushService.getClients(serviceName, namespaceId); } }
SubscribeManager { private List<Subscriber> getSubscribers(String serviceName, String namespaceId) { return pushService.getClients(serviceName, namespaceId); }  }
SubscribeManager { private List<Subscriber> getSubscribers(String serviceName, String namespaceId) { return pushService.getClients(serviceName, namespaceId); }  List<Subscriber> getSubscribers(String serviceName, String namespaceId, boolean aggregation); static Predicate<T> distinctByKey(Function<? super T, Object> keyExtractor); }
SubscribeManager { private List<Subscriber> getSubscribers(String serviceName, String namespaceId) { return pushService.getClients(serviceName, namespaceId); }  List<Subscriber> getSubscribers(String serviceName, String namespaceId, boolean aggregation); static Predicate<T> distinctByKey(Function<? super T, Object> keyExtractor);  }