Skip to content

Commit 15fe066

Browse files
committed
Remove Correlations and ICorrelationStore subsystem
1 parent 3f03132 commit 15fe066

37 files changed

Lines changed: 21 additions & 1298 deletions

File tree

Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/CorrelationStoreTests.cs

Lines changed: 0 additions & 32 deletions
This file was deleted.

Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/ControlPanelTests.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,6 @@ public override Task ExistingEffectCanBeSetToFailed()
138138
public override Task SaveChangesPersistsChangedResult()
139139
=> SaveChangesPersistsChangedResult(Utils.CreateInMemoryFunctionStoreTask());
140140

141-
[TestMethod]
142-
public override Task CorrelationsCanBeChanged()
143-
=> CorrelationsCanBeChanged(FunctionStoreFactory.Create());
144-
145141
[TestMethod]
146142
public override Task DeleteRemovesFunctionFromAllStores()
147143
=> DeleteRemovesFunctionFromAllStores(FunctionStoreFactory.Create());

Core/Cleipnir.ResilientFunctions.Tests/InMemoryTests/RFunctionTests/RoutingTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ public override Task MessageIsRoutedToFuncInstance()
2222
public override Task MessageIsRoutedUsingRoutingInfo()
2323
=> MessageIsRoutedUsingRoutingInfo(FunctionStoreFactory.Create());
2424

25-
[TestMethod]
26-
public override Task MessageIsRoutedToParamlessInstanceUsingCorrelationId()
27-
=> MessageIsRoutedToParamlessInstanceUsingCorrelationId(FunctionStoreFactory.Create());
28-
29-
[TestMethod]
30-
public override Task MessageIsRoutedToMultipleInstancesUsingCorrelationId()
31-
=> MessageIsRoutedToMultipleInstancesUsingCorrelationId(FunctionStoreFactory.Create());
32-
3325
[TestMethod]
3426
public override Task ParamlessInstanceIsStartedByMessage()
3527
=> ParamlessInstanceIsStartedByMessage(FunctionStoreFactory.Create());

Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/CorrelationStoreTests.cs

Lines changed: 0 additions & 115 deletions
This file was deleted.

Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/FunctionTests/ControlPanelTests.cs

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,52 +1225,16 @@ protected async Task SaveChangesPersistsChangedResult(Task<IFunctionStore> store
12251225
unhandledExceptionCatcher.ShouldNotHaveExceptions();
12261226
}
12271227

1228-
public abstract Task CorrelationsCanBeChanged();
1229-
protected async Task CorrelationsCanBeChanged(Task<IFunctionStore> storeTask)
1230-
{
1231-
var unhandledExceptionCatcher = new UnhandledExceptionCatcher();
1232-
1233-
var store = await storeTask;
1234-
var functionId = TestFlowId.Create();
1235-
var (flowType, flowInstance) = functionId;
1236-
using var functionsRegistry = new FunctionsRegistry(store, new Settings(unhandledExceptionCatcher.Catch));
1237-
1238-
var registration = functionsRegistry.RegisterParamless(
1239-
flowType,
1240-
async workflow =>
1241-
{
1242-
await workflow.Correlations.Register("SomeCorrelation");
1243-
1244-
}
1245-
);
1246-
1247-
await registration.Run(flowInstance.Value);
1248-
1249-
var controlPanel = await registration.ControlPanel(flowInstance.Value);
1250-
controlPanel.ShouldNotBeNull();
1251-
1252-
await controlPanel.Correlations.Contains("SomeCorrelation").ShouldBeTrueAsync();
1253-
await controlPanel.Correlations.Remove("SomeCorrelation");
1254-
await controlPanel.Correlations.Register("SomeNewCorrelation");
1255-
1256-
controlPanel = await registration.ControlPanel(flowInstance.Value);
1257-
controlPanel.ShouldNotBeNull();
1258-
await controlPanel.Correlations.Contains("SomeCorrelation").ShouldBeFalseAsync();
1259-
await controlPanel.Correlations.Contains("SomeNewCorrelation").ShouldBeTrueAsync();
1260-
1261-
unhandledExceptionCatcher.ShouldNotHaveExceptions();
1262-
}
1263-
12641228
public abstract Task DeleteRemovesFunctionFromAllStores();
12651229
protected async Task DeleteRemovesFunctionFromAllStores(Task<IFunctionStore> storeTask)
12661230
{
12671231
var unhandledExceptionCatcher = new UnhandledExceptionCatcher();
1268-
1232+
12691233
var store = await storeTask;
12701234
var functionId = TestFlowId.Create();
12711235
var (flowType, flowInstance) = functionId;
12721236
using var functionsRegistry = new FunctionsRegistry(store, new Settings(unhandledExceptionCatcher.Catch));
1273-
1237+
12741238
var registration = functionsRegistry.RegisterParamless(
12751239
flowType,
12761240
inner: () => Task.CompletedTask
@@ -1281,28 +1245,23 @@ protected async Task DeleteRemovesFunctionFromAllStores(Task<IFunctionStore> sto
12811245
var controlPanel = await registration.ControlPanel(flowInstance.Value);
12821246
controlPanel.ShouldNotBeNull();
12831247

1284-
await controlPanel.Correlations.Register("SomeCorrelation");
12851248
await controlPanel.Effects.SetSucceeded("SomeEffect".GetHashCode());
12861249
await controlPanel.Messages.Append("Some Message");
12871250

12881251
await controlPanel.Delete();
12891252

12901253
var storedId = registration.MapToStoredId(functionId.Instance);
12911254
await store.GetFunction(storedId).ShouldBeNullAsync();
1292-
1255+
12931256
await store.MessageStore.GetMessages(storedId)
12941257
.SelectAsync(msgs => msgs.Count == 0)
12951258
.ShouldBeTrueAsync();
12961259

1297-
await store.CorrelationStore.GetCorrelations(storedId)
1298-
.SelectAsync(c => c.Any())
1299-
.ShouldBeFalseAsync();
1300-
13011260
await store.EffectsStore
13021261
.GetEffectResults(storedId)
13031262
.SelectAsync(e => e.Any())
13041263
.ShouldBeFalseAsync();
1305-
1264+
13061265
unhandledExceptionCatcher.ShouldNotHaveExceptions();
13071266
}
13081267

Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/FunctionTests/RoutingTests.cs

Lines changed: 0 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -167,116 +167,6 @@ await registration.SendMessage(
167167
unhandledExceptionCatcher.ShouldNotHaveExceptions();
168168
}
169169

170-
#region Route using Correlation
171-
172-
public abstract Task MessageIsRoutedToParamlessInstanceUsingCorrelationId();
173-
protected async Task MessageIsRoutedToParamlessInstanceUsingCorrelationId(Task<IFunctionStore> storeTask)
174-
{
175-
var store = await storeTask;
176-
var functionId = TestFlowId.Create();
177-
var (flowType, flowInstance) = functionId;
178-
179-
var unhandledExceptionCatcher = new UnhandledExceptionCatcher();
180-
using var functionsRegistry = new FunctionsRegistry(
181-
store,
182-
new Settings(unhandledExceptionCatcher.Catch)
183-
);
184-
185-
var correlationId = $"SomeCorrelationId_{Guid.NewGuid().ToString()}";
186-
187-
var correlationIdRegisteredFlag = new SyncedFlag();
188-
var syncedFlag = new SyncedFlag();
189-
var syncedValue = new Synced<string>();
190-
191-
var registration = functionsRegistry.RegisterParamless(
192-
flowType,
193-
inner: async workflow =>
194-
{
195-
await workflow.RegisterCorrelation(correlationId);
196-
correlationIdRegisteredFlag.Raise();
197-
198-
var someMessage = await workflow.Message<SomeCorrelatedMessage>();
199-
syncedValue.Value = someMessage.Value;
200-
syncedFlag.Raise();
201-
}
202-
);
203-
204-
await registration.Schedule(flowInstance);
205-
await correlationIdRegisteredFlag.WaitForRaised();
206-
207-
await registration.RouteMessage(
208-
new SomeCorrelatedMessage(correlationId, "SomeValue!"),
209-
correlationId
210-
);
211-
212-
await syncedFlag.WaitForRaised();
213-
syncedValue.Value.ShouldBe("SomeValue!");
214-
215-
unhandledExceptionCatcher.ShouldNotHaveExceptions();
216-
}
217-
218-
public abstract Task MessageIsRoutedToMultipleInstancesUsingCorrelationId();
219-
protected async Task MessageIsRoutedToMultipleInstancesUsingCorrelationId(Task<IFunctionStore> storeTask)
220-
{
221-
var store = await storeTask;
222-
var functionId = TestFlowId.Create();
223-
var (flowType, flowInstance1) = functionId;
224-
var (_, flowInstance2) = TestFlowId.Create().WithTypeId(flowType);
225-
226-
var unhandledExceptionCatcher = new UnhandledExceptionCatcher();
227-
using var functionsRegistry = new FunctionsRegistry(
228-
store,
229-
new Settings(unhandledExceptionCatcher.Catch)
230-
);
231-
232-
var correlationId = $"SomeCorrelationId_{Guid.NewGuid().ToString()}";
233-
234-
var registration = functionsRegistry.RegisterParamless(
235-
flowType,
236-
inner: async workflow =>
237-
{
238-
await workflow.RegisterCorrelation(correlationId);
239-
await workflow.Message<SomeCorrelatedMessage>();
240-
}
241-
);
242-
var storedType = registration.StoredType;
243-
244-
await registration.Schedule(flowInstance1);
245-
await registration.Schedule(flowInstance2);
246-
247-
await BusyWait.Until(() => store
248-
.CorrelationStore
249-
.GetCorrelations(storedType, correlationId)
250-
.SelectAsync(l => l.Count == 2)
251-
);
252-
253-
await registration.RouteMessage(
254-
new SomeCorrelatedMessage(correlationId, "SomeValue!"),
255-
correlationId
256-
);
257-
258-
var controlPanel1 = await registration.ControlPanel(flowInstance1);
259-
controlPanel1.ShouldNotBeNull();
260-
await BusyWait.Until(async () =>
261-
{
262-
await controlPanel1.Refresh();
263-
return controlPanel1.Status == Status.Succeeded;
264-
});
265-
266-
267-
var controlPanel2 = await registration.ControlPanel(flowInstance2);
268-
controlPanel2.ShouldNotBeNull();
269-
await BusyWait.Until(async () =>
270-
{
271-
await controlPanel2.Refresh();
272-
return controlPanel2.Status == Status.Succeeded;
273-
});
274-
275-
unhandledExceptionCatcher.ShouldNotHaveExceptions();
276-
}
277-
278-
#endregion
279-
280170
#region Paramless is started by message
281171

282172
public abstract Task ParamlessInstanceIsStartedByMessage();
@@ -319,5 +209,4 @@ await registration.SendMessage(
319209
#endregion
320210

321211
public record SomeMessage(string RouteTo, string Value);
322-
public record SomeCorrelatedMessage(string Correlation, string Value);
323212
}

0 commit comments

Comments
 (0)