Skip to content

Commit 23e32f3

Browse files
authored
feat: propagate sourceFile field value from template based changes to audit entries (#865)
1 parent 4928a02 commit 23e32f3

File tree

32 files changed

+251
-13
lines changed

32 files changed

+251
-13
lines changed

community/flamingock-auditstore-couchbase/src/test/java/io/flamingock/store/couchbase/PipelineTestHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public static FlamingockMetadata getPreviewPipeline(String stageName, Trio<Class
8787
changeInfo.getOrder(),
8888
changeInfo.getAuthor(),
8989
trio.getFirst().getName(),
90+
null,
9091
PreviewConstructor.getDefault(),
9192
new PreviewMethod("apply", getParameterTypes(trio.getSecond())),
9293
rollback,

community/flamingock-auditstore-dynamodb/src/test/java/io/flamingock/store/dynamodb/PipelineTestHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public static PreviewPipeline getPreviewPipeline(String stageName, Trio<Class<?>
8888
changeInfo.getOrder(),
8989
changeInfo.getAuthor(),
9090
trio.getFirst().getName(),
91+
null,
9192
PreviewConstructor.getDefault(),
9293
new PreviewMethod("apply", getParameterTypes(trio.getSecond())),
9394
rollback,

community/flamingock-auditstore-dynamodb/src/test/java/io/flamingock/store/dynamodb/internal/entities/AuditEntryEntityTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ void shouldConvertToAndFromAuditEntryWithTxType() {
5858
assertEquals(original.getTaskId(), converted.getTaskId());
5959
assertEquals(original.getAuthor(), converted.getAuthor());
6060
assertEquals(original.getState(), converted.getState());
61+
assertEquals(original.getSourceFile(), converted.getSourceFile());
6162
}
6263

6364
@Test
@@ -129,6 +130,7 @@ void shouldConvertToAndFromAuditEntryWithTargetSystemId() {
129130
assertEquals(original.getTaskId(), converted.getTaskId());
130131
assertEquals(original.getAuthor(), converted.getAuthor());
131132
assertEquals(original.getState(), converted.getState());
133+
assertEquals(original.getSourceFile(), converted.getSourceFile());
132134
}
133135

134136
@Test

community/flamingock-auditstore-sql/src/test/java/io/flamingock/store/sql/PipelineTestHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public static FlamingockMetadata getPreviewPipeline(String stageName, Trio<Class
8787
changeInfo.getOrder(),
8888
changeInfo.getAuthor(),
8989
trio.getFirst().getName(),
90+
null,
9091
PreviewConstructor.getDefault(),
9192
new PreviewMethod("apply", getParameterTypes(trio.getSecond())),
9293
rollback,

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/core/preview/AbstractPreviewTask.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ public AbstractPreviewTask(String id,
3636
String order,
3737
String author,
3838
String source,
39+
String sourceFile,
3940
boolean runAlways,
4041
Boolean transactional,
4142
boolean system,
4243
TargetSystemDescriptor targetSystem,
4344
RecoveryDescriptor recovery,
4445
boolean legacy) {
45-
super(id, order, author, source, runAlways, transactional, system, targetSystem, recovery, legacy);
46+
super(id, order, author, source, sourceFile, runAlways, transactional, system, targetSystem, recovery, legacy);
4647
}
4748

4849
@Override

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/core/preview/CodePreviewChange.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public CodePreviewChange(String id,
3636
String order,
3737
String author,
3838
String sourceClassPath,
39+
String sourceFile,
3940
PreviewConstructor previewConstructor,
4041
PreviewMethod applyPreviewMethod,
4142
PreviewMethod rollbackPreviewMethod,
@@ -45,7 +46,7 @@ public CodePreviewChange(String id,
4546
TargetSystemDescriptor targetSystem,
4647
RecoveryDescriptor recovery,
4748
boolean legacy) {
48-
super(id, order, author, sourceClassPath, runAlways, transactional, system, targetSystem, recovery, legacy);
49+
super(id, order, author, sourceClassPath, sourceFile, runAlways, transactional, system, targetSystem, recovery, legacy);
4950
this.previewConstructor = previewConstructor;
5051
this.applyPreviewMethod = applyPreviewMethod;
5152
this.rollbackPreviewMethod = rollbackPreviewMethod;

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/core/preview/TemplatePreviewChange.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public TemplatePreviewChange(String fileName,
4848
Object steps,
4949
TargetSystemDescriptor targetSystem,
5050
RecoveryDescriptor recovery) {
51-
super(id, order, author, templateName, runAlways, transactional, system, targetSystem, recovery, false);
51+
super(id, order, author, templateName, fileName, runAlways, transactional, system, targetSystem, recovery, false);
5252
this.fileName = fileName;
5353
this.profiles = profiles;
5454
this.configuration = configuration;

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/core/preview/builder/CodePreviewTaskBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ private CodePreviewChange getCodePreviewChange() {
171171
order,
172172
author,
173173
sourceClassPath,
174+
null,
174175
constructor,
175176
applyMethod,
176177
rollbackMethod,

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/core/task/AbstractTaskDescriptor.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public abstract class AbstractTaskDescriptor implements TaskDescriptor {
2929

3030
protected String source;
3131

32+
protected String sourceFile;
33+
3234
protected boolean runAlways;
3335

3436
protected Boolean transactionalFlag;
@@ -47,6 +49,7 @@ public AbstractTaskDescriptor(String id,
4749
String order,
4850
String author,
4951
String source,
52+
String sourceFile,
5053
boolean runAlways,
5154
Boolean transactionalFlag,
5255
boolean system,
@@ -57,6 +60,7 @@ public AbstractTaskDescriptor(String id,
5760
this.order = order;
5861
this.author = author;
5962
this.source = source;
63+
this.sourceFile = sourceFile;
6064
this.runAlways = runAlways;
6165
this.transactionalFlag = transactionalFlag;
6266
this.system = system;
@@ -85,6 +89,11 @@ public String getSource() {
8589
return source;
8690
}
8791

92+
@Override
93+
public String getSourceFile() {
94+
return sourceFile;
95+
}
96+
8897
@Override
8998
public boolean isRunAlways() {
9099
return runAlways;
@@ -131,6 +140,10 @@ public void setSource(String source) {
131140
this.source = source;
132141
}
133142

143+
public void setSourceFile(String sourceFile) {
144+
this.sourceFile = sourceFile;
145+
}
146+
134147
public void setRunAlways(boolean runAlways) {
135148
this.runAlways = runAlways;
136149
}
@@ -174,6 +187,7 @@ public int hashCode() {
174187
public String toString() {
175188
return new StringJoiner(", ", AbstractTaskDescriptor.class.getSimpleName() + "[", "]")
176189
.add("source=" + source)
190+
.add("sourceFile=" + sourceFile)
177191
.add("sourceClass=" + getSource())
178192
.add("sourceName='" + getSource() + "'")
179193
.add("id='" + getId() + "'")

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/core/task/TaskDescriptor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public interface TaskDescriptor extends Comparable<TaskDescriptor> {
3232

3333
String getSource();
3434

35+
String getSourceFile();
36+
3537
Optional<String> getOrder();
3638

3739
TargetSystemDescriptor getTargetSystem();

0 commit comments

Comments
 (0)