diff --git a/src/net/KEFCore/Storage/Internal/KafkaCluster.cs b/src/net/KEFCore/Storage/Internal/KafkaCluster.cs index 6948f173..97486426 100644 --- a/src/net/KEFCore/Storage/Internal/KafkaCluster.cs +++ b/src/net/KEFCore/Storage/Internal/KafkaCluster.cs @@ -109,7 +109,17 @@ public virtual bool EnsureDeleted( foreach (var entityType in designModel.GetEntityTypes()) { var topic = entityType.TopicName(Options); - + if (!Options.UseCompactedReplicator) + { + try + { + StreamsResetter.ResetApplicationForced(Options.BootstrapServers, entityType.ApplicationIdForTable(Options), topic); + } + catch (ExecutionException ex) + { + throw ex.InnerException; + } + } coll.Add(topic); } diff --git a/test/KEFCore.Test.InMemory/KEFCore.Test.InMemory.csproj b/test/KEFCore.Test.InMemory/KEFCore.Test.InMemory.csproj new file mode 100644 index 00000000..eada7b8a --- /dev/null +++ b/test/KEFCore.Test.InMemory/KEFCore.Test.InMemory.csproj @@ -0,0 +1,20 @@ + + + + Exe + MASES.EntityFrameworkCore.KNet.Test.InMemory + MASES.EntityFrameworkCore.KNet.Test.InMemory + EntityFrameworkCore InMemory Test + EntityFrameworkCore InMemory Test + MASES.EntityFrameworkCore.KNet.Test.InMemory + ..\..\bin\ + + + + + + + + + + diff --git a/test/KEFCore.Test.InMemory/ProgramConfig.cs b/test/KEFCore.Test.InMemory/ProgramConfig.cs new file mode 100644 index 00000000..429dcef3 --- /dev/null +++ b/test/KEFCore.Test.InMemory/ProgramConfig.cs @@ -0,0 +1,35 @@ +/* + * MIT License + * + * Copyright (c) 2022 MASES s.r.l. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +namespace MASES.EntityFrameworkCore.KNet.Test +{ + partial class Program + { + public static bool UseInMemoryProvider = true; + public static bool UseModelBuilder = false; + public static bool UseCompactedReplicator = false; + public static string DatabaseName = null; + static bool deleteApplication = false; + } +} diff --git a/test/KEFCore.Test.Replicator/KEFCore.Test.Replicator.csproj b/test/KEFCore.Test.Replicator/KEFCore.Test.Replicator.csproj new file mode 100644 index 00000000..ea21d142 --- /dev/null +++ b/test/KEFCore.Test.Replicator/KEFCore.Test.Replicator.csproj @@ -0,0 +1,20 @@ + + + + Exe + MASES.EntityFrameworkCore.KNet.Test.Replicator + MASES.EntityFrameworkCore.KNet.Test.Replicator + EntityFrameworkCore Replicator Test + EntityFrameworkCore Replicator Test + MASES.EntityFrameworkCore.KNet.Test.Replicator + ..\..\bin\ + + + + + + + + + + diff --git a/test/KEFCore.Test.Replicator/ProgramConfig.cs b/test/KEFCore.Test.Replicator/ProgramConfig.cs new file mode 100644 index 00000000..8b687633 --- /dev/null +++ b/test/KEFCore.Test.Replicator/ProgramConfig.cs @@ -0,0 +1,35 @@ +/* + * MIT License + * + * Copyright (c) 2022 MASES s.r.l. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +namespace MASES.EntityFrameworkCore.KNet.Test +{ + partial class Program + { + public static bool UseInMemoryProvider = false; + public static bool UseModelBuilder = false; + public static bool UseCompactedReplicator = true; + public static string DatabaseName = null; + static bool deleteApplication = false; + } +} diff --git a/test/KEFCore.Test.sln b/test/KEFCore.Test.sln index 3fda56b8..43a08ec0 100644 --- a/test/KEFCore.Test.sln +++ b/test/KEFCore.Test.sln @@ -7,6 +7,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KEFCore.Test", "KEFCore.Tes EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KEFCore", "..\src\net\KEFCore\KEFCore.csproj", "{BB85D638-A032-41F5-9118-3264F6F6D14C}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KEFCore.Test.InMemory", "KEFCore.Test.InMemory\KEFCore.Test.InMemory.csproj", "{B32C7AB4-6B7D-4CDF-B18E-467B9757D231}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{B35B16BB-890F-4385-AB20-7AA4DD6E9C01}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{4A0AD520-9BC4-4F92-893B-6F92BBC35BFA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KEFCore.Test.Replicator", "KEFCore.Test.Replicator\KEFCore.Test.Replicator.csproj", "{6FE8F586-4EA6-496E-AC8D-53F5C25E5388}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,10 +29,24 @@ Global {BB85D638-A032-41F5-9118-3264F6F6D14C}.Debug|Any CPU.Build.0 = Debug|Any CPU {BB85D638-A032-41F5-9118-3264F6F6D14C}.Release|Any CPU.ActiveCfg = Release|Any CPU {BB85D638-A032-41F5-9118-3264F6F6D14C}.Release|Any CPU.Build.0 = Release|Any CPU + {B32C7AB4-6B7D-4CDF-B18E-467B9757D231}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B32C7AB4-6B7D-4CDF-B18E-467B9757D231}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B32C7AB4-6B7D-4CDF-B18E-467B9757D231}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B32C7AB4-6B7D-4CDF-B18E-467B9757D231}.Release|Any CPU.Build.0 = Release|Any CPU + {6FE8F586-4EA6-496E-AC8D-53F5C25E5388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6FE8F586-4EA6-496E-AC8D-53F5C25E5388}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6FE8F586-4EA6-496E-AC8D-53F5C25E5388}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6FE8F586-4EA6-496E-AC8D-53F5C25E5388}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {6999B7F3-6887-41CE-B1E9-2CE6BB881FDA} = {4A0AD520-9BC4-4F92-893B-6F92BBC35BFA} + {BB85D638-A032-41F5-9118-3264F6F6D14C} = {B35B16BB-890F-4385-AB20-7AA4DD6E9C01} + {B32C7AB4-6B7D-4CDF-B18E-467B9757D231} = {4A0AD520-9BC4-4F92-893B-6F92BBC35BFA} + {6FE8F586-4EA6-496E-AC8D-53F5C25E5388} = {4A0AD520-9BC4-4F92-893B-6F92BBC35BFA} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {36C294ED-9ECE-42AA-8273-31E008749AF3} EndGlobalSection