public void SetUp() { this.pluginSettingsService = new PluginSettingsService(); this.expectedSettingsPath = Path.Combine( this.pluginSettingsService.AppDataFolder, this.pluginSettingsService.Cdp4ConfigurationDirectoryFolder, "CDP4RelationshipMatrix.settings.json"); this.relationshipMatrixModule = new RelationshipMatrixModule(null, null, null, null, null); this.settings = new RelationshipMatrixPluginSettings { PossibleClassKinds = new List <ClassKind> { ClassKind.ElementDefinition, ClassKind.ElementUsage, ClassKind.NestedElement, ClassKind.RequirementsSpecification, ClassKind.RequirementsGroup, ClassKind.Requirement }, PossibleDisplayKinds = new List <DisplayKind> { DisplayKind.Name, DisplayKind.ShortName } }; }
public void SetUp() { this.expectedSettingsPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"RHEA/CDP4/CDP4Composition.Tests"); this.pluginSettingsService = new PluginSettingsService(); this.testModule = new TestModule(this.pluginSettingsService); }
public void Setup() { this.serviceLocator = new Mock <IServiceLocator>(); this.messageBoxService = new Mock <IMessageBoxService>(); ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object); this.serviceLocator.Setup(x => x.GetInstance <IMessageBoxService>()).Returns(this.messageBoxService.Object); this.pluginSettingsService = new PluginSettingsService(); this.expectedSettingsPath = Path.Combine( this.pluginSettingsService.AppDataFolder, this.pluginSettingsService.Cdp4ConfigurationDirectoryFolder, "CDP4Requirements.settings.json"); this.iteration = new Iteration() { }; this.uri = "http://www.rheagroup.com/"; var credentials = new Credentials("John", "Doe", new Uri(this.uri)); this.session = new Session(new Mock <IDal>().Object, credentials); var reqIfPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "Settings", "testreq.reqif"); this.reqIf = new ReqIFDeserializer().Deserialize(reqIfPath).First(); this.dataTypeDefinitionMapConverter = new DataTypeDefinitionMapConverter(this.reqIf, this.session); this.specObjectTypeMapConverter = new SpecObjectTypeMapConverter(this.reqIf, this.session); this.specRelationTypeMapConverter = new SpecRelationTypeMapConverter(this.reqIf, this.session); this.relationGroupTypeMapConverter = new RelationGroupTypeMapConverter(this.reqIf, this.session); this.specificationTypeMapConverter = new SpecificationTypeMapConverter(this.reqIf, this.session); }
public void VerifySettingsCanBeDeserialized() { this.SetupData(); Assert.DoesNotThrow(() => { this.pluginSettingsService.Write(this.settings, this.dataTypeDefinitionMapConverter, this.specObjectTypeMapConverter, this.specRelationTypeMapConverter, this.relationGroupTypeMapConverter, this.specificationTypeMapConverter); }); ImportMappingConfiguration newSettings = null; Assert.DoesNotThrow(() => newSettings = new PluginSettingsService().Read <RequirementsModuleSettings>(true, this.dataTypeDefinitionMapConverter, this.specObjectTypeMapConverter, this.specRelationTypeMapConverter, this.relationGroupTypeMapConverter, this.specificationTypeMapConverter).SavedConfigurations.Cast <ImportMappingConfiguration>().First()); Assert.IsNotNull(newSettings); Assert.AreEqual(0, newSettings.DatatypeDefinitionMap.Count); Assert.AreEqual(2, newSettings.SpecObjectTypeMap.Count); Assert.AreEqual(1, newSettings.SpecRelationTypeMap.Count); Assert.AreEqual(0, newSettings.RelationGroupTypeMap.Count); Assert.AreEqual(1, newSettings.SpecificationTypeMap.Count); }
public void SetUp() { this.expectedSettingsPath = Path.Combine( PluginSettingsService.AppDataFolder, PluginSettingsService.CDP4ConfigurationDirectoryFolder, "CDP4Composition.Tests.settings.json"); this.pluginSettingsService = new PluginSettingsService(); this.testSettings = new TestSettings { Identifier = Guid.Parse("78d90eda-bc57-45fe-8bfa-b9ca23130a00"), Description = "this is a description" }; }
/// <summary> /// Public constructor for service. Here is where we start our file watcher and launch /// our periodic logging. /// </summary> public SimpleLogParserService(bool asMonitor = false) { _asMonitor = asMonitor; string connectionString = ConfigurationManager.ConnectionStrings["SimpleLogParserDataSource"].ConnectionString; // set up our log parser var metricService = new MetricService(connectionString); var settingsService = new PluginSettingsService(connectionString); var subscriberService = new SubscriberService(connectionString); var directory = new PluginDirectory(); _service = new StatefulParser(metricService, settingsService, directory, subscriberService, OnAlert); string path = ConfigurationManager.AppSettings["WatchDirectory"]; bool includeSubdirectories = false; try { includeSubdirectories = bool.Parse(ConfigurationManager.AppSettings["IncludeSubdirectories"]); } catch { } _queue = new FileSystemQueue(path, connectionString, includeSubdirectories); int intervalMinutes = int.Parse(ConfigurationManager.AppSettings["IntervalMinutes"] ?? "30"); // if we want active monitoring we need to start the watcher if (asMonitor) { _queue.Start(); } _timer = new Timer(FrequencyIntervalMilliseconds * intervalMinutes) { AutoReset = true }; _timer.Elapsed += (sender, eventArgs) => this.SynchronizedMain(); this.SynchronizedMain(); // call the timer callback right away to start }