http://git-wip-us.apache.org/repos/asf/knox/blob/e5fd0622/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreatorTest.java
--
diff --cc
gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreatorTest.java
index f015dd5,000..c0b1de8
mode 100644,00..100644
---
a/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreatorTest.java
+++
b/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreatorTest.java
@@@ -1,876 -1,0 +1,920 @@@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+package org.apache.knox.gateway.topology.discovery.ambari;
+
+import org.apache.commons.io.FileUtils;
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import static junit.framework.TestCase.assertTrue;
+import static junit.framework.TestCase.fail;
+import static org.junit.Assert.assertEquals;
++import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+
+public class AmbariDynamicServiceURLCreatorTest {
+
+@Test
+public void testHiveURLFromInternalMapping() throws Exception {
+testHiveURL(null);
+}
+
+@Test
+public void testHiveURLFromExternalMapping() throws Exception {
+testHiveURL(TEST_MAPPING_CONFIG);
+}
+
+private void testHiveURL(Object mappingConfiguration) throws Exception {
+
+final String SERVICE_NAME = "HIVE";
+final String[] HOSTNAMES= {"host3", "host2", "host4"};
+final String HTTP_PATH= "cliservice";
+final String HTTP_PORT= "10001";
+final String BINARY_PORT = "1";
+
+String expectedScheme = "http";
+
+final List hiveServerHosts = Arrays.asList(HOSTNAMES);
+
+AmbariComponent hiveServer =
EasyMock.createNiceMock(AmbariComponent.class);
+
+AmbariCluster cluster = EasyMock.createNiceMock(AmbariCluster.class);
+
EasyMock.expect(cluster.getComponent("HIVE_SERVER")).andReturn(hiveServer).anyTimes();
+EasyMock.replay(cluster);
+
+// Configure HTTP Transport
+
EasyMock.expect(hiveServer.getHostNames()).andReturn(hiveServerHosts).anyTimes();
+
EasyMock.expect(hiveServer.getConfigProperty("hive.server2.use.SSL")).andReturn("false").anyTimes();
+
EasyMock.expect(hiveServer.getConfigProperty("hive.server2.thrift.http.path")).andReturn(HTTP_PATH).anyTimes();
+
EasyMock.expect(hiveServer.getConfigProperty("hive.server2.thrift.http.port")).andReturn(HTTP_PORT).anyTimes();
+
EasyMock.expect(hiveServer.getConfigProperty("hive.server2.transport.mode")).andReturn("http").anyTimes();
+EasyMock.replay(hiveServer);
+
+// Run the test
+AmbariDynamicServiceURLCreator builder = newURLCreator(cluster,
mappingConfiguration);
+List urls = builder.create(SERVICE_NAME);
+assertEquals(HOSTNAMES.length, urls.size());
+validateServiceURLs(urls, HOSTNAMES, expectedScheme, HTTP_PORT,
HTTP_PATH);
+
+// Configure BINARY Transport
+EasyMock.reset(hiveServer);
+
EasyMock.expect(hiveServer.getHostNames()).andReturn(hiveServerHosts).anyTimes();
+
EasyMock.expect(hiveServer.getConfigProperty("hive.server2.use.SSL")).andReturn("false").anyTimes();
+
EasyMock.expect(hiveServer.getConfigProperty("hive.server2.thrift.http.path")).andReturn("").anyTimes();
+
EasyMock.expect(hiveServer.getConfigProperty("hive.server2.thrift.http.port")).andReturn(HTTP_PORT).anyTimes();
+
EasyMock.expect(hiveServer.getConfigProperty("hive.server2.thrift.port")).andReturn(BINARY_PORT).anyTimes();
+