GetObjectByRemoteId() public méthode

Gets the object by remote identifier.
public GetObjectByRemoteId ( string id ) : IMappedObject
id string /// CMIS Object Id. ///
Résultat IMappedObject
 public void GetObjectByIdWithNotExistingIdMustReturnNull([Values(true, false)]bool withValidation) {
     var storage = new MetaDataStorage(this.engine, this.matcher, withValidation);
     Assert.That(storage.GetObjectByRemoteId("DOESNOTEXIST"), Is.Null);
 }
        public void FindRootFolder([Values(true, false)]bool withValidation) {
            string id = "id";
            string path = Path.GetTempPath();
            var fsInfo = new DirectoryInfoWrapper(new DirectoryInfo(path));
            var matcher = new PathMatcher(path, "/");
            var storage = new MetaDataStorage(this.engine, matcher, withValidation);
            var rootFolder = new MappedObject("/", id, MappedObjectType.Folder, null, "token");
            storage.SaveMappedObject(rootFolder);

            Assert.That(storage.GetObjectByRemoteId(id), Is.Not.Null, "Not findable by ID");
            Assert.That(storage.GetObjectByLocalPath(fsInfo), Is.Not.Null, "Not findable by path");
        }
        public void SaveRenamedMappedObjectOverridesExistingEntry([Values(true, false)]bool withValidation) {
            string id = "id";
            string oldName = "my";
            string newName = "newMy";
            string path = Path.GetTempPath();
            string parentId = "ParentId";
            string oldToken = "oldToken";
            string newToken = "newToken";
            var matcher = new PathMatcher(path, "/");
            var storage = new MetaDataStorage(this.engine, matcher, withValidation);
            var rootFolder = new MappedObject("/", parentId, MappedObjectType.Folder, null, "token");
            storage.SaveMappedObject(rootFolder);
            var folder = new MappedObject(oldName, id, MappedObjectType.Folder, parentId, oldToken);
            storage.SaveMappedObject(folder);

            var savedObject = storage.GetObjectByRemoteId(id);
            savedObject.Name = newName;
            savedObject.LastChangeToken = newToken;
            storage.SaveMappedObject(savedObject);

            Assert.That(storage.GetObjectByLocalPath(Mock.Of<IDirectoryInfo>(d => d.FullName == Path.Combine(path, oldName))), Is.Null);
            Assert.That(storage.GetObjectByLocalPath(Mock.Of<IDirectoryInfo>(d => d.FullName == Path.Combine(path, newName))), Is.EqualTo(savedObject));
        }
        public void RemoveObjectDoesNotTouchParents([Values(true, false)]bool withValidation) {
            string remoteId = "remoteId";
            string childId = "childId";
            string subChildId = "subchildId";
            var storage = new MetaDataStorage(this.engine, this.matcher, withValidation);
            var obj = new MappedObject("name", remoteId, MappedObjectType.Folder, null, null);
            var child = new MappedObject("child", childId, MappedObjectType.Folder, remoteId, null);
            var subchild = new MappedObject("subchild", subChildId, MappedObjectType.File, childId, null);
            storage.SaveMappedObject(obj);
            storage.SaveMappedObject(child);
            storage.SaveMappedObject(subchild);

            storage.RemoveObject(child);

            Assert.That(storage.GetObjectByRemoteId(remoteId), Is.EqualTo(obj));
            Assert.That(storage.GetObjectByRemoteId(childId), Is.Null);
            Assert.That(storage.GetObjectByRemoteId(subChildId), Is.Null);
        }
        public void RemoveObjectTest([Values(true, false)]bool withValidation) {
            string remoteId = "remoteId";
            var storage = new MetaDataStorage(this.engine, this.matcher, withValidation);
            var obj = new MappedObject("name", remoteId, MappedObjectType.Folder, null, null);
            storage.SaveMappedObject(obj);

            storage.RemoveObject(obj);

            Assert.That(storage.GetObjectByRemoteId(remoteId), Is.Null);
        }
        public void SaveFileObjectAndGetObjectReturnsEqualObject([Values(true, false)]bool withValidation) {
            var storage = new MetaDataStorage(this.engine, this.matcher, withValidation);
            string remoteId = "remoteId";
            var file = new MappedObject("file", remoteId, MappedObjectType.File, null, null) {
                Description = "desc",
                Guid = Guid.NewGuid(),
                LastChecksum = new byte[20]
            };

            storage.SaveMappedObject(file);
            var obj = storage.GetObjectByRemoteId(remoteId);

            Assert.That(obj.LastChecksum, Is.Not.Null);
            Assert.That(obj.Equals(file));
        }
 public void StoreDateOnStoringMappedObject([Values(true, false)]bool withValidation) {
     var underTest = new MetaDataStorage(this.engine, this.matcher, withValidation);
     IMappedObject obj = new MappedObject("obj", "remoteId", MappedObjectType.File, null, null);
     Assert.That(obj.LastTimeStoredInStorage, Is.Null);
     underTest.SaveMappedObject(obj);
     obj = underTest.GetObjectByRemoteId("remoteId");
     Assert.That(obj.LastTimeStoredInStorage, Is.EqualTo(DateTime.UtcNow).Within(1).Seconds);
 }
        public void SaveFolderObjectAndGetObjectReturnEqualObject([Values(true, false)]bool withValidation) {
            var storage = new MetaDataStorage(this.engine, this.matcher, withValidation);
            string remoteId = "remoteId";
            var folder = new MappedObject("folder", remoteId, MappedObjectType.Folder, null, null) {
                Description = "desc",
                Guid = Guid.NewGuid(),
            };

            storage.SaveMappedObject(folder);
            var obj = storage.GetObjectByRemoteId(remoteId);

            Assert.That(obj.Equals(folder));
        }