Prechádzať zdrojové kódy

AMBARI-14442. Typo in error message displayed when connection fails in Hive view (alexantonenko)

Alex Antonenko 9 rokov pred
rodič
commit
37a0ff7ec1

+ 1 - 1
contrib/views/hive/src/main/java/org/apache/ambari/view/hive/client/Connection.java

@@ -107,7 +107,7 @@ public class Connection {
       transport.open();
       client = new TCLIService.Client(new TBinaryProtocol(transport));
     } catch (TTransportException e) {
-      throw new HiveClientException("H020 Could not establish connecton to "
+      throw new HiveClientException("H020 Could not establish connection to "
           + host + ":" + port + ": " + e.toString(), e);
     } catch (SQLException e) {
       throw new HiveClientException(e.getMessage(), e);

+ 10 - 0
contrib/views/hive/src/test/java/org/apache/ambari/view/hive/client/ConnectionTest.java

@@ -40,6 +40,16 @@ public class ConnectionTest {
     new Connection("127.0.0.1", 42420, auth, "ambari-qa", null);
   }
 
+  @Test
+  public void testOpenConnectionMessage() throws Exception {
+    HashMap<String, String> auth = new HashMap<String, String>();
+    auth.put("auth", "NONE");
+
+    thrown.expect(HiveClientException.class);
+    thrown.expectMessage("H020 Could not establish connection to");
+    new Connection("127.0.0.1", 42420, auth, "ambari-qa", null);
+  }
+
   @Test
   public void testAskPasswordWithoutPassword() throws Exception {
     HashMap<String, String> auth = new HashMap<String, String>();