Services { public String getYARNProtocol() { String httpPolicy = getYarnConfig(YARN_HTTP_POLICY); if (!(HTTP_ONLY.equals(httpPolicy) || HTTPS_ONLY.equals(httpPolicy))) { LOG.error(String.format("RA030 Unknown value %s of yarn-site/yarn.http.policy. HTTP_ONLY assumed.", httpPolicy)); httpPolicy = HTTP_ONLY; } return getProtocol(httpPolicy); } 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; }
@Test public void basicGetYARNProtocol() 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(); setClusterExpectationWithEmptyWebappConfig(cluster, "HTTP_ONLY"); expect(viewContext.getCluster()).andReturn(cluster).anyTimes(); Services services = new Services(ambariApi, viewContext); replayAll(); assertEquals("http", services.getYARNProtocol()); }