Пример #1
0
        public void OrderInstanceValidationTest()
        {
            var target = new  SourceSchema();

            //=== The SamplePOInput.xml file from <Samples Path>\Orchestrations\HelloWorld ===//
            string strSourcePO_XML = @"C:\Users\amigupta7\Desktop\Amit\Project\POC\Timewave.BizUnit.Sample\Testing\OrderSample.xml";

            //=== Validate the SamplePOInput message against the schema ===//
            Assert.IsTrue(target.ValidateInstance(strSourcePO_XML, Microsoft.BizTalk.TestTools.Schema.OutputInstanceType.XML));
        }
Пример #2
0
        private void ChooseSourceCommand_Executed(object state)
        {
            if (SourceSchema.GetType() == typeof(SchemaCsv))
            {
                var ofg = new Microsoft.Win32.OpenFileDialog(); // Alternative: System.Windows.Forms.OpenFileDialog
                //ofg.InitialDirectory = "C:\\Users\\savinov\\git\\samm\\Test";
                ofg.Filter           = "CSV Files (*.csv)|*.csv|All files (*.*)|*.*";
                ofg.RestoreDirectory = true;
                ofg.CheckFileExists  = true;
                ofg.Multiselect      = false;

                Nullable <bool> result = ofg.ShowDialog();
                if (result != true)
                {
                    return;
                }

                string filePath     = ofg.FileName;
                string safeFilePath = ofg.SafeFileName;
                string fileDir      = System.IO.Path.GetDirectoryName(filePath);
                string tableName    = System.IO.Path.GetFileNameWithoutExtension(filePath);

                //
                // Create a source table and load its structure into the schema
                //
                // TODO: Check that this table has not been loaded yet (compare paths). Or do it in dialog.
                // If already exists then either allow for imports into different local tables (with different parameters along different projection dimensions) or reuse the existing imported table.
                SetCsv sourceTable = (SetCsv)SourceSchema.CreateTable(tableName);
                sourceTable.FilePath = filePath;

                //sourceTable.HasHeaderRecord = (bool)hasHeaderRecord.IsChecked;

                var columns = ((SchemaCsv)SourceSchema).LoadSchema(sourceTable);
                columns.ForEach(x => x.Add());
                SourceSchema.AddTable(sourceTable, null, null);

                Column.Input = sourceTable;

                // TODO: Check if the chosen source file/table is different from the current
                // TODO: Check if the chosen source file/table already exists in the source schema as an object, e.g., if it has been imported already (we can import one file more than one time)
                // TODO: Create table and initialize its column structure

                Initialize(); // Initialize the dialog
                RefreshAll();
            }
        }
Пример #3
0
        int CopyObject(string type)
        {
            string objectname = targetObject.ObjectName;

            if (type == "P")
            {
                DropProcedure(targetCmd, targetObject.DatabaseSchemaObject);
            }
            else
            {
                DropFunction(targetCmd, targetObject.SchemaFunction);
            }

            string text = sourceCmd.RetrieveProcedureTextString(sourceObject.SchemaObject).Replace(insert_new_owner_text, TargetSchema);

            int i = text.Length,
                j = 0;

            string lowerText = text.Substring(0, i > 100 ? 100 : i).ToLower();

            i = lowerText.IndexOf("." + objectname.ToLower());
            j = lowerText.IndexOf(objectname.ToLower());

            if (i < 0 || i > j)
            {
                text = text.Substring(0, j) + TargetSchema + "." + text.Substring(j);
            }

            targetCmd.Execute(text = text.Replace(SourceSchema, TargetSchema).Replace(SourceSchema.ToLower(), TargetSchema));

            return(text.Length);
        }