public void Test_roundtrip_ebinterface_to_ubl_and_back() { string ebiInvoiceSchema = TestUtils.PathToTestResource(@"XSDExporterTest\transformer\roundtrip_ebinterface_to_ubl_and_back\original_ebinterface_invoice_xml_schema\Invoice.xsd"); string ebiXmlSchemaExportDirectory_1 = TestUtils.PathToTestResource(@"XSDExporterTest\transformer\roundtrip_ebinterface_to_ubl_and_back\imported_ebinterface_model_exported_as_ebinterface_xml_schema\"); string ebiXmlSchemaExportDirectory_2 = TestUtils.PathToTestResource(@"XSDExporterTest\transformer\roundtrip_ebinterface_to_ubl_and_back\transformed_ebinterface_as_ubl_as_ebinterface_xml_schema\"); string repositoryFile = TestUtils.PathToTestResource(@"XSDExporterTest\transformer\roundtrip_ebinterface_to_ubl_and_back\repository_containing_roundtripped_models.eap"); Repository eaRepository = new Repository(); eaRepository.OpenFile(repositoryFile); ICctsRepository cctsRepository = CctsRepositoryFactory.CreateCctsRepository(eaRepository); IBieLibrary ebiBieLibrary = cctsRepository.GetBieLibraryByPath((Path)"Model" / "bLibrary" / "ebInterface BIELibrary"); IBieLibrary ublBieLibrary = cctsRepository.GetBieLibraryByPath((Path)"Model" / "bLibrary" / "UBL BIE Library"); IDocLibrary ebiDocLibrary = cctsRepository.GetDocLibraryByPath((Path)"Model" / "bLibrary" / "ebInterface DOCLibrary"); IDocLibrary ublDocLibrary = cctsRepository.GetDocLibraryByPath((Path)"Model" / "bLibrary" / "UBL DOC Library"); SubsetExporter.ExportSubset(ebiDocLibrary, ebiInvoiceSchema, ebiXmlSchemaExportDirectory_1); Transformer.Transform(ebiBieLibrary, ublBieLibrary, ebiDocLibrary, ublDocLibrary); Transformer.Transform(ublBieLibrary, ebiBieLibrary, ublDocLibrary, ebiDocLibrary); SubsetExporter.ExportSubset(ebiDocLibrary, ebiInvoiceSchema, ebiXmlSchemaExportDirectory_2); }
private void backgroundworkerGenerate_DoWork(object sender, DoWorkEventArgs e) { Transformer.Transform(selectedSourceBieLibrary, selectedTargetBieLibrary, selectedSourceDocLibrary, selectedTargetDocLibrary); SubsetExporter.ExportSubset(selectedTargetDocLibrary, xsdFilename, (targetFolder.EndsWith("\\") || targetFolder.EndsWith("/") ? targetFolder : targetFolder + "\\")); }
public void Test_exporting_subset_of_ubl() { string schemaFileComplete = TestUtils.PathToTestResource(@"XSDExporterTest\mapping\SubsetExporter\exporting_subset_of_ubl\invoice\UBL-Invoice-2.0.xsd"); string schemaDirectorySubset = TestUtils.PathToTestResource(@"XSDExporterTest\mapping\SubsetExporter\exporting_subset_of_ubl\subset\"); string repositoryFile = TestUtils.PathToTestResource(@"XSDExporterTest\mapping\SubsetExporter\exporting_subset_of_ubl\Invoice_complete.eap"); Repository eaRepository = new Repository(); eaRepository.OpenFile(repositoryFile); ICctsRepository cctsRepository = CctsRepositoryFactory.CreateCctsRepository(eaRepository); IDocLibrary docLibrary = cctsRepository.GetDocLibraryByPath((Path)"Model" / "bLibrary" / "Test DOC Library"); SubsetExporter.ExportSubset(docLibrary, schemaFileComplete, schemaDirectorySubset); }
private void buttonTransform_Click(object sender, RoutedEventArgs e) { innerCanvas.Visibility = Visibility.Visible; innerCanvas.Dispatcher.Invoke(DispatcherPriority.Render, new Action(delegate { })); Mouse.OverrideCursor = Cursors.Wait; IDocLibrary sourceDocLibrary = null; IDocLibrary targetDocLibrary = null; IBieLibrary sourceBieLibrary = null; IBieLibrary targetBieLibrary = null; foreach (var library in cctsR.GetAllLibraries()) { if (library is IDocLibrary) { var doclibrary = (IDocLibrary)library; if (doclibrary.Name.Equals(selectedSourceDocLibrary)) { sourceDocLibrary = doclibrary; } else if (doclibrary.Name.Equals(selectedTargetDocLibrary)) { targetDocLibrary = doclibrary; } } else if (library is IBieLibrary) { var bieLibrary = (IBieLibrary)library; if (bieLibrary.Name.Equals(selectedSourceBieLibrary)) { sourceBieLibrary = bieLibrary; } else if (bieLibrary.Name.Equals(selectedTargetBieLibrary)) { targetBieLibrary = bieLibrary; } } } Transformer.Transform(sourceBieLibrary, targetBieLibrary, sourceDocLibrary, targetDocLibrary); SubsetExporter.ExportSubset(targetDocLibrary, targetXSDFilename, outputDirectory); innerCanvas.Visibility = Visibility.Collapsed; Mouse.OverrideCursor = Cursors.Arrow; }
private void buttonExport_Click(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; textBoxStatus.Text = "Starting to generate XML schemas ...\n\n"; GatherUserInput(); cBIV currentBIV = cache.BIVs[selectedBIVName]; IDocLibrary docl = cctsR.GetDocLibraryById(currentBIV.Id); // TODO: xsd generator needs to be adapted - currently all doc libraries are being generated whereas // only the ones that are checked should be generated.. //TODO: currently the wizard just takes the input from the text fields whereas the prefix and the // target namespace should be (a) stored in the cache and (b) read from there while generation.. if (comboboxDocumentModel.SelectedItem.Equals("CCTS")) { // TODO: check if path is valid cDOC document = currentBIV.DOC; if (document != null && document.State == CheckState.Checked) { } string targetNamespace = textboxTagetNamespace.Text; string namespacePrefix = textboxPrefix.Text; bool annotate = checkboxDocumentationAnnotations.IsChecked == true ? true : false; bool allschemas = checkboxGenerateCcSchemas.IsChecked == true ? true : false; var generationContext = new GeneratorContext(cctsR, targetNamespace, namespacePrefix, annotate, allschemas, outputDirectory, docl); generationContext.SchemaAdded += HandleSchemaAdded; XSDGenerator.GenerateSchemas(generationContext); } else { SubsetExporter.ExportSubset(docl, originalXMLSchema, outputDirectory); } textBoxStatus.Text += "\nGenerating XML schemas completed!"; Cursor = Cursors.Arrow; }
public void Test_transforming_ebinterface_to_ubl() { string ublInvoiceSchema = TestUtils.PathToTestResource(@"XSDExporterTest\transformer\transforming_ebinterface_to_ubl\ubl_invoice\UBL-Invoice-2.0.xsd"); string ebInterfaceAsUblSchemaDirectory = TestUtils.PathToTestResource(@"XSDExporterTest\transformer\transforming_ebinterface_to_ubl\ebinterface_as_ubl\"); string repositoryFile = TestUtils.PathToTestResource(@"XSDExporterTest\transformer\transforming_ebinterface_to_ubl\invoice.eap"); Repository eaRepository = new Repository(); eaRepository.OpenFile(repositoryFile); ICctsRepository cctsRepository = CctsRepositoryFactory.CreateCctsRepository(eaRepository); IBieLibrary ebiBieLibrary = cctsRepository.GetBieLibraryByPath((Path)"Model" / "bLibrary" / "ebInterface BIELibrary"); IBieLibrary ublBieLibrary = cctsRepository.GetBieLibraryByPath((Path)"Model" / "bLibrary" / "UBL BIE Library"); IDocLibrary ebiDocLibrary = cctsRepository.GetDocLibraryByPath((Path)"Model" / "bLibrary" / "ebInterface DOCLibrary"); IDocLibrary ublDocLibrary = cctsRepository.GetDocLibraryByPath((Path)"Model" / "bLibrary" / "UBL DOC Library"); Transformer.Transform(ebiBieLibrary, ublBieLibrary, ebiDocLibrary, ublDocLibrary); SubsetExporter.ExportSubset(ublDocLibrary, ublInvoiceSchema, ebInterfaceAsUblSchemaDirectory); }
public void Test_exporting_subset_of_complex_type_mapped_to_multiple_accs() { string schemaFileComplete = TestUtils.PathToTestResource(@"XSDExporterTest\mapping\SubsetExporter\exporting_subset_of_complex_type_mapped_to_multiple_accs\source.xsd"); string schemaFileSubset = TestUtils.PathToTestResource(@"XSDExporterTest\mapping\SubsetExporter\exporting_subset_of_complex_type_mapped_to_multiple_accs\subset\"); EARepository eaRepository = new EARepository(); Element bdtStringText = null; Element primString = null; Element abiePersonTypePerson = null; Element abiePersonTypeNote = null; #region EA Repository Subset eaRepository.AddModel( "Test Model Subset", m => m.AddPackage("bLibrary", bLibrary => { bLibrary.Element.Stereotype = Stereotype.bLibrary; bLibrary.AddPackage("PRIMLibrary", package => { package.Element.Stereotype = Stereotype.PRIMLibrary; primString = package.AddPRIM("String"); }); bLibrary.AddPackage("BDTLibrary", package => { package.Element.Stereotype = Stereotype.BDTLibrary; bdtStringText = package.AddBDT("String_Text").With(e => { e.Stereotype = Stereotype.BDT; e.AddCON(primString); }); }); bLibrary.AddPackage("BIELibrary", package => { package.Element.Stereotype = Stereotype.BIELibrary; Element abieAddressTypeAddress = package.AddClass("AddressType_Address").With(e => { e.Stereotype = Stereotype.ABIE; e.AddBBIE(bdtStringText, "City_CityName"); }); abiePersonTypePerson = package.AddClass("PersonType_Person").With(e => { e.Stereotype = Stereotype.ABIE; e.AddBBIE(bdtStringText, "Name_Name"); e.AddASBIE(abieAddressTypeAddress, "Address_Residence", EaAggregationKind.Composite); }); abiePersonTypeNote = package.AddClass("PersonType_Note").With(e => { e.Stereotype = Stereotype.ABIE; }); }); bLibrary.AddPackage("DOCLibrary", package => { package.Element.Stereotype = Stereotype.DOCLibrary; Element maPersonType = package.AddClass("PersonType").With(e => { e.Stereotype = Stereotype.MA; e.AddASMA(abiePersonTypePerson, "Person"); e.AddASMA(abiePersonTypeNote, "Note"); }); Element maPassportType = package.AddClass("PassportType").With(e => { e.Stereotype = Stereotype.MA; e.AddASMA(maPersonType, "Person"); }); package.AddClass("Austrian_Passport").With(e => { e.Stereotype = Stereotype.MA; e.AddASMA(maPassportType, "Passport"); }); }); })); #endregion ICctsRepository cctsRepository = CctsRepositoryFactory.CreateCctsRepository(eaRepository); IDocLibrary docLibrary = cctsRepository.GetDocLibraryByPath((Path)"Test Model Subset" / "bLibrary" / "DOCLibrary"); SubsetExporter.ExportSubset(docLibrary, schemaFileComplete, schemaFileSubset); }