Ejemplo n.º 1
0
        public void TestAppendWithoutTxn()
        {
            testName = "TestAppendWithoutTxn";
            testHome = testFixtureHome + "/" + testName;
            string queueDBFileName = testHome + "/" + testName + ".db";

            Configuration.ClearDir(testHome);

            QueueDatabaseConfig queueConfig = new QueueDatabaseConfig();

            queueConfig.Creation = CreatePolicy.ALWAYS;
            queueConfig.Length   = 1000;
            QueueDatabase queueDB = QueueDatabase.Open(
                queueDBFileName, queueConfig);

            byte[] byteArr = new byte[4];
            byteArr = BitConverter.GetBytes((int)1);
            DatabaseEntry data  = new DatabaseEntry(byteArr);
            uint          recno = queueDB.Append(data);

            // Confirm that the recno is larger than 0.
            Assert.AreNotEqual(0, recno);

            // Confirm that the record exists in the database.
            byteArr = BitConverter.GetBytes(recno);
            DatabaseEntry key = new DatabaseEntry();

            key.Data = byteArr;
            Assert.IsTrue(queueDB.Exists(key));
            queueDB.Close();
        }