예제 #1
0
        private MonitorServiceTests Setup()
        {
            Cleanup();

            options = new DbContextOptionsBuilder <DatastoreContext>()
                      .UseInMemoryDatabase(Guid.NewGuid().ToString())
                      .Options;
            using (var store = new DatastoreContext(options, StubConfig.Default))
            {
                store.Database.EnsureCreated();
            }
            SetupDataStore();
            datastoreContext = new DatastoreContext(options, StubConfig.Default);

            var mapperConfig = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(new SettingsAutoMapper());
                cfg.AddProfile(new MonitorAutoMapper());
            });

            DatastoreRepository = Substitute.For <IDatastoreRepository>();
            var bodyStore = new StubMessageBodyRetriever(() => Stream.Null);

            monitorService = new MonitorService(datastoreContext, SetupPmodeSource(), DatastoreRepository, bodyStore, mapperConfig);

            return(this);
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MonitorService" /> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="pmodeSource">The pmode source.</param>
 /// <param name="datastoreRepository">The datastore repository.</param>
 /// <param name="mapperConfig">The mapper configuration.</param>
 public MonitorService(
     DatastoreContext context,
     IAs4PmodeSource pmodeSource,
     IDatastoreRepository datastoreRepository,
     MapperConfiguration mapperConfig)
     : this(context, pmodeSource, datastoreRepository, Registry.Instance.MessageBodyStore, mapperConfig)
 {
 }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MarkForRetryService"/> class.
        /// </summary>
        /// <param name="repository">The repository.</param>
        public MarkForRetryService(IDatastoreRepository repository)
        {
            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }

            _repository = repository;
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PiggyBackingService"/> class.
        /// </summary>
        internal PiggyBackingService(DatastoreContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            _context    = context;
            _repository = new DatastoreRepository(_context);
        }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MonitorService" /> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="pmodeSource">The pmode source.</param>
 /// <param name="datastoreRepository">The datastore repository.</param>
 /// <param name="bodyStore">The body store.</param>
 /// <param name="mapperConfig">The mapper configuration.</param>
 public MonitorService(
     DatastoreContext context,
     IAs4PmodeSource pmodeSource,
     IDatastoreRepository datastoreRepository,
     IAS4MessageBodyStore bodyStore,
     MapperConfiguration mapperConfig)
 {
     this.context             = context;
     this.pmodeSource         = pmodeSource;
     this.datastoreRepository = datastoreRepository;
     this.bodyStore           = bodyStore;
     this.mapperConfig        = mapperConfig;
 }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InMessageService"/> class.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="repository">The repository.</param>
        public InMessageService(IConfig config, IDatastoreRepository repository)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }

            _configuration = config;
            _repository    = repository;
        }
예제 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OutMessageService" /> class.
        /// </summary>
        /// <param name="config">The configuration used to retrieve the response <see cref="SendingProcessingMode"/> while inserting messages and the store location for <see cref="OutMessage"/>s.</param>
        /// <param name="repository">The repository used to insert and update <see cref="OutMessage"/>s.</param>
        /// <param name="messageBodyStore">The <see cref="IAS4MessageBodyStore"/> that must be used to persist the AS4 Message Body.</param>
        public OutMessageService(IConfig config, IDatastoreRepository repository, IAS4MessageBodyStore messageBodyStore)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }

            if (messageBodyStore == null)
            {
                throw new ArgumentNullException(nameof(messageBodyStore));
            }

            _configuration    = config;
            _repository       = repository;
            _messageBodyStore = messageBodyStore;
        }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExceptionService"/> class.
        /// </summary>
        public ExceptionService(
            IConfig config,
            IDatastoreRepository repository,
            IAS4MessageBodyStore bodyStore)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (repository == null)
            {
                throw new ArgumentNullException(nameof(repository));
            }

            if (bodyStore == null)
            {
                throw new ArgumentNullException(nameof(bodyStore));
            }

            _config     = config;
            _repository = repository;
            _bodyStore  = bodyStore;
        }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OutMessageService"/> class.
 /// </summary>
 /// <param name="repository">The repository used to insert and update <see cref="OutMessage"/>s.</param>
 /// <param name="messageBodyStore">The <see cref="IAS4MessageBodyStore"/> that must be used to persist the AS4 Message Body.</param>
 public OutMessageService(IDatastoreRepository repository, IAS4MessageBodyStore messageBodyStore)
     : this(Config.Instance, repository, messageBodyStore)
 {
 }