@Test
  public void testDataConnector() throws Throwable {
    final String connector_name1 = "test_connector1";
    final String connector_name2 = "test_connector2";
    final String mysql_type = "mysql";
    final String mysql_url = "jdbc:mysql://nightly1.apache.org:3306/hive1";
    final String postgres_type = "postgres";
    final String postgres_url = "jdbc:postgresql://localhost:5432";

    try {
      DataConnector connector = new DataConnector(connector_name1, mysql_type, mysql_url);
      Map<String, String> params = new HashMap<>();
      params.put(AbstractJDBCConnectorProvider.JDBC_USERNAME, "hive");
      params.put(AbstractJDBCConnectorProvider.JDBC_PASSWORD, "hive");
      connector.setParameters(params);
      client.createDataConnector(connector);

      DataConnector dConn = client.getDataConnector(connector_name1);
      assertNotNull(dConn);
      assertEquals("name of returned data connector is different from that of inserted connector", connector_name1,
          dConn.getName());
      assertEquals("type of data connector returned is different from the type inserted", mysql_type, dConn.getType());
      assertEquals("url of the data connector returned is different from the url inserted", mysql_url, dConn.getUrl());
      // assertEquals(SecurityUtils.getUser(), dConn.getOwnerName());
      assertEquals(PrincipalType.USER, dConn.getOwnerType());
      assertNotEquals("Size of data connector parameters not as expected", 0, dConn.getParametersSize());

      try {
        client.createDataConnector(connector);
        fail("Creating duplicate connector should fail");
      } catch (Exception e) { /* as expected */ }

      connector = new DataConnector(connector_name2, postgres_type, postgres_url);
      params = new HashMap<>();
      params.put(AbstractJDBCConnectorProvider.JDBC_USERNAME, "hive");
      params.put(AbstractJDBCConnectorProvider.JDBC_PASSWORD, "hive");
      connector.setParameters(params);
      client.createDataConnector(connector);

      dConn = client.getDataConnector(connector_name2);
      assertEquals("name of returned data connector is different from that of inserted connector", connector_name2,
          dConn.getName());
      assertEquals("type of data connector returned is different from the type inserted", postgres_type, dConn.getType());
      assertEquals("url of the data connector returned is different from the url inserted", postgres_url, dConn.getUrl());

      List<String> connectors = client.getAllDataConnectorNames();
      assertEquals("Number of dataconnectors returned is not as expected", 2, connectors.size());

      DataConnector connector1 = new DataConnector(connector);
      connector1.setUrl(mysql_url);
      client.alterDataConnector(connector.getName(), connector1);

      dConn = client.getDataConnector(connector.getName());
      assertEquals("url of the data connector returned is different from the url inserted", mysql_url, dConn.getUrl());

      // alter data connector parameters
      params.put(AbstractJDBCConnectorProvider.JDBC_NUM_PARTITIONS, "5");
      connector1.setParameters(params);
      client.alterDataConnector(connector.getName(), connector1);

      dConn = client.getDataConnector(connector.getName());
      assertEquals("Size of data connector parameters not as expected", 3, dConn.getParametersSize());

      // alter data connector parameters
      connector1.setOwnerName("hiveadmin");
      connector1.setOwnerType(PrincipalType.ROLE);
      client.alterDataConnector(connector.getName(), connector1);

      dConn = client.getDataConnector(connector.getName());
      assertEquals("Data connector owner name not as expected", "hiveadmin", dConn.getOwnerName());
      assertEquals("Data connector owner type not as expected", PrincipalType.ROLE, dConn.getOwnerType());

      client.dropDataConnector(connector_name1, false, false);
      connectors = client.getAllDataConnectorNames();
      assertEquals("Number of dataconnectors returned is not as expected", 1, connectors.size());

      client.dropDataConnector(connector_name2, false, false);
      connectors = client.getAllDataConnectorNames();
      assertEquals("Number of dataconnectors returned is not as expected", 0, connectors.size());
    } catch (Throwable e) {
      System.err.println(StringUtils.stringifyException(e));
      System.err.println("testDataConnector() failed.");
      throw e;
    }
  }
While altering partition(s), verify DO NOT calculate partition statistics if
<ol>
  <li>table property DO_NOT_UPDATE_STATS is true</li>
  <li>STATS_AUTO_GATHER is false</li>
  <li>Is View</li>
</ol>
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java