public async Task CanSynchronizeFileRename() { var content = new MemoryStream(new byte[] { 1, 2, 3, 4 }); var sourceClient = NewAsyncClient(0); var destinationClient = NewAsyncClient(1, enableAuthentication: true, credentials: new NetworkCredential(username, password, domain)); await sourceClient.UploadAsync("test.bin", content); content.Position = 0; await destinationClient.UploadAsync("test.bin", content); await sourceClient.RenameAsync("test.bin", "renamed.bin"); // we need to indicate old file name, otherwise content update would be performed because renamed file does not exist on dest var report = SyncTestUtils.ResolveConflictAndSynchronize(sourceClient, destinationClient, "test.bin"); Assert.Null(report.Exception); Assert.Equal(SynchronizationType.Rename, report.Type); var testMetadata = await destinationClient.GetMetadataForAsync("test.bin"); var renamedMetadata = await destinationClient.GetMetadataForAsync("renamed.bin"); Assert.Null(testMetadata); Assert.NotNull(renamedMetadata); }
public async Task CanSynchronizeMetadata() { var content = new MemoryStream(new byte[] { 1, 2, 3, 4 }); var sourceClient = NewAsyncClient(0); var destinationClient = NewAsyncClient(1, enableAuthentication: true, credentials: new NetworkCredential(username, password, domain)); await sourceClient.UploadAsync("test.bin", content, new RavenJObject { { "difference", "metadata" } }); content.Position = 0; await destinationClient.UploadAsync("test.bin", content); var report = SyncTestUtils.ResolveConflictAndSynchronize(sourceClient, destinationClient, "test.bin"); Assert.Null(report.Exception); Assert.Equal(SynchronizationType.MetadataUpdate, report.Type); var destinationMetadata = destinationClient.GetMetadataForAsync("test.bin").Result; Assert.Equal("metadata", destinationMetadata["difference"]); }
public async Task CanSynchronizeMetadata() { var content = new MemoryStream(new byte[] { 1, 2, 3, 4 }); var sourceClient = NewAsyncClient(0, customConfig: ConfigurationHelper.ApplySettingsToConfiguration); var destinationClient = NewAsyncClient(1, enableAuthentication: true, credentials: new NetworkCredential(FactIfWindowsAuthenticationIsAvailable.Admin.UserName, FactIfWindowsAuthenticationIsAvailable.Admin.Password, FactIfWindowsAuthenticationIsAvailable.Admin.Domain)); await sourceClient.UploadAsync("test.bin", content, new RavenJObject { { "difference", "metadata" } }); content.Position = 0; await destinationClient.UploadAsync("test.bin", content); var report = SyncTestUtils.ResolveConflictAndSynchronize(sourceClient, destinationClient, "test.bin"); Assert.Null(report.Exception); Assert.Equal(SynchronizationType.MetadataUpdate, report.Type); var destinationMetadata = destinationClient.GetMetadataForAsync("test.bin").Result; Assert.Equal("metadata", destinationMetadata["difference"]); }