ServerInfo implements Comparable<ServerInfo> { public boolean supportsSources(List<String> sources) { return checkSubsequence(sources, getSources()); } ServerInfo(String name, String state, InetSocketAddress address, List<String> sources);  ServerInfo(String name, StateId state, InetSocketAddress address,
                    Collection<DatabusSubscription> subs,
                    SubscriptionUriCodec uriCodec);  ServerInfo(String name, String state, InetSocketAddress address, String... sources); String getPhysicalSourceName(); void setPhysicalSourceName(String PhysicalSourceName); String getName(); InetSocketAddress getAddress(); List<String> getSources(); List<DatabusSubscription> getSubs(); String toJsonString(); @Override String toString(); StringBuilder toSimpleString(StringBuilder sb); String toSimpleString(); boolean supportsSources(List<String> sources); static boolean checkSubsequence(List<String> sources, List<String> serverSources); static boolean checkSubsequenceSubsV3(List<DatabusSubscription> subs,
                                               List<DatabusSubscription> serverSubs); static ServerInfo buildServerInfoFromHostPort(String serverHostPort, String hostPortDelim); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(ServerInfo o); static final String MODULE; static final Logger LOG; }
@Test public void testSupportsSources() { ServerInfo serverInfo = new ServerInfo("test", StateId.ONLINE.name(), new InetSocketAddress("localhost", 9000), "source1", "source2", "source3", "source4"); assertEquals(4, serverInfo.getSources().size()); assertEquals(true, serverInfo.supportsSources(Arrays.asList("source1"))); assertEquals(true, serverInfo.supportsSources(Arrays.asList("source3"))); assertEquals(true, serverInfo.supportsSources(Arrays.asList("source2", "source4"))); assertEquals(false, serverInfo.supportsSources(Arrays.asList("source5"))); assertEquals(false, serverInfo.supportsSources(Arrays.asList("source3", "source1"))); }