diff --git a/src/Couchbase.Lite.Shared/API/Database/Collection.cs b/src/Couchbase.Lite.Shared/API/Database/Collection.cs index 30829341a..42caf417e 100644 --- a/src/Couchbase.Lite.Shared/API/Database/Collection.cs +++ b/src/Couchbase.Lite.Shared/API/Database/Collection.cs @@ -91,9 +91,7 @@ public sealed unsafe class Collection : IChangeObservable c4Db == null || _c4coll == null || !NativeSafe.c4coll_isValid(_c4coll); // Must be called inside self lock @@ -948,9 +946,7 @@ internal bool IsIndexTrained(string name) /// /// Throws if this collection has been deleted, or its database closed. /// -#if !XAMARINIOS && !MONOANDROID [MemberNotNull(nameof(c4Db), nameof(_c4coll))] -#endif internal void CheckCollectionValid() { using var scope = ThreadSafety.BeginLockedScope(); @@ -987,7 +983,7 @@ internal void PostDatabaseChanged() if (nChanges == 0 || external != newExternal || docIDs.Count > 1000) { if (docIDs.Count > 0) { // Only notify if there are actually changes to send - var args = new CollectionChangedEventArgs(this, docIDs, Database); + var args = new CollectionChangedEventArgs(this, docIDs); _databaseChanged.Fire(this, args); docIDs = new List(); } diff --git a/src/Couchbase.Lite.Shared/API/Database/CollectionChangedEventArgs.cs b/src/Couchbase.Lite.Shared/API/Database/CollectionChangedEventArgs.cs index 6a55de1d8..385eb3b66 100644 --- a/src/Couchbase.Lite.Shared/API/Database/CollectionChangedEventArgs.cs +++ b/src/Couchbase.Lite.Shared/API/Database/CollectionChangedEventArgs.cs @@ -16,6 +16,7 @@ // limitations under the License. // +using System; using System.Collections.Generic; using System.Diagnostics; @@ -24,9 +25,7 @@ namespace Couchbase.Lite /// /// The parameters of a collection changed event /// -#pragma warning disable CS0618 // Type or member is obsolete - public sealed class CollectionChangedEventArgs : DatabaseChangedEventArgs -#pragma warning restore CS0618 // Type or member is obsolete + public sealed class CollectionChangedEventArgs : EventArgs { #region Properties @@ -35,14 +34,18 @@ public sealed class CollectionChangedEventArgs : DatabaseChangedEventArgs /// public Collection Collection { get; } + /// + /// Gets the document that was changed + /// + public IReadOnlyList DocumentIDs { get; } + #endregion #region Constructors - internal CollectionChangedEventArgs(Collection collection, IReadOnlyList documentIDs, - Database database) - :base(database, documentIDs) + internal CollectionChangedEventArgs(Collection collection, IReadOnlyList documentIDs) { + DocumentIDs = documentIDs; Collection = collection; } diff --git a/src/Couchbase.Lite.Shared/API/Database/Database.cs b/src/Couchbase.Lite.Shared/API/Database/Database.cs index e8317ba57..7779f04ba 100644 --- a/src/Couchbase.Lite.Shared/API/Database/Database.cs +++ b/src/Couchbase.Lite.Shared/API/Database/Database.cs @@ -99,10 +99,7 @@ public enum MaintenanceType /// instances. It is portable between platforms if the file is retrieved, /// and can be seeded with pre-populated data if desired. /// -#pragma warning disable CS0618 // Type or member is obsolete - public sealed unsafe partial class Database : IChangeObservable, IDocumentChangeObservable, -#pragma warning restore CS0618 // Type or member is obsolete - IDisposable + public sealed unsafe partial class Database : IDisposable { #region Constants @@ -146,20 +143,6 @@ public sealed unsafe partial class Database : IChangeObservable public DatabaseConfiguration Config { get; } - /// - /// [DEPRECATED] Gets the number of documents in the database - /// - [Obsolete("Count is deprecated, please use GetDefaultCollection().Count")] - public ulong Count => GetDefaultCollection().Count; - - /// - /// [DEPRECATED] Gets a with the given document ID - /// - /// The ID of the to retrieve - /// The object - [Obsolete("Document subscript in the Database class is deprecated, please use Document Script of the default collection.")] - public DocumentFragment this[string id] => new DocumentFragment(GetDocument(id)); - /// /// Gets the object that stores the available logging methods /// for Couchbase Lite @@ -228,9 +211,7 @@ internal bool IsClosedLocked private bool IsShell { get; } //this object is borrowing the C4Database from somewhere else, so don't free C4Database at the end if isshell // Must be called inside self lock -#if !XAMARINIOS && !MONOANDROID [MemberNotNullWhen(false, nameof(c4db))] -#endif private bool IsClosed { get { @@ -610,46 +591,6 @@ public void PerformMaintenance(MaintenanceType type) }); } - /// - /// [DEPRECATED] Creates an index which could be a value index from or a full-text search index - /// from with the given name. - /// The name can be used for deleting the index. Creating a new different index with an existing - /// index name will replace the old index; creating the same index with the same name will be no-ops. - /// - /// The index name - /// The index - /// Thrown if or - /// is null - /// Thrown if an error condition is returned from LiteCore - /// Thrown if this method is called after the database is closed - /// Thrown if an implementation of other than one of the library - /// provided ones is used - [Obsolete("CreateIndex is deprecated, please use GetDefaultCollection().CreateIndex")] - public void CreateIndex(string name, IIndex index) - { - GetDefaultCollection().CreateIndex(name, index); - } - - /// - /// [DEPRECATED] Creates a SQL++ query index which could be a value index from or a full-text search index - /// from with the given name. - /// The name can be used for deleting the index. Creating a new different index with an existing - /// index name will replace the old index; creating the same index with the same name will be no-ops. - /// - /// The index name - /// The index - /// Thrown if or - /// is null - /// Thrown if an error condition is returned from LiteCore - /// Thrown if this method is called after the database is closed - /// Thrown if an implementation of other than one of the library - /// provided ones is used - [Obsolete("CreateIndex is deprecated, please use GetDefaultCollection().CreateIndex")] - public void CreateIndex(string name, IndexConfiguration indexConfig) - { - GetDefaultCollection().CreateIndex(name, indexConfig); - } - /// /// Creates a Query object from the given SQL++ string. /// @@ -682,71 +623,6 @@ public void Delete() Delete(Name, Config.Directory); } - /// - /// [DEPRECATED] Deletes a document from the database. When write operations are executed - /// concurrently, the last writer will overwrite all other written values. - /// Calling this method is the same as calling - /// with - /// - /// The document - /// Thrown if an error condition is returned from LiteCore - /// Thrown with - /// when trying to save a document into a database other than the one it was previously added to - /// Thrown with - /// when trying to delete a document that hasn't been saved into a yet - /// Thrown if this method is called after the database is closed - [Obsolete("Delete is deprecated, please use GetDefaultCollection().Delete")] - public void Delete(Document document) => Delete(document, ConcurrencyControl.LastWriteWins); - - /// - /// [DEPRECATED] Deletes the given from this database - /// - /// The document to save - /// The rule to use when encountering a conflict in the database - /// true if the delete succeeded, false if there was a conflict - /// Thrown if an error condition is returned from LiteCore - /// Thrown with - /// when trying to save a document into a database other than the one it was previously added to - /// Thrown with - /// when trying to delete a document that hasn't been saved into a yet - /// Thrown if this method is called after the database is closed - [Obsolete("Delete is deprecated, please use GetDefaultCollection().Delete")] - public bool Delete(Document document, ConcurrencyControl concurrencyControl) - { - return GetDefaultCollection().Delete(document, concurrencyControl); - } - - /// - /// [DEPRECATED] Deletes the index with the given name - /// - /// The name of the index to delete - [Obsolete("DeleteIndex is deprecated, please use GetDefaultCollection().DeleteIndex")] - public void DeleteIndex(string name) - { - GetDefaultCollection().DeleteIndex(name); - } - - /// - /// [DEPRECATED] Gets the with the specified ID - /// - /// The ID to use when creating or getting the document - /// The instantiated document, or null if it does not exist - [Obsolete("GetDocument is deprecated, please use GetDefaultCollection().GetDocument")] - public Document? GetDocument(string id) - { - return GetDefaultCollection().GetDocument(id); - } - - /// - /// [DEPRECATED] Gets a list of index names that are present in the database - /// - /// The list of created index names - [Obsolete("GetIndexes is deprecated, please use GetDefaultCollection().GetIndexes")] - public IList GetIndexes() - { - return GetDefaultCollection().GetIndexes(); - } - /// /// Runs the given batch of operations as an atomic unit /// @@ -774,105 +650,6 @@ public void InBatch(Action action) } } - /// - /// [DEPRECATED] Purges the given from the database. This leaves - /// no trace behind and will not be replicated - /// - /// The document to purge - /// Thrown when trying to purge a document from a database - /// other than the one it was previously added to - [Obsolete("Purge is deprecated, please use GetDefaultCollection().Purge")] - public void Purge(Document document) - { - GetDefaultCollection().Purge(document); - } - - /// - /// [DEPRECATED] Purges the given document id of the - /// from the database. This leaves no trace behind and will - /// not be replicated - /// - /// The id of the document to purge - /// Throws NOT FOUND error if the document - /// of the docId doesn't exist. - [Obsolete("Purge is deprecated, please use GetDefaultCollection().Purge")] - public void Purge(string docId) - { - GetDefaultCollection().Purge(docId); - } - - /// - /// [DEPRECATED] Sets an expiration date on a document. After this time, the document - /// will be purged from the database. - /// - /// The ID of the - /// Nullable expiration timestamp as a - /// , set timestamp to null - /// to remove expiration date time from doc. - /// Whether successfully sets an expiration date on the document - /// Throws NOT FOUND error if the document - /// doesn't exist - [Obsolete("SetDocumentExpiration is deprecated, please use GetDefaultCollection().SetDocumentExpiration")] - public bool SetDocumentExpiration(string docId, DateTimeOffset? expiration) - { - return GetDefaultCollection().SetDocumentExpiration(docId, expiration); - } - - /// - /// [DEPRECATED] Returns the expiration time of the document. null will be returned - /// if there is no expiration time set - /// - /// The ID of the - /// Nullable expiration timestamp as a - /// of the document or null if time not set. - /// Throws NOT FOUND error if the document - /// doesn't exist - [Obsolete("GetDocumentExpiration is deprecated, please use GetDefaultCollection().GetDocumentExpiration")] - public DateTimeOffset? GetDocumentExpiration(string docId) - { - return GetDefaultCollection().GetDocumentExpiration(docId); - } - - /// - /// [DEPRECATED] Saves the given into this database. This call is equivalent to calling - /// with a second argument of - /// - /// - /// The document to save - /// Thrown when trying to save a document into a database - /// other than the one it was previously added to - [Obsolete("Save is deprecated, please use GetDefaultCollection().Save")] - public void Save(MutableDocument document) => Save(document, ConcurrencyControl.LastWriteWins); - - /// - /// [DEPRECATED] Saves the given into this database - /// - /// The document to save - /// The rule to use when encountering a conflict in the database - /// Thrown when trying to save a document into a database - /// other than the one it was previously added to - /// true if the save succeeded, false if there was a conflict - [Obsolete("Save is deprecated, please use GetDefaultCollection().Save")] - public bool Save(MutableDocument document, ConcurrencyControl concurrencyControl) - { - return GetDefaultCollection().Save(document, concurrencyControl); - } - - /// - /// [DEPRECATED] Saves a document to the database. When write operations are executed concurrently, - /// and if conflicts occur, conflict handler will be called. Use the handler to directly - /// edit the document.Returning true, will save the document. Returning false, will cancel - /// the save operation. - /// - /// The document to save - /// The conflict handler block which can be used to resolve it. - /// true if the save succeeded, false if there was a conflict - [Obsolete("Save is deprecated, please use GetDefaultCollection().Save")] - public bool Save(MutableDocument document, Func conflictHandler) - { - return GetDefaultCollection().Save(document, conflictHandler); - } - /// /// Save a blob object directly into the database without associating it with any documents. /// @@ -918,96 +695,6 @@ public void SaveBlob(Blob blob) #endregion - #region IChangeObservable - - /// - /// [DEPRECATED] Adds a change listener for the changes that occur in the default collection - /// of this database. Signatures are the same as += style event handlers, but the callbacks - /// will be called using the specified . If the scheduler is null, - /// the default task scheduler will be used (scheduled via thread pool). - /// - /// The scheduler to use when firing the change handler - /// The handler to invoke - /// A that can be used to remove the handler later - /// Thrown if is null - /// Thrown if this method is called after the database is closed - [Obsolete("AddChangeListener is deprecated, please use GetDefaultCollection().AddChangeListener")] - public ListenerToken AddChangeListener(TaskScheduler? scheduler, - EventHandler handler) - { - EventHandler collectionChangeEventHandler = - new EventHandler((sender, args) => - { - handler(sender, args); - }); - return GetDefaultCollection().AddChangeListener(scheduler, collectionChangeEventHandler); - } - - /// - /// [DEPRECATED] Adds a change listener for the changes that occur in the default collection - /// of this database. Signatures are the same as += style event handlers. The callback will - /// be invoked on a thread pool thread. - /// - /// The handler to invoke - /// A that can be used to remove the handler later - /// Thrown if is null - /// Thrown if this method is called after the database is closed - [Obsolete("AddChangeListener is deprecated, please use GetDefaultCollection().AddChangeListener")] - public ListenerToken AddChangeListener(EventHandler handler) => AddChangeListener(null, handler); - - #endregion - - #region IDocumentChangeObservable - - /// - /// [DEPRECATED] Adds a document change listener for the document with the given ID and the - /// that will be used to invoke the callback. If the scheduler is not specified, then the default scheduler - /// will be used (scheduled via thread pool) - /// - /// The document ID - /// The scheduler to use when firing the event handler - /// The logic to handle the event - /// A that can be used to remove the listener later - /// Thrown if or - /// is null - /// Thrown if this method is called after the database is closed - [Obsolete("AddDocumentChangeListener is deprecated, please use GetDefaultCollection().AddDocumentChangeListener")] - public ListenerToken AddDocumentChangeListener(string id, TaskScheduler? scheduler, - EventHandler handler) - { - return GetDefaultCollection().AddDocumentChangeListener(id, scheduler, handler); - } - - /// - /// [DEPRECATED] Adds a document change listener for the document with the given ID. The callback will be - /// invoked on a thread pool thread. - /// - /// The document ID - /// The logic to handle the event - /// A that can be used to remove the listener later - /// Thrown if or - /// is null - /// Thrown if this method is called after the database is closed - [Obsolete("AddDocumentChangeListener is deprecated, please use GetDefaultCollection().AddDocumentChangeListener")] - public ListenerToken AddDocumentChangeListener(string id, EventHandler handler) => AddDocumentChangeListener(id, null, handler); - - #endregion - - #region IChangeObservableRemovable - - /// - /// [DEPRECATED] Removes a database changed listener by token - /// - /// The token received from - /// and family - [Obsolete("RemoveChangeListener is deprecated, please use GetDefaultCollection().RemoveChangeListener")] - public void RemoveChangeListener(ListenerToken token) - { - GetDefaultCollection().RemoveChangeListener(token); - } - - #endregion - #region Internal Methods internal void AddActiveStoppable(IStoppable stoppable) @@ -1196,9 +883,7 @@ private static string DatabasePath(string name, string? directory) } // Must be called inside self lock -#if !XAMARINIOS && !MONOANDROID [MemberNotNull(nameof(c4db))] -#endif private void CheckOpen() { if (IsClosed) { diff --git a/src/Couchbase.Lite.Shared/API/Database/DatabaseChangedEventArgs.cs b/src/Couchbase.Lite.Shared/API/Database/DatabaseChangedEventArgs.cs deleted file mode 100644 index 8c7baeac9..000000000 --- a/src/Couchbase.Lite.Shared/API/Database/DatabaseChangedEventArgs.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -// DatabaseChangedEventArgs.cs -// -// Copyright (c) 2017 Couchbase, Inc All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; - -namespace Couchbase.Lite -{ - /// - /// [DEPRECATED] The parameters of a database changed event - /// - [Obsolete("DatabaseChangedEventArgs is deprecated, please use CollectionChangedEventArgs")] - public class DatabaseChangedEventArgs : EventArgs - { - #region Properties - - /// - /// Gets the database in which the change occurred - /// - public Database Database { get; } - - /// - /// Gets the document that was changed - /// - public IReadOnlyList DocumentIDs { get; } - - #endregion - - #region Constructors - - internal DatabaseChangedEventArgs(Database database, IReadOnlyList documentIDs) - { - Database = database; - DocumentIDs = documentIDs; - } - - #endregion - } -} \ No newline at end of file diff --git a/src/Couchbase.Lite.Shared/API/Database/DocumentChangedEventArgs.cs b/src/Couchbase.Lite.Shared/API/Database/DocumentChangedEventArgs.cs index b15bb2fb8..a46df978f 100644 --- a/src/Couchbase.Lite.Shared/API/Database/DocumentChangedEventArgs.cs +++ b/src/Couchbase.Lite.Shared/API/Database/DocumentChangedEventArgs.cs @@ -33,12 +33,6 @@ public sealed class DocumentChangedEventArgs : EventArgs /// public string DocumentID { get; } - /// - /// [DEPRECATED] The source of the document that changed - /// - [Obsolete("Database is deprecated, please use Collection property instead")] - public Database Database { get; } - /// /// The source of the document that changed /// @@ -52,9 +46,6 @@ internal DocumentChangedEventArgs(string documentID, Collection collection) { DocumentID = documentID; Collection = collection; -#pragma warning disable CS0618 // Type or member is obsolete - Database = collection.Database; -#pragma warning restore CS0618 // Type or member is obsolete } #endregion diff --git a/src/Couchbase.Lite.Shared/API/Database/Scope.cs b/src/Couchbase.Lite.Shared/API/Database/Scope.cs index ec086a5f1..563062abb 100644 --- a/src/Couchbase.Lite.Shared/API/Database/Scope.cs +++ b/src/Couchbase.Lite.Shared/API/Database/Scope.cs @@ -215,9 +215,7 @@ internal bool DeleteCollection(string name, string scope) #region Private Methods -#if !XAMARINIOS && !MONODROID [MemberNotNull(nameof(c4Db))] -#endif private void CheckOpen() { if (c4Db == null) { diff --git a/src/Couchbase.Lite.Shared/API/Info/Defaults_Deprecated.cs b/src/Couchbase.Lite.Shared/API/Info/Defaults_Deprecated.cs deleted file mode 100644 index fd90fff40..000000000 --- a/src/Couchbase.Lite.Shared/API/Info/Defaults_Deprecated.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// Copyright (c) 2024-present Couchbase, Inc All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using Couchbase.Lite.Sync; -using Couchbase.Lite.Logging; - -using System; - -namespace Couchbase.Lite.Info; - -public static partial class Constants -{ - /// - /// Default value for (false) - /// Plaintext is not used, and instead binary encoding is used in log files - /// - [Obsolete("Use Constants.UsePlantext instead")] - public static readonly bool DefaultLogFileUsePlainText = DefaultLogFileUsePlaintext; - - /// - /// Default value for (TimeSpan.FromSeconds(300)) - /// Max wait time between retry attempts in seconds - /// - [Obsolete("Use Constants.DefaultReplicatorMaxAttemptsWaitTime (attempt -> attemps) instead")] - public static readonly TimeSpan DefaultReplicatorMaxAttemptWaitTime = DefaultReplicatorMaxAttemptsWaitTime; -} diff --git a/src/Couchbase.Lite.Shared/API/Query/DataSource.cs b/src/Couchbase.Lite.Shared/API/Query/DataSource.cs index 35141b355..22dfb9b6f 100644 --- a/src/Couchbase.Lite.Shared/API/Query/DataSource.cs +++ b/src/Couchbase.Lite.Shared/API/Query/DataSource.cs @@ -49,20 +49,6 @@ public static IDataSourceAs Collection(Collection collection) return new DatabaseSource(c, c.ThreadSafety); } - /// - /// [DEPRECATED] Creates a data source for an that gets results from the given - /// - /// - /// The database to operate on - /// The source of data for the - [Obsolete("DataSource.Database is deprecated, please use DataSource.Collection")] - public static IDataSourceAs Database(Database database) - { - var db = CBDebug.MustNotBeNull(WriteLog.To.Query, Tag, nameof(database), database); - - return new DatabaseSource(database, db.ThreadSafety); - } - #endregion } } diff --git a/src/Couchbase.Lite.Shared/API/Query/FullTextExpression.cs b/src/Couchbase.Lite.Shared/API/Query/FullTextExpression.cs deleted file mode 100644 index 90c84b84f..000000000 --- a/src/Couchbase.Lite.Shared/API/Query/FullTextExpression.cs +++ /dev/null @@ -1,46 +0,0 @@ -// -// FullTextExpression.cs -// -// Copyright (c) 2017 Couchbase, Inc All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using System; - -using Couchbase.Lite.Internal.Query; - -namespace Couchbase.Lite.Query -{ - /// - /// [DEPRECATED] A class that generates expressions that operate on the results of full-text searching - /// - [Obsolete("This class deprecated, please use FullTextFunction.")] - public static class FullTextExpression - { - #region Public Methods - - /// - /// [DEPRECATED] Generates a query expression that will check for matches against a - /// given full text index name - /// - /// The name of the full-text index to perform the - /// check against - /// The generated query expression - [Obsolete("This class deprecated, please use Match(string indexName, string query) in FullTextFunction class.")] - public static IFullTextExpression Index(string name) => - new QueryCompoundExpression("MATCH()", Expression.String(name), Expression.String(String.Empty)); - - #endregion - } -} \ No newline at end of file diff --git a/src/Couchbase.Lite.Shared/API/Query/FullTextFunction.cs b/src/Couchbase.Lite.Shared/API/Query/FullTextFunction.cs index f2e205869..8b3c09992 100644 --- a/src/Couchbase.Lite.Shared/API/Query/FullTextFunction.cs +++ b/src/Couchbase.Lite.Shared/API/Query/FullTextFunction.cs @@ -27,27 +27,6 @@ namespace Couchbase.Lite.Query /// public static class FullTextFunction { - /// - /// Create a full-text matching function that will check for matches between given - /// full text index name and the given query expression - /// - /// The name of the full-text index to perform the - /// check against - /// The query expression to perform the check against - /// A function that will perform the matching - [Obsolete("Use Match(index, query) instead")] - public static IExpression Match(string indexName, string query) => - Match(Expression.FullTextIndex(indexName), query); - - /// - /// Creates a full-text ranking value function indicating how well the current - /// query result matches the full-text query when performing the match comparison. - /// - /// The FTS index name to use when performing the calculation - /// A function that will perform the ranking - [Obsolete("Use Rank(index) instead")] - public static IExpression Rank(string indexName) => Rank(Expression.FullTextIndex(indexName)); - /// /// Create a full-text matching function that will check for matches between given /// full text index name and the given query expression diff --git a/src/Couchbase.Lite.Shared/API/Query/IExpression.cs b/src/Couchbase.Lite.Shared/API/Query/IExpression.cs index 97e8c5553..17f60e90b 100644 --- a/src/Couchbase.Lite.Shared/API/Query/IExpression.cs +++ b/src/Couchbase.Lite.Shared/API/Query/IExpression.cs @@ -116,14 +116,6 @@ public interface IExpression /// The expression representing the new operation IExpression IsNot(IExpression expression); - /// - /// [DEPRECATED] Gets an expression representing if the current expression is null - /// or missing (i.e. does not have a value) - /// - /// The expression representing the new operation - [Obsolete("This query expression deprecated, please use IsNotValued().")] - IExpression IsNullOrMissing(); - /// /// Gets an expression representing if the current expression has a value /// @@ -184,14 +176,6 @@ public interface IExpression /// The expression representing the new operation IExpression NotEqualTo(IExpression expression); - /// - /// [DEPRECATED] Gets an expression representing if the current expression is neither null - /// nor missing (i.e. has a value) - /// - /// The expression representing the new operation - [Obsolete("This query expression deprecated, please use IsValued().")] - IExpression NotNullOrMissing(); - /// /// Logically "ors" the given expression with the current expression /// diff --git a/src/Couchbase.Lite.Shared/API/Sync/Replicator+Backgrounding.cs b/src/Couchbase.Lite.Shared/API/Sync/Replicator+Backgrounding.cs index 71bed080a..fc105b977 100644 --- a/src/Couchbase.Lite.Shared/API/Sync/Replicator+Backgrounding.cs +++ b/src/Couchbase.Lite.Shared/API/Sync/Replicator+Backgrounding.cs @@ -22,6 +22,7 @@ using Foundation; using LiteCore.Interop; using System; +using System.Linq; using System.Threading; using UIKit; @@ -46,7 +47,7 @@ private NSFileProtection FileProtection { get { #pragma warning disable CS0618 // Type or member is obsolete - var attrs = NSFileManager.DefaultManager.GetAttributes(Config.Database.Path!); + var attrs = NSFileManager.DefaultManager.GetAttributes(Config.Collections.First().Database.Path!); return attrs?.ProtectionKey ?? NSFileProtection.None; #pragma warning restore CS0618 // Type or member is obsolete } diff --git a/src/Couchbase.Lite.Shared/API/Sync/Replicator.cs b/src/Couchbase.Lite.Shared/API/Sync/Replicator.cs index 8127c09ce..1dca59f59 100644 --- a/src/Couchbase.Lite.Shared/API/Sync/Replicator.cs +++ b/src/Couchbase.Lite.Shared/API/Sync/Replicator.cs @@ -373,36 +373,6 @@ public void Stop() }); } - /// - /// [DEPRECATED] Gets a list of document IDs that are going to be pushed, but have not been pushed yet - /// - /// API is a snapshot and results may change between the time the call was made and the time - /// - /// - /// An immutable set of strings, each of which is a document ID - /// Thrown if no push replication - /// Thrown if an error condition is returned from LiteCore - [Obsolete("GetPendingDocumentIDs() is deprecated, please use GetPendingDocumentIDs(Collection collection)")] - public IImmutableSet GetPendingDocumentIDs() - { - return GetPendingDocumentIDs(Config.Database.GetDefaultCollection()); - } - - /// - /// [DEPRECATED] Checks whether or not a document with the given ID has any pending revisions to push - /// - /// The document ID - /// A bool which represents whether or not the document with the corresponding ID has one or more pending revisions. - /// true means that one or more revisions have not been pushed to the remote yet, - /// and false means that all revisions on the document have been pushed - /// Thrown if no push replication - /// Thrown if an error condition is returned from LiteCore - [Obsolete("IsDocumentPending(string documentID) is deprecated, please use IsDocumentPending(string documentID, Collection collection)")] - public bool IsDocumentPending(string documentID) - { - return IsDocumentPending(documentID, Config.Database.GetDefaultCollection()); - } - /// /// Checks whether or not a document with the given ID in the given collection is pending to push or not. /// If the given collection is not part of the replication, an Invalid Parameter Exception will be thrown. diff --git a/src/Couchbase.Lite.Shared/API/Sync/ReplicatorConfiguration.cs b/src/Couchbase.Lite.Shared/API/Sync/ReplicatorConfiguration.cs index 7420628ff..00ba48522 100644 --- a/src/Couchbase.Lite.Shared/API/Sync/ReplicatorConfiguration.cs +++ b/src/Couchbase.Lite.Shared/API/Sync/ReplicatorConfiguration.cs @@ -155,27 +155,6 @@ public ProxyAuthenticator? ProxyAuthenticator set => _freezer.SetValue(ref _proxyAuthenticator, value); } - /// - /// [DEPRECATED] A set of Sync Gateway channel names to pull from. Ignored for push replicatoin. - /// The default value is null, meaning that all accessible channels will be pulled. - /// Note: channels that are not accessible to the user will be ignored by Sync Gateway. - /// - /// - /// Note: Channels property is only applicable in the replications with Sync Gateway. - /// - [Obsolete("Channels is deprecated, please use CollectionConfiguration.Channels")] - public IList? Channels - { - get => DefaultCollectionConfig.Options.Channels; - set { - _freezer.PerformAction(() => - { - DefaultCollectionConfig.Options.Channels = value; - Options.Channels = value; - }); - } - } - /// /// Gets or sets whether or not the should stay /// active indefinitely. The default is false @@ -192,31 +171,6 @@ public bool Continuous } } - /// - /// [DEPRECATED] Gets the local database participating in the replication. - /// - /// Thrown if Database doesn't exist in the replicator configuration. - [Obsolete("Database is deprecated, please use Collections")] - public Database Database => Collections.Count > 0 && Collections[0].Database != null ? Collections[0].Database - : throw new CouchbaseLiteException(C4ErrorCode.InvalidParameter, "Cannot operate on a missing Database in the Replication Configuration."); - - /// - /// [DEPRECATED] A set of document IDs to filter by. If not null, only documents with these IDs will be pushed - /// and/or pulled - /// - [Obsolete("DocumentIDs is deprecated, please use CollectionConfiguration.DocumentIDs")] - public IList? DocumentIDs - { - get => DefaultCollectionConfig.Options.DocIDs; - set { - _freezer.PerformAction(() => - { - DefaultCollectionConfig.Options.DocIDs = value; - Options.DocIDs = value; - }); - } - } - /// /// Extra HTTP headers to send in all requests to the remote target /// @@ -255,30 +209,6 @@ internal string? NetworkInterface set => _freezer.PerformAction(() => Options.NetworkInterface = value); } - /// - /// [DEPRECATED] Func delegate that takes Document input parameter and bool output parameter - /// Document pull will be allowed if output is true, othewise, Document pull - /// will not be allowed - /// - [Obsolete("PullFilter is deprecated, please use CollectionConfiguration.PullFilter")] - public Func? PullFilter - { - get => DefaultCollectionConfig.PullFilter; - set => _freezer.PerformAction(() => DefaultCollectionConfig.PullFilter = value); - } - - /// - /// [DEPRECATED] Func delegate that takes Document input parameter and bool output parameter - /// Document push will be allowed if output is true, othewise, Document push - /// will not be allowed - /// - [Obsolete("PushFilter is deprecated, please use CollectionConfiguration.PushFilter")] - public Func? PushFilter - { - get => DefaultCollectionConfig.PushFilter; - set => _freezer.PerformAction(() => DefaultCollectionConfig.PushFilter = value); - } - /// /// A value indicating the direction of the replication. The default is /// which is bidirectional @@ -375,18 +305,6 @@ public TimeSpan? MaxAttemptsWaitTime /// public IEndpoint Target { get; } - /// - /// [DEPRECATED] The implemented custom conflict resolver object can be registered to the replicator - /// at ConflictResolver property. The default value of the conflictResolver is null. - /// When the value is null, the default conflict resolution will be applied. - /// - [Obsolete("ConflictResolver is deprecated, please use CollectionConfiguration.ConflictResolver")] - public IConflictResolver? ConflictResolver - { - get => DefaultCollectionConfig.ConflictResolver; - set => _freezer.PerformAction(() => DefaultCollectionConfig.ConflictResolver = value); - } - /// /// The collections in the replication. /// @@ -456,21 +374,6 @@ public ReplicatorConfiguration(IEndpoint target) castTarget.Visit(this); } - /// - /// [DEPRECATED] Constructs a new builder object with the required properties - /// - /// The database that will serve as the local side of the replication - /// The endpoint to replicate to, either local or remote - /// Thrown if an unsupported implementation - /// is provided as - [Obsolete("Constructor ReplicatorConfiguration(Database, IEndpoint) is deprecated, please use ReplicatorConfiguration(IEndpoint)")] - public ReplicatorConfiguration(Database database, IEndpoint target) - :this(target) - { - CBDebug.MustNotBeNull(WriteLog.To.Sync, Tag, nameof(database), database); - AddCollection(database.GetDefaultCollection()); - } - #endregion #region Public Methods - Collections' Replicator Configurations diff --git a/src/Couchbase.Lite.Shared/Couchbase.Lite.Shared.projitems b/src/Couchbase.Lite.Shared/Couchbase.Lite.Shared.projitems index b6d71fb23..2c522add3 100644 --- a/src/Couchbase.Lite.Shared/Couchbase.Lite.Shared.projitems +++ b/src/Couchbase.Lite.Shared/Couchbase.Lite.Shared.projitems @@ -15,7 +15,6 @@ - @@ -47,7 +46,6 @@ - @@ -58,7 +56,6 @@ - diff --git a/src/Couchbase.Lite.Shared/Query/QueryExpression.cs b/src/Couchbase.Lite.Shared/Query/QueryExpression.cs index 2b0124520..11df5a68a 100644 --- a/src/Couchbase.Lite.Shared/Query/QueryExpression.cs +++ b/src/Couchbase.Lite.Shared/Query/QueryExpression.cs @@ -201,9 +201,6 @@ public IExpression Is(IExpression expression) => public IExpression IsNot(IExpression expression) => GetOperator(BinaryOpType.IsNot, CBDebug.MustNotBeNull(WriteLog.To.Query, Tag, nameof(expression), expression)); - [Obsolete("This query expression deprecated, please use IsNotValued().")] - public IExpression IsNullOrMissing() => new QueryUnaryExpression(this, UnaryOpType.Null) - .Or(new QueryUnaryExpression(this, UnaryOpType.Missing)); public IExpression IsNotValued() => Expression.Not(IsValued()); public IExpression IsValued() => new QueryUnaryExpression(this, UnaryOpType.Valued); public IExpression LessThan(IExpression expression) => @@ -219,8 +216,6 @@ public IExpression Multiply(IExpression expression) => GetOperator(BinaryOpType.Multiply, CBDebug.MustNotBeNull(WriteLog.To.Query, Tag, nameof(expression), expression)); public IExpression NotEqualTo(IExpression expression) => GetOperator(BinaryOpType.NotEqualTo, CBDebug.MustNotBeNull(WriteLog.To.Query, Tag, nameof(expression), expression)); - [Obsolete("This query expression deprecated, please use IsValued().")] - public IExpression NotNullOrMissing() => Expression.Not(IsNullOrMissing()); public IExpression Or(IExpression expression) => new QueryCompoundExpression("OR", this, CBDebug.MustNotBeNull(WriteLog.To.Query, Tag, nameof(expression), expression)); public IExpression Regex(IExpression expression) => diff --git a/src/Couchbase.Lite.Support.Android/Couchbase.Lite.Support.Android.csproj b/src/Couchbase.Lite.Support.Android/Couchbase.Lite.Support.Android.csproj index d8f400842..681f9505a 100644 --- a/src/Couchbase.Lite.Support.Android/Couchbase.Lite.Support.Android.csproj +++ b/src/Couchbase.Lite.Support.Android/Couchbase.Lite.Support.Android.csproj @@ -3,7 +3,7 @@ Debug;Release;Packaging AnyCPU net9.0-android - 22.0 + 24.0 Library Couchbase.Lite.Support.Android Couchbase.Lite.Support.Android diff --git a/src/Couchbase.Lite.Support.Apple/iOS/Couchbase.Lite.Support.iOS.csproj b/src/Couchbase.Lite.Support.Apple/iOS/Couchbase.Lite.Support.iOS.csproj index 5c93a13cd..51ce931eb 100644 --- a/src/Couchbase.Lite.Support.Apple/iOS/Couchbase.Lite.Support.iOS.csproj +++ b/src/Couchbase.Lite.Support.Apple/iOS/Couchbase.Lite.Support.iOS.csproj @@ -3,8 +3,8 @@ Debug;Release;Packaging AnyCPU net9.0-ios;net9.0-maccatalyst - 12.0 - 13.1 + 15.0 + 15.0 Library Couchbase.Lite.Support.iOS Couchbase.Lite.Support.iOS @@ -65,5 +65,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + + \ No newline at end of file diff --git a/src/Couchbase.Lite.Tests.Shared/NotificationTest.cs b/src/Couchbase.Lite.Tests.Shared/NotificationTest.cs index 03de73d0f..29b525ee9 100644 --- a/src/Couchbase.Lite.Tests.Shared/NotificationTest.cs +++ b/src/Couchbase.Lite.Tests.Shared/NotificationTest.cs @@ -47,32 +47,6 @@ protected override void Dispose(bool disposing) _wa?.Dispose(); } - [Fact] - public void TestDatabaseChange() - { - using var wa = new WaitAssert(); - DefaultCollection.AddChangeListener(null, (sender, args) => - { - var docIDs = args.DocumentIDs; - wa.RunAssert(() => - { - args.Database.ShouldBe(Db); - docIDs.Count.ShouldBe(10, "because that is the number of expected rows"); - }); - }); - - Db.InBatch(() => - { - for (uint i = 0; i < 10; i++) { - var doc = new MutableDocument($"doc-{i}"); - doc.SetString("type", "demo"); - DefaultCollection.Save(doc); - } - }); - - wa.WaitForResult(TimeSpan.FromSeconds(5)); - } - [Fact] public void TestCollectionChange() { diff --git a/src/Couchbase.Lite.Tests.Shared/QueryTest.cs b/src/Couchbase.Lite.Tests.Shared/QueryTest.cs index 3b5d18956..030656731 100644 --- a/src/Couchbase.Lite.Tests.Shared/QueryTest.cs +++ b/src/Couchbase.Lite.Tests.Shared/QueryTest.cs @@ -321,58 +321,6 @@ public void TestNoWhereQuery() } #endif - [Fact] - [Obsolete] - public void TestWhereNullOrMissing() - { - MutableDocument? doc1 = null, doc2 = null; - doc1 = new MutableDocument("doc1"); - doc1.SetString("name", "Scott"); - DefaultCollection.Save(doc1); - - doc2 = new MutableDocument("doc2"); - doc2.SetString("name", "Tiger"); - doc2.SetString("address", "123 1st ave."); - doc2.SetInt("age", 20); - DefaultCollection.Save(doc2); - - var name = Expression.Property("name"); - var address = Expression.Property("address"); - var age = Expression.Property("age"); - var work = Expression.Property("work"); - - var tests = new[] { - Tuple.Create(name.NotNullOrMissing(), new[] { doc1, doc2 }), - Tuple.Create(name.IsNullOrMissing(), new MutableDocument[0]), - Tuple.Create(address.NotNullOrMissing(), new[] { doc2 }), - Tuple.Create(address.IsNullOrMissing(), new[] { doc1 }), - Tuple.Create(age.NotNullOrMissing(), new[] { doc2 }), - Tuple.Create(age.IsNullOrMissing(), new[] { doc1 }), - Tuple.Create(work.NotNullOrMissing(), new MutableDocument[0]), - Tuple.Create(work.IsNullOrMissing(), new[] { doc1, doc2 }) - }; - - int testNum = 1; - foreach (var test in tests) { - var exp = test.Item1; - var expectedDocs = test.Item2; - using (var q = QueryBuilder.Select(SelectResult.Expression(Meta.ID)).From(DataSource.Collection(DefaultCollection)).Where(exp)) { - var numRows = VerifyQuery(q, (n, row) => - { - if (n <= expectedDocs.Length) { - var doc = expectedDocs[n - 1]; - row.GetString("id") - .ShouldBe(doc.Id, $"because otherwise the row results were different than expected ({testNum})"); - } - }); - - numRows.ShouldBe(expectedDocs.Length, "because otherwise too many rows were returned"); - } - - testNum++; - } - } - [Fact] public void TestWhereValued() { @@ -2751,16 +2699,13 @@ public void TestSelectAllResultKey() ("test.flowers as f", "f") }; -#pragma warning disable CS0618 // Type or member is obsolete var queryBuilderInputAndResult = new List<(IDataSource querySource, string resultName)> { - (DataSource.Database(Db), Db.Name), (DataSource.Collection(DefaultCollection).As("db-alias"), "db-alias"), (DataSource.Collection(DefaultCollection), "_default"), (DataSource.Collection(c), "flowers"), (DataSource.Collection(c).As("collection-alias"), "collection-alias") }; -#pragma warning restore CS0618 // Type or member is obsolete using var doc1 = new MutableDocument("foo1"); diff --git a/src/Couchbase.Lite.Tests.Shared/ScopesCollections.ReplicationTest.cs b/src/Couchbase.Lite.Tests.Shared/ScopesCollections.ReplicationTest.cs index c37396c3a..471447ad2 100644 --- a/src/Couchbase.Lite.Tests.Shared/ScopesCollections.ReplicationTest.cs +++ b/src/Couchbase.Lite.Tests.Shared/ScopesCollections.ReplicationTest.cs @@ -65,139 +65,6 @@ public ScopesCollectionsReplicationTest(ITestOutputHelper output) : base(output) #region 8.13 ReplicatorConfiguration - [Fact] - [Obsolete] - public void TestCreateConfigWithDatabase() - { - var config = new ReplicatorConfiguration(Db, new DatabaseEndpoint(OtherDb)); - config.Collections.ShouldContain(Db.GetDefaultCollection(), "Because Default collection configuration with default collection is created with ReplicatorConfiguration init."); - var collConfig = config.GetCollectionConfig(Db.GetDefaultCollection()); - collConfig.ShouldNotBeNull("because it was just set"); - collConfig!.GetType().ShouldBe(typeof(CollectionConfiguration)); - collConfig.Equals(config.DefaultCollectionConfig).ShouldBeTrue(); - collConfig.ConflictResolver.ShouldBe(ConflictResolver.Default); - collConfig.PushFilter.ShouldBeNull(); - collConfig.PullFilter.ShouldBeNull(); - collConfig.Channels.ShouldBeNull(); - collConfig.DocumentIDs.ShouldBeNull(); - config.Database.ShouldBe(Db); - } - - [Fact] - [Obsolete] - public void TestCreateConfigWithDatabaseAndConflictResolver() - { - var config = new ReplicatorConfiguration(new DatabaseEndpoint(OtherDb)); - config.AddCollection(DefaultCollection, new CollectionConfiguration - { - ConflictResolver = new FakeConflictResolver() - }); - - var collConfig = config.GetCollectionConfig(Db.GetDefaultCollection()); - collConfig?.ConflictResolver.ShouldBe(config.ConflictResolver); - } - - [Fact] - [Obsolete] - public void TestUpdateConflictResolverForDefaultCollection() - { - var config = new ReplicatorConfiguration(Db, new DatabaseEndpoint(OtherDb)) { ConflictResolver = new FakeConflictResolver() }; - var collConfig = config.GetCollectionConfig(Db.GetDefaultCollection()); - collConfig.ShouldNotBeNull("because it was just set"); - collConfig!.ConflictResolver.ShouldBe(config.ConflictResolver); - config.ConflictResolver = new TestConflictResolver((conflict) => { return conflict.LocalDocument; }); - collConfig = config.GetCollectionConfig(Db.GetDefaultCollection()); - collConfig.ShouldNotBeNull("because it was just set"); - collConfig!.ConflictResolver.ShouldBe(config.ConflictResolver); - collConfig.ConflictResolver = new FakeConflictResolver(); - config.AddCollection(Db.GetDefaultCollection(), collConfig); - collConfig = config.GetCollectionConfig(Db.GetDefaultCollection()); - collConfig?.ConflictResolver.ShouldBe(config.ConflictResolver); - } - - [Fact] - [Obsolete] - public void TestCreateConfigWithDatabaseAndFilters() - { - var config = new ReplicatorConfiguration(Db, new DatabaseEndpoint(OtherDb)) - { - Channels = new List { "channelA", "channelB" }, - DocumentIDs = new List { "doc1", "doc2" }, - ConflictResolver = new FakeConflictResolver(), - PullFilter = _replicator__filterCallbackTrue, - PushFilter = _replicator__filterCallbackTrue - }; - - var defaultCollConfig = config.GetCollectionConfig(Db.GetDefaultCollection()); - defaultCollConfig.ShouldNotBeNull("because the default collection should be present by default"); - defaultCollConfig!.Channels.ShouldBeSameAs(config.Channels); - defaultCollConfig.DocumentIDs.ShouldBeSameAs(config.DocumentIDs); - defaultCollConfig.ConflictResolver.ShouldBeSameAs(config.ConflictResolver); - defaultCollConfig.PullFilter.ShouldBeSameAs(config.PullFilter); - defaultCollConfig.PushFilter.ShouldBeSameAs(config.PushFilter); - } - - [Fact] - [Obsolete] - public void TestUpdateFiltersForDefaultCollection() - { - var config = new ReplicatorConfiguration(Db, new DatabaseEndpoint(OtherDb)) - { - Channels = new List { "channelA", "channelB" }, - DocumentIDs = new List { "doc1", "doc2" }, - ConflictResolver = new FakeConflictResolver(), - PullFilter = _replicator__filterCallbackTrue, - PushFilter = _replicator__filterCallbackTrue - }; - - var defaultCollConfig = config.GetCollectionConfig(Db.GetDefaultCollection()); - defaultCollConfig.ShouldNotBeNull("because the default collection should be present by default"); - defaultCollConfig!.Channels.ShouldBeSameAs(config.Channels); - defaultCollConfig.DocumentIDs.ShouldBeSameAs(config.DocumentIDs); - defaultCollConfig.ConflictResolver.ShouldBeSameAs(config.ConflictResolver); - defaultCollConfig.PullFilter.ShouldBeSameAs(config.PullFilter); - defaultCollConfig.PushFilter.ShouldBeSameAs(config.PushFilter); - - config.Channels = new List { "channelA1", "channelB1" }; - config.DocumentIDs = new List { "doc1a", "doc2a" }; - config.ConflictResolver = new TestConflictResolver((conflict) => { return conflict.LocalDocument; }); - config.PullFilter = _replicator__filterCallbackFalse; - config.PushFilter = _replicator__filterCallbackFalse; - - defaultCollConfig = config.GetCollectionConfig(Db.GetDefaultCollection()); - defaultCollConfig.ShouldNotBeNull("because the default collection should be present by default"); - defaultCollConfig!.Channels.ShouldBeSameAs(config.Channels); - defaultCollConfig.DocumentIDs.ShouldBeSameAs(config.DocumentIDs); - defaultCollConfig.ConflictResolver.ShouldBeSameAs(config.ConflictResolver); - defaultCollConfig.PullFilter.ShouldBeSameAs(config.PullFilter); - defaultCollConfig.PushFilter.ShouldBeSameAs(config.PushFilter); - - defaultCollConfig.Channels = new List { "channelA", "channelB" }; - defaultCollConfig.DocumentIDs = new List { "doc1", "doc2" }; - defaultCollConfig.ConflictResolver = new FakeConflictResolver(); - defaultCollConfig.PullFilter = _replicator__filterCallbackTrue; - defaultCollConfig.PushFilter = _replicator__filterCallbackTrue; - - config.AddCollection(Db.GetDefaultCollection(), defaultCollConfig); - - defaultCollConfig = config.GetCollectionConfig(Db.GetDefaultCollection()); - defaultCollConfig.ShouldNotBeNull("because the default collection should be present by default"); - defaultCollConfig!.Channels.ShouldBeSameAs(config.Channels); - defaultCollConfig.DocumentIDs.ShouldBeSameAs(config.DocumentIDs); - defaultCollConfig.ConflictResolver.ShouldBeSameAs(config.ConflictResolver); - defaultCollConfig.PullFilter.ShouldBeSameAs(config.PullFilter); - defaultCollConfig.PushFilter.ShouldBeSameAs(config.PushFilter); - } - - [Fact] - [Obsolete] - public void TestCreateConfigWithEndpointOnly() - { - var config = new ReplicatorConfiguration(new DatabaseEndpoint(OtherDb)); - config.Collections.ShouldBeEmpty("Because no collection was added via AddCollection or AddCollections"); - Should.Throw(() => config.Database, "Because there is no Database atm since neither AddCollection nor AddCollections were called."); - } - [Fact] public void TestAddCollectionsWithoutCollectionConfig() { @@ -997,77 +864,6 @@ public void TestAddCollectionsToDatabaseInitiatedConfig() colBInOtherDb.GetDocument("doc7")?.GetString("str7").ShouldBe("string7"); } - [Fact] - [Obsolete] - public void TestOuterFiltersWithCollections() - { - var colA = Db.CreateCollection("colA", "scopeA"); - var colB = Db.CreateCollection("colB", "scopeA"); - - var targetEndpoint = new URLEndpoint(new Uri("wss://foo:4984/")); - var config = new ReplicatorConfiguration(targetEndpoint); ; - - config.AddCollections(new List() { colA, colB }); - - var defaultCollection = Db.GetDefaultCollection(); - - // set the outer filters after adding default collection - config.AddCollection(defaultCollection); - - config.Channels = new List { "channelA", "channelB" }; - config.DocumentIDs = new List { "doc1", "doc2" }; - config.ConflictResolver = new FakeConflictResolver(); - config.PullFilter = _replicator__filterCallbackTrue; - config.PushFilter = _replicator__filterCallbackTrue; - - var defaultCollConfig = config.GetCollectionConfig(defaultCollection); - defaultCollConfig!.Channels.ShouldBeSameAs(config.Channels); - defaultCollConfig.DocumentIDs.ShouldBeSameAs(config.DocumentIDs); - defaultCollConfig.ConflictResolver.ShouldBeSameAs(config.ConflictResolver); - defaultCollConfig.PullFilter.ShouldBeSameAs(config.PullFilter); - defaultCollConfig.PushFilter.ShouldBeSameAs(config.PushFilter); - } - - [Fact] - [Obsolete] - public void TestUpdateCollectionConfigWithDefault() - { - var colA = Db.CreateCollection("colA", "scopeA"); - var defaultCollection = Db.GetDefaultCollection(); - - var targetEndpoint = new URLEndpoint(new Uri("wss://foo:4984/")); - var replConfig = new ReplicatorConfiguration(targetEndpoint); - - var collConfig = new CollectionConfiguration() - { - PullFilter = _replicator__filterCallbackTrue - }; - - // Use addCollections() to add both colA and the default collection to the replicator config - // configured with the the CollectionConfiguration. - replConfig.AddCollections(new List() { defaultCollection, colA }, collConfig); - - collConfig = replConfig.GetCollectionConfig(defaultCollection); - collConfig!.PullFilter.ShouldNotBeNull("Because defaultCollection's collConfig PullFilter is assigned"); - collConfig.PushFilter.ShouldBeNull("Because no PushFilter is assigned in defaultCollection's collConfig"); - - collConfig = replConfig.GetCollectionConfig(colA); - collConfig!.PullFilter.ShouldNotBeNull("Because colA's collConfig PullFilter is assigned"); - collConfig.PushFilter.ShouldBeNull("Because no PushFilter is assigned in colA's collConfig"); - - // Set ReplicationFilter as the push filter using the deprecated ReplicatorConfiguration.setPushFilter method. - replConfig.PushFilter = _replicator__filterCallbackTrue; - - collConfig = replConfig.GetCollectionConfig(defaultCollection); - collConfig!.PullFilter.ShouldNotBeNull("Because defaultCollection's collConfig PullFilter is assigned"); - collConfig.PushFilter.ShouldNotBeNull("Because defaultCollection's collConfig PushFilter is assigned"); - - // Verify that the only thing that has changed is the default collection's push filter. - collConfig = replConfig.GetCollectionConfig(colA); - collConfig!.PullFilter.ShouldNotBeNull("Because colA's collConfig PullFilter is assigned"); - collConfig.PushFilter.ShouldBeNull("Because no PushFilter is assigned in colA's collConfig"); - } - #endregion #region Private Methods diff --git a/src/Couchbase.Lite/Couchbase.Lite.csproj b/src/Couchbase.Lite/Couchbase.Lite.csproj index 97e1f8dc0..ea6a64638 100644 --- a/src/Couchbase.Lite/Couchbase.Lite.csproj +++ b/src/Couchbase.Lite/Couchbase.Lite.csproj @@ -8,9 +8,9 @@ $(TargetFrameworks);$(DotNetFrameworkVersion);$(MauiDotNetVersion)-windows10.0.19041.0 true true - 12.0 - 13.1 - 22.0 + 15.0 + 15.0 + 24.0 10.0.19041.0 10.0.19041.0 Couchbase.Lite