summaryrefslogtreecommitdiff
path: root/test/csharp/QueueDatabaseTest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'test/csharp/QueueDatabaseTest.cs')
-rw-r--r--test/csharp/QueueDatabaseTest.cs59
1 files changed, 58 insertions, 1 deletions
diff --git a/test/csharp/QueueDatabaseTest.cs b/test/csharp/QueueDatabaseTest.cs
index d60f6fe0..87477feb 100644
--- a/test/csharp/QueueDatabaseTest.cs
+++ b/test/csharp/QueueDatabaseTest.cs
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2009, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
using System;
@@ -442,6 +442,61 @@ namespace CsharpAPITest
}
[Test]
+ public void TestMessageFile()
+ {
+ testName = "TestMessageFile";
+ SetUpTest(true);
+
+ // Configure and open an environment.
+ DatabaseEnvironmentConfig envConfig =
+ new DatabaseEnvironmentConfig();
+ envConfig.Create = true;
+ envConfig.UseMPool = true;
+ DatabaseEnvironment env = DatabaseEnvironment.Open(
+ testHome, envConfig);
+
+ // Configure and open a database.
+ QueueDatabaseConfig DBConfig =
+ new QueueDatabaseConfig();
+ DBConfig.Env = env;
+ DBConfig.Creation = CreatePolicy.IF_NEEDED;
+
+ string DBFileName = testName + ".db";
+ QueueDatabase db = QueueDatabase.Open(
+ DBFileName, DBConfig);
+
+ // Confirm message file does not exist.
+ string messageFile = testHome + "/" + "msgfile";
+ Assert.AreEqual(false, File.Exists(messageFile));
+
+ // Call set_msgfile() of db.
+ db.Msgfile = messageFile;
+
+ // Print db statistic to message file.
+ db.PrintStats(true);
+
+ // Confirm message file exists now.
+ Assert.AreEqual(true, File.Exists(messageFile));
+
+ db.Msgfile = "";
+ string line = null;
+
+ // Read the third line of message file.
+ System.IO.StreamReader file = new System.IO.StreamReader(@"" + messageFile);
+ line = file.ReadLine();
+ line = file.ReadLine();
+ line = file.ReadLine();
+
+ // Confirm the message file is not empty.
+ Assert.AreEqual(line, "DB handle information:");
+ file.Close();
+
+ // Close database and environment.
+ db.Close();
+ env.Close();
+ }
+
+ [Test]
public void TestOpenExistingQueueDB()
{
testName = "TestOpenExistingQueueDB";
@@ -619,6 +674,7 @@ namespace CsharpAPITest
QueueStats stats = db.Stats();
ConfirmStatsPart1Case1(stats);
+ db.Msgfile = testHome + "/" + testName+ ".log";
db.PrintFastStats(true);
// Put 500 records into the database.
@@ -674,6 +730,7 @@ namespace CsharpAPITest
stats = db.Stats(statsTxn, Isolation.DEGREE_ONE);
ConfirmStatsPart1Case1(stats);
+ db.Msgfile = home + "/" + name+ ".log";
db.PrintStats(true);
// Put 500 records into the database.