//The tests here are rather complicated; we can probably simplify them in the future, but for now,
    //I just need a system that REALLY tests if this whole thing works, and that is most reliable if
    //I just use the (known to work) dbwriter to set up the database in a way we expect.
    public EventQueueTest(DbUnitTestSearchFixture fixture)
    {
        this.fixture    = fixture;
        this.searcher   = fixture.GetGenericSearcher();
        this.mapper     = fixture.GetService <IMapper>();
        this.permission = fixture.GetService <IPermissionService>();
        this.shortcuts  = fixture.GetService <ShortcutsService>();

        this.config = new LiveEventQueueConfig()
        {
            //Ensure nothing ever expires
            DataCacheExpire = System.TimeSpan.MaxValue
        };
        this.trackerConfig = new CacheCheckpointTrackerConfig()
        {
            CacheCleanFrequency = int.MaxValue
        };
        //Note: WE HAVE TO create a new tracker every time! We don't want old data clogging this up!!
        this.tracker = new CacheCheckpointTracker <LiveEvent>(fixture.GetService <ILogger <CacheCheckpointTracker <LiveEvent> > >(), trackerConfig);
        this.queue   = new LiveEventQueue(fixture.GetService <ILogger <LiveEventQueue> >(), this.config, this.tracker, fixture.dbFactory, this.permission, this.mapper);
        writer       = new DbWriter(fixture.GetService <ILogger <DbWriter> >(), this.searcher,
                                    fixture.GetConnection(), fixture.GetService <IViewTypeInfoService>(), this.mapper,
                                    fixture.GetService <History.IHistoryConverter>(), this.permission, this.queue,
                                    new DbWriterConfig(), new RandomGenerator(), fixture.GetService <IUserService>());


        //Reset it for every test
        fixture.ResetDatabase();
    }
Beispiel #2
0
 public LiveEventQueue(ILogger <LiveEventQueue> logger, LiveEventQueueConfig config, ICacheCheckpointTracker <LiveEvent> tracker, IDbServicesFactory factory,
                       IPermissionService permissionService, IMapper mapper)
 {
     this.logger            = logger;
     this.eventTracker      = tracker;
     this.dbFactory         = factory;
     this.permissionService = permissionService;
     this.config            = config;
     this.mapper            = mapper;
 }