@Test public void shouldConnectToRMConfiguredInClusterMode() throws Exception { ViewContext viewContext = getViewContext(new HashMap<String, String>()); AmbariApi ambariApi = createNiceMock(AmbariApi.class); Cluster cluster = createNiceMock(Cluster.class); expect(ambariApi.isClusterAssociated()).andReturn(true).anyTimes(); setClusterExpectation(cluster, "HTTP_ONLY"); expect(viewContext.getCluster()).andReturn(cluster).anyTimes(); replayAll(); Services services = new Services(ambariApi, viewContext); assertEquals(HTTP_RM_URL1, services.getRMUrl()); reset(cluster); setClusterExpectation(cluster, "HTTPS_ONLY"); replay(cluster); assertEquals(HTTPS_RM_URL2, services.getRMUrl()); reset(cluster); setClusterExpectation(cluster, "HTTPS_ONLY_XYZ"); replay(cluster); assertEquals(HTTP_RM_URL1, services.getRMUrl()); }
public String getRMUrl() { String url; if (context.getCluster() != null) { url = getRMUrlFromClusterConfig(); } else { url = getRmUrlFromCustomConfig(); } return removeTrailingSlash(url); }
Services { public String getRMUrl() { String url; if (context.getCluster() != null) { url = getRMUrlFromClusterConfig(); } else { url = getRmUrlFromCustomConfig(); } return removeTrailingSlash(url); } }
Services { public String getRMUrl() { String url; if (context.getCluster() != null) { url = getRMUrlFromClusterConfig(); } else { url = getRmUrlFromCustomConfig(); } return removeTrailingSlash(url); } Services(AmbariApi ambariApi, ViewContext context); }
Services { public String getRMUrl() { String url; if (context.getCluster() != null) { url = getRMUrlFromClusterConfig(); } else { url = getRmUrlFromCustomConfig(); } return removeTrailingSlash(url); } Services(AmbariApi ambariApi, ViewContext context); String getRMUrl(); String getWebHCatURL(); String getTimelineServerUrl(); String getYARNProtocol(); static String addProtocolIfMissing(String url, String protocol); static boolean hasProtocol(String[] urls); static boolean hasProtocol(String url); String getHadoopHttpWebAuthType(); String getTimelineServerAuthType(); }
Services { public String getRMUrl() { String url; if (context.getCluster() != null) { url = getRMUrlFromClusterConfig(); } else { url = getRmUrlFromCustomConfig(); } return removeTrailingSlash(url); } Services(AmbariApi ambariApi, ViewContext context); String getRMUrl(); String getWebHCatURL(); String getTimelineServerUrl(); String getYARNProtocol(); static String addProtocolIfMissing(String url, String protocol); static boolean hasProtocol(String[] urls); static boolean hasProtocol(String url); String getHadoopHttpWebAuthType(); String getTimelineServerAuthType(); static final String HTTPS_ONLY; static final String HTTP_ONLY; static final String YARN_SITE; static final String YARN_HTTP_POLICY; static final String YARN_RESOURCEMANAGER_HA_ENABLED; static final String RM_INFO_API_ENDPOINT; static final String TIMELINE_AUTH_TYPE_PROP_KEY; static final String HADOOP_HTTP_AUTH_TYPE_KEY; }