Skip to content

Commit 0e9d487

Browse files
committed
refactor: inMemory support(3)
1 parent ac2c802 commit 0e9d487

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

core/flamingock-test-support/src/test/java/io/flamingock/support/integration/FlamingockTestSupportIntegrationTest.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
import io.flamingock.common.test.pipeline.CodeChangeTestDefinition;
1919
import io.flamingock.common.test.pipeline.PipelineTestHelper;
20-
import io.flamingock.core.kit.inmemory.InternalInMemoryTestKit;
2120
import io.flamingock.internal.common.core.util.Deserializer;
2221
import io.flamingock.internal.core.runner.PipelineExecutionException;
2322
import io.flamingock.support.FlamingockTestSupport;
23+
import io.flamingock.support.inmemory.InMemoryFlamingockBuilder;
2424
import io.flamingock.support.integration.changes.*;
2525
import io.flamingock.support.integration.helpers.Counter;
2626
import io.flamingock.targetsystem.nontransactional.NonTransactionalTargetSystem;
@@ -39,7 +39,6 @@ class FlamingockTestSupportIntegrationTest {
3939
@Test
4040
@DisplayName("Should execute non-transactional change")
4141
void shouldExecuteNonTransactionalChange() {
42-
InternalInMemoryTestKit testKit = InternalInMemoryTestKit.create();
4342

4443
try (MockedStatic<Deserializer> mocked = Mockito.mockStatic(Deserializer.class)) {
4544
mocked.when(Deserializer::readPreviewPipelineFromFile).thenReturn(
@@ -50,21 +49,18 @@ void shouldExecuteNonTransactionalChange() {
5049
NonTransactionalTargetSystem targetSystem = new NonTransactionalTargetSystem("kafka");
5150

5251
FlamingockTestSupport
53-
.givenBuilder(testKit.createBuilder().addTargetSystem(targetSystem))
52+
.givenBuilder(InMemoryFlamingockBuilder.create().addTargetSystem(targetSystem))
5453
.whenRun()
5554
.thenExpectAuditFinalStateSequence(
5655
APPLIED(_001__SimpleNonTransactionalChange.class)
5756
)
5857
.verify();
59-
} finally {
60-
testKit.cleanUp();
6158
}
6259
}
6360

6461
@Test
6562
@DisplayName("Should verify multiple changes execute in correct sequence with complete audit flow")
6663
void shouldVerifyMultipleChangesInSequence() {
67-
InternalInMemoryTestKit testKit = InternalInMemoryTestKit.create();
6864

6965
try (MockedStatic<Deserializer> mocked = Mockito.mockStatic(Deserializer.class)) {
7066
mocked.when(Deserializer::readPreviewPipelineFromFile).thenReturn(
@@ -75,7 +71,7 @@ void shouldVerifyMultipleChangesInSequence() {
7571
);
7672

7773
FlamingockTestSupport
78-
.givenBuilder(testKit.createBuilder()
74+
.givenBuilder(InMemoryFlamingockBuilder.create()
7975
.addTargetSystem(new NonTransactionalTargetSystem("okta"))
8076
.addTargetSystem(new NonTransactionalTargetSystem("elasticsearch"))
8177
.addTargetSystem(new NonTransactionalTargetSystem("s3")))
@@ -91,7 +87,6 @@ void shouldVerifyMultipleChangesInSequence() {
9187
@Test
9288
@DisplayName("Should verify failing transactional change triggers rollback with correct audit trail")
9389
void shouldVerifyFailingTransactionalChangeTriggersRollback() {
94-
InternalInMemoryTestKit testKit = InternalInMemoryTestKit.create();
9590

9691
try (MockedStatic<Deserializer> mocked = Mockito.mockStatic(Deserializer.class)) {
9792
mocked.when(Deserializer::readPreviewPipelineFromFile).thenReturn(
@@ -101,7 +96,7 @@ void shouldVerifyFailingTransactionalChangeTriggersRollback() {
10196
);
10297

10398
FlamingockTestSupport
104-
.givenBuilder(testKit.createBuilder()
99+
.givenBuilder(InMemoryFlamingockBuilder.create()
105100
.addTargetSystem(new NonTransactionalTargetSystem("salesforce"))
106101
.addTargetSystem(new NonTransactionalTargetSystem("okta"))
107102
.addTargetSystem(new NonTransactionalTargetSystem("elasticsearch"))
@@ -119,7 +114,6 @@ void shouldVerifyFailingTransactionalChangeTriggersRollback() {
119114
@Test
120115
@DisplayName("Should verify already-applied changes are skipped on subsequent runs")
121116
void shouldVerifyAlreadyAppliedChangesAreSkipped() {
122-
InternalInMemoryTestKit testKit = InternalInMemoryTestKit.create();
123117

124118
try (MockedStatic<Deserializer> mocked = Mockito.mockStatic(Deserializer.class)) {
125119
mocked.when(Deserializer::readPreviewPipelineFromFile).thenReturn(
@@ -129,7 +123,7 @@ void shouldVerifyAlreadyAppliedChangesAreSkipped() {
129123
);
130124

131125
FlamingockTestSupport
132-
.givenBuilder(testKit.createBuilder()
126+
.givenBuilder(InMemoryFlamingockBuilder.create()
133127
.addTargetSystem(new NonTransactionalTargetSystem("stripe-api"))
134128
.addTargetSystem(new NonTransactionalTargetSystem("okta"))
135129
.addTargetSystem(new NonTransactionalTargetSystem("elasticsearch"))
@@ -148,7 +142,6 @@ void shouldVerifyAlreadyAppliedChangesAreSkipped() {
148142
@Test
149143
@DisplayName("Should verify dependency injection works correctly in rollback for non-transactional changes")
150144
void shouldVerifyDependencyInjectionInRollbackForNonTransactionalChanges() {
151-
InternalInMemoryTestKit testKit = InternalInMemoryTestKit.create();
152145
Counter counter = new Counter();
153146

154147
NonTransactionalTargetSystem targetSystem = new NonTransactionalTargetSystem("kafka")
@@ -164,7 +157,7 @@ void shouldVerifyDependencyInjectionInRollbackForNonTransactionalChanges() {
164157
);
165158

166159
FlamingockTestSupport
167-
.givenBuilder(testKit.createBuilder().addTargetSystem(targetSystem))
160+
.givenBuilder(InMemoryFlamingockBuilder.create().addTargetSystem(targetSystem))
168161
.whenRun()
169162
.thenExpectException(PipelineExecutionException.class, ex -> {
170163
assertTrue(ex.getMessage().contains("Intentional failure"));
@@ -182,7 +175,6 @@ void shouldVerifyDependencyInjectionInRollbackForNonTransactionalChanges() {
182175
@Test
183176
@DisplayName("Should verify transactional change executes successfully with correct audit entries")
184177
void shouldVerifyTransactionalChangeExecutesSuccessfully() {
185-
InternalInMemoryTestKit testKit = InternalInMemoryTestKit.create();
186178

187179
try (MockedStatic<Deserializer> mocked = Mockito.mockStatic(Deserializer.class)) {
188180
mocked.when(Deserializer::readPreviewPipelineFromFile).thenReturn(
@@ -192,7 +184,7 @@ void shouldVerifyTransactionalChangeExecutesSuccessfully() {
192184
);
193185

194186
FlamingockTestSupport
195-
.givenBuilder(testKit.createBuilder()
187+
.givenBuilder(InMemoryFlamingockBuilder.create()
196188
.addTargetSystem(new NonTransactionalTargetSystem("okta"))
197189
.addTargetSystem(new NonTransactionalTargetSystem("elasticsearch"))
198190
.addTargetSystem(new NonTransactionalTargetSystem("s3")))

0 commit comments

Comments
 (0)