@Test
  public void testAlterPartitionsWithEnvironmentCtx() throws Exception {
    EnvironmentContext context = new EnvironmentContext();
    context.setProperties(new HashMap<String, String>(){
      {
        put("TestKey", "TestValue");
      }
    });

    List<List<String>> testValues = createTable4PartColsParts(client);
    List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);

    for (int i = 0; i < testValues.size(); ++i) {
      assertPartitionUnchanged(oldParts.get(i), testValues.get(i), PARTCOL_SCHEMA);
    }
    oldParts.forEach(p -> makeTestChangesOnPartition(p));

    client.alter_partitions(DB_NAME, TABLE_NAME, oldParts, context);

    List<Partition> newParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);

    for (int i = 0; i < testValues.size(); ++i) {
      assertPartitionChanged(oldParts.get(i), testValues.get(i), PARTCOL_SCHEMA);
    }
    assertPartitionsHaveCorrectValues(newParts, testValues);

    client.alter_partitions(DB_NAME, TABLE_NAME, newParts, new EnvironmentContext());
    client.alter_partitions(DB_NAME, TABLE_NAME, newParts);

    for (int i = 0; i < testValues.size(); ++i) {
      assertPartitionChanged(oldParts.get(i), testValues.get(i), PARTCOL_SCHEMA);
    }
  }
Testing
   alter_partitions(String,String,List(Partition),EnvironmentContext) ->
   alter_partitions_with_environment_context(String,String,List(Partition),EnvironmentContext).
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAlterPartitions.java