protected void acquireLock(Table t, Partition p, long txnId) throws Exception {
    LockComponentBuilder lockCompBuilder = new LockComponentBuilder()
            .setLock(LockType.SHARED_WRITE)
            .setOperationType(DataOperationType.INSERT)
            .setDbName(t.getDbName())
            .setTableName(t.getTableName())
            .setIsTransactional(true);
    if (p != null) {
      lockCompBuilder.setPartitionName(t.getPartitionKeys().get(0).getName() + "=" + p.getValues().get(0));
    }
    LockRequestBuilder requestBuilder = new LockRequestBuilder().setUser(null)
            .setTransactionId(txnId).addLockComponent(lockCompBuilder.build());
    requestBuilder.setZeroWaitReadEnabled(!conf.getBoolVar(HiveConf.ConfVars.TXN_OVERWRITE_X_LOCK) ||
            !conf.getBoolVar(HiveConf.ConfVars.TXN_WRITE_X_LOCK));
    ms.lock(requestBuilder.build());
  }
Super class for all of the compactor test modules.
ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/CompactorTest.java