从soapui框架读取配置单元数据

6l7fqoea  于 2021-06-29  发布在  Hive
关注(0)|答案(1)|浏览(358)

我不熟悉soapui框架。我正在尝试使用soapui框架来测试restapi。在测试restapi时,我需要验证来自后端数据库的数据,比如hive和cassandra。
我可以为soapui做设置,并且可以使用soapui框架提供的groovy脚本测试cassandra上的查询。但是当我使用soapui搜索连接到hive时,我找不到任何关于这个的参考。同样在这些站点上,没有提供jdbc驱动程序,但是没有提到hive。
那么,有没有从soapui框架连接到hive的选项呢?
我应该考虑从soapui使用hivejdbc驱动程序吗?
谢谢你的帮助!

i2byvkas

i2byvkas1#

我相信您应该能够通过以下方式将其用于不同的数据库:
jdbc测试步骤
groovy脚本(您应该能够使用几乎所有的java代码)
无论哪种方法,都可以将驱动程序/库复制到 SOAPUI_HOME/bin/ext 目录并重新启动 SoapUI 下面是客户端代码(在java中)要连接到的链接 Hive .
上面链接中的示例连接代码(因此应该能够在groovy中使用):

try {
      Class.forName(driverName);
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      System.exit(1);
    }
    Connection con = DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", "");
    Statement stmt = con.createStatement();
    String tableName = "testHiveDriverTable";
    stmt.executeQuery("drop table " + tableName);
    ResultSet res = stmt.executeQuery("create table " + tableName + " (key int, value string)");
    // show tables
    String sql = "show tables '" + tableName + "'";
    System.out.println("Running: " + sql);
    res = stmt.executeQuery(sql);

相关问题