Esempio n. 1
0
        public void Notify_EmptyChangeMap(SiteModelChangeMapOrigin origin, SiteModelChangeMapOperation operation)
        {
            var notifier = new SiteModelChangeMapDeltaNotifier();

            // The notifier uses the non-transacted storage proxy:
            var proxy = DIContext.Obtain <Func <IStorageProxyCache <ISiteModelChangeBufferQueueKey, ISiteModelChangeBufferQueueItem> > >()();

            proxy.Should().NotBeNull();
            proxy.Clear();

            var projectUid = Guid.NewGuid();
            var insertUtc  = DateTime.UtcNow;

            // Ask the notifier to notify a new item
            notifier.Notify(projectUid, insertUtc, new SubGridTreeSubGridExistenceBitMask(), origin, operation);

            // Check the new item was placed into the cache
            var cachedItem = proxy.Get(new SiteModelChangeBufferQueueKey(projectUid, insertUtc));

            cachedItem.Should().NotBeNull();
            cachedItem.Operation.Should().Be(operation);
            cachedItem.Origin.Should().Be(origin);

            var readMap = new SubGridTreeSubGridExistenceBitMask();

            readMap.FromBytes(cachedItem.Content);

            readMap.CountBits().Should().Be(0);
        }
Esempio n. 2
0
        public void Notify_TAGFileDerivedChangeMap_DirectNotify()
        {
            // Build a site model from a TAG file and verify there is a change map written to the queue that matches the existence map
            // for the newly created model
            var tagFiles = new[]
            {
                Path.Combine(TestHelper.CommonTestDataPath, "TestTAGFile.tag"),
            };

            var siteModel = DITAGFileAndSubGridRequestsFixture.BuildModel(tagFiles, out _);
            var notifier  = new SiteModelChangeMapDeltaNotifier();

            // The notifier uses the non-transacted storage proxy:
            var proxy = DIContext.Obtain <Func <IStorageProxyCache <ISiteModelChangeBufferQueueKey, ISiteModelChangeBufferQueueItem> > >()();

            proxy.Should().NotBeNull();
            proxy.Clear();

            var insertUtc = DateTime.UtcNow;

            // Ask the notifier to notify a new item
            notifier.Notify(siteModel.ID, insertUtc, siteModel.ExistenceMap, SiteModelChangeMapOrigin.Ingest, SiteModelChangeMapOperation.AddSpatialChanges);

            // Check the new item was placed into the cache
            var cachedItem = proxy.Get(new SiteModelChangeBufferQueueKey(siteModel.ID, insertUtc));

            cachedItem.Should().NotBeNull();
            cachedItem.ProjectUID.Should().Be(siteModel.ID);
            cachedItem.Operation.Should().Be(SiteModelChangeMapOperation.AddSpatialChanges);
            cachedItem.Origin.Should().Be(SiteModelChangeMapOrigin.Ingest);

            var readMap = new SubGridTreeSubGridExistenceBitMask();

            readMap.FromBytes(cachedItem.Content);

            readMap.CountBits().Should().Be(12);
            readMap.CountBits().Should().Be(siteModel.ExistenceMap.CountBits());
            readMap.ScanAllSetBitsAsSubGridAddresses(x => siteModel.ExistenceMap[x.X >> SubGridTreeConsts.SubGridIndexBitsPerLevel, x.Y >> SubGridTreeConsts.SubGridIndexBitsPerLevel].Should().BeTrue());
        }
Esempio n. 3
0
        public void Creation()
        {
            var notifier = new SiteModelChangeMapDeltaNotifier();

            notifier.Should().NotBeNull();
        }