ServerInfo implements Comparable<ServerInfo> { public String toJsonString() { if (null == _jsonString) { StringWriter out = new StringWriter(); ObjectMapper objMapper = new ObjectMapper(); try { objMapper.writeValue(out, this); _jsonString = out.toString(); } catch (Exception e) { _jsonString = "serialiationError"; } } return _jsonString; } 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 testToJsonString() { ServerInfo serverInfo = new ServerInfo("test", StateId.ONLINE.name(), new InetSocketAddress("localhost", 9000), "source1", "source2", "source3", "source4"); String jsonString = serverInfo.toJsonString(); assertEquals(true, jsonString.contains("\"name\":\"test\"")); assertEquals(true, jsonString.contains("[\"source1\",\"source2\",\"source3\",\"source4\"]")); }