示例#1
0
        public void OneTimeSetUp()
        {
            var templateHandler = TemplateHandlerBuilder.Build(null);

            _tested = new ForEachColumnTableContextHandler(templateHandler);
            columnNameContextHandler = new ColumnNameColumnContextHandler(templateHandler);
        }
        public void OneTimeSetUp()
        {
            var templateHandlerNew = TemplateHandlerBuilder.Build(null);
            TemplateContextHandlerRegister register = new TemplateContextHandlerRegister(templateHandlerNew, null);

            _tested = new HighLightRulesGenerator(register);
        }
示例#3
0
        public void OneTimeSetUp()
        {
            var templateHandlerNew = TemplateHandlerBuilder.Build(null);

            _tested = new ColumnValueMaxSizeColumnContextHandler(templateHandlerNew);
            _random = new Random();
        }
        public void OneTimeSetUp()
        {
            var templateHandler = TemplateHandlerBuilder.Build(null);

            _tested = new ForEachTablesForeignVisitContextHanlder(templateHandler);
            tableNameTableContextHandler = new TableNameTableContextHandler(templateHandler);
        }
        private static BuildDBTemplateModeAction CreateBuildDBTemplateModeAction()
        {
            var templateHandlerNew = TemplateHandlerBuilder.Build(null);
            TemplateContextHandlerRegister register = new TemplateContextHandlerRegister(templateHandlerNew, null);
            var highLightRulesGenerator             = new HighLightRulesGenerator(register);

            return(new BuildDBTemplateModeAction(highLightRulesGenerator));
        }
        public void OneTimeSetUp()
        {
            templateHandlerNew = TemplateHandlerBuilder.Build(null);
            ITemplateContextHandlerPackageProvider <ITemplateContextHandler> templateContextHandlerPackageProvider =
                new TemplateContextHandlerPackageProvider <ITemplateContextHandler>(templateHandlerNew, null);

            _tested = new ContextVisitor <ITemplateContextHandler>(templateContextHandlerPackageProvider);
        }
        public void SetUp()
        {
            var typeMappings = new List <ITypeMapping>()
            {
            };

            _templateHandlerNew = TemplateHandlerBuilder.Build(typeMappings);
            _tested             = new TemplateContextProcessor(_templateHandlerNew, typeMappings);
        }
        public void ShouldReturnDatabaseNameAndTableName()
        {
            var templateHandlerNew = TemplateHandlerBuilder.Build(null);
            DatabaseNameDatabaseContextHandler databaseNameDatabaseContextHandler = new DatabaseNameDatabaseContextHandler(templateHandlerNew);
            TableNameTableContextHandler       tableNameTableContextHandler       = new TableNameTableContextHandler(templateHandlerNew);
            string databaseName = "DatabaseName";
            string tableName    = "TableName";
            DatabaseTemplateHandlerInputModel input = new DatabaseTemplateHandlerInputModel()
            {
                TemplateModels = new List <ITemplateModel>
                {
                    new TemplateModel()
                    {
                        TemplatedFilePath    = $"{_tested.DatabaseFilePathTemplateWord}-{_tested.TableFilePathTemplateWord}",
                        TemplatedFileContent = $"{databaseNameDatabaseContextHandler.Signature}-{tableNameTableContextHandler.Signature}",
                    }
                },
                DatabaseModel = new DatabaseModel()
                {
                    Name   = databaseName,
                    Tables = new List <ITableModel>()
                    {
                        new TableModel()
                        {
                            Name    = tableName,
                            Columns = new List <IColumnModel>(),
                        }
                    },
                }
            };

            var result = _tested.Process(input);

            Assert.IsNotNull(result);
            CollectionAssert.IsNotEmpty(result);
            Assert.AreEqual(1, result.Count);
            var resultItem = result.First();

            Assert.IsNotNull(resultItem);
            Assert.AreEqual($"{databaseName}-{tableName}", resultItem.Path);
            Assert.AreEqual($"{databaseName}-{tableName}", resultItem.Content);
        }
示例#9
0
        public void OneTimeSetUp()
        {
            var templateHandler = TemplateHandlerBuilder.Build(null);

            _tested = new ForEachNotIndexedColumnTableContextHandler(templateHandler);
        }
        public void OneTimeSetUp()
        {
            var templateHandler = TemplateHandlerBuilder.Build(null);

            _tested = new IsColumnAutoGeneratedValueColumnContextHandler(templateHandler);
        }
 public void OneTimeSetUp()
 {
     _tested = new IsIndexedColumnAFirstIndexedColumnContextHandler(TemplateHandlerBuilder.Build(null));
 }
示例#12
0
        public void OneTimeSetUp()
        {
            var templateHandler = TemplateHandlerBuilder.Build(null);

            _tested = new IsColumnNotALastColumnContextHandler(templateHandler);
        }
示例#13
0
        public void ShouldOneLineDeclarationWithTwoTypeMappingWork()
        {
            MappingDeclarePreprcessorContextHandlerForTest _tested = new MappingDeclarePreprcessorContextHandlerForTest(TemplateHandlerBuilder.Build(null));
            var processed = $@"{{:TDB:PREPROCESSOR:MAPPING:DECLARE([->({envB})<-]<=>[[->({envAType1})<-]=>[->({envBType1})<-],[->({envAType2})<-]=>[->({envBType2})<-]]):PREPROCESSOR:}}";
            var result    = _tested.ProcessContext(processed, null);

            Assert.IsNotNull(_tested.TemplateHandlerNew);
            Assert.IsNotNull(_tested.TemplateHandlerNew.TypeMappings);
            var typeMappings = _tested.TemplateHandlerNew.TypeMappings; CollectionAssert.IsNotEmpty(typeMappings);

            Assert.AreEqual(1, typeMappings.Count);
            var typeMapping = typeMappings.Single();

            Assert.AreEqual(typeMapping.DestinationTypeSetName, envB);
            Assert.IsNotNull(typeMapping.TypeMappingItems);
            CollectionAssert.IsNotEmpty(typeMapping.TypeMappingItems);
            CollectionAssert.AreEquivalent(
                typeMapping.TypeMappingItems.Select(m => $"{m.SourceType}-{m.DestinationType}"),
                new[] {
                $"{envAType1}-{envBType1}",
                $"{envAType2}-{envBType2}",
            });
            Assert.AreEqual(string.Empty, result);
        }
        public void OneTimeSetUp()
        {
            var templateHandler = TemplateHandlerBuilder.Build(null);

            _tested = new ReplaceWithFunctionTemplateHandler(templateHandler);
        }
 public void OneTimeSetUp()
 {
     _tested = new IsAutoColumnNotAFirstAutoColumnContextHandler(TemplateHandlerBuilder.Build(null));
 }
示例#16
0
        public void OneTimeSetUp()
        {
            var templateHandler = TemplateHandlerBuilder.Build(null);

            _tested = new ColumnValueTypeColumnContextHandler(templateHandler);
        }
示例#17
0
 public void OneTimeSetUp()
 {
     _typeMappings    = new List <ITypeMapping>();
     _templateHandler = TemplateHandlerBuilder.Build(_typeMappings);
     _tested          = new TemplatePreprocessor(_templateHandler, _typeMappings);
 }
        public void OneTimeSetUp()
        {
            var templateHandlerNew = TemplateHandlerBuilder.Build(null);

            _tested = new IsColumnNotNullValueColumnContextHandler(templateHandlerNew);
        }
        public void OneTimeSetUp()
        {
            var templateHandler = TemplateHandlerBuilder.Build(null);

            _tested = new ConnectionStringDatabaseContextHandler(templateHandler);
        }
示例#20
0
        public void OneTimeSetUp()
        {
            var templateHandler = TemplateHandlerBuilder.Build(null);

            _tested = new DatabaseNameDatabaseContextHandler(templateHandler);
        }
示例#21
0
        public void OneTimeSetUp()
        {
            columnValueTypeColumnContextHandler = new ColumnValueTypeSemanticDefinition();
            var typeMappings = new List <ITypeMapping>()
            {
                new TypeMappingForTest()
                {
                    DestinationTypeSetName = "JAVA",
                    TypeMappingItems       = new List <ITypeMappingItem>()
                    {
                        new TypeMappingItemForTest()
                        {
                            SourceType = "INT", DestinationType = "int"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "BIGINT", DestinationType = "long"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "BOOLEAN", DestinationType = "boolean"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "CHAR", DestinationType = "char"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "DATE", DestinationType = "Date"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "DATETIME", DestinationType = "Date"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "DECIMAL", DestinationType = "double"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "INTEGER", DestinationType = "int"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "NUMERIC", DestinationType = "double"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "REAL", DestinationType = "double"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "STRING", DestinationType = "String"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "TEXT", DestinationType = "String"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "TIME", DestinationType = "Date"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "VARCHAR", DestinationType = "String"
                        },
                    }
                },
                new TypeMappingForTest()
                {
                    DestinationTypeSetName = "JAVA_WITH_PROCESSED_OUTPUT_TYPE",
                    TypeMappingItems       = new List <ITypeMappingItem>()
                    {
                        new TypeMappingItemForTest()
                        {
                            SourceType = "INT", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->int"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "BIGINT", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->long"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "BOOLEAN", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->boolean"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "CHAR", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->char"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "DATE", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->Date"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "DATETIME", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->Date"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "DECIMAL", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->double"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "INTEGER", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->int"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "NUMERIC", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->double"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "REAL", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->double"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "STRING", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->String"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "TEXT", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->String"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "TIME", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->Date"
                        },
                        new TypeMappingItemForTest()
                        {
                            SourceType = "VARCHAR", DestinationType = $"{columnValueTypeColumnContextHandler.Signature}->String"
                        },
                    }
                },
            };

            _tested = new ColumnValueConvertTypeColumnContextHandler(TemplateHandlerBuilder.Build(typeMappings), typeMappings); //Bad check how to make full IOC
        }
        public void OneTimeSetUp()
        {
            var templateHandler = TemplateHandlerBuilder.Build(null);

            _tested = new WhenHasIndexColumnTableContextHandler(templateHandler);
        }
示例#23
0
        public void OneTimeSetUp()
        {
            var templateHandlerNew = TemplateHandlerBuilder.Build(null);

            _tested = new AutoColumnIndexColumnContextHandler(templateHandlerNew);
        }
        public void OneTimeSetUp()
        {
            var templateHandler = TemplateHandlerBuilder.Build(null);

            _tested = new TableSchemaTableContextHandler(templateHandler);
        }
示例#25
0
        public void OneTimeSetUp()
        {
            var templateHanlder = TemplateHandlerBuilder.Build(null);

            _tested = new ConstraintNameConstraintContextHandler(templateHanlder);
        }