ChangeFeedProcessor: Refactors AVAD metadata Contract (#4380)
* refactoring for name change * more refactoring and run UpdateContracts
This commit is contained in:
Родитель
dfee5ad2b0
Коммит
4855a6afd7
|
@ -1025,7 +1025,7 @@ namespace Microsoft.Azure.Cosmos.Encryption.Custom
|
|||
#if SDKPROJECTREF
|
||||
public override ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes<T>(
|
||||
string processorName,
|
||||
ChangeFeedHandler<ChangeFeedItemChange<T>> onChangesDelegate)
|
||||
ChangeFeedHandler<ChangeFeedItem<T>> onChangesDelegate)
|
||||
{
|
||||
return this.container.GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(
|
||||
processorName,
|
||||
|
|
|
@ -758,7 +758,7 @@ namespace Microsoft.Azure.Cosmos.Encryption
|
|||
#if SDKPROJECTREF
|
||||
public override ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes<T>(
|
||||
string processorName,
|
||||
ChangeFeedHandler<ChangeFeedItemChange<T>> onChangesDelegate)
|
||||
ChangeFeedHandler<ChangeFeedItem<T>> onChangesDelegate)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
|
|||
private readonly ChangesHandler<T> legacyOnChanges;
|
||||
private readonly ChangeFeedHandler<T> onChanges;
|
||||
private readonly ChangeFeedHandlerWithManualCheckpoint<T> onChangesWithManualCheckpoint;
|
||||
private readonly ChangeFeedHandler<ChangeFeedItemChange<T>> onAllVersionsAndDeletesChanges;
|
||||
private readonly ChangeFeedHandler<ChangeFeedItem<T>> onAllVersionsAndDeletesChanges;
|
||||
private readonly CosmosSerializerCore serializerCore;
|
||||
|
||||
public ChangeFeedObserverFactoryCore(
|
||||
|
@ -72,7 +72,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
|
|||
}
|
||||
|
||||
public ChangeFeedObserverFactoryCore(
|
||||
ChangeFeedHandler<ChangeFeedItemChange<T>> onChanges,
|
||||
ChangeFeedHandler<ChangeFeedItem<T>> onChanges,
|
||||
CosmosSerializerCore serializerCore)
|
||||
: this(serializerCore)
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
|
|||
Stream stream,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
IReadOnlyCollection<ChangeFeedItemChange<T>> changes = this.AllVersionsAsIReadOnlyCollection(stream, context);
|
||||
IReadOnlyCollection<ChangeFeedItem<T>> changes = this.AllVersionsAsIReadOnlyCollection(stream, context);
|
||||
if (changes.Count == 0)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
|
@ -156,13 +156,13 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
|
|||
}
|
||||
}
|
||||
|
||||
private IReadOnlyCollection<ChangeFeedItemChange<T>> AllVersionsAsIReadOnlyCollection(
|
||||
private IReadOnlyCollection<ChangeFeedItem<T>> AllVersionsAsIReadOnlyCollection(
|
||||
Stream stream,
|
||||
ChangeFeedObserverContextCore context)
|
||||
{
|
||||
try
|
||||
{
|
||||
return CosmosFeedResponseSerializer.FromFeedResponseStream<ChangeFeedItemChange<T>>(
|
||||
return CosmosFeedResponseSerializer.FromFeedResponseStream<ChangeFeedItem<T>>(
|
||||
this.serializerCore,
|
||||
stream);
|
||||
}
|
||||
|
|
|
@ -1697,7 +1697,7 @@ namespace Microsoft.Azure.Cosmos
|
|||
/// ManualResetEvent allProcessedDocumentsEvent = new ManualResetEvent(false);
|
||||
///
|
||||
/// ChangeFeedProcessor changeFeedProcessor = this.Container
|
||||
/// .GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(processorName: "processor", onChangesDelegate: (ChangeFeedProcessorContext context, IReadOnlyCollection<ChangeFeedItemChange<dynamic>> documents, CancellationToken token) =>
|
||||
/// .GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(processorName: "processor", onChangesDelegate: (ChangeFeedProcessorContext context, IReadOnlyCollection<ChangeFeedItem<dynamic>> documents, CancellationToken token) =>
|
||||
/// {
|
||||
/// Console.WriteLine($"number of documents processed: {documents.Count}");
|
||||
///
|
||||
|
@ -1705,7 +1705,7 @@ namespace Microsoft.Azure.Cosmos
|
|||
/// string pk = default;
|
||||
/// string description = default;
|
||||
///
|
||||
/// foreach (ChangeFeedItemChange<dynamic> changeFeedItem in documents)
|
||||
/// foreach (ChangeFeedItem<dynamic> changeFeedItem in documents)
|
||||
/// {
|
||||
/// if (changeFeedItem.Metadata.OperationType != ChangeFeedOperationType.Delete)
|
||||
/// {
|
||||
|
@ -1754,7 +1754,7 @@ namespace Microsoft.Azure.Cosmos
|
|||
/// <returns>An instance of <see cref="ChangeFeedProcessorBuilder"/></returns>
|
||||
public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes<T>(
|
||||
string processorName,
|
||||
ChangeFeedHandler<ChangeFeedItemChange<T>> onChangesDelegate);
|
||||
ChangeFeedHandler<ChangeFeedItem<T>> onChangesDelegate);
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -1222,7 +1222,7 @@ namespace Microsoft.Azure.Cosmos
|
|||
|
||||
public override ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes<T>(
|
||||
string processorName,
|
||||
ChangeFeedHandler<ChangeFeedItemChange<T>> onChangesDelegate)
|
||||
ChangeFeedHandler<ChangeFeedItem<T>> onChangesDelegate)
|
||||
{
|
||||
if (processorName == null)
|
||||
{
|
||||
|
|
|
@ -150,7 +150,7 @@ namespace Microsoft.Azure.Cosmos
|
|||
|
||||
public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes<T>(
|
||||
string processorName,
|
||||
ChangeFeedHandler<ChangeFeedItemChange<T>> onChangesDelegate);
|
||||
ChangeFeedHandler<ChangeFeedItem<T>> onChangesDelegate);
|
||||
#endif
|
||||
|
||||
public abstract class TryExecuteQueryResult
|
||||
|
|
|
@ -23,19 +23,19 @@ namespace Microsoft.Azure.Cosmos
|
|||
/// PartitionKey partitionKey = new PartitionKey(@"learning");
|
||||
/// ChangeFeedStartFrom changeFeedStartFrom = ChangeFeedStartFrom.Now(FeedRange.FromPartitionKey(partitionKey));
|
||||
///
|
||||
/// using (FeedIterator<ChangeFeedItemChanges<ToDoActivity>> feedIterator = container.GetChangeFeedIterator<ChangeFeedItemChanges<ToDoActivity>>(
|
||||
/// using (FeedIterator<ChangeFeedItem<ToDoActivity>> feedIterator = container.GetChangeFeedIterator<ChangeFeedItemChanges<ToDoActivity>>(
|
||||
/// changeFeedStartFrom: changeFeedStartFrom,
|
||||
/// changeFeedMode: changeFeedMode))
|
||||
/// {
|
||||
/// while (feedIterator.HasMoreResults)
|
||||
/// {
|
||||
/// FeedResponse<ChangeFeedItemChanges<ToDoActivity>> feedResponse = await feedIterator.ReadNextAsync();
|
||||
/// FeedResponse<ChangeFeedItem<ToDoActivity>> feedResponse = await feedIterator.ReadNextAsync();
|
||||
///
|
||||
/// if (feedResponse.StatusCode != HttpStatusCode.NotModified)
|
||||
/// {
|
||||
/// IEnumerable<ChangeFeedItemChanges<ToDoActivity>> feedResource = feedResponse.Resource;
|
||||
/// IEnumerable<ChangeFeedItem<ToDoActivity>> feedResource = feedResponse.Resource;
|
||||
///
|
||||
/// foreach(ChangeFeedItemChanges<ToDoActivity> itemChanges in feedResource)
|
||||
/// foreach(ChangeFeedItem<ToDoActivity> itemChanges in feedResource)
|
||||
/// {
|
||||
/// ToDoActivity currentToDoActivity = itemChanges.Current;
|
||||
/// ToDoActivity previousToDoActivity = itemChanges.Previous;
|
||||
|
@ -47,13 +47,13 @@ namespace Microsoft.Azure.Cosmos
|
|||
/// ]]>
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <remarks><see cref="ChangeFeedItemChange{T}"/> is an optional helper class that uses Newtonsoft serialization libraries. Users are welcome to create their own custom helper class.</remarks>
|
||||
/// <remarks><see cref="ChangeFeedItem{T}"/> is an optional helper class that uses Newtonsoft serialization libraries. Users are welcome to create their own custom helper class.</remarks>
|
||||
#if PREVIEW
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
class ChangeFeedItemChange<T>
|
||||
class ChangeFeedItem<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// The full fidelity change feed current item.
|
|
@ -20,7 +20,7 @@ namespace Microsoft.Azure.Cosmos
|
|||
class ChangeFeedMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// New instance of meta data for <see cref="ChangeFeedItemChange{T}"/> created.
|
||||
/// New instance of meta data for <see cref="ChangeFeedItem{T}"/> created.
|
||||
/// </summary>
|
||||
/// <param name="conflictResolutionTimestamp"></param>
|
||||
/// <param name="lsn"></param>
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace Microsoft.Azure.Cosmos
|
|||
string directAssemblyName = typeof(Documents.PartitionKeyRange).Assembly.GetName().Name;
|
||||
string inputAssemblyName = inputType.Assembly.GetName().Name;
|
||||
bool inputIsClientOrDirect = string.Equals(inputAssemblyName, clientAssemblyName) || string.Equals(inputAssemblyName, directAssemblyName);
|
||||
bool typeIsWhiteListed = inputType == typeof(Document) || (inputType.IsGenericType && inputType.GetGenericTypeDefinition() == typeof(ChangeFeedItemChange<>));
|
||||
bool typeIsWhiteListed = inputType == typeof(Document) || (inputType.IsGenericType && inputType.GetGenericTypeDefinition() == typeof(ChangeFeedItem<>));
|
||||
|
||||
if (!typeIsWhiteListed && inputIsClientOrDirect)
|
||||
{
|
||||
|
|
|
@ -39,13 +39,13 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests.ChangeFeed
|
|||
Exception exception = default;
|
||||
|
||||
ChangeFeedProcessor processor = monitoredContainer
|
||||
.GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(processorName: "processor", onChangesDelegate: (ChangeFeedProcessorContext context, IReadOnlyCollection<ChangeFeedItemChange<dynamic>> docs, CancellationToken token) =>
|
||||
.GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(processorName: "processor", onChangesDelegate: (ChangeFeedProcessorContext context, IReadOnlyCollection<ChangeFeedItem<dynamic>> docs, CancellationToken token) =>
|
||||
{
|
||||
string id = default;
|
||||
string pk = default;
|
||||
string description = default;
|
||||
|
||||
foreach (ChangeFeedItemChange<dynamic> change in docs)
|
||||
foreach (ChangeFeedItem<dynamic> change in docs)
|
||||
{
|
||||
if (change.Metadata.OperationType != ChangeFeedOperationType.Delete)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests.ChangeFeed
|
|||
Assert.IsTrue(context.Diagnostics.ToString().Contains("Change Feed Processor Read Next Async"));
|
||||
Assert.AreEqual(expected: 3, actual: docs.Count);
|
||||
|
||||
ChangeFeedItemChange<dynamic> createChange = docs.ElementAt(0);
|
||||
ChangeFeedItem<dynamic> createChange = docs.ElementAt(0);
|
||||
Assert.IsNotNull(createChange.Current);
|
||||
Assert.AreEqual(expected: "1", actual: createChange.Current.id.ToString());
|
||||
Assert.AreEqual(expected: "1", actual: createChange.Current.pk.ToString());
|
||||
|
@ -84,7 +84,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests.ChangeFeed
|
|||
Assert.AreEqual(expected: createChange.Metadata.PreviousLsn, actual: 0);
|
||||
Assert.IsNull(createChange.Previous);
|
||||
|
||||
ChangeFeedItemChange<dynamic> replaceChange = docs.ElementAt(1);
|
||||
ChangeFeedItem<dynamic> replaceChange = docs.ElementAt(1);
|
||||
Assert.IsNotNull(replaceChange.Current);
|
||||
Assert.AreEqual(expected: "1", actual: replaceChange.Current.id.ToString());
|
||||
Assert.AreEqual(expected: "1", actual: replaceChange.Current.pk.ToString());
|
||||
|
@ -93,7 +93,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests.ChangeFeed
|
|||
Assert.AreEqual(expected: createChange.Metadata.Lsn, actual: replaceChange.Metadata.PreviousLsn);
|
||||
Assert.IsNull(replaceChange.Previous);
|
||||
|
||||
ChangeFeedItemChange<dynamic> deleteChange = docs.ElementAt(2);
|
||||
ChangeFeedItem<dynamic> deleteChange = docs.ElementAt(2);
|
||||
Assert.IsNull(deleteChange.Current.id);
|
||||
Assert.AreEqual(expected: deleteChange.Metadata.OperationType, actual: ChangeFeedOperationType.Delete);
|
||||
Assert.AreEqual(expected: replaceChange.Metadata.Lsn, actual: deleteChange.Metadata.PreviousLsn);
|
||||
|
@ -341,7 +341,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests.ChangeFeed
|
|||
ChangeFeedProcessor allVersionsAndDeletesProcessorAtomic = null;
|
||||
|
||||
ChangeFeedProcessorBuilder allVersionsAndDeletesProcessorBuilder = monitoredContainer
|
||||
.GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(processorName: $"processorName", onChangesDelegate: (ChangeFeedProcessorContext context, IReadOnlyCollection<ChangeFeedItemChange<dynamic>> documents, CancellationToken token) => Task.CompletedTask)
|
||||
.GetChangeFeedProcessorBuilderWithAllVersionsAndDeletes(processorName: $"processorName", onChangesDelegate: (ChangeFeedProcessorContext context, IReadOnlyCollection<ChangeFeedItem<dynamic>> documents, CancellationToken token) => Task.CompletedTask)
|
||||
.WithInstanceName(Guid.NewGuid().ToString())
|
||||
.WithMaxItems(1)
|
||||
.WithLeaseContainer(leaseContainer)
|
||||
|
|
|
@ -822,7 +822,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
enableQueryOnPreviousImage: true);
|
||||
ContainerCore container = (ContainerCore)response;
|
||||
// FF does not work with StartFromBeginning currently, so we capture an initial continuation.
|
||||
FeedIterator<ChangeFeedItemChange<Document>> fullFidelityIterator = container.GetChangeFeedIteratorWithQuery<ChangeFeedItemChange<Document>>(
|
||||
FeedIterator<ChangeFeedItem<Document>> fullFidelityIterator = container.GetChangeFeedIteratorWithQuery<ChangeFeedItem<Document>>(
|
||||
ChangeFeedStartFrom.Now(),
|
||||
ChangeFeedMode.AllVersionsAndDeletes,
|
||||
querySpec,
|
||||
|
@ -831,7 +831,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
string initialContinuation = null;
|
||||
while (fullFidelityIterator.HasMoreResults)
|
||||
{
|
||||
FeedResponse<ChangeFeedItemChange<Document>> feedResponse = await fullFidelityIterator.ReadNextAsync(this.cancellationToken);
|
||||
FeedResponse<ChangeFeedItem<Document>> feedResponse = await fullFidelityIterator.ReadNextAsync(this.cancellationToken);
|
||||
initialContinuation = feedResponse.ContinuationToken;
|
||||
|
||||
if (feedResponse.StatusCode == HttpStatusCode.NotModified)
|
||||
|
@ -855,7 +855,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
}
|
||||
|
||||
// Resume Change Feed and verify we pickup the events where documents matches the query
|
||||
fullFidelityIterator = container.GetChangeFeedIteratorWithQuery<ChangeFeedItemChange<Document>>(
|
||||
fullFidelityIterator = container.GetChangeFeedIteratorWithQuery<ChangeFeedItem<Document>>(
|
||||
ChangeFeedStartFrom.ContinuationToken(initialContinuation),
|
||||
ChangeFeedMode.AllVersionsAndDeletes,
|
||||
querySpec,
|
||||
|
@ -864,9 +864,9 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
|
||||
while (fullFidelityIterator.HasMoreResults)
|
||||
{
|
||||
FeedResponse<ChangeFeedItemChange<Document>> feedResponse = await fullFidelityIterator.ReadNextAsync(this.cancellationToken);
|
||||
FeedResponse<ChangeFeedItem<Document>> feedResponse = await fullFidelityIterator.ReadNextAsync(this.cancellationToken);
|
||||
|
||||
foreach (ChangeFeedItemChange<Document> item in feedResponse)
|
||||
foreach (ChangeFeedItem<Document> item in feedResponse)
|
||||
{
|
||||
Assert.AreEqual("id3", item.Current.Id);
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
await container.DeleteItemAsync<Document>("id2", new Cosmos.PartitionKey("pkey1"));
|
||||
await container.DeleteItemAsync<Document>("id3", new Cosmos.PartitionKey("pkey1"));
|
||||
|
||||
fullFidelityIterator = container.GetChangeFeedIteratorWithQuery<ChangeFeedItemChange<Document>>(
|
||||
fullFidelityIterator = container.GetChangeFeedIteratorWithQuery<ChangeFeedItem<Document>>(
|
||||
ChangeFeedStartFrom.ContinuationToken(initialContinuation),
|
||||
ChangeFeedMode.AllVersionsAndDeletes,
|
||||
querySpec,
|
||||
|
@ -892,9 +892,9 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
detectedEvents = 0;
|
||||
while (fullFidelityIterator.HasMoreResults)
|
||||
{
|
||||
FeedResponse<ChangeFeedItemChange<Document>> feedResponse = await fullFidelityIterator.ReadNextAsync(this.cancellationToken);
|
||||
FeedResponse<ChangeFeedItem<Document>> feedResponse = await fullFidelityIterator.ReadNextAsync(this.cancellationToken);
|
||||
|
||||
foreach (ChangeFeedItemChange<Document> item in feedResponse)
|
||||
foreach (ChangeFeedItem<Document> item in feedResponse)
|
||||
{
|
||||
Assert.AreEqual("id3", item.Previous.Id);
|
||||
Assert.AreEqual(ChangeFeedOperationType.Delete, item.Metadata.OperationType);
|
||||
|
@ -925,14 +925,14 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
ChangeFeedMode changeFeedMode = ChangeFeedMode.AllVersionsAndDeletes;
|
||||
ChangeFeedStartFrom changeFeedStartFrom = ChangeFeedStartFrom.Now(FeedRange.FromPartitionKey(partitionKey));
|
||||
|
||||
using (FeedIterator<ChangeFeedItemChange<Item>> feedIterator = container.GetChangeFeedIterator<ChangeFeedItemChange<Item>>(
|
||||
using (FeedIterator<ChangeFeedItem<Item>> feedIterator = container.GetChangeFeedIterator<ChangeFeedItem<Item>>(
|
||||
changeFeedStartFrom: changeFeedStartFrom,
|
||||
changeFeedMode: changeFeedMode))
|
||||
{
|
||||
string continuation = null;
|
||||
while (feedIterator.HasMoreResults)
|
||||
{
|
||||
FeedResponse<ChangeFeedItemChange<Item>> feedResponse = await feedIterator.ReadNextAsync();
|
||||
FeedResponse<ChangeFeedItem<Item>> feedResponse = await feedIterator.ReadNextAsync();
|
||||
|
||||
if (feedResponse.StatusCode == HttpStatusCode.NotModified)
|
||||
{
|
||||
|
@ -950,20 +950,20 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
#if DEBUG
|
||||
Console.WriteLine(JsonConvert.SerializeObject(feedResponse.Resource));
|
||||
#endif
|
||||
IEnumerable<ChangeFeedItemChange<Item>> itemChanges = feedResponse.Resource;
|
||||
IEnumerable<ChangeFeedItem<Item>> itemChanges = feedResponse.Resource;
|
||||
|
||||
ChangeFeedIteratorCoreTests.AssertGatewayMode(feedResponse);
|
||||
|
||||
Assert.AreEqual(expected: 2, actual: itemChanges.Count());
|
||||
|
||||
foreach(ChangeFeedItemChange<Item> item in itemChanges)
|
||||
foreach(ChangeFeedItem<Item> item in itemChanges)
|
||||
{
|
||||
Item current = item.Current;
|
||||
Item previous = item.Previous;
|
||||
ChangeFeedMetadata metadata = item.Metadata;
|
||||
}
|
||||
|
||||
ChangeFeedItemChange<Item> createOperation = itemChanges.ElementAtOrDefault(0);
|
||||
ChangeFeedItem<Item> createOperation = itemChanges.ElementAtOrDefault(0);
|
||||
|
||||
Assert.AreEqual(expected: id, actual: createOperation.Current.Id);
|
||||
Assert.AreEqual(expected: "One Microsoft Way", actual: createOperation.Current.Line1);
|
||||
|
@ -977,7 +977,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
Assert.AreEqual(expected: default, actual: createOperation.Metadata.PreviousLsn);
|
||||
Assert.IsFalse(createOperation.Metadata.IsTimeToLiveExpired);
|
||||
|
||||
ChangeFeedItemChange<Item> replaceOperation = itemChanges.ElementAtOrDefault(1);
|
||||
ChangeFeedItem<Item> replaceOperation = itemChanges.ElementAtOrDefault(1);
|
||||
|
||||
Assert.AreEqual(expected: id, actual: replaceOperation.Current.Id);
|
||||
Assert.AreEqual(expected: "205 16th St NW", actual: replaceOperation.Current.Line1);
|
||||
|
@ -1010,14 +1010,14 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
string id = Guid.NewGuid().ToString();
|
||||
string otherId = Guid.NewGuid().ToString();
|
||||
|
||||
using (FeedIterator<ChangeFeedItemChange<Item>> feedIterator = container.GetChangeFeedIterator<ChangeFeedItemChange<Item>>(
|
||||
using (FeedIterator<ChangeFeedItem<Item>> feedIterator = container.GetChangeFeedIterator<ChangeFeedItem<Item>>(
|
||||
changeFeedStartFrom: ChangeFeedStartFrom.Now(),
|
||||
changeFeedMode: ChangeFeedMode.AllVersionsAndDeletes))
|
||||
{
|
||||
string continuation = null;
|
||||
while (feedIterator.HasMoreResults)
|
||||
{
|
||||
FeedResponse<ChangeFeedItemChange<Item>> feedResponse = await feedIterator.ReadNextAsync();
|
||||
FeedResponse<ChangeFeedItem<Item>> feedResponse = await feedIterator.ReadNextAsync();
|
||||
|
||||
if (feedResponse.StatusCode == HttpStatusCode.NotModified)
|
||||
{
|
||||
|
@ -1037,13 +1037,13 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
#if DEBUG
|
||||
Console.WriteLine(JsonConvert.SerializeObject(feedResponse.Resource));
|
||||
#endif
|
||||
List<ChangeFeedItemChange<Item>> resources = feedResponse.Resource.ToList();
|
||||
List<ChangeFeedItem<Item>> resources = feedResponse.Resource.ToList();
|
||||
|
||||
ChangeFeedIteratorCoreTests.AssertGatewayMode(feedResponse);
|
||||
|
||||
Assert.AreEqual(expected: 4, actual: resources.Count);
|
||||
|
||||
ChangeFeedItemChange<Item> firstCreateOperation = resources[0];
|
||||
ChangeFeedItem<Item> firstCreateOperation = resources[0];
|
||||
|
||||
Assert.AreEqual(expected: otherId, actual: firstCreateOperation.Current.Id);
|
||||
Assert.AreEqual(expected: "87 38floor, Witthayu Rd, Lumphini, Pathum Wan District", actual: firstCreateOperation.Current.Line1);
|
||||
|
@ -1056,7 +1056,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
Assert.AreEqual(expected: default, actual: firstCreateOperation.Metadata.PreviousLsn);
|
||||
Assert.IsFalse(firstCreateOperation.Metadata.IsTimeToLiveExpired);
|
||||
|
||||
ChangeFeedItemChange<Item> createOperation = resources[1];
|
||||
ChangeFeedItem<Item> createOperation = resources[1];
|
||||
|
||||
Assert.AreEqual(expected: id, actual: createOperation.Current.Id);
|
||||
Assert.AreEqual(expected: "One Microsoft Way", actual: createOperation.Current.Line1);
|
||||
|
@ -1069,7 +1069,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
Assert.AreEqual(expected: default, actual: createOperation.Metadata.PreviousLsn);
|
||||
Assert.IsFalse(createOperation.Metadata.IsTimeToLiveExpired);
|
||||
|
||||
ChangeFeedItemChange<Item> replaceOperation = resources[2];
|
||||
ChangeFeedItem<Item> replaceOperation = resources[2];
|
||||
|
||||
Assert.AreEqual(expected: id, actual: replaceOperation.Current.Id);
|
||||
Assert.AreEqual(expected: "205 16th St NW", actual: replaceOperation.Current.Line1);
|
||||
|
@ -1082,7 +1082,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
Assert.AreNotEqual(notExpected: default, actual: replaceOperation.Metadata.PreviousLsn);
|
||||
Assert.IsFalse(replaceOperation.Metadata.IsTimeToLiveExpired);
|
||||
|
||||
ChangeFeedItemChange<Item> deleteOperation = resources[3];
|
||||
ChangeFeedItem<Item> deleteOperation = resources[3];
|
||||
|
||||
Assert.IsNull(deleteOperation.Current.Id);
|
||||
Assert.IsNull(deleteOperation.Current.Line1);
|
||||
|
@ -1144,14 +1144,14 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
#if DEBUG
|
||||
Console.WriteLine(JsonConvert.SerializeObject(feedResponse.Resource));
|
||||
#endif
|
||||
List<ChangeFeedItemChange<Item>> itemChanges = JsonConvert.DeserializeObject<List<ChangeFeedItemChange<Item>>>(
|
||||
List<ChangeFeedItem<Item>> itemChanges = JsonConvert.DeserializeObject<List<ChangeFeedItem<Item>>>(
|
||||
JsonConvert.SerializeObject(feedResponse.Resource));
|
||||
|
||||
ChangeFeedIteratorCoreTests.AssertGatewayMode(feedResponse);
|
||||
|
||||
Assert.AreEqual(expected: 3, actual: itemChanges.Count);
|
||||
|
||||
ChangeFeedItemChange<Item> createOperation = itemChanges[0];
|
||||
ChangeFeedItem<Item> createOperation = itemChanges[0];
|
||||
|
||||
Assert.AreEqual(expected: id, actual: createOperation.Current.Id);
|
||||
Assert.AreEqual(expected: "One Microsoft Way", actual: createOperation.Current.Line1);
|
||||
|
@ -1165,7 +1165,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
Assert.AreEqual(expected: default, actual: createOperation.Metadata.PreviousLsn);
|
||||
Assert.IsFalse(createOperation.Metadata.IsTimeToLiveExpired);
|
||||
|
||||
ChangeFeedItemChange<Item> replaceOperation = itemChanges[1];
|
||||
ChangeFeedItem<Item> replaceOperation = itemChanges[1];
|
||||
|
||||
Assert.AreEqual(expected: id, actual: replaceOperation.Current.Id);
|
||||
Assert.AreEqual(expected: "205 16th St NW", actual: replaceOperation.Current.Line1);
|
||||
|
@ -1179,7 +1179,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.FeedRanges
|
|||
Assert.AreNotEqual(notExpected: default, actual: replaceOperation.Metadata.PreviousLsn);
|
||||
Assert.IsFalse(replaceOperation.Metadata.IsTimeToLiveExpired);
|
||||
|
||||
ChangeFeedItemChange<Item> deleteOperation = itemChanges[2];
|
||||
ChangeFeedItem<Item> deleteOperation = itemChanges[2];
|
||||
|
||||
Assert.IsNotNull(deleteOperation.Metadata);
|
||||
Assert.AreEqual(expected: ChangeFeedOperationType.Delete, actual: deleteOperation.Metadata.OperationType);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"Subclasses": {
|
||||
"Microsoft.Azure.Cosmos.ChangeFeedItemChange`1;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": {
|
||||
"Microsoft.Azure.Cosmos.ChangeFeedItem`1;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": {
|
||||
"Subclasses": {},
|
||||
"Members": {
|
||||
"Microsoft.Azure.Cosmos.ChangeFeedMetadata get_Metadata()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
|
||||
|
|
Загрузка…
Ссылка в новой задаче