2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 2009, 2012 Oracle and/or its affiliates. All rights reserved.
8 using System.Collections;
9 using System.Collections.Generic;
13 using NUnit.Framework;
16 namespace CsharpAPITest
19 public class MPoolConfigTest : CSharpTestFixture
22 public void SetUpTestFixture()
24 testFixtureName = "MPoolConfigTest";
25 base.SetUpTestfixture();
29 public void TestConfig()
31 testName = "TestConfig";
34 // Config and confirm mpool subsystem configuration.
35 MPoolConfig mpoolConfig = new MPoolConfig();
36 XmlElement xmlElem = Configuration.TestSetUp(
37 testFixtureName, testName);
38 Config(xmlElem, ref mpoolConfig, true);
39 Confirm(xmlElem, mpoolConfig, true);
42 public static void Confirm(XmlElement
43 xmlElement, MPoolConfig mpoolConfig, bool compulsory)
45 Configuration.ConfirmCacheSize(xmlElement,
46 "CacheSize", mpoolConfig.CacheSize, compulsory);
47 Configuration.ConfirmCacheSize(xmlElement,
48 "MaxCacheSize", mpoolConfig.MaxCacheSize,
50 Configuration.ConfirmInt(xmlElement, "MaxOpenFiles",
51 mpoolConfig.MaxOpenFiles, compulsory);
52 Configuration.ConfirmUint(xmlElement,
54 mpoolConfig.MMapSize, compulsory);
55 Configuration.ConfirmMaxSequentialWrites(xmlElement,
56 "MaxSequentialWrites",
57 mpoolConfig.SequentialWritePause,
58 mpoolConfig.MaxSequentialWrites, compulsory);
61 public static void Config(XmlElement
62 xmlElement, ref MPoolConfig mpoolConfig, bool compulsory)
64 uint uintValue = new uint();
65 int intValue = new int();
67 Configuration.ConfigCacheInfo(xmlElement,
68 "CacheSize", ref mpoolConfig.CacheSize, compulsory);
69 Configuration.ConfigCacheInfo(xmlElement,
70 "MaxCacheSize", ref mpoolConfig.MaxCacheSize,
72 if (Configuration.ConfigInt(xmlElement, "MaxOpenFiles",
73 ref intValue, compulsory))
74 mpoolConfig.MaxOpenFiles = intValue;
75 Configuration.ConfigMaxSequentialWrites(
76 xmlElement, "MaxSequentialWrites", mpoolConfig,
78 if (Configuration.ConfigUint(xmlElement,
79 "MMapSize", ref uintValue, compulsory))
80 mpoolConfig.MMapSize = uintValue;