示例#1
0
        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, );
        }
示例#2
0
 /// <summary>
 /// 抽象类的构造方法
 /// </summary>
 /// <param name="options"></param>
 protected TestflowRunner(TestflowRunnerOptions options)
 {
     this.Option  = options;
     this.Context = new TestflowContext();
     I18NOption i18NOption = new I18NOption(typeof(TestflowRunner).Assembly,
                                            "i18n_common_cn", "i18n_common_en")
     {
         Name = CommonConst.I18nName
     };
     I18N i18N = I18N.GetInstance(i18NOption);
 }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <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());
        }
示例#5
0
        /// <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;
        }
示例#6
0
        //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;
        }
示例#7
0
        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;
        }
示例#9
0
 /// <summary>
 /// 创建日志服务实例
 /// </summary>
 public LogService()
 {
     if (null != _inst)
     {
         I18N i18N = I18N.GetInstance(Constants.I18NName);
         throw new TestflowRuntimeException(CommonErrorCode.InternalError, i18N.GetStr("InstAlreadyExist"));
     }
     lock (_instLock)
     {
         Thread.MemoryBarrier();
         if (null != _inst)
         {
             I18N i18N = I18N.GetInstance(Constants.I18NName);
             throw new TestflowRuntimeException(CommonErrorCode.InternalError, i18N.GetStr("InstAlreadyExist"));
         }
         I18NOption i18NOption = new I18NOption(this.GetType().Assembly, "i18n_logger_zh", "i18n_logger_en")
         {
             Name = Constants.I18NName
         };
         _i18N         = I18N.GetInstance(i18NOption);
         _testflowInst = TestflowRunner.GetInstance();
         _inst         = this;
     }
 }