private void doTestSessionGlobalInitFile() throws Exception {

    OperationManager operationManager = service.getService().getSessionManager()
        .getOperationManager();
    SessionHandle sessionHandle = client.openSession(null, null, null);

    // ensure there is no operation related object leak
    Assert.assertEquals("Verifying all operations used for init file are closed",
        0, operationManager.getOperations().size());

    verifyInitProperty("a", "1", sessionHandle);
    verifyInitProperty("b", "1", sessionHandle);
    verifyInitProperty("c", "1", sessionHandle);
    verifyInitProperty("hivevar:c", "1", sessionHandle);
    verifyInitProperty("d", "1", sessionHandle);

    /**
     * TODO: client.executeStatement do not support listing resources command
     * (beeline> list jar)
     */
    // Assert.assertEquals("expected uri", api.getAddedResource("jar"));

    Assert.assertEquals("Verifying all operations used for checks are closed",
        0, operationManager.getOperations().size());
    client.closeSession(sessionHandle);

  }
create session, and fetch the property set in global init file. Test if
the global init file .hiverc is loaded correctly by checking the expected
setting property.
service/src/test/org/apache/hive/service/cli/session/TestSessionGlobalInitFile.java