コード例 #1
0
 public PartitionedRefresh(PartitionedTableConfiguration partitionedTable,
                           IPartitionWrapperFactory partitionFactory,
                           ILogger logger)
 {
     _partitionFactory = partitionFactory;
     _logger           = logger;
     PartitionedTable  = partitionedTable;
 }
コード例 #2
0
        public void Setup()
        {
            _configuration = new PartitionedTableConfiguration
            {
                Partitions = new List <PartitionConfiguration>
                {
                    new PartitionConfiguration
                    {
                        Maximum = 20190930, Minimum = 20190901, Name = "20190901", Refresh = true
                    }
                }
            };

            _sut = new RefreshFactory();
        }
コード例 #3
0
 public PartitionedRefresh(PartitionedTableConfiguration partitionedTable)
     : this(partitionedTable, new PartitionWrapperFactory(), LogManager.GetCurrentClassLogger())
 {
 }
コード例 #4
0
        public void Setup()
        {
            _configuration = new PartitionedTableConfiguration
            {
                Partitions = new List <PartitionConfiguration>
                {
                    new PartitionConfiguration
                    {
                        Maximum = 20190930,
                        Minimum = 20190901,
                        Name    = "20190901",
                        Refresh = false
                    },
                    new PartitionConfiguration
                    {
                        Maximum = 20191031,
                        Minimum = 20191001,
                        Name    = "20191001",
                        Refresh = false
                    },
                    new PartitionConfiguration
                    {
                        Maximum = 20191130,
                        Minimum = 20191101,
                        Name    = "20191101",
                        Refresh = true
                    },
                    new PartitionConfiguration
                    {
                        Maximum = 20191231,
                        Minimum = 20191201,
                        Name    = "20191201",
                        Refresh = false
                    }
                }
            };

            _templatePartition = new FakePartitionWrapper
            {
                Name   = "Template",
                Source = new MPartitionSource
                {
                    Expression = "M Expression Where DateKey >= -1 AND DateKey <= -2"
                }
            };

            var collection = new List <IPartitionWrapper>
            {
                _templatePartition,
                new FakePartitionWrapper
                {
                    Name   = "DevPartition",
                    Source = new MPartitionSource
                    {
                        Expression = "M Expression Where DateKey >= 20190101 AND DateKey <= 20190201"
                    }
                },
                new FakePartitionWrapper
                {
                    Name   = "DevPartition2",
                    Source = new MPartitionSource
                    {
                        Expression = "M Expression Where DateKey >= 20190201 AND DateKey <= 20190301"
                    }
                },
                new FakePartitionWrapper
                {
                    Name   = "20190801",
                    Source = new MPartitionSource
                    {
                        Expression = "M Expression Where DateKey >= 20190801 AND DateKey <= 20190831"
                    }
                },
                new FakePartitionWrapper
                {
                    Name   = "20190901",
                    Source = new MPartitionSource
                    {
                        Expression = "M Expression Where DateKey >= 20190901 AND DateKey <= 20190930"
                    }
                },
                new FakePartitionWrapper
                {
                    Name   = "20191001",
                    Source = new MPartitionSource
                    {
                        Expression = "M Expression Where DateKey >= 20191001 AND DateKey <= 20191031"
                    }
                },
                new FakePartitionWrapper
                {
                    Name   = "20191101",
                    Source = new MPartitionSource
                    {
                        Expression = "M Expression Where DateKey >= 20191101 AND DateKey <= 20191130"
                    }
                }
            };

            _partitionFactory = new Mock <IPartitionWrapperFactory>();
            _partitionFactory.Setup(x => x.Create()).Returns(new FakePartitionWrapper());

            _logger = new Mock <ILogger>();

            _partitionCollection = new Mock <IPartitionCollectionWrapper>();
            _partitionCollection.Setup(x => x.Find(It.IsAny <string>())).Returns(_templatePartition);
            _partitionCollection.Setup(x => x.GetEnumerator()).Returns(() => collection.GetEnumerator());

            _partitionCollection.Setup(x => x.Add(It.IsAny <IPartitionWrapper>()))
            .Callback <IPartitionWrapper>(x => collection.Add(x));

            _partitionCollection.Setup(x => x.Remove(It.IsAny <IPartitionWrapper>()))
            .Callback <IPartitionWrapper>(x => collection.Remove(x))
            .Returns(true);

            _table = new Mock <ITableWrapper>();
            _table.Setup(x => x.Partitions).Returns(_partitionCollection.Object);
            _table.Setup(x => x.Name).Returns("PartitionedTable");

            _sut = new PartitionedRefresh(_configuration, _partitionFactory.Object, _logger.Object);
        }
コード例 #5
0
 public IRefresh CreatePartitioned(PartitionedTableConfiguration partitionedTable)
 {
     return(new PartitionedRefresh(partitionedTable));
 }