public void TestPurgeTransactionRecord() { RecoveryFileLogger logger = new RecoveryFileLogger(); byte[] globalId = new byte[32]; byte[] branchQ = new byte[32]; byte[] recoveryData = new byte[256]; Random gen = new Random(); gen.NextBytes(globalId); gen.NextBytes(branchQ); gen.NextBytes(recoveryData); logger.Location = nonDefaultLogLocation; logger.Initialize(rmId.ToString()); XATransactionId xid = new XATransactionId(); xid.GlobalTransactionId = globalId; xid.BranchQualifier = branchQ; logger.LogRecoveryInfo(xid, recoveryData); Assert.IsTrue(File.Exists(logger.Location + Path.DirectorySeparatorChar + rmId.ToString() + ".bin"), "Recovery File was not created"); logger.Purge(); Assert.IsFalse(File.Exists(logger.Location + Path.DirectorySeparatorChar + rmId.ToString() + ".bin"), "Recovery File was not created"); }
public void TestPurgeTransactionRecord() { RecoveryFileLogger logger = new RecoveryFileLogger(); logger.Location = nonDefaultLogLocation; logger.Initialize(this.resourceManagerId.ToString()); TransactionData transactionData01 = new TransactionData(); logger.LogRecoveryInfo(transactionData01.Transaction, transactionData01.RecoveryData); TransactionData transactionData02 = new TransactionData(); logger.LogRecoveryInfo(transactionData02.Transaction, transactionData02.RecoveryData); Assert.IsTrue(File.Exists(this.GetFilename(logger, transactionData01)), "Recovery File was not created"); Assert.IsTrue(File.Exists(this.GetFilename(logger, transactionData02)), "Recovery File was not created"); logger.Purge(); this.AssertFileIsDeleted(this.GetFilename(logger, transactionData01), 1000); this.AssertFileIsDeleted(this.GetFilename(logger, transactionData02), 1000); }