public LmdbStorageModule(string baseDirectory, RulesEnum rulesType, string[] blockTxesStorageLocations = null)
 {
     this.baseDirectory = baseDirectory;
     this.blockTxesStorageLocations = blockTxesStorageLocations;
     this.dataDirectory = Path.Combine(baseDirectory, "Data", rulesType.ToString());
     this.rulesType = rulesType;
 }
Example #2
0
        public static string Get(RulesEnum rules)
        {
            switch (rules)
            {
            case RulesEnum.general:
                return("Общие положения");

            case RulesEnum.documents:
                return("Необходимые документы");

            case RulesEnum.process:
                return("Процесс заказа авиабилетов");

            case RulesEnum.payment:
                return("Способ оплаты авиабилетов");

            case RulesEnum.delivery:
                return("Получение авиабилетов");

            case RulesEnum.moneyback:
                return("Возврат билетов");

            case RulesEnum.exchange:
                return("Обмен билетов");

            case RulesEnum.contact:
                return("Контакты");
            }

            return("");
        }
        public void ChooseSection(RulesEnum rules)
        {
            MainPage mainPage = new MainPage(driver);

            ((AviaRulesPage)((MainPage)mainPage.Open()).OrderingAirTicketsRules()).ChooseSection(rules);;

            Assert.AreEqual(driver.Url, AviaRulesPage.URL + AviaRulesPage.SECTION);
        }
Example #4
0
 public EsentStorageModule(string baseDirectory, RulesEnum rulesType, long?cacheSizeMinBytes = null, long?cacheSizeMaxBytes = null)
 {
     this.baseDirectory     = baseDirectory;
     this.dataDirectory     = Path.Combine(baseDirectory, "Data", rulesType.ToString());
     this.peersDirectory    = Path.Combine(baseDirectory, "Peers", rulesType.ToString());
     this.rulesType         = rulesType;
     this.cacheSizeMinBytes = cacheSizeMinBytes;
     this.cacheSizeMaxBytes = cacheSizeMaxBytes;
 }
 public EsentStorageModule(string baseDirectory, RulesEnum rulesType, bool blockStorage = true, long? cacheSizeMinBytes = null, long? cacheSizeMaxBytes = null, string[] blockTxesStorageLocations = null)
 {
     this.baseDirectory = baseDirectory;
     this.blockTxesStorageLocations = blockTxesStorageLocations;
     this.dataDirectory = Path.Combine(baseDirectory, "Data", rulesType.ToString());
     this.peersDirectory = Path.Combine(baseDirectory, "Peers", rulesType.ToString());
     this.rulesType = rulesType;
     this.cacheSizeMinBytes = cacheSizeMinBytes;
     this.cacheSizeMaxBytes = cacheSizeMaxBytes;
     this.blockStorage = blockStorage;
 }
        public Page ChooseSection(RulesEnum rule)
        {
            //find link among presented in RulesEnum
            IWebElement contacts = driver
                                   .FindElements(By.TagName(AviaRulesPageSelectors.ContactsSelector))
                                   .Where(el => el.Text == SectionName.Get(rule))
                                   .First();

            contacts.Click();

            SECTION = $"#{rule}";
            return(this);
        }
Example #7
0
        public LocalClient(Logger logger, RulesEnum type, IKernel kernel, IBlockchainRules rules, CoreDaemon coreDaemon, NetworkPeerCache networkPeerCache)
        {
            this.shutdownToken = new CancellationTokenSource();

            this.logger           = logger;
            this.type             = type;
            this.kernel           = kernel;
            this.rules            = rules;
            this.coreDaemon       = coreDaemon;
            this.coreStorage      = coreDaemon.CoreStorage;
            this.networkPeerCache = networkPeerCache;

            this.messageRateMeasure = new RateMeasure();

            this.peerWorker = new PeerWorker(
                new WorkerConfig(initialNotify: true, minIdleTime: TimeSpan.FromSeconds(1), maxIdleTime: TimeSpan.FromSeconds(1)),
                this.logger, this, this.coreDaemon);

            this.listenWorker = new ListenWorker(this.logger, this, this.peerWorker);

            this.headersRequestWorker = new HeadersRequestWorker(
                new WorkerConfig(initialNotify: true, minIdleTime: TimeSpan.FromMilliseconds(50), maxIdleTime: TimeSpan.FromSeconds(5)),
                this.logger, this, this.coreDaemon);

            this.blockRequestWorker = new BlockRequestWorker(
                new WorkerConfig(initialNotify: true, minIdleTime: TimeSpan.FromMilliseconds(50), maxIdleTime: TimeSpan.FromSeconds(30)),
                this.logger, this, this.coreDaemon);

            this.statsWorker = new WorkerMethod("LocalClient.StatsWorker", StatsWorker, true, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(30), this.logger);

            this.peerWorker.PeerConnected    += HandlePeerConnected;
            this.peerWorker.PeerDisconnected += HandlePeerDisconnected;

            switch (this.Type)
            {
            case RulesEnum.MainNet:
                Messaging.Port  = 8333;
                Messaging.Magic = Messaging.MAGIC_MAIN;
                break;

            case RulesEnum.TestNet3:
                Messaging.Port  = 18333;
                Messaging.Magic = Messaging.MAGIC_TESTNET3;
                break;

            case RulesEnum.ComparisonToolTestNet:
                Messaging.Port  = 18444;
                Messaging.Magic = Messaging.MAGIC_COMPARISON_TOOL;
                break;
            }
        }
Example #8
0
        public LocalClient(Logger logger, RulesEnum type, IKernel kernel, IBlockchainRules rules, CoreDaemon blockchainDaemon, BlockHeaderCache blockHeaderCache, ChainedHeaderCache chainedHeaderCache, TransactionCache transactionCache, BlockCache blockCache, NetworkPeerCache networkPeerCache)
        {
            this.shutdownToken = new CancellationTokenSource();

            this.logger             = logger;
            this.type               = type;
            this.kernel             = kernel;
            this.rules              = rules;
            this.blockchainDaemon   = blockchainDaemon;
            this.blockHeaderCache   = blockHeaderCache;
            this.chainedHeaderCache = chainedHeaderCache;
            this.transactionCache   = transactionCache;
            this.blockCache         = blockCache;
            this.networkPeerCache   = networkPeerCache;

            this.messageRateMeasure = new RateMeasure();

            this.connectWorker        = new WorkerMethod("LocalClient.ConnectWorker", ConnectWorker, true, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), this.logger);
            this.headersRequestWorker = kernel.Get <HeadersRequestWorker>(
                new ConstructorArgument("workerConfig", new WorkerConfig(initialNotify: true, minIdleTime: TimeSpan.FromMilliseconds(50), maxIdleTime: TimeSpan.FromSeconds(30))),
                new ConstructorArgument("localClient", this));
            this.blockRequestWorker = kernel.Get <BlockRequestWorker>(
                new ConstructorArgument("workerConfig", new WorkerConfig(initialNotify: true, minIdleTime: TimeSpan.FromMilliseconds(50), maxIdleTime: TimeSpan.FromSeconds(30))),
                new ConstructorArgument("localClient", this));
            this.statsWorker = new WorkerMethod("LocalClient.StatsWorker", StatsWorker, true, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(30), this.logger);

            switch (this.Type)
            {
            case RulesEnum.MainNet:
                Messaging.Port  = 8333;
                Messaging.Magic = Messaging.MAGIC_MAIN;
                break;

            case RulesEnum.TestNet3:
                Messaging.Port  = 18333;
                Messaging.Magic = Messaging.MAGIC_TESTNET3;
                break;

            case RulesEnum.ComparisonToolTestNet:
                Messaging.Port  = 18444;
                Messaging.Magic = Messaging.MAGIC_COMPARISON_TOOL;
                break;
            }
        }
Example #9
0
        public Simulator(RulesEnum rulesType)
        {
            // initialize kernel
            this.kernel = new StandardKernel();

            // add logging module
            this.kernel.Load(new ConsoleLoggingModule());

            // log startup
            this.logger = LogManager.GetCurrentClassLogger();
            this.logger.Info($"Starting up: {DateTime.Now}");

            this.random = new Random();
            this.blockProvider = TestBlockProvider.CreateForRules(rulesType);

            // add storage module
            this.kernel.Load(new MemoryStorageModule());

            // add rules module
            this.kernel.Load(new RulesModule(rulesType));

            // TODO ignore script errors in test daemon until scripting engine is completed
            var rules = this.kernel.Get<IBlockchainRules>();
            rules.IgnoreScriptErrors = true;

            // initialize the blockchain daemon
            this.kernel.Bind<CoreDaemon>().ToSelf().InSingletonScope();
            this.coreDaemon = this.kernel.Get<CoreDaemon>();
            this.coreStorage = this.coreDaemon.CoreStorage;

            // start the blockchain daemon
            this.coreDaemon.Start();

            // wait for initial work
            this.coreDaemon.WaitForUpdate();

            // verify initial state
            Assert.AreEqual(0, this.coreDaemon.TargetChainHeight);
            Assert.AreEqual(rules.GenesisBlock.Hash, this.coreDaemon.TargetChain.LastBlock.Hash);
            Assert.AreEqual(rules.GenesisBlock.Hash, this.coreDaemon.CurrentChain.LastBlock.Hash);
        }
Example #10
0
 public RulesModule(RulesEnum rules)
 {
     this.rules = rules;
 }
Example #11
0
 public NetworkPeerStorage(string baseDirectory, RulesEnum rulesType)
 {
     this.name      = "KnownAddresses";
     this.directory = Path.Combine(baseDirectory, this.name);
     this.dict      = new PersistentByteDictionary(this.directory);
 }
Example #12
0
 public RulesModule(RulesEnum rules)
 {
     this.rules = rules;
 }
Example #13
0
 public void AddPerformance(string teamName, RulesEnum performance)
 {
 }