Beispiel #1
0
        public void CanIgnore_MissingDiscriminator()
        {
            var root = CreateOneItem<XmlableItem>(1, "root", null);
            var child = CreateOneItem<XmlableItem2>(2, "child", root);

            var navigator = SerializeAndReadOutput(root);

            ItemXmlReader reader = new ItemXmlReader(TestSupport.SetupDefinitions(typeof(XmlableItem)), activator);
            var readRoot = reader.Read(navigator);

            Assert.That(readRoot.RootItem.Name, Is.EqualTo("root"));
            Assert.That(readRoot.RootItem.Children.Count, Is.EqualTo(0));
        }
Beispiel #2
0
 public GZipImporter(IPersister persister, ItemXmlReader reader, IFileSystem fs, ContentSource source, IContentItemRepository repository)
     : base(persister, reader, fs, source, repository)
 {
 }
Beispiel #3
0
		public Importer(IPersister persister, ItemXmlReader reader, IFileSystem fs)
		{
			this.persister = persister;
			this.reader = reader;
			this.fs = fs;
		}
Beispiel #4
0
 public Importer(IPersister persister, ItemXmlReader reader)
 {
     this.persister = persister;
     this.reader = reader;
 }
Beispiel #5
0
		public GZipImporter(IPersister persister, ItemXmlReader reader, IFileSystem fs) 
			: base(persister, reader, fs)
		{
		}
        /* public void WriteFile(string name, string data)
        {
            var path = Path.Combine(_path, name);

            using (var ms = new MemoryStream())
            {
                var bytes = Encoding.UTF8.GetBytes(data);
                ms.Write(bytes, 0, bytes.Length);
                ms.Position = 0;
                _fs.WriteFile(path, ms);
            }
        } */

        public IImportRecord SyncItem(ReplicatedItem item)
        {
            lock (this)
            {
                try
                {
                    var reader = new ItemXmlReader(_definitions, _activator, _persister.Repository);
                    var importer = new Importer(null, reader, null);

                    // TODO download
                    var ins = _fs.OpenFile(item.Path, true);
                    var record = importer.Read(ins, item.Path);
                    if (record.RootItem != null)
                        ContentVersion.ReorderBySortOrderRecursive(record.RootItem);
                    return record;
                }
                catch (Exception ex)
                {
                    _logger.Error(string.Format("IMPORT Error: {0} - {1}", item.ID, ex.Message), ex);
                    throw;
                }
            }
        }
Beispiel #7
0
 public Importer(IPersister persister, ItemXmlReader reader, IFileSystem fs)
 {
     this.persister = persister;
     this.reader    = reader;
     this.fs        = fs;
 }
Beispiel #8
0
 public GZipImporter(IPersister persister, ItemXmlReader reader, IFileSystem fs)
     : base(persister, reader, fs)
 {
 }
Beispiel #9
0
 public GZipImporter(IPersister persister, ItemXmlReader reader)
     : base(persister, reader)
 {
 }
Beispiel #10
0
 public Importer(IPersister persister, ItemXmlReader reader)
 {
     this.persister = persister;
     this.reader    = reader;
 }
Beispiel #11
0
 public GZipImporter(IPersister persister, ItemXmlReader reader)
     : base(persister, reader)
 {
 }