public void TestBaseBLAttribute_ByCoreBaseAttribute()
        {
            // Daten einlesen...
            var fileName = @"..\..\..\..\Test\Data\interface_demo.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);

            // Auswählen
            var coreIfa  = model.Interfaces[0];
            var coreAttr = coreIfa.Attributes[0];
            var blIfa    = new DefaultBLInterface(coreIfa, null);

            // In BaseBLAttribute konvertieren
            BaseBLAttribute attr = new BaseBLAttribute((CoreBaseAttribute)coreAttr, blIfa);

            // Inhalt überprüfen
            Assert.AreEqual("Semester_KNZ", attr.Name);
            Assert.AreEqual("def_Semester.Semester_KNZ", attr.FullName);
            Assert.AreEqual(CoreDataType.VARCHAR, attr.DataType);
            Assert.AreEqual(50, attr.Length);
            Assert.AreEqual(0, attr.Decimals);
            Assert.IsTrue(attr.IsPartOfUniqueKey);
            Assert.IsFalse(attr.IsIdentity);
            Assert.IsFalse(attr.IsPrimaryKey);
        }
Esempio n. 2
0
        public void TestALBaseAttribute_GetName()
        {
            // Daten einlesen...
            var fileName = @"..\..\..\..\Test\Data\al_tests.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);

            var bt      = new BT.BTModel(model);
            var alModel = new AL.ALModel(bt);

            var baseAttr = alModel.FactInterfaces[0].Attributes.Where(a => a is BaseALAttribute).FirstOrDefault();

            Assert.IsNotNull(baseAttr);
            Assert.AreEqual("Students_ID", baseAttr.Name);

            baseAttr = alModel.DimensionInterfaces[0].Attributes.Where(a => a is BaseALAttribute).FirstOrDefault();
            Assert.IsNotNull(baseAttr);
            Assert.AreEqual("Term_Primary_TermGroup_ID", baseAttr.Name);

            baseAttr = alModel.DimensionInterfaces[2].Attributes.Where(a => a is BaseALAttribute).FirstOrDefault();
            Assert.IsNotNull(baseAttr);
            Assert.AreEqual("Term_Term_ID", baseAttr.Name);
        }
        public void TestInterfaceParser()
        {
            var data   = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\interface_demo.ceusdl"));
            var p      = new InterfaceParser(data);
            var result = p.Parse();

            // TODO: Ausgabe

            data   = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\interface_demo2.ceusdl"));
            p      = new InterfaceParser(data);
            result = p.Parse();

            data = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\interface_demo3.ceusdl"));
            p    = new InterfaceParser(data);
            var result2 = p.Parse();

            if (!result.Name.Equals(result2.Name))
            {
                throw new InvalidOperationException("Name nicht gleich!");
            }
            if (!result.Type.Equals(result2.Type))
            {
                throw new InvalidOperationException("Type nicht gleich!");
            }
            if (!result.Attributes.Count.Equals(result2.Attributes.Count))
            {
                throw new InvalidOperationException("Anzahl Attribute nicht gleich!");
            }
            if (!result.Parameters.Count.Equals(result2.Parameters.Count))
            {
                throw new InvalidOperationException("Anzahl Attribute nicht gleich!");
            }
        }
Esempio n. 4
0
        static void ExecuteCompilation(string srcFile, GenerationOptions options)
        {
            string conStr = null;

            if (options != null)
            {
                conStr = options.DbConnectionString;
            }
            var data   = new ParsableData(System.IO.File.ReadAllText(srcFile), srcFile);
            var p      = new FileParser(data);
            var result = p.Parse();
            var model  = new CoreModel(result);

            var validationResult = CoreModelValidator.Validate(model);

            validationResult.Print();
            if (validationResult.ContainsErrors())
            {
                Console.WriteLine("ERROR: Compilation stopped by validation errors");
                throw new CeusdlCompilationException(validationResult);
            }

            // CeusDL generieren.
            ExecuteStep(new CeusDLGenerator(model), GENERATED_CEUSDL);

            // Code generieren
            if (options.GenerateMySql)
            {
                ExecuteGenerationMySql(options, conStr, model);
            }
            else
            {
                ExecuteGenerationMsSql(options, conStr, model);
            }
        }
        public void TestAttributeParser()
        {
            var data4   = new ParsableData("base KNZ:varchar(len=\"50\", primary_key=\"true\");");
            var p4      = new AttributeParser(data4);
            var result4 = p4.Parse();

            Console.WriteLine($"Result4: {result4.AttributeType} {result4.Name} {result4.Parameters.Count}");

            data4   = new ParsableData("base KURZBEZ:varchar ( len = \"100\"  ) ;          ");
            p4      = new AttributeParser(data4);
            result4 = p4.Parse();
            Console.WriteLine($"Result4: {result4.AttributeType} {result4.Name} {result4.Parameters.Count}");

            data4   = new ParsableData("fact Anzahl_F:decimal(len=\"1,0\",\n\t default=\"1\"); // ein default=\"1\" wäre hier noch nett");
            p4      = new AttributeParser(data4);
            result4 = p4.Parse();
            Console.WriteLine($"Result4: {result4.AttributeType} {result4.Name} {result4.Parameters.Count}");

            data4   = new ParsableData("ref JaNein.KNZ as Zulassung; // Zulassung_JaNein");
            p4      = new AttributeParser(data4);
            result4 = p4.Parse();
            Console.WriteLine($"Result4: {result4.AttributeType} {result4.InterfaceName}.{result4.FieldName} {result4.Alias}");

            // Neuer Testfall: ref-Attribute sollen auch Primärschlüssel-Bestandteile sein können!
            data4   = new ParsableData("ref Tag.KNZ(primary_key=\"true\");");
            p4      = new AttributeParser(data4);
            result4 = p4.Parse();
            Console.WriteLine($"Result4: {result4.AttributeType} {result4.InterfaceName}.{result4.FieldName} {result4.Alias}");
        }
        public void TestConfigParser()
        {
            var data   = new ParsableData("config  {\r\n name=\"Wiedermann\";\n vorname=\"Wolfgang\";\n\n}");
            var p      = new ConfigParser(data);
            var result = p.Parse();


            foreach (var v in result.Parameters)
            {
                Console.WriteLine($"Result5: {v.Name} -> {v.Value}");
            }
            Console.WriteLine("------");


            data   = new ParsableData(" config { // Beispieldatei\n name=\"Wiedermann\";\n vorname=\"Wolfgang\";\n\n}");
            p      = new ConfigParser(data);
            result = p.Parse();

            foreach (var v in result.Parameters)
            {
                Console.WriteLine($"Result5: {v.Name} -> {v.Value}");
            }

            Console.WriteLine("------");


            data   = new ParsableData("config { /* Beispieldatei */ name=\"Wiedermann\";\n \n /* Beispieldatei */\n vorname=\"Wolfgang\";\n\n}\n // Und noch ein Kommentar, der eigentlich ignoriert werden sollte...");
            p      = new ConfigParser(data);
            result = p.Parse();

            foreach (var v in result.Parameters)
            {
                Console.WriteLine($"Result5: {v.Name} -> {v.Value}");
            }
        }
Esempio n. 7
0
        public void TestAttributeRecognition_Case2()
        {
            var       data   = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\file_demo2.ceusdl"));
            var       p      = new FileParser(data);
            var       result = p.Parse();
            CoreModel m      = new CoreModel(result);

            if (m.Interfaces.Count != result.Interfaces.Count)
            {
                throw new Exception("ERROR: Anzahl der Interfaces in Tmp und Core verschieden");
            }

            var b = m.Interfaces.Where(i => i.Name == "Bewerber").First();

            if (!b.IsMandant)
            {
                throw new Exception("ERROR: Das Interfaces Bewerber ist definitiv Mandanten-abhängig.");
            }
            if (!b.IsHistorized)
            {
                throw new Exception("ERROR: Das Interfaces Bewerber ist definitiv nach Tag.KNZ historisiert.");
            }
            if (!((CoreRefAttribute)b.HistoryBy).ReferencedInterface.Name.Equals("Tag"))
            {
                throw new Exception("ERROR: Das Interfaces Bewerber ist definitiv nach Tag.KNZ historisiert.");
            }

            Console.WriteLine("Und jetzt im Debugger testen!");
        }
        public void TestDerivedBLInterface_FormerName()
        {
            var fileName = @"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\interface_demo2.1.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);
            var blModel  = new BLModel(model);

            // Auswählen
            var coreIfa  = model.Interfaces[0];
            var coreAttr = coreIfa.Attributes[0];

            // in DefaultBLInterface konvertieren
            var blIfa = new DefaultBLInterface(coreIfa, blModel);

            Assert.AreEqual("AP_BL_D_StudiengangHisInOne", blIfa.Name);
            Assert.AreEqual("AP_BL_D_Studiengang", blIfa.FormerName);
            Assert.AreEqual("FH_AP_BaseLayer.dbo.AP_BL_D_Studiengang", blIfa.FullFormerName);

            var blIfa2 = new DerivedBLInterface(blIfa, blModel);

            Assert.AreEqual("AP_BL_D_StudiengangHisInOne_VERSION", blIfa2.Name);
            Assert.AreEqual("AP_BL_D_Studiengang_VERSION", blIfa2.FormerName);
            Assert.AreEqual("FH_AP_BaseLayer.dbo.AP_BL_D_Studiengang_VERSION", blIfa2.FullFormerName);
        }
Esempio n. 9
0
        public void TestParseWithSplitFile()
        {
            var fileName = @"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\split_main.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();

            // TODO: Hier noch Asserts einbauen, bisher testet das halt einfach
            //       obs ohne Exception durchläuft.
        }
        public void TestFileParser()
        {
            var data   = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\file_demo.ceusdl"));
            var p      = new FileParser(data);
            var result = p.Parse();

            if (result.Config == null)
            {
                throw new InvalidOperationException("Config darf nicht null sein!");
            }
            if (result.Config?.Parameters?.Count != 6)
            {
                throw new InvalidOperationException("Falsche Zahl an Config-Parametern gefunden");
            }
            Assert.AreEqual(4, result.Interfaces?.Count);
            if (result.Interfaces?.Count != 4)
            {
                throw new InvalidOperationException("Falsche Zahl an Interfaces gefunden");
            }

            data   = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\file_demo2.ceusdl"));
            p      = new FileParser(data);
            result = p.Parse();

            if (result.Config == null)
            {
                throw new InvalidOperationException("Config darf nicht null sein!");
            }
            if (result.Config?.Parameters?.Count != 6)
            {
                throw new InvalidOperationException("Falsche Zahl an Config-Parametern gefunden");
            }
            if (result.Interfaces?.Count != 34)
            {
                throw new InvalidOperationException("Falsche Zahl an Interfaces gefunden");
            }

            data   = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\file_demo3.ceusdl"));
            p      = new FileParser(data);
            result = p.Parse();

            if (result.Config == null)
            {
                throw new InvalidOperationException("Config darf nicht null sein!");
            }
            if (result.Config?.Parameters?.Count != 6)
            {
                throw new InvalidOperationException("Falsche Zahl an Config-Parametern gefunden");
            }
            if (result.Interfaces?.Count != 34)
            {
                throw new InvalidOperationException("Falsche Zahl an Interfaces gefunden");
            }
        }
Esempio n. 11
0
        public void TestParseSimpleImport()
        {
            var data   = new ParsableData("import \"../../../../Test/Data/interface_demo.ceusdl\"");
            var p      = new ImportParser(data);
            var result = p.Parse();

            Console.WriteLine($"Result : {result.Path}");

            StringAssert.EndsWith(result.Path, "..\\..\\..\\..\\Test\\Data\\interface_demo.ceusdl");
            Assert.AreEqual(1, result?.Content?.Interfaces?.Count);
            Assert.AreEqual("Semester", result.Content.Interfaces[0].Name);
        }
        public void TestDefaultBLInterface_BySimpleFile()
        {
            // Daten einlesen...
            var fileName = @"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\interface_demo.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);

            // Auswählen
            var coreIfa  = model.Interfaces[0];
            var coreAttr = coreIfa.Attributes[0];

            // in DefaultBLInterface konvertieren
            var blIfa = new DefaultBLInterface(coreIfa, null);

            IBLAttribute attr = blIfa.Attributes[0];

            // Inhalt des 0. Attributs überprüfen
            Assert.AreEqual("Semester_ID", attr.Name);
            Assert.AreEqual("def_Semester.Semester_ID", attr.FullName);
            Assert.AreEqual(CoreDataType.INT, attr.DataType);
            Assert.AreEqual(0, attr.Length);
            Assert.AreEqual(0, attr.Decimals);
            Assert.IsFalse(attr.IsPartOfUniqueKey);
            Assert.IsTrue(attr.IsIdentity);
            Assert.IsTrue(attr.IsPrimaryKey);

            attr = blIfa.Attributes[1];

            // Inhalt des 1. Attributs überprüfen
            Assert.AreEqual("Semester_KNZ", attr.Name);
            Assert.AreEqual("def_Semester.Semester_KNZ", attr.FullName);
            Assert.AreEqual(CoreDataType.VARCHAR, attr.DataType);
            Assert.AreEqual(50, attr.Length);
            Assert.AreEqual(0, attr.Decimals);
            Assert.IsTrue(attr.IsPartOfUniqueKey);
            Assert.IsFalse(attr.IsIdentity);
            Assert.IsFalse(attr.IsPrimaryKey);

            attr = blIfa.Attributes[2];

            // Inhalt des 2. Attributs überprüfen
            Assert.AreEqual("Semester_KURZBEZ", attr.Name);
            Assert.AreEqual("def_Semester.Semester_KURZBEZ", attr.FullName);
            Assert.AreEqual(CoreDataType.VARCHAR, attr.DataType);
            Assert.AreEqual(100, attr.Length);
            Assert.AreEqual(0, attr.Decimals);
            Assert.IsFalse(attr.IsPartOfUniqueKey);
            Assert.IsFalse(attr.IsIdentity);
            Assert.IsFalse(attr.IsPrimaryKey);
        }
Esempio n. 13
0
        public void TestBLModel_BySimpleFile()
        {
            // Daten einlesen...
            var fileName = @"..\..\..\..\Test\Data\interface_demo.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);

            var blModel = new BLModel(model);
            var blIfa   = blModel.Interfaces[0];

            // Properties des 0. Interfaces prüfen...
            Assert.IsFalse(blIfa.IsHistorized);
            Assert.IsNull(blIfa.HistoryAttribute);

            IBLAttribute attr = blIfa.Attributes[0];

            // Inhalt des 0. Attributs überprüfen
            Assert.AreEqual("Semester_ID", attr.Name);
            Assert.AreEqual("def_Semester.Semester_ID", attr.FullName);
            Assert.AreEqual(CoreDataType.INT, attr.DataType);
            Assert.AreEqual(0, attr.Length);
            Assert.AreEqual(0, attr.Decimals);
            Assert.IsFalse(attr.IsPartOfUniqueKey);
            Assert.IsTrue(attr.IsIdentity);
            Assert.IsTrue(attr.IsPrimaryKey);

            attr = blIfa.Attributes[1];

            // Inhalt des 1. Attributs überprüfen
            Assert.AreEqual("Semester_KNZ", attr.Name);
            Assert.AreEqual("def_Semester.Semester_KNZ", attr.FullName);
            Assert.AreEqual(CoreDataType.VARCHAR, attr.DataType);
            Assert.AreEqual(50, attr.Length);
            Assert.AreEqual(0, attr.Decimals);
            Assert.IsTrue(attr.IsPartOfUniqueKey);
            Assert.IsFalse(attr.IsIdentity);
            Assert.IsFalse(attr.IsPrimaryKey);

            attr = blIfa.Attributes[2];

            // Inhalt des 2. Attributs überprüfen
            Assert.AreEqual("Semester_KURZBEZ", attr.Name);
            Assert.AreEqual("def_Semester.Semester_KURZBEZ", attr.FullName);
            Assert.AreEqual(CoreDataType.VARCHAR, attr.DataType);
            Assert.AreEqual(100, attr.Length);
            Assert.AreEqual(0, attr.Decimals);
            Assert.IsFalse(attr.IsPartOfUniqueKey);
            Assert.IsFalse(attr.IsIdentity);
            Assert.IsFalse(attr.IsPrimaryKey);
        }
Esempio n. 14
0
        public void TestParseToCoreModelWithSplitFile()
        {
            var fileName = @"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\split_main.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();

            var model = new CoreModel(result);

            Assert.AreEqual(39, model.Interfaces.Count);
            Assert.AreEqual("Tag", model.Interfaces.Where(i => i.Name == "Tag").First().Name);
            Assert.AreEqual("Studienfach", model.Interfaces.Where(i => i.Name == "Studienfach").First().Name);
        }
Esempio n. 15
0
        public void TestBLModel_ByComplexFile()
        {
            // Daten einlesen...
            var fileName = @"..\..\..\..\Test\Data\file_demo2.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);

            var blModel = new BLModel(model);

            Assert.AreEqual(34, blModel.Interfaces.Count);
        }
Esempio n. 16
0
        public static void RunTests()
        {
            var test = new CeusDLGeneratorTest();

            var data = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\file_demo2.ceusdl"));
            //var data = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\sample.ceusdl"));
            var p      = new FileParser(data);
            var result = p.Parse();
            var model  = new CoreModel(result);

            test.GenerateCeusDL(model);
            test.TestILModel(model);
        }
        public void TestCommentParser()
        {
            var data2   = new ParsableData("//LineComment\n\n   ");
            var p2      = new CommentParser(data2);
            var result2 = p2.Parse();

            Console.WriteLine($"Result2: {result2}");

            var data3   = new ParsableData("/*\n * ein einfacher Block Comment\n *\n*/\n   ");
            var p3      = new CommentParser(data3);
            var result3 = p3.Parse();

            Console.WriteLine($"Result3: {result3}");
        }
        public void TestNextNonWhitespaceIs()
        {
            var data = new ParsableData("     // Hallo Welt\n so gehts doch nicht");

            if (ParserUtil.NextNonWhitespaceIs(data, '/'))
            {
                Console.WriteLine("Passt");
            }
            else
            {
                Console.WriteLine("Passt NICHT !!!");
                Assert.Fail("Passt nicht!");
            }
        }
Esempio n. 19
0
        public void TestAttributeRecognition_Case1()
        {
            var data   = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\file_demo.ceusdl"));
            var p      = new FileParser(data);
            var result = p.Parse();

            CoreModel m = new CoreModel(result);

            if (!(m.Interfaces[1].Attributes[3] is CoreRefAttribute))
            {
                Console.WriteLine("Fehler: Das 4. Attribut im Interface StudiengangHISinOne muss ein RefAttribut sein.");
            }

            Console.WriteLine("Und jetzt im Debugger testen!");
        }
        public void TestNamedParameterParser()
        {
            var data   = new ParsableData("text=\"Hallo Welt\\n----------\"");
            var p      = new NamedParameterParser(data);
            var result = p.Parse();

            Console.WriteLine($"Result : {result.Name} = {result.Value}");

            data   = new ParsableData("text = \"Hallo Welt\\n----------\"");
            p      = new NamedParameterParser(data);
            result = p.Parse();
            Console.WriteLine($"Result : {result.Name} = {result.Value}");

            Assert.AreEqual("text", result.Name);
            Assert.AreEqual("Hallo Welt\n----------", result.Value);
        }
Esempio n. 21
0
        public void TestDimensionALInterface_GetName()
        {
            // Daten einlesen...
            var fileName = @"..\..\..\..\Test\Data\al_tests.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);

            var bt      = new BT.BTModel(model);
            var alModel = new AL.ALModel(bt);
            var refBt   = (BT.RefBTAttribute)bt.Interfaces[3].Attributes.Where(a => a is BT.RefBTAttribute).FirstOrDefault();
            var dim     = new DimensionALInterface(alModel, refBt);

            Assert.IsNotNull(refBt);
            Assert.AreEqual("ARC_D_Term_1_Term", dim.Name);
        }
        public void TestBaseBLAttribute_FormerName()
        {
            var fileName  = @"..\..\..\..\Test\Data\interface_demo.1.ceusdl";
            var data      = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p         = new FileParser(data);
            var result    = p.Parse();
            var coreModel = new CoreModel(result);
            var blModel   = new BLModel(coreModel);

            // Auswählen
            var blIfa  = (DefaultBLInterface)blModel.Interfaces[0];
            var blAttr = (BaseBLAttribute)blIfa.Attributes.Where(a => a.ShortName == "KURZBEZ").First();

            Assert.AreEqual("AP_def_Semester", blIfa.Name);
            Assert.AreEqual("Semester_KURZBEZ", blAttr.Name);
            Assert.AreEqual("Sem_KurzBezeichnung", blAttr.FormerName);
            Assert.AreEqual("AP_def_Sem.Sem_KurzBezeichnung", blAttr.FullFormerName);
        }
        public void TestInterfaceRenamed_Complex()
        {
            var fileName = @"..\..\..\..\Test\Data\interface_demo.3.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);
            var blModel  = new BLModel(model);

            // Auswählen
            var ifa = blModel.Interfaces[0];

            using (var con = new SqlConnection("Data Source=localhost;Initial Catalog=FH_AP_BaseLayer;Integrated Security=True;Application Name=\"CEUSDL Tests\"")) {
                con.Open();
                var  ana = new ModificationAnalyzer(blModel, con);
                bool tex = ana.InterfaceRenamed(ifa);
                Assert.IsTrue(tex);
            }
        }
Esempio n. 24
0
        public void TestBTAttribute_RefAttributesNaming()
        {
            // Daten einlesen aus Datei ohne Config-Section
            var fileName = @"..\..\..\..\Test\Data\interface_demo.2.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);
            var blModel  = new BL.BLModel(model);
            var btModel  = new BTModel(blModel);

            Assert.AreEqual(3, btModel.Interfaces.Count);
            Assert.AreEqual("AP", btModel.Config.Prefix);
            Assert.AreEqual("FH_AP_BaseLayer", btModel.Config.BTDatabase);

            var btIfa = btModel.Interfaces[0];

            Assert.AreEqual("AP_BT_D_Land", btIfa.Name);

            var btAttr1 = btIfa.Attributes[6];

            Assert.IsTrue(btAttr1 is RefBTAttribute);
            var refAttr = (RefBTAttribute)btAttr1;

            Assert.AreEqual("Kontinent_KNZ", refAttr.KnzAttribute.Name);
            Assert.AreEqual("Kontinent_ID", refAttr.IdAttribute.Name);
            Assert.AreEqual(CoreDataType.VARCHAR, refAttr.KnzAttribute.DataType);
            Assert.AreEqual(CoreDataType.INT, refAttr.IdAttribute.DataType);
            Assert.AreEqual("varchar(50)", refAttr.KnzAttribute.SqlDataType);
            Assert.AreEqual("int", refAttr.IdAttribute.SqlDataType);

            var btAttr2 = btIfa.Attributes[7];

            Assert.IsTrue(btAttr2 is RefBTAttribute);
            refAttr = (RefBTAttribute)btAttr2;
            Assert.AreEqual("ExistiertSeit_Semester_KNZ", refAttr.KnzAttribute.Name);
            Assert.AreEqual("ExistiertSeit_Semester_ID", refAttr.IdAttribute.Name);
            Assert.AreEqual("Semester_KNZ", refAttr.KnzAttribute.ShortName);
            Assert.AreEqual("Semester_ID", refAttr.IdAttribute.ShortName);
            Assert.AreEqual("ExistiertSeit", refAttr.KnzAttribute.Alias);
            Assert.AreEqual("ExistiertSeit", refAttr.IdAttribute.Alias);
        }
        public void TestRefBLAttribute_FormerName()
        {
            var fileName  = @"..\..\..\..\Test\Data\interface_demo.2.ceusdl";
            var data      = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p         = new FileParser(data);
            var result    = p.Parse();
            var coreModel = new CoreModel(result);
            var blModel   = new BLModel(coreModel);

            var ifaLand  = (DefaultBLInterface)blModel.Interfaces[0];
            var attrKont = (RefBLAttribute)ifaLand.Attributes.Where(a => a.Name.Contains("Kontinent")).First();

            Assert.IsNotNull(attrKont);
            Assert.AreEqual("Kontinent_KNZ", attrKont.Name);
            Assert.AreEqual("Kont_Kontinent_KNZ", attrKont.FormerName);
            Assert.AreEqual("AP_BL_D_Land.Kont_Kontinent_KNZ", attrKont.FullFormerName);

            // Das wird noch interessant, denn was ist, wenn Attributbezeichnung und Tabellenbezeichnung
            // zu unterschiedlichen Zeitpunkten geändert werden?
        }
Esempio n. 26
0
        public void TestBTModel_WithMandantAndHistoryFile2()
        {
            // Daten einlesen aus Datei ohne Config-Section
            var fileName = @"..\..\..\..\Test\Data\interface_demo.6.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);
            var blModel  = new BL.BLModel(model);
            var btModel  = new BTModel(blModel);

            Assert.AreEqual(4, btModel.Interfaces.Count);
            Assert.AreEqual("AP", btModel.Config.Prefix);
            Assert.AreEqual("FH_AP_BaseLayer", btModel.Config.BLDatabase);
            Assert.AreEqual("FH_AP_BaseLayer", btModel.Config.BTDatabase);

            var btIfa = btModel.Interfaces[0];

            Assert.AreEqual("Land", btIfa.ShortName);
            Assert.AreEqual("AP_BT_D_Land", btIfa.Name);
            Assert.AreEqual("FH_AP_BaseLayer.dbo.AP_BT_D_Land", btIfa.FullName);

            var btIfaV = btModel.Interfaces[1];

            Assert.AreEqual("AP_BT_D_Land_VERSION", btIfaV.Name);

            var identity = (BaseBTAttribute)btIfaV.Attributes[0];

            Assert.AreEqual("Land_VERSION_ID", identity.Name);
            Assert.IsTrue(identity.IsIdentity);

            var reference = (RefBTAttribute)btIfaV.Attributes[2];

            Assert.AreEqual("Land_ID", reference.IdAttribute.Name);
            Assert.AreEqual("Land_KNZ", reference.KnzAttribute.Name);
            Assert.AreEqual("AP_BL_D_Land", reference.ReferencedBLInterface.Name);
            Assert.AreEqual("AP_BT_D_Land", reference.ReferencedBTInterface.Name);
            Assert.AreEqual("Land_ID", ((BaseBTAttribute)(reference.ReferencedBTAttribute)).Name);
            Assert.AreEqual("Land_KNZ", reference.ReferencedBLAttribute.Name);
        }
Esempio n. 27
0
        public void TestBTModel_BySimpleFile()
        {
            // Daten einlesen aus Datei ohne Config-Section
            var fileName = @"..\..\..\..\Test\Data\interface_demo.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);
            var blModel  = new BL.BLModel(model);
            var btModel  = new BTModel(blModel);

            Assert.AreEqual(1, btModel.Interfaces.Count);
            Assert.AreEqual(null, btModel.Config.Prefix);
            Assert.AreEqual(null, btModel.Config.BLDatabase);
            Assert.AreEqual(null, btModel.Config.BTDatabase);

            var btIfa = btModel.Interfaces[0];

            Assert.AreEqual("Semester", btIfa.ShortName);
            Assert.AreEqual("BT_D_Semester", btIfa.Name);
            Assert.AreEqual("dbo.BT_D_Semester", btIfa.FullName);
        }
Esempio n. 28
0
        public void TestBTModel_WithMandantAndHistoryFile()
        {
            // Daten einlesen aus Datei ohne Config-Section
            var fileName = @"..\..\..\..\Test\Data\interface_demo.5.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);
            var blModel  = new BL.BLModel(model);
            var btModel  = new BTModel(blModel);

            Assert.AreEqual(3, btModel.Interfaces.Count);
            Assert.AreEqual("AP", btModel.Config.Prefix);
            Assert.AreEqual("FH_AP_BaseLayer", btModel.Config.BLDatabase);
            Assert.AreEqual("FH_AP_BaseLayer", btModel.Config.BTDatabase);

            var btIfa = btModel.Interfaces[0];

            Assert.AreEqual("Land", btIfa.ShortName);
            Assert.AreEqual("AP_BT_D_Land", btIfa.Name);
            Assert.AreEqual("FH_AP_BaseLayer.dbo.AP_BT_D_Land", btIfa.FullName);
        }
        public void TestDefaultBLInterface_ILInterface()
        {
            // Daten einlesen...
            var fileName = @"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\interface_demo2.1.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);

            // Auswählen
            var coreIfa  = model.Interfaces[0];
            var coreAttr = coreIfa.Attributes[0];

            // in DefaultBLInterface konvertieren
            var blIfa = new DefaultBLInterface(coreIfa, null);

            Assert.IsNotNull(blIfa.GetILInterface());
            Assert.AreEqual("AP_IL_StudiengangHisInOne", blIfa.GetILInterface().Name);

            IBLAttribute attr = blIfa.Attributes[0];

            // Inhalt des 0. Attributs überprüfen
            Assert.AreEqual("StudiengangHisInOne_ID", attr.Name);
            Assert.IsNull(attr.GetILAttribute());

            attr = blIfa.Attributes[1];

            // Inhalt des 1. Attributs überprüfen
            Assert.AreEqual("StudiengangHisInOne_KNZ", attr.Name);
            Assert.IsNotNull(attr.GetILAttribute());
            Assert.AreEqual("StudiengangHisInOne_KNZ", attr.GetILAttribute().Name);

            attr = blIfa.Attributes[2];

            // Inhalt des 2. Attributs überprüfen
            Assert.AreEqual("StudiengangHisInOne_KURZBEZ", attr.Name);
            Assert.IsNotNull(attr.GetILAttribute());
            Assert.AreEqual("StudiengangHisInOne_KURZBEZ", attr.GetILAttribute().Name);
        }
Esempio n. 30
0
        public void TestDimensionALInterface_CheckReferences()
        {
            // Daten einlesen...
            var fileName = @"..\..\..\..\Test\Data\al_tests.ceusdl";
            var data     = new ParsableData(System.IO.File.ReadAllText(fileName), fileName);
            var p        = new FileParser(data);
            var result   = p.Parse();
            var model    = new CoreModel(result);

            var bt      = new BT.BTModel(model);
            var alModel = new AL.ALModel(bt);
            var refAttr = alModel.FactInterfaces[0].Attributes.Where(a => a is RefALAttribute).Select(a => (RefALAttribute)a).FirstOrDefault();

            Assert.IsNotNull(refAttr);
            Assert.AreEqual("Term_Term_ID", refAttr.Name);

            var dim = refAttr.ReferencedDimension;

            Assert.IsNotNull(dim);
            Assert.AreEqual("ARC_D_Term_1_Term", dim.Name);
            Assert.AreEqual("ARC_D_Term_1_Term", dim.RootDimension.Name);
            Assert.AreEqual(5, dim.Attributes.Count);

            var childRef = dim.Attributes.Where(a => a is RefALAttribute).Select(a => (RefALAttribute)a).FirstOrDefault();

            Assert.IsNotNull(childRef);
            Assert.AreEqual("Term_Primary_TermGroup_ID", childRef.Name);
            Assert.IsNotNull(childRef.ReferencedDimension);
            var childDim = childRef.ReferencedDimension;

            Assert.AreEqual("ARC_D_Term_2_Primary_TermGroup", childDim.Name);
            Assert.AreEqual("ARC_D_Term_1_Term", childDim.RootDimension.Name);

            refAttr = alModel.FactInterfaces[0].Attributes.Where(a => a is RefALAttribute).Select(a => (RefALAttribute)a).LastOrDefault();
            Assert.IsNotNull(refAttr);
            Assert.AreEqual("Former_Gender_Former_Gender_ID", refAttr.Name);
        }