public DaoTests()
        {
            _hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));

            _mappers = new IMapperInitializer[]
            {
                new ProtocolMessageDao(),
                new ConfidentialEntryDao(),
                new CandidateDeltaBroadcastDao(),
                new ProtocolErrorMessageSignedDao(),
                new PeerIdDao(),
                new SigningContextDao(),
                new DeltaDao(),
                new CandidateDeltaBroadcastDao(),
                new DeltaDfsHashBroadcastDao(),
                new FavouriteDeltaBroadcastDao(),
                new CoinbaseEntryDao(),
                new PublicEntryDao(),
                new ConfidentialEntryDao(),
                new TransactionBroadcastDao(),
                new ContractEntryDao(),
                new SignatureDao(),
                new BaseEntryDao(),
            };

            var map = new MapperProvider(_mappers);

            map.Start();
        }
        public PeerRepositoryTests(ITestOutputHelper output) : base(output)
        {
            var mappers = new IMapperInitializer[]
            {
                new PeerIdDao(),
                new PeerDao()
            };

            var map = new MapperProvider(mappers);

            map.Start();
        }
示例#3
0
        public TransactionBroadcastRepositoryTests(ITestOutputHelper output) : base(output)
        {
            var mappers = new IMapperInitializer[]
            {
                new ProtocolMessageDao(),
                new ConfidentialEntryDao(),
                new ProtocolErrorMessageSignedDao(),
                new PeerIdDao(),
                new SigningContextDao(),
                new CoinbaseEntryDao(),
                new PublicEntryDao(),
                new ConfidentialEntryDao(),
                new TransactionBroadcastDao(),
                new ContractEntryDao(),
                new SignatureDao(),
                new BaseEntryDao(),
            };

            var map = new MapperProvider(mappers);

            map.Start();
        }
示例#4
0
        /// <summary>
        ///     For ref what passing custom boot logic looks like, this is the same as Kernel.StartNode()
        /// </summary>
        /// <param name="kernel"></param>
        /// <returns></returns>
        private static void CustomBootLogic(Kernel kernel)
        {
            var mappers = new IMapperInitializer[]
            {
                new ProtocolMessageDao(),
                new ConfidentialEntryDao(),
                new CandidateDeltaBroadcastDao(),
                new ProtocolErrorMessageSignedDao(),
                new PeerIdDao(),
                new SigningContextDao(),
                new DeltaDao(),
                new CandidateDeltaBroadcastDao(),
                new DeltaDfsHashBroadcastDao(),
                new FavouriteDeltaBroadcastDao(),
                new CoinbaseEntryDao(),
                new PublicEntryDao(),
                new ConfidentialEntryDao(),
                new TransactionBroadcastDao(),
                new RangeProofDao(),
                new ContractEntryDao(),
                new SignatureDao(),
                new BaseEntryDao()
            };

            var map = new MapperProvider(mappers);
            map.Start();

            // core modules
            Kernel.ContainerBuilder.RegisterType<CatalystNodePoa>().As<ICatalystNode>();
            Kernel.ContainerBuilder.RegisterType<ConsoleUserOutput>().As<IUserOutput>();
            Kernel.ContainerBuilder.RegisterType<ConsoleUserInput>().As<IUserInput>();

            // core modules
            Kernel.ContainerBuilder.RegisterModule(new CoreLibProvider());

            Kernel.ContainerBuilder.RegisterModule(new MongoMempoolModule());

            Kernel.ContainerBuilder.RegisterModule(new ConsensusModule());
            Kernel.ContainerBuilder.RegisterModule(new LedgerModule());
            Kernel.ContainerBuilder.RegisterModule(new DiscoveryHastingModule());
            Kernel.ContainerBuilder.RegisterModule(new RpcServerModule());
            Kernel.ContainerBuilder.RegisterModule(new BulletProofsModule());
            Kernel.ContainerBuilder.RegisterModule(new KeystoreModule());
            Kernel.ContainerBuilder.RegisterModule(new KeySignerModule());
            Kernel.ContainerBuilder.RegisterModule(new RpcServerModule());
            Kernel.ContainerBuilder.RegisterModule(new DfsModule());
            Kernel.ContainerBuilder.RegisterModule(new ConsensusModule());
            Kernel.ContainerBuilder.RegisterModule(new BulletProofsModule());
            Kernel.ContainerBuilder.RegisterModule(new AuthenticationModule());

            // node modules
            kernel.ContainerBuilder.RegisterModule(new PoaConsensusModule());
            kernel.ContainerBuilder.RegisterModule(new PoaP2PModule());

            Kernel.ContainerBuilder.Register(c => new MongoDbRepository<TweetLike, string>())
                .As<IRepository<TweetLike, string>>()
                .SingleInstance();
            Kernel.ContainerBuilder.RegisterType<TweetLikeRepository>().As<ITweetLikeRepository>().SingleInstance();
            Kernel.ContainerBuilder.RegisterType<TweetLikeService>().As<ITweetLikeService>().SingleInstance();

            kernel.ContainerBuilder.RegisterModule(new ApiModule("http://*:5006",
                new List<string>
                    {"Catalyst.Core.Modules.Web3", "Catalyst.Module.Twitter", "Catalyst.Module.TwitterLikes"}));

            kernel.StartContainer();
            kernel.Instance.Resolve<ICatalystNode>()
                .RunAsync(new CancellationToken())
                .Wait();
        }