public SequenceManager() { if (null != _instance) { I18N i18N = I18N.GetInstance(Constants.I18nName); throw new TestflowRuntimeException(CommonErrorCode.InternalError, i18N.GetStr("InstAlreadyExist")); } lock (_instLock) { Thread.MemoryBarrier(); if (null != _instance) { I18N i18N = I18N.GetInstance(Constants.I18nName); throw new TestflowRuntimeException(CommonErrorCode.InternalError, i18N.GetStr("InstAlreadyExist")); } I18NOption i18NOption = new I18NOption(this.GetType().Assembly, "i18n_sequence_zh", "i18n_sequence_en") { Name = Constants.I18nName }; I18N.InitInstance(i18NOption); this.ConfigData = null; this.Version = string.Empty; _instance = this; } }
public EngineHandle() { I18NOption i18NOption = new I18NOption(typeof(EngineHandle).Assembly, "i18n_engineCore_zh.resx", "i18n_engineCore_en.resx") { Name = Constants.I18nName }; I18N.InitInstance(i18NOption); if (null != _instance) { I18N i18N = I18N.GetInstance(Constants.I18nName); throw new TestflowRuntimeException(CommonErrorCode.InternalError, i18N.GetStr("InstAlreadyExist")); } lock (_instLock) { Thread.MemoryBarrier(); if (null != _instance) { I18N i18N = I18N.GetInstance(Constants.I18nName); throw new TestflowRuntimeException(CommonErrorCode.InternalError, i18N.GetStr("InstAlreadyExist")); } _instance = this; } }
public void GetEntity() { I18N.InitInstance(_i18NOption); I18N i18N = I18N.GetInstance(I18nName); Assert.AreNotEqual(null, i18N); }
public ResultManager() { I18NOption i18NOption = new I18NOption(this.GetType().Assembly, "i18n_resultmanager_zh", "i18n_resultmanager_en") { Name = Constants.I18nName }; I18N.InitInstance(i18NOption); }
public InterfaceManager() { I18NOption i18NOption = new I18NOption(typeof(InterfaceManager).Assembly, "i18n_commanager_zh", "i18n_commanager_en") { Name = Constants.I18nName }; I18N.InitInstance(i18NOption); }
public AppDomainTestLauncher(string configDataStr) { I18NOption i18NOption = new I18NOption(typeof(TestLauncher).Assembly, "i18n_SlaveCore_zh", "i18n_SlaveCore_en") { Name = Constants.I18nName }; I18N.InitInstance(i18NOption); _slaveContext = new SlaveContext(configDataStr); }
static SequenceUtils() { // 初始化i18n模块 I18NOption i18NOption = new I18NOption(typeof(Messenger).Assembly, "i18n_utils_zh", "i18n_utils_en") { Name = UtilityConstants.UtilsName }; I18N.InitInstance(i18NOption); }
public TestLauncher(string configDataStr) { I18NOption i18NOption = new I18NOption(typeof(TestLauncher).Assembly, "i18n_SlaveCore_zh", "i18n_SlaveCore_en") { Name = Constants.I18nName }; I18N.InitInstance(i18NOption); _contextManager = new SlaveContext(configDataStr); // _transceiver = new MessageTransceiver(_contextManager, ); }
/// <summary> /// 常见Messanger抽象类 /// </summary> /// <param name="option"></param> protected Messenger(MessengerOption option) { this.Option = option; // 初始化i18n模块 I18NOption i18NOption = new I18NOption(typeof(Messenger).Assembly, "i18n_messenger_zh", "i18n_messenger_en") { Name = UtilityConstants.MessengerName }; I18N.InitInstance(i18NOption); this._messageDispatcher = new MessageDispatcher(this); }
/// <summary> /// 创建库类型属性实例 /// </summary> public TestflowCategoryAttribute(LibraryCategory category) { I18NOption i18NOption = new I18NOption(Assembly.GetAssembly(this.GetType()), "i18n_userlib_zh", "i18n_userlib_en") { Name = Constants.I18nName }; I18N.InitInstance(i18NOption); I18N i18N = I18N.GetInstance(Constants.I18nName); this.Category = category; this.CategoryString = i18N.GetStr(category.ToString()); }
/// <summary> /// 创建库类型属性实例 /// </summary> /// <param name="categoryString"></param> public TestflowCategoryAttribute(string categoryString) { I18NOption i18NOption = new I18NOption(Assembly.GetAssembly(this.GetType()), "i18n_userlib_zh", "i18n_userlib_en") { Name = Constants.I18nName }; I18N.InitInstance(i18NOption); I18N i18N = I18N.GetInstance(Constants.I18nName); this.CategoryString = i18N.GetStr(categoryString) ?? categoryString; Category = LibraryCategory.Miscellaneous; }
//todo SetUp/TearDown = null public DesignTimeService() { this.TestProject = null; // need to load SequenceSessions = new Dictionary <int, IDesignTimeSession>(); Components = new Dictionary <string, IComInterfaceDescription>(); I18NOption i18NOption = new I18NOption(this.GetType().Assembly, "i18n_designService_zh", "i18n_designService_en") { Name = Constants.I18nName }; I18N.InitInstance(i18NOption); SetUpSession = null; TearDownSession = null; }
protected DatabaseProxy(IModuleConfigData configData, bool isRuntimeModuleModule) { this.ConfigData = configData; IsRuntimeModule = isRuntimeModuleModule; I18NOption i18NOption = new I18NOption(this.GetType().Assembly, "i18n_datamaintain_zh", "i18n_datamaintain_en") { Name = Constants.I18nName }; I18N.InitInstance(i18NOption); I18N = I18N.GetInstance(Constants.I18nName); Logger = TestflowRunner.GetInstance().LogService; try { // 使用DbProviderFactory方式连接需要在App.Config文件中定义DbProviderFactories节点 // 但是App.Config文件只在入口Assembly中时才会被默认加载,所以目前写死为SqlConnection // DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.SQLite"); // Connection = factory.CreateConnection(); // if (null == Connection) // { // Logger.Print(LogLevel.Fatal, CommonConst.PlatformLogSession, "Connect db failed."); // throw new TestflowRuntimeException(ModuleErrorCode.ConnectDbFailed, I18N.GetStr("ConnectDbFailed")); // } InitializeDatabaseAndConnection(); } catch (DbException ex) { Logger.Print(LogLevel.Fatal, CommonConst.PlatformLogSession, ex, "Connect db failed."); throw new TestflowRuntimeException(ModuleErrorCode.ConnectDbFailed, I18N.GetStr("ConnectDbFailed"), ex); } this._databaseLock = new ReaderWriterLockSlim(); DataModelMapper = new DataModelMapper(); }
public PlatformConfigManager() { I18NOption i18NOption = new I18NOption(this.GetType().Assembly, "i18n_config_zh", "i18n_config_en") { Name = Constants.I18nName }; I18N.InitInstance(i18NOption); I18N i18N = I18N.GetInstance(Constants.I18nName); string platformDir = Environment.GetEnvironmentVariable(CommonConst.EnvironmentVariable); if (string.IsNullOrWhiteSpace(platformDir) || !Directory.Exists(platformDir)) { TestflowRunner.GetInstance().LogService.Print(LogLevel.Fatal, CommonConst.PlatformLogSession, $"Invalid environment variable:{CommonConst.EnvironmentVariable}"); throw new TestflowRuntimeException(ModuleErrorCode.InvalidEnvDir, i18N.GetStr("InvalidHomeVariable")); } this.ConfigData = new ModuleConfigData(); string configFilePath = $"{platformDir}{Path.DirectorySeparatorChar}{Constants.ConfigFileDir}{Path.DirectorySeparatorChar}{Constants.ConfigFileName}"; this.ConfigData.SetProperty(Constants.ConfigFile, configFilePath); this.GlobalInfo = ConfigData; }