public MultiClusterData ApplyDataAndNotify(MultiClusterData data)
        {
            if (data.IsEmpty)
            {
                return(data);
            }

            MultiClusterData delta;
            MultiClusterData prev = this.localData;

            this.localData = prev.Merge(data, out delta);

            if (logger.IsVerbose2)
            {
                logger.Verbose2("ApplyDataAndNotify: delta {0}", delta);
            }

            if (delta.IsEmpty)
            {
                return(delta);
            }

            if (delta.Configuration != null)
            {
                // notify configuration listeners of change
                // code will be added in separate PR
            }

            return(delta);
        }
        private void AssertEffect(MultiClusterData what, MultiClusterData to, MultiClusterData expectedMerge, MultiClusterData expectedDelta = null)
        {
            MultiClusterData delta;
            var merge = to.Merge(what, out delta);

            Assert.True(CheckEquality(expectedMerge, merge));

            if (expectedDelta != null)
            {
                Assert.Equal(expectedDelta, expectedDelta);
            }
        }
        private void TestAlgebraicProperties(MultiClusterData A, MultiClusterData B)
        {
            MultiClusterData D;
            var BB    = B.Merge(A, out D);
            var empty = new MultiClusterData();

            AssertEffect(D, B, BB, D);
            AssertEffect(D, BB, BB, empty);
            AssertEffect(D, A, A, empty);

            AssertEffect(BB.Minus(D), B, B, empty);
            AssertEffect(BB.Minus(D), A, BB);
            AssertEffect(B, A, BB);
        }
Example #4
0
        private void AssertEffect(MultiClusterData what, MultiClusterData to, MultiClusterData expectedMerge, MultiClusterData expectedDelta = null)
        {
            MultiClusterData delta;
            var merge = to.Merge(what, out delta);

            Assert.True(CheckEquality(expectedMerge, merge));

            if (expectedDelta != null)
                Assert.Equal(expectedDelta, expectedDelta);
        }
Example #5
0
        private void TestAlgebraicProperties(MultiClusterData A, MultiClusterData B)
        {
            MultiClusterData D;
            var BB = B.Merge(A, out D);
            var empty = new MultiClusterData();

            AssertEffect(D, B, BB, D);
            AssertEffect(D, BB, BB, empty);
            AssertEffect(D, A, A, empty);

            AssertEffect(BB.Minus(D), B, B, empty);
            AssertEffect(BB.Minus(D), A, BB);
            AssertEffect(B, A, BB);
        }