public void OpenAndSaveConfiguration() { ApplicationNode.Hierarchy.Load(); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); ApplicationNode.Hierarchy.Open(); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); CacheManagerSettingsNode rootNode = (CacheManagerSettingsNode)Hierarchy.FindNodeByType(ApplicationNode, typeof(CacheManagerSettingsNode)); Assert.IsNotNull(rootNode); Assert.AreEqual("ShortInMemoryPersistence", rootNode.DefaultCacheManager.Name); Assert.AreEqual(1, Hierarchy.FindNodesByType(ApplicationNode, typeof(CacheManagerSettingsNode)).Count); Assert.AreEqual(2, Hierarchy.FindNodesByType(ApplicationNode, typeof(CacheManagerNode)).Count); Assert.AreEqual(1, Hierarchy.FindNodesByType(ApplicationNode, typeof(CacheStorageNode)).Count); Hierarchy.Load(); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); Hierarchy.Open(); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); CacheManagerCollectionNode cacheManagerCollectionNode = (CacheManagerCollectionNode)Hierarchy.FindNodeByType(ApplicationNode, typeof(CacheManagerCollectionNode)); CacheManagerNode cacheManagerNode = new CacheManagerNode(); cacheManagerCollectionNode.AddNode(cacheManagerNode); AddDataCacheStorageCommand cmd = new AddDataCacheStorageCommand(ServiceProvider); cmd.Execute(cacheManagerNode); DataCacheStorageNode dataNode = (DataCacheStorageNode)Hierarchy.FindNodeByType(ApplicationNode, typeof(DataCacheStorageNode)); ConnectionStringSettingsNode connectNode = (ConnectionStringSettingsNode)Hierarchy.FindNodeByType(ApplicationNode, typeof(ConnectionStringSettingsNode)); dataNode.DatabaseInstance = connectNode; dataNode.PartitionName = "foo"; Assert.AreEqual(1, Hierarchy.FindNodesByType(ApplicationNode, typeof(DatabaseSectionNode)).Count); Hierarchy.Save(); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); Hierarchy.Load(); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); Hierarchy.Open(); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); Assert.AreEqual(1, Hierarchy.FindNodesByType(ApplicationNode, typeof(DataCacheStorageNode)).Count); dataNode = (DataCacheStorageNode)Hierarchy.FindNodeByType(ApplicationNode, typeof(DataCacheStorageNode)); Assert.AreEqual(dataNode.DatabaseInstance.Name, connectNode.Name); Assert.AreEqual(dataNode.PartitionName, "foo"); DatabaseSectionNode databaseSectionNode = (DatabaseSectionNode)Hierarchy.FindNodeByType(ApplicationNode, typeof(DatabaseSectionNode)); databaseSectionNode.Remove(); dataNode.Remove(); Hierarchy.Save(); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); }
public void RegisterXmlIncludeTypeTest() { DataCacheStorageNode node = new DataCacheStorageNode(); CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration()); GeneratedHierarchy.Open(); Type[] types = XmlIncludeTypeService.GetXmlIncludeTypes(CacheManagerSettings.SectionName); Assert.AreEqual(1, types.Length); Assert.AreEqual(typeof(DataCacheStorageData), types[0]); }
public void DataTest() { string name = "testName"; string type = typeof(DataBackingStore).AssemblyQualifiedName; DataCacheStorageData data = new DataCacheStorageData(); data.Name = name; DataCacheStorageNode node = new DataCacheStorageNode(data); CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration()); Assert.AreEqual(name, node.Name); Assert.AreEqual(type, node.Type); }
public void RegisterTest() { CachingDatabaseConfigurationDesignManager manager = new CachingDatabaseConfigurationDesignManager(); ApplicationData data = ApplicationData.FromCurrentAppDomain(); ApplicationConfigurationNode node = new ApplicationConfigurationNode(data); CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration()); manager.Register(Host); DataCacheStorageNode testNode = NodeCreationService.CreateNode(typeof(DataCacheStorageData), new object[] { new DataCacheStorageData() }) as DataCacheStorageNode; Assert.IsNotNull(testNode); }
public void NodeTest() { string databaseInstanceName = "dabaseInstanceName"; string databasePartitionName = "databasePartitionName"; InstanceNode databaseNode = new InstanceNode(new InstanceData(databaseInstanceName)); DataCacheStorageNode node = new DataCacheStorageNode(); IUIHierarchy hierarchy = CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration()); hierarchy.AddNode(databaseNode); node.DatabaseInstance = databaseNode; node.PartitionName = databasePartitionName; Assert.AreEqual(databaseInstanceName, node.DatabaseInstance.Name); DataCacheStorageData nodeData = (DataCacheStorageData) node.CacheStorageData; Assert.AreEqual(databaseInstanceName, nodeData.DatabaseInstanceName); }
public void NodeTest() { string databaseInstanceName = "dabaseInstanceName"; string databasePartitionName = "databasePartitionName"; InstanceNode databaseNode = new InstanceNode(new InstanceData(databaseInstanceName)); DataCacheStorageNode node = new DataCacheStorageNode(); IUIHierarchy hierarchy = CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration()); hierarchy.AddNode(databaseNode); node.DatabaseInstance = databaseNode; node.PartitionName = databasePartitionName; Assert.AreEqual(databaseInstanceName, node.DatabaseInstance.Name); DataCacheStorageData nodeData = (DataCacheStorageData)node.CacheStorageData; Assert.AreEqual(databaseInstanceName, nodeData.DatabaseInstanceName); }