Beispiel #1
0
 public App(
     ILogger <App> logger,
     DataMoverSettings dataMoverSettings,
     SourceDataReader sourceDataReader,
     DatabasePublisher publisher,
     ReadCommandGenerator readCommandGenerator,
     SchemaCopier schemaCopier)
 {
     _logger               = logger;
     _dataMoverSettings    = dataMoverSettings;
     _sourceDataReader     = sourceDataReader;
     _publisher            = publisher;
     _readCommandGenerator = readCommandGenerator;
     _schemaCopier         = schemaCopier;
 }
        public void GenerateSql_PartitionWithOneRow_ShouldReturnValidString()
        {
            // Arrange
            var insertCommand = new InsertCommand
            {
                TableName = "TestTable",
                Batch     = new Batch
                {
                    Columns = new List <Column>
                    {
                        new Column {
                            Name = "IdField"
                        },
                        new Column {
                            Name = "DateTimeField"
                        },
                        new Column {
                            Name = "MessageField"
                        }
                    }
                }
            };

            var partitionList = new List <List <object> >
            {
                new List <object>
                {
                    1,
                    "2020-04-10 02:42:09",
                    "Test message"
                },
                new List <object>
                {
                    2,
                    "2020-04-10 02:42:09",
                    "Test message"
                }
            };

            // Act
            var res = DatabasePublisher.GenerateSql(insertCommand.TableName, insertCommand.Batch.Columns,
                                                    partitionList.Count, false);

            // Assert
            Assert.AreEqual(
                "insert into `TestTable` (`IdField`,`DateTimeField`,`MessageField`) values (@p1,@p2,@p3),(@p4,@p5,@p6)",
                res);
        }
Beispiel #3
0
        public void Index()
        {
            log.Info("About to index public objects in the following projects...");
            IDictionary<string, Project> projects = ProjectDiscovery.Discover("ProjectConfiguration");
            List<Project> projectList = new List<Project>(projects.Values);
            projectList.ForEach(project => log.InfoFormat("\t{0}", project));

            log.Info("About to gather all declared public objects...");
            List<PublicObject> publics = GatherPublicObjects(projectList);
            log.InfoFormat("Found total of {0} public objects...", publics.Count());

            log.Info("About to find occurrences of all declared public objects...");
            List<Occurrence> occurrences = new List<Occurrence>();
            projectList.ForEach(p => occurrences.AddRange(FindOccurrences(publics, p)));
            log.InfoFormat("Found total of {0} occurrences ...", occurrences.Count);

            log.Info("About to publish the results ...");
            using (DatabasePublisher publisher = new DatabasePublisher())
            {
                publisher.Publish(occurrences);
            }
            log.Info("Results published ...");
            log.Info("Done.");
        }