@Test public void connectionTest() { ISchemaRegistryClient client = new DefaultSchemaRegistryClientForTesting(); AutocompletionAgent autocompletionAgent = new AutocompletionAgent("schema-registry", client); HashMap<String, Object> res = autocompletionAgent.connectionTest(); assertEquals(res.get("connectivityStatus"), true); assertEquals(res.get("message"), "ConnectionTest Successful"); assertEquals(res.get("description"), "ConnectionTest Successful"); assertNull(res.get("objectId")); assertNull(res.get("fieldName")); client = new DefaultSchemaRegistryClientForTesting() { public void checkConnection() throws Exception { throw new Exception("Cannot connect to the SR server"); } }; autocompletionAgent = new AutocompletionAgent("schema-registry", client); res = autocompletionAgent.connectionTest(); String errMessage = "You can still save the repository and start creating " + "policies, but you would not be able to use autocomplete for " + "resource names. Check server logs for more info."; assertEquals(res.get("connectivityStatus"), false); assertThat(res.get("message"), is(errMessage)); assertThat(res.get("description"), is(errMessage)); assertNull(res.get("objectId")); assertNull(res.get("fieldName")); }
public HashMap<String, Object> connectionTest() { HashMap<String, Object> responseData = new HashMap<String, Object>(); try { client.checkConnection(); BaseClient.generateResponseDataMap(true, successMsg, successMsg, null, null, responseData); if(LOG.isDebugEnabled()) { LOG.debug("ConnectionTest Successful."); } } catch (Exception e) { LOG.error("Error connecting to SchemaRegistry. schemaRegistryClient=" + this, e); BaseClient.generateResponseDataMap(false, errMessage, errMessage, null, null, responseData); } return responseData; }
AutocompletionAgent { public HashMap<String, Object> connectionTest() { HashMap<String, Object> responseData = new HashMap<String, Object>(); try { client.checkConnection(); BaseClient.generateResponseDataMap(true, successMsg, successMsg, null, null, responseData); if(LOG.isDebugEnabled()) { LOG.debug("ConnectionTest Successful."); } } catch (Exception e) { LOG.error("Error connecting to SchemaRegistry. schemaRegistryClient=" + this, e); BaseClient.generateResponseDataMap(false, errMessage, errMessage, null, null, responseData); } return responseData; } }
AutocompletionAgent { public HashMap<String, Object> connectionTest() { HashMap<String, Object> responseData = new HashMap<String, Object>(); try { client.checkConnection(); BaseClient.generateResponseDataMap(true, successMsg, successMsg, null, null, responseData); if(LOG.isDebugEnabled()) { LOG.debug("ConnectionTest Successful."); } } catch (Exception e) { LOG.error("Error connecting to SchemaRegistry. schemaRegistryClient=" + this, e); BaseClient.generateResponseDataMap(false, errMessage, errMessage, null, null, responseData); } return responseData; } AutocompletionAgent(String serviceName, Map<String, String> configs);  AutocompletionAgent(String serviceName, ISchemaRegistryClient client); }
AutocompletionAgent { public HashMap<String, Object> connectionTest() { HashMap<String, Object> responseData = new HashMap<String, Object>(); try { client.checkConnection(); BaseClient.generateResponseDataMap(true, successMsg, successMsg, null, null, responseData); if(LOG.isDebugEnabled()) { LOG.debug("ConnectionTest Successful."); } } catch (Exception e) { LOG.error("Error connecting to SchemaRegistry. schemaRegistryClient=" + this, e); BaseClient.generateResponseDataMap(false, errMessage, errMessage, null, null, responseData); } return responseData; } AutocompletionAgent(String serviceName, Map<String, String> configs);  AutocompletionAgent(String serviceName, ISchemaRegistryClient client); HashMap<String, Object> connectionTest(); List<String> getSchemaGroupList(String lookupGroupName, List<String> groupList); List<String> getSchemaMetadataList(String lookupSchemaMetadataName,
                                              List<String> schemaGroupList,
                                              List<String> schemaMetadataList); List<String> getBranchList(String lookupBranchName,
                                      List<String> groupList,
                                      List<String> schemaList,
                                      List<String> branchList); @Override String toString(); }
AutocompletionAgent { public HashMap<String, Object> connectionTest() { HashMap<String, Object> responseData = new HashMap<String, Object>(); try { client.checkConnection(); BaseClient.generateResponseDataMap(true, successMsg, successMsg, null, null, responseData); if(LOG.isDebugEnabled()) { LOG.debug("ConnectionTest Successful."); } } catch (Exception e) { LOG.error("Error connecting to SchemaRegistry. schemaRegistryClient=" + this, e); BaseClient.generateResponseDataMap(false, errMessage, errMessage, null, null, responseData); } return responseData; } AutocompletionAgent(String serviceName, Map<String, String> configs);  AutocompletionAgent(String serviceName, ISchemaRegistryClient client); HashMap<String, Object> connectionTest(); List<String> getSchemaGroupList(String lookupGroupName, List<String> groupList); List<String> getSchemaMetadataList(String lookupSchemaMetadataName,
                                              List<String> schemaGroupList,
                                              List<String> schemaMetadataList); List<String> getBranchList(String lookupBranchName,
                                      List<String> groupList,
                                      List<String> schemaList,
                                      List<String> branchList); @Override String toString();  }