Example #1
0
        public void t11_TargetDocumentId()
        {
            // Create xml document
            XmlDocument data = createDataPool().RootNode.InnerXmlNode.OwnerDocument;

            // We use a dedicated SIEE_Adapter for this test.  We must first register it in the FactoryManager.
            SIEEFactory factory = new Test_SIEEFactory();

            SIEEFactoryManager.Add(factory);

            // We use a default SIEE_Adapter_Settings object and set the Schema
            EECWriterSettings adapterSettings = createWriterSettings(new SIEEFieldlist());

            SIEEWriterExport adapterExport = new SIEEWriterExport();

            adapterExport.Configure(adapterSettings);

            Test_SIEEExport.ExportFunc = (settings, doc, name, fieldlist) =>
            {
                doc.TargetDocumentId = "4711";
            };

            DataPool pool = new DataPool(adapterExport.transform(data, null));

            Assert.AreEqual("4711", pool.RootNode.Documents[0].Annotations["TargetDocumentId"].Value);
            Assert.AreEqual("SIEE_Adapter", pool.RootNode.Documents[0].Annotations["TargetType"].Value);
        }
Example #2
0
        public void t09_SIEEAnnotation()
        {
            // Create a data pool
            DataPool pool = createDataPool();

            pool.RootNode.Documents[0].Fields["field1"].Value = "field1value";

            // Create an xml document from the data pool
            XmlDocument data;

            data = pool.RootNode.InnerXmlNode.OwnerDocument;

            // We use a dedicated SIEE_Adapter for this test.  We must first register it in the FactoryManager.
            SIEEFactory factory = new Test_SIEEFactory();

            SIEEFactoryManager.Add(factory);

            // We use a default SIEE_Adapter_Settings object and set the Schema
            EECWriterSettings adapterSettings = createWriterSettings(new SIEEFieldlist()
            {
                { new SIEEField()
                  {
                      Name = "field1", ExternalId = ""
                  } },
                { new SIEEField()
                  {
                      Name = "field2", ExternalId = ""
                  } },
            });

            SIEEWriterExport adapterExport = new SIEEWriterExport();

            adapterExport.Configure(adapterSettings);

            Test_SIEEExport.ExportFunc = (settings, doc, name, fieldlist) =>
            {
                int val = 0;
                if (doc.SIEEAnnotation != null)
                {
                    val = int.Parse(doc.SIEEAnnotation);
                }
                if (val <= 3)
                {
                    doc.NewSIEEAnnotation = (val + 1).ToString();
                }
                throw new Exception("Some exception");
            };
            int count = 1;

            pool = new DataPool(adapterExport.transform(data, null));
            t09_testAnnotation(pool, count++);
            pool = new DataPool(adapterExport.transform(pool.RootNode.InnerXmlNode.OwnerDocument, null));
            t09_testAnnotation(pool, count++);
            pool = new DataPool(adapterExport.transform(pool.RootNode.InnerXmlNode.OwnerDocument, null));
            t09_testAnnotation(pool, count);
            pool = new DataPool(adapterExport.transform(pool.RootNode.InnerXmlNode.OwnerDocument, null));
            t09_testAnnotation(pool, count);
        }