@Test public void testGetUrl() throws Exception { Cluster cluster = createNiceMock(Cluster.class); Config config = createNiceMock(Config.class); Map<String, String> map = new HashMap<>(); map.put("atlas.enableTLS", "false"); map.put("atlas.server.http.port", "21000"); expect(cluster.getDesiredConfigByType("application-properties")).andReturn(config).anyTimes(); expect(config.getProperties()).andReturn(map).anyTimes(); replay(cluster, config); AtlasServerHttpPropertyRequest propertyRequest = new AtlasServerHttpPropertyRequest(); String url = propertyRequest.getUrl(cluster, "host1"); Assert.assertEquals("http: }
@Override public String getUrl(Cluster cluster, String hostName) throws SystemException { Map<String, String> atlasConfig = cluster.getDesiredConfigByType(CONFIG_APPLICATION_PROPERTIES).getProperties(); boolean useHttps = Boolean.parseBoolean(getConfigValue(atlasConfig, PROPERTY_ENABLE_TLS, "false")); String port = useHttps ? getConfigValue(atlasConfig, PROPERTY_SERVER_HTTPS_PORT, "21443") : getConfigValue(atlasConfig, PROPERTY_SERVER_HTTP_PORT, "21000"); return String.format(URL_TEMPLATE, useHttps ? "https" : "http", hostName, port); }
AtlasServerHttpPropertyRequest extends JsonHttpPropertyRequest { @Override public String getUrl(Cluster cluster, String hostName) throws SystemException { Map<String, String> atlasConfig = cluster.getDesiredConfigByType(CONFIG_APPLICATION_PROPERTIES).getProperties(); boolean useHttps = Boolean.parseBoolean(getConfigValue(atlasConfig, PROPERTY_ENABLE_TLS, "false")); String port = useHttps ? getConfigValue(atlasConfig, PROPERTY_SERVER_HTTPS_PORT, "21443") : getConfigValue(atlasConfig, PROPERTY_SERVER_HTTP_PORT, "21000"); return String.format(URL_TEMPLATE, useHttps ? "https" : "http", hostName, port); } }
AtlasServerHttpPropertyRequest extends JsonHttpPropertyRequest { @Override public String getUrl(Cluster cluster, String hostName) throws SystemException { Map<String, String> atlasConfig = cluster.getDesiredConfigByType(CONFIG_APPLICATION_PROPERTIES).getProperties(); boolean useHttps = Boolean.parseBoolean(getConfigValue(atlasConfig, PROPERTY_ENABLE_TLS, "false")); String port = useHttps ? getConfigValue(atlasConfig, PROPERTY_SERVER_HTTPS_PORT, "21443") : getConfigValue(atlasConfig, PROPERTY_SERVER_HTTP_PORT, "21000"); return String.format(URL_TEMPLATE, useHttps ? "https" : "http", hostName, port); } AtlasServerHttpPropertyRequest(); }
AtlasServerHttpPropertyRequest extends JsonHttpPropertyRequest { @Override public String getUrl(Cluster cluster, String hostName) throws SystemException { Map<String, String> atlasConfig = cluster.getDesiredConfigByType(CONFIG_APPLICATION_PROPERTIES).getProperties(); boolean useHttps = Boolean.parseBoolean(getConfigValue(atlasConfig, PROPERTY_ENABLE_TLS, "false")); String port = useHttps ? getConfigValue(atlasConfig, PROPERTY_SERVER_HTTPS_PORT, "21443") : getConfigValue(atlasConfig, PROPERTY_SERVER_HTTP_PORT, "21000"); return String.format(URL_TEMPLATE, useHttps ? "https" : "http", hostName, port); } AtlasServerHttpPropertyRequest(); @Override String getUrl(Cluster cluster, String hostName); }
AtlasServerHttpPropertyRequest extends JsonHttpPropertyRequest { @Override public String getUrl(Cluster cluster, String hostName) throws SystemException { Map<String, String> atlasConfig = cluster.getDesiredConfigByType(CONFIG_APPLICATION_PROPERTIES).getProperties(); boolean useHttps = Boolean.parseBoolean(getConfigValue(atlasConfig, PROPERTY_ENABLE_TLS, "false")); String port = useHttps ? getConfigValue(atlasConfig, PROPERTY_SERVER_HTTPS_PORT, "21443") : getConfigValue(atlasConfig, PROPERTY_SERVER_HTTP_PORT, "21000"); return String.format(URL_TEMPLATE, useHttps ? "https" : "http", hostName, port); } AtlasServerHttpPropertyRequest(); @Override String getUrl(Cluster cluster, String hostName);  }