public SPRSynchronizationUtility(StreamWriter logFile, string scope, string app) { _logFile = logFile; _settings = new NameValueCollection(); _settings["XmlPath"] = @".\App_Data\"; _baseDirectory = Directory.GetCurrentDirectory(); if (_baseDirectory.Contains("\\bin")) { _baseDirectory = _baseDirectory.Substring(0, _baseDirectory.LastIndexOf("\\bin")); Directory.SetCurrentDirectory(_baseDirectory); } _settings["BaseDirectoryPath"] = _baseDirectory; _settings["ProjectName"] = scope; _settings["ApplicationName"] = app; _adapterSettings = new AdapterSettings(); _adapterSettings.AppendSettings(_settings); string appSettingsPath = String.Format("{0}{1}.{2}.config", _adapterSettings["XmlPath"], _settings["ProjectName"], _settings["ApplicationName"] ); if (File.Exists(appSettingsPath)) { AppSettingsReader appSettings = new AppSettingsReader(appSettingsPath); _adapterSettings.AppendSettings(appSettings); } _dataLayer = new SPRDataLayer(_adapterSettings); _dataLayer.GetDictionary(); _dataLayer.EnableLogging(_logFile); }
public void it_should_return_empty_settings() { var expected = new AdapterSettings(); var actual = repository.Load(discoveryContext); actual.ShouldBeEquivalentTo(expected, this.GetType().Name); }
public SPRSynchronizationUtility(StreamWriter logFile, string scope, string app) { _logFile = logFile; _settings = new NameValueCollection(); _settings["XmlPath"] = @".\App_Data\"; _baseDirectory = Directory.GetCurrentDirectory(); if (_baseDirectory.Contains("\\bin")) { _baseDirectory = _baseDirectory.Substring(0, _baseDirectory.LastIndexOf("\\bin")); Directory.SetCurrentDirectory(_baseDirectory); } _settings["BaseDirectoryPath"] = _baseDirectory; _settings["ProjectName"] = scope; _settings["ApplicationName"] = app; _adapterSettings = new AdapterSettings(); _adapterSettings.AppendSettings(_settings); string appSettingsPath = String.Format("{0}{1}.{2}.config", _adapterSettings["XmlPath"], _settings["ProjectName"], _settings["ApplicationName"] ); if (File.Exists(appSettingsPath)) { AppSettingsReader appSettings = new AppSettingsReader(appSettingsPath); _adapterSettings.AppendSettings(appSettings); } _dataLayer = new SPRDataLayer(_adapterSettings); _dataLayer.GetDictionary(); _dataLayer.EnableLogging(_logFile); }
public ObjectDataLayer(AdapterSettings settings) : base(settings) { _settings = settings; _widgetProvider = new WidgetProvider(); }
public void RetrievePropertiesFromSettings(int?portNumber) { var expectedClientId = "Expected Client ID"; var expectedServer = "mqtt.server.example.com"; var expectedPort = portNumber; var expectedUser = "******"; var expectedPassword = "******"; var expectedVersion = "0.0.TEST"; var configuration = new Mock <IConfiguration>(); var section = new Mock <IConfigurationSection>(); configuration.Setup(c => c.GetSection(It.Is <string>(v => "MQTT".Equals(v)))).Returns(section.Object); section.SetupGet(s => s[It.Is <string>(v => "ClientId".Equals(v))]).Returns(expectedClientId); section.SetupGet(s => s[It.Is <string>(v => "Server".Equals(v))]).Returns(expectedServer); section.SetupGet(s => s[It.Is <string>(v => "Port".Equals(v))]).Returns(expectedPort?.ToString()); section.SetupGet(s => s[It.Is <string>(v => "User".Equals(v))]).Returns(expectedUser); section.SetupGet(s => s[It.Is <string>(v => "Password".Equals(v))]).Returns(expectedPassword); configuration.SetupGet(c => c[It.Is <string>(v => "Version".Equals(v))]).Returns(expectedVersion); var settings = new AdapterSettings(configuration.Object); Assert.Equal(expectedClientId, settings.ClientId); Assert.Equal(expectedServer, settings.Server); Assert.Equal(expectedPort, settings.Port); Assert.Equal(expectedUser, settings.User); Assert.Equal(expectedPassword, settings.Password); Assert.Equal(expectedVersion, settings.Version); }
public SP3DDataLayer(AdapterSettings settings) : base(settings) { ServiceSettings servcieSettings = new ServiceSettings(); _settings.AppendSettings(servcieSettings); if (settings["DataLayerPath"] != null) { _dataPath = settings["DataLayerPath"]; } else { _dataPath = settings["AppDataPath"]; } _scope = _settings["ProjectName"] + "." + _settings["ApplicationName"]; _settings["BinaryPath"] = @".\Bin\"; _configurationPath = string.Format("{0}Configuration.{1}.xml", _dataPath, _scope); projectNameSpace = "org.iringtools.adapter.datalayer.proj_" + _scope; //"org.iringtools.adapter.datalayer.proj_12345_000.ABC" _dictionaryPath = string.Format("{0}DataDictionary.{1}.xml", _dataPath, _scope); }
public SQLDataLayerTest() { _settings = new NameValueCollection(); _settings["ProjectName"] = "12345_000"; _settings["XmlPath"] = @"..\SQLDataLayer.NUnit\12345_000\"; _settings["ApplicationName"] = "SQL"; _settings["TestMode"] = "WriteFiles"; //UseFiles/WriteFiles _baseDirectory = Directory.GetCurrentDirectory(); _baseDirectory = _baseDirectory.Substring(0, _baseDirectory.LastIndexOf("\\bin")); _settings["BaseDirectoryPath"] = _baseDirectory; Directory.SetCurrentDirectory(_baseDirectory); _adapterSettings = new AdapterSettings(); _adapterSettings.AppendSettings(_settings); string appSettingsPath = String.Format("{0}{1}.{2}.config", _adapterSettings["XmlPath"], _settings["ProjectName"], _settings["ApplicationName"] ); if (File.Exists(appSettingsPath)) { AppSettingsReader appSettings = new AppSettingsReader(appSettingsPath); _adapterSettings.AppendSettings(appSettings); } _dataLayer = new SQLDataLayer(_adapterSettings); }
public SPPIDDataLayer(AdapterSettings settings) : base(settings) { try { _dataPath = _settings["DataLayerPath"] ?? _settings[Constants.DATA_PATH]; _project = _settings[Constants.PROJECT]; _application = _settings[Constants.APPLICATION]; _siteConnStr = _settings[Constants.SPPID_SITE_SCHEMA]; if (Utility.IsBase64Encoded(_siteConnStr)) { _siteConnStr = EncryptionUtility.Decrypt(_siteConnStr); } _plantSchemaConnStr = _settings[Constants.SPPID_PLANT_SCHEMA]; if (Utility.IsBase64Encoded(_plantSchemaConnStr)) { _plantSchemaConnStr = EncryptionUtility.Decrypt(_plantSchemaConnStr); } _stagingConnStr = _settings[Constants.SPPID_STAGING]; if (Utility.IsBase64Encoded(_stagingConnStr)) { _stagingConnStr = EncryptionUtility.Decrypt(_stagingConnStr); } } catch (Exception ex) { string error = "Error initializing SPPID data layer: " + ex.Message; _logger.Error(error); throw new Exception(error); } }
public ObjectDataLayer(AdapterSettings settings) : base(settings) { _settings = settings; _widgetProvider = new WidgetProvider(); }
public SPPIDDataLayer(AdapterSettings settings) : base(settings) { try { _dataPath = _settings["DataLayerPath"] ?? _settings[Constants.DATA_PATH]; _project = _settings[Constants.PROJECT]; _application = _settings[Constants.APPLICATION]; _siteConnStr = _settings[Constants.SPPID_SITE_SCHEMA]; if (Utility.IsBase64Encoded(_siteConnStr)) { _siteConnStr = EncryptionUtility.Decrypt(_siteConnStr); } _plantSchemaConnStr = _settings[Constants.SPPID_PLANT_SCHEMA]; if (Utility.IsBase64Encoded(_plantSchemaConnStr)) { _plantSchemaConnStr = EncryptionUtility.Decrypt(_plantSchemaConnStr); } _stagingConnStr = _settings[Constants.SPPID_STAGING]; if (Utility.IsBase64Encoded(_stagingConnStr)) { _stagingConnStr = EncryptionUtility.Decrypt(_stagingConnStr); } } catch (Exception ex) { string error = "Error initializing SPPID data layer: " + ex.Message; _logger.Error(error); throw new Exception(error); } }
public Tests() { _objectType = "Function"; string baseDir = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(baseDir.Substring(0, baseDir.LastIndexOf("\\bin"))); AdapterSettings adapterSettings = new AdapterSettings(); adapterSettings.AppendSettings(new AppSettingsReader("App.config")); FileInfo log4netConfig = new FileInfo("Log4net.config"); log4net.Config.XmlConfigurator.Configure(log4netConfig); string twConfigFile = String.Format("{0}{1}.{2}.config", adapterSettings["AppDataPath"], adapterSettings["ProjectName"], adapterSettings["ApplicationName"] ); AppSettingsReader twSettings = new AppSettingsReader(twConfigFile); adapterSettings.AppendSettings(twSettings); _dataLayer = new Bechtel.DataLayer.RestDataLayer2(adapterSettings); _filter = Utility.Read<DataFilter>(adapterSettings["FilterPath"]); //_scenarios = Utility.Read<Scenarios>("Scenarios.xml"); _objectType = adapterSettings["ObjectType"]; _modifiedProperty = adapterSettings["ModifiedProperty"]; _modifiedValue = adapterSettings["ModifiedValue"]; _objectDefinition = GetObjectDefinition(_objectType); }
public void SetUp() { var testlogger = new TestLogger(new MessageLoggerStub()); _settings = new AdapterSettings(testlogger); testlogger.InitSettings(_settings); }
public ObjectDataLayerTest() { _settings = new NameValueCollection(); _settings["ProjectName"] = "12345_000"; _settings["XmlPath"] = @"..\ObjectDataLayer.NUnit\12345_000\"; _settings["ApplicationName"] = "OBJ"; _settings["TestMode"] = "WriteFiles"; //UseFiles/WriteFiles _baseDirectory = Directory.GetCurrentDirectory(); _baseDirectory = _baseDirectory.Substring(0, _baseDirectory.LastIndexOf("\\bin")); _settings["BaseDirectoryPath"] = _baseDirectory; Directory.SetCurrentDirectory(_baseDirectory); _adapterSettings = new AdapterSettings(); _adapterSettings.AppendSettings(_settings); string appSettingsPath = String.Format("{0}{1}.{2}.config", _adapterSettings["XmlPath"], _settings["ProjectName"], _settings["ApplicationName"] ); if (File.Exists(appSettingsPath)) { AppSettingsReader appSettings = new AppSettingsReader(appSettingsPath); _adapterSettings.AppendSettings(appSettings); } _dataLayer = new ObjectDataLayer(_adapterSettings); }
static void RunTask() { _logger.Debug("RunTask ..."); AdapterSettings adapterSettings; NameValueCollection settings; foreach (Task task in _sequence.Tasks) { string project = task.Project; string app = task.App; settings = ConfigurationManager.AppSettings; adapterSettings = new AdapterSettings(); adapterSettings.AppendSettings(settings); adapterSettings["ProjectName"] = project; adapterSettings["ApplicationName"] = app; adapterSettings["Scope"] = project + "." + app; //Call agent provider AgentProvider agentProvider = new AgentProvider(adapterSettings); agentProvider.ProcessTask(task); } _logger.Info("Task finished: "); }
internal void Init(AdapterSettings adapterSettings) { if (adapterSettings != null) { string typeName = adapterSettings.Class; Type type = ObjectFactory.Locate(typeName); if (type != null) { _adapter = ObjectFactory.CreateInstance(type) as ServiceAdapter; _adapter.SetDestination(this); _adapter.SetAdapterSettings(adapterSettings); _adapter.SetDestinationSettings(_settings); _adapter.Init(); } } MessageBroker messageBroker = this.Service.GetMessageBroker(); messageBroker.RegisterDestination(this, _service); //If the source has application scope create an instance here, so the service can listen for SessionCreated events for the first request if (this.Scope == "application") { FactoryInstance factoryInstance = GetFactoryInstance(); object inst = factoryInstance.Lookup(); } }
public BaseSQLDataLayer(AdapterSettings settings) : base(settings) { if (!String.IsNullOrEmpty(settings["WhereClauseAlias"])) { _whereClauseAlias = settings["WhereClauseAlias"]; } }
public void it_should_have_empty_settings() { provider.Load(reader); var expected = new AdapterSettings(); var actual = provider.Settings; actual.ShouldBeEquivalentTo(expected); }
public AdapterSettings UpdateAdapterSettings(AdapterSettings settings) { if (settings == null) { throw new ArgumentNullException("settings"); } return(BandRepository.UpdateAdapterSettings(settings)); }
public void TestMapEnum <T>(string setting, T defaultValue, T expected) where T : struct, Enum { var logger = Substitute.For <ITestLogger>(); var sut = new AdapterSettings(logger); var result = sut.MapEnum(setting, defaultValue); Assert.That(result, Is.EqualTo(expected), $"Failed for {setting}"); }
public NHibernateAuthorization(AdapterSettings settings, IDictionary keyRing, NHibernateSettings nhSettings) : base(settings, keyRing) { _authorizationPath = string.Format("{0}Authorization.{1}.xml", _settings["AppDataPath"], _settings["Scope"] ); _nhSettings = nhSettings; }
public DataProjectionEngine(AdapterSettings settings, DataDictionary dictionary) : base(settings) { _dictionary = dictionary; if (settings["SpCharList"] != null && settings["SpCharValue"] != null) { arrSpecialcharlist = settings["SpCharList"].ToString().Split(','); arrSpecialcharValue = settings["SpCharValue"].ToString().Split(','); } }
public XmlProjectionEngine(AdapterSettings settings, IDataLayer2 dataLayer, Mapping mapping) : base(settings, dataLayer, mapping) { _individualsCache = new Dictionary <string, List <string> >(); string baseUri = _settings["GraphBaseUri"]; string project = _settings["ProjectName"]; string app = _settings["ApplicationName"]; _appNamespace = Utility.FormEndpointBaseURI(_uriMaps, baseUri, project, app); }
public SP3DDataLayerTest() { _settings = new NameValueCollection(); _settings["XmlPath"] = @".\12345_000\"; _settings["ProjectName"] = "12345_000"; _settings["ApplicationName"] = "SP3D"; _baseDirectory = Directory.GetCurrentDirectory(); _baseDirectory = _baseDirectory.Substring(0, _baseDirectory.LastIndexOf("\\bin")); _settings["BaseDirectoryPath"] = _baseDirectory; Directory.SetCurrentDirectory(_baseDirectory); _adapterSettings = new AdapterSettings(); _adapterSettings.AppendSettings(_settings); string appSettingsPath = String.Format("{0}12345_000.SP3D.config", _adapterSettings["XmlPath"] ); if (File.Exists(appSettingsPath)) { AppSettingsReader appSettings = new AppSettingsReader(appSettingsPath); _adapterSettings.AppendSettings(appSettings); } var ninjectSettings = new NinjectSettings { LoadExtensions = false }; _kernel = new StandardKernel(ninjectSettings); _kernel.Load(new XmlExtensionModule()); string relativePath = String.Format(@"{0}BindingConfiguration.{1}.{2}.xml", _settings["XmlPath"], _settings["ProjectName"], _settings["ApplicationName"] ); //Ninject Extension requires fully qualified path. string bindingConfigurationPath = Path.Combine( _settings["BaseDirectoryPath"], relativePath ); _kernel.Load(bindingConfigurationPath); // _sp3dDataLayer = _kernel.Get<SP3DDataLayer>(); This will reset the new updated adaptersettings with default values. _sp3dDataLayer = new SP3DDataLayer(_adapterSettings); }
public static AdapterSettings CreateSingle(string adapterName) { var entity = new AdapterSettings { AdapterName = adapterName, OAuthAccessToken = OAuthAccessTokenCreator.CreateSingle(), OAuthRequestToken = OAuthRequestTokenCreator.CreateSingle() }; entity.SetName = string.Format(CultureInfo.InvariantCulture, "SetName {0}", entity.Id); return(entity); }
public SPRDataLayer(AdapterSettings settings) : base(settings) { _settings = settings; _xmlPath = _settings["xmlPath"]; _projectName = _settings["projectName"]; _applicationName = _settings["applicationName"]; _baseDirectory = Directory.GetCurrentDirectory(); _appConfigXML = String.Format("{0}{1}.{2}.config", _xmlPath, _projectName, _applicationName); _sprSettings = new StaticDust.Configuration.AppSettingsReader(_appConfigXML); _dbConnectionString = EncryptionUtility.Decrypt(_sprSettings["dbconnection"].ToString()); }
public void TestXmlFileNameGenerationNewOutputXmlFileForEachRun() { var logger = Substitute.For <ITestLogger>(); var settings = new AdapterSettings(logger); settings.Load("<RunSettings><NUnit><TestOutputXml>/my/work/dir</TestOutputXml><NewOutputXmlFileForEachRun>true</NewOutputXmlFileForEachRun></NUnit></RunSettings>"); var sut = new NUnitEngineAdapter(); sut.InitializeSettingsAndLogging(settings, logger); string path = sut.GetXmlFilePath("c:/", "assembly", "xml"); Assert.That(path, Is.EqualTo("c:/assembly.1.xml")); }
public ReferenceDataTests() { _baseDirectory = Directory.GetCurrentDirectory(); _baseDirectory = _baseDirectory.Substring(0, _baseDirectory.LastIndexOf("\\Bin")); Directory.SetCurrentDirectory(_baseDirectory); AdapterSettings adapterSettings = new AdapterSettings(); adapterSettings.AppendSettings(new AppSettingsReader("App.config")); _settings = new ReferenceDataSettings(); _settings.AppendSettings((ServiceSettings)adapterSettings); _settings["BaseDirectoryPath"] = _baseDirectory; _refdataProvider = new ReferenceDataProvider(_settings); }
public Tests() { string baseDir = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(baseDir.Substring(0, baseDir.LastIndexOf("\\bin"))); AdapterSettings adapterSettings = new AdapterSettings(); adapterSettings.AppendSettings(new AppSettingsReader("App.config")); FileInfo log4netConfig = new FileInfo("Log4net.config"); log4net.Config.XmlConfigurator.Configure(log4netConfig); _dataLayer = new ebDataLayer(adapterSettings); _scenarios = Utility.Read<Scenarios>("Scenarios.xml"); }
public test() { string baseDir = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(baseDir.Substring(0, baseDir.LastIndexOf("\\bin"))); AdapterSettings adapterSettings = new AdapterSettings(); adapterSettings.AppendSettings(new AppSettingsReader("App.config")); _dataLayer = new Bechtel.iRING.SPR.SPRDataLayer(adapterSettings); _objectType = adapterSettings["ObjectType"]; _objectDefinition = GetObjectDefinition(_objectType); _dataLayer.GetDictionary(); //_dataLayer.RefreshAll(); }
public SP3DDataLayerTest() { _settings = new NameValueCollection(); _settings["XmlPath"] = @".\12345_000\"; _settings["ProjectName"] = "12345_000"; _settings["ApplicationName"] = "SP3D"; _baseDirectory = Directory.GetCurrentDirectory(); _baseDirectory = _baseDirectory.Substring(0, _baseDirectory.LastIndexOf("\\bin")); _settings["BaseDirectoryPath"] = _baseDirectory; Directory.SetCurrentDirectory(_baseDirectory); _adapterSettings = new AdapterSettings(); _adapterSettings.AppendSettings(_settings); string appSettingsPath = String.Format("{0}12345_000.SP3D.config", _adapterSettings["XmlPath"] ); if (File.Exists(appSettingsPath)) { AppSettingsReader appSettings = new AppSettingsReader(appSettingsPath); _adapterSettings.AppendSettings(appSettings); } var ninjectSettings = new NinjectSettings { LoadExtensions = false }; _kernel = new StandardKernel(ninjectSettings); _kernel.Load(new XmlExtensionModule()); string relativePath = String.Format(@"{0}BindingConfiguration.{1}.{2}.xml", _settings["XmlPath"], _settings["ProjectName"], _settings["ApplicationName"] ); //Ninject Extension requires fully qualified path. string bindingConfigurationPath = Path.Combine( _settings["BaseDirectoryPath"], relativePath ); _kernel.Load(bindingConfigurationPath); // _sp3dDataLayer = _kernel.Get<SP3DDataLayer>(); This will reset the new updated adaptersettings with default values. _sp3dDataLayer = new SP3DDataLayer(_adapterSettings); }
public Tests() { string baseDir = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(baseDir.Substring(0, baseDir.LastIndexOf("\\bin"))); AdapterSettings adapterSettings = new AdapterSettings(); adapterSettings["ProjectName"] = project; adapterSettings["ApplicationName"] = app; string appConfigPath = string.Format("App_Data\\{0}.{1}.config", project, app); adapterSettings.AppendSettings(new AppSettingsReader(appConfigPath)); _dataLayer = new SPPIDDataLayer(adapterSettings); _scenarios = org.iringtools.utility.Utility.Read<Scenarios>("Scenarios.xml"); }
public Startup(IConfiguration configuration, ILoggerFactory loggerFactory, DiagnosticSource diagnosticSource) { _loggerFactory = loggerFactory; _diagnosticSource = diagnosticSource; Configuration = configuration; _monitoringRuleRepositorySettings = new RepositorySetting(); configuration.GetSection("MonitoringRuleRepository").Bind(_monitoringRuleRepositorySettings); _monitoringItemRepositorySettings = new RepositorySetting(); configuration.GetSection("MonitoringItemRepositorySettings").Bind(_monitoringRuleRepositorySettings); _adapterSettings = new AdapterSettings(); configuration.GetSection("AdapterSettings").Bind(_monitoringRuleRepositorySettings); }
public test() { string baseDir = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(baseDir.Substring(0, baseDir.LastIndexOf("\\bin"))); AdapterSettings adapterSettings = new AdapterSettings(); adapterSettings.AppendSettings(new AppSettingsReader("App.config")); _dataLayer = new Bechtel.iRING.SPR.SPRDataLayer(adapterSettings); _objectType = adapterSettings["ObjectType"]; _objectDefinition = GetObjectDefinition(_objectType); _dataLayer.GetDictionary(); //_dataLayer.RefreshAll(); }
public Tests() { string baseDir = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(baseDir.Substring(0, baseDir.LastIndexOf("\\bin"))); AdapterSettings adapterSettings = new AdapterSettings(); adapterSettings.AppendSettings(new AppSettingsReader("App.config")); FileInfo log4netConfig = new FileInfo("Log4net.config"); log4net.Config.XmlConfigurator.Configure(log4netConfig); _dataLayer = new ebDataLayer(adapterSettings); _scenarios = Utility.Read <Scenarios>("Scenarios.xml"); }
public AdapterTest() { _settings = new AdapterSettings(); _baseDirectory = Directory.GetCurrentDirectory(); _baseDirectory = _baseDirectory.Substring(0, _baseDirectory.LastIndexOf("\\Bin")); _settings["BaseDirectoryPath"] = _baseDirectory; Directory.SetCurrentDirectory(_baseDirectory); _settings.AppendSettings(new StaticDust.Configuration.AppSettingsReader("App.config")); _settings["ProjectName"] = "12345_000"; _settings["ApplicationName"] = "ABC"; _settings["GraphName"] = "Lines"; _adapterProvider = new AdapterProvider(_settings); }
public SpreadsheetProvider(AdapterSettings settings) { _settings = settings; _configurationPath = Path.Combine(_settings["AppDataPath"], "spreadsheet-configuration." + _settings["Scope"] + ".xml"); if (File.Exists(_configurationPath)) { InitializeProvider(Utility.Read <SpreadsheetConfiguration>(_configurationPath)); if (_configuration.Generate) { _configuration = ProcessConfiguration(_configuration, null); _configuration.Generate = false; Utility.Write <SpreadsheetConfiguration>(_configuration, _configurationPath, true); } } }
public BasePart7ProjectionEngine(AdapterSettings settings, DataDictionary dictionary, Mapping mapping) { _dataObjects = new List <IDataObject>(); _relatedObjectsCache = new Dictionary <string, List <IDataObject> >(); _settings = settings; _dictionary = dictionary; _mapping = mapping; if (!String.IsNullOrEmpty(_settings["fixedIdentifierBoundary"])) { _fixedIdentifierBoundary = _settings["fixedIdentifierBoundary"]; } // get classification settings _primaryClassificationStyle = (ClassificationStyle)Enum.Parse(typeof(ClassificationStyle), _settings["PrimaryClassificationStyle"].ToString()); _secondaryClassificationStyle = (ClassificationStyle)Enum.Parse(typeof(ClassificationStyle), _settings["SecondaryClassificationStyle"].ToString()); string classificationTemplateFile = _settings["ClassificationTemplateFile"]; if (File.Exists(classificationTemplateFile)) { _classificationConfig = Utility.Read <ClassificationTemplate>(classificationTemplateFile); } // load uri maps config _uriMaps = new Properties(); string uriMapsFilePath = _settings["AppDataPath"] + "UriMaps.conf"; if (File.Exists(uriMapsFilePath)) { try { _uriMaps.Load(uriMapsFilePath); } catch (Exception e) { _logger.Info("Error loading [UriMaps.config]: " + e); } } }
public NHibernateTest() { _settings = new AdapterSettings(); _baseDirectory = Directory.GetCurrentDirectory(); _baseDirectory = _baseDirectory.Substring(0, _baseDirectory.LastIndexOf("\\Bin")); _settings["BaseDirectoryPath"] = _baseDirectory; Directory.SetCurrentDirectory(_baseDirectory); _settings.AppendSettings(new StaticDust.Configuration.AppSettingsReader("App.config")); _settings["ProjectName"] = "12345_000"; _settings["ApplicationName"] = "ABC"; _settings["SchemaObjectName"] = "LINES"; _settings["ExecutingAssemblyName"] = "NUnit.Tests"; _hibernateProvider = new NHibernateProvider(_settings); }
public Tests() { string baseDir = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(baseDir.Substring(0, baseDir.LastIndexOf("\\bin"))); AdapterSettings adapterSettings = new AdapterSettings(); adapterSettings["ProjectName"] = project; adapterSettings["ApplicationName"] = app; string appConfigPath = string.Format("App_Data\\{0}.{1}.config", project, app); adapterSettings.AppendSettings(new AppSettingsReader(appConfigPath)); _dataLayer = new SPPIDDataLayer(adapterSettings); _scenarios = org.iringtools.utility.Utility.Read <Scenarios>("Scenarios.xml"); }
protected HueAdapaterBase() { string path = "hueAdapter.json"; if (!File.Exists(path)) { path = "../../../../config/hueAdapter.json"; if (!File.Exists(path)) { throw new Exception("Could not find adapter settings!"); } } string adapterJson = File.ReadAllText(path); _settings = JsonConvert.DeserializeObject <AdapterSettings>(adapterJson); }
public RestDataLayer2(AdapterSettings settings) : base(settings) { _xmlPath = _settings["xmlPath"]; _projectName = _settings["projectName"]; _applicationName = _settings["applicationName"]; _baseDirectory = _settings["BaseDirectoryPath"]; _authToken = _settings["AuthToken"]; _appKey = _settings["AppKey"]; _endPointUrl = _settings["EndPointUrl"]; _baseUrl = _settings["BaseUrl"]; _keyDelimiter = Convert.ToString(_settings["DefaultKeyDelimiter"]) ?? string.Empty; //_webClient = new WebClient(_baseUrl, _appKey, _authToken); _webClient = new IringWebClient(_baseUrl, _appKey, _authToken); //_webClient = new MockWebClient(_baseUrl, _appKey, _authToken); LoadEndPointSettings(); _selfUrl = GetSelfUrlList(); }
public SP3DDataLayer(AdapterSettings settings) : base(settings) { ServiceSettings servcieSettings = new ServiceSettings(); _settings.AppendSettings(servcieSettings); if (settings["DataLayerPath"] != null) _dataPath = settings["DataLayerPath"]; else _dataPath = settings["AppDataPath"]; _scope = _settings["ProjectName"] + "." + _settings["ApplicationName"]; _settings["BinaryPath"] = @".\Bin\"; _configurationPath = string.Format("{0}Configuration.{1}.xml", _dataPath, _scope); projectNameSpace = "org.iringtools.adapter.datalayer.proj_" + _scope; //"org.iringtools.adapter.datalayer.proj_12345_000.ABC" _dictionaryPath = string.Format("{0}DataDictionary.{1}.xml", _dataPath, _scope); }
static void Main(string[] args) { AdapterSettings settings = new AdapterSettings(); settings["WhereClauseAlias"] = "_t"; sampleDL = new SampleSQLDataLayer(settings); #region test get // from iRING service point of view IList<IDataObject> dataObjects = sampleDL.Get("LINES", null); Console.WriteLine("Object Count: " + dataObjects.Count); foreach (IDataObject dataObject in dataObjects) { DebugDataObject(dataObject, "LINES"); } #endregion #region test post foreach (IDataObject dataObject in dataObjects) { ((GenericDataObject)dataObject).ObjectType = "LINES"; // make tag different by appending timestamp on it string tag = dataObject.GetPropertyValue("TAG").ToString(); string newTag = tag + DateTime.Now.ToString(); if (newTag.Length > 100) newTag = newTag.Substring(0, 100); dataObject.SetPropertyValue("TAG", newTag); } // from iRING service point of view Response response = sampleDL.Post(dataObjects); Console.WriteLine("Post result: " + response.Level.ToString()); #endregion Console.WriteLine("Test completed!"); Console.ReadKey(); }
public ebDataLayer(AdapterSettings settings) : base(settings) { try { _dataPath = settings["DataLayerPath"]; if (_dataPath == null) { _dataPath = settings["AppDataPath"]; } _scope = _settings["ProjectName"] + "." + _settings["ApplicationName"]; // // load app settings // string configPath = string.Format("{0}{1}.config", _dataPath, _scope); if (!System.IO.File.Exists(configPath)) { _dataPath += "App_Data\\"; configPath = string.Format("{0}{1}.config", _dataPath, _scope); } _settings.AppendSettings(new AppSettingsReader(configPath)); _dictionaryPath = string.Format("{0}DataDictionary.{1}.xml", _dataPath, _scope); _server = _settings["ebServer"]; _dataSource = _settings["ebDataSource"]; _userName = _settings["ebUserName"]; _password = _settings["ebPassword"]; _classObjects = _settings["ebClassObjects"]; _keyDelimiter = _settings["ebKeyDelimiter"]; if (_keyDelimiter == null) { _keyDelimiter = ";"; } _communityName = _settings["ebCommunityName"]; string[] configFiles = Directory.GetFiles(_dataPath, "*" + _communityName + ".xml"); string ruleFile = _dataPath + "Rules_" + _communityName + ".xml"; // // load configurations // _configs = new Dictionary<string, Configuration>(StringComparer.OrdinalIgnoreCase); foreach (string configFile in configFiles) { if (configFile.ToLower() == ruleFile.ToLower()) { _rules = Utility.Read<Rules>(ruleFile, false); } else { string fileName = Path.GetFileName(configFile); Configuration config = Utility.Read<Configuration>(configFile, false); _configs[fileName] = config; } } // load content types string contentTypesFile = _dataPath + "ContentTypes.xml"; _contentTypes = Utility.Read<ContentTypes>(contentTypesFile, true); } catch (Exception e) { _logger.Error("Error initializing ebDataLayer: " + e.Message); } }
public SampleSQLDataLayer(AdapterSettings settings) : base(settings) { string connStr = "server=.\\SQLEXPRESS;database=ABC;user id=abc;password=abc"; _conn = new SqlConnection(connStr); }
public BaseContentLayer(AdapterSettings settings) : base(settings) { }
public void SetUp() { _settings = new AdapterSettings(); }
public SQLDataLayer(AdapterSettings settings) : base(settings) { //Some basic initialization can be done here. }