Skip to content

Commit eb8ae32

Browse files
committed
refaactor: renamed pipelineFile to configFile*EnableFlamingock)
1 parent ced409c commit eb8ae32

File tree

9 files changed

+58
-58
lines changed

9 files changed

+58
-58
lines changed

core/flamingock-core-api/src/main/java/io/flamingock/api/annotations/EnableFlamingock.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
* The annotation supports two mutually exclusive pipeline configuration modes:
3333
*
3434
* <h3>1. File-based Configuration</h3>
35-
* Use {@link #pipelineFile()} to reference a YAML pipeline definition:
35+
* Use {@link #configFile()} to reference a YAML pipeline definition:
3636
* <pre>
37-
* &#64;EnableFlamingock(pipelineFile = "config/pipeline.yaml")
37+
* &#64;EnableFlamingock(configFile = "config/pipeline.yaml")
3838
* public class MyMigrationConfig {
3939
* // Configuration class
4040
* }
@@ -99,7 +99,7 @@
9999
*
100100
* <h2>Validation Rules</h2>
101101
* <ul>
102-
* <li>Either {@link #pipelineFile()} OR {@link #stages()} must be specified (mutually exclusive)</li>
102+
* <li>Either {@link #configFile()} OR {@link #stages()} must be specified (mutually exclusive)</li>
103103
* <li>At least one configuration mode must be provided</li>
104104
* <li>Maximum of 1 stage with type {@code StageType.SYSTEM} is allowed</li>
105105
* <li>Maximum of 1 stage with type {@code StageType.LEGACY} is allowed</li>
@@ -118,7 +118,7 @@
118118
* Defines the pipeline stages.
119119
* Each stage represents a logical grouping of changes that execute in sequence.
120120
*
121-
* <p>Mutually exclusive with {@link #pipelineFile()}. When using stages,
121+
* <p>Mutually exclusive with {@link #configFile()}. When using stages,
122122
* do not specify a pipeline file.
123123
*
124124
* <p>Stage type restrictions:
@@ -158,12 +158,12 @@
158158
*
159159
* <p>Example:
160160
* <pre>
161-
* pipelineFile = "config/flamingock-pipeline.yaml"
161+
* configFile = "config/flamingock-pipeline.yaml"
162162
* </pre>
163163
*
164164
* @return the pipeline file path, or empty string for annotation-based configuration
165165
*/
166-
String pipelineFile() default "";
166+
String configFile() default "";
167167

168168
/**
169169
* Controls how Flamingock integrates with application frameworks.

core/flamingock-core-commons/src/main/java/io/flamingock/internal/common/core/metadata/FlamingockMetadata.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ public class FlamingockMetadata {
2121

2222
private PreviewPipeline pipeline;
2323
private String setup;
24-
private String pipelineFile;
24+
private String configFile;
2525

2626
public FlamingockMetadata() {
2727
}
2828

29-
public FlamingockMetadata(PreviewPipeline pipeline, String setup, String pipelineFile) {
29+
public FlamingockMetadata(PreviewPipeline pipeline, String setup, String configFile) {
3030
this.pipeline = pipeline;
3131
this.setup = setup;
32-
this.pipelineFile = pipelineFile;
32+
this.configFile = configFile;
3333
}
3434

3535
public PreviewPipeline getPipeline() {
@@ -49,18 +49,18 @@ public void setSetup(String setup) {
4949
}
5050

5151
public String getPipelineFile() {
52-
return pipelineFile;
52+
return configFile;
5353
}
5454

55-
public void setPipelineFile(String pipelineFile) {
56-
this.pipelineFile = pipelineFile;
55+
public void setPipelineFile(String configFile) {
56+
this.configFile = configFile;
5757
}
5858

5959
@Override
6060
public String toString() {
6161
return "FlamingockMetadata{" + "pipeline=" + pipeline +
6262
", setup='" + setup + '\'' +
63-
", pipelineFile='" + pipelineFile + '\'' +
63+
", configFile='" + configFile + '\'' +
6464
'}';
6565
}
6666
}

core/flamingock-processor/src/main/java/io/flamingock/core/processor/FlamingockAnnotationProcessor.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,42 +58,42 @@
5858
* <h2>@Flamingock Annotation Configuration</h2>
5959
* The processor supports two mutually exclusive configuration modes:
6060
* <ul>
61-
* <li><b>File-based configuration:</b> Uses {@code pipelineFile} to reference a YAML pipeline definition</li>
61+
* <li><b>File-based configuration:</b> Uses {@code configFile} to reference a YAML pipeline definition</li>
6262
* <li><b>Annotation-based configuration:</b> Uses {@code stages} array to define the pipeline inline</li>
6363
* </ul>
6464
*
6565
* <h3>Pipeline File Resolution</h3>
66-
* When using {@code pipelineFile}, the processor provides resource resolution
66+
* When using {@code configFile}, the processor provides resource resolution
6767
* supporting multiple file locations:
6868
*
6969
* <h4>Examples:</h4>
7070
* <pre>{@code
7171
* // Absolute file path - highest priority
72-
* &#64;EnableFlamingock(pipelineFile = "/path/to/external/pipeline.yaml")
72+
* &#64;EnableFlamingock(configFile = "/path/to/external/pipeline.yaml")
7373
* // Uses direct file system path
7474
*
7575
* // Relative file path - second priority (relative to working directory)
76-
* &#64;EnableFlamingock(pipelineFile = "config/flamingock-pipeline.yaml")
76+
* &#64;EnableFlamingock(configFile = "config/flamingock-pipeline.yaml")
7777
* // Resolves relative to current working directory, NOT as classpath resource
7878
*
7979
* // Classpath resource - fallback if file doesn't exist relative to working directory
80-
* &#64;EnableFlamingock(pipelineFile = "flamingock/pipeline.yaml")
80+
* &#64;EnableFlamingock(configFile = "flamingock/pipeline.yaml")
8181
* // If "flamingock/pipeline.yaml" doesn't exist in working directory,
8282
* // then tries: src/main/resources/flamingock/pipeline.yaml
8383
* // then tries: src/test/resources/flamingock/pipeline.yaml
8484
*
8585
* // Resource with explicit "resources/" prefix (automatically stripped)
86-
* &#64;EnableFlamingock(pipelineFile = "resources/flamingock/pipeline.yaml")
86+
* &#64;EnableFlamingock(configFile = "resources/flamingock/pipeline.yaml")
8787
* // First tries: "resources/flamingock/pipeline.yaml" relative to working directory
8888
* // If not found, strips "resources/" prefix and tries classpath resolution:
8989
* // src/main/resources/flamingock/pipeline.yaml or src/test/resources/flamingock/pipeline.yaml
9090
* }</pre>
9191
*
9292
* <h4>Resolution Order (stops at first match):</h4>
9393
* <ol>
94-
* <li><b>Direct file path:</b> {@code [pipelineFile]} (absolute or relative to working directory)</li>
95-
* <li><b>Main resources:</b> {@code src/main/resources/[pipelineFile]}</li>
96-
* <li><b>Test resources:</b> {@code src/test/resources/[pipelineFile]}</li>
94+
* <li><b>Direct file path:</b> {@code [configFile]} (absolute or relative to working directory)</li>
95+
* <li><b>Main resources:</b> {@code src/main/resources/[configFile]}</li>
96+
* <li><b>Test resources:</b> {@code src/test/resources/[configFile]}</li>
9797
* <li><b>Main resources (stripped):</b> If path starts with "resources/", strips prefix and tries {@code src/main/resources/[remaining-path]}</li>
9898
* <li><b>Test resources (stripped):</b> If path starts with "resources/", strips prefix and tries {@code src/test/resources/[remaining-path]}</li>
9999
* </ol>
@@ -120,7 +120,7 @@
120120
* <h2>Validation Rules</h2>
121121
* <ul>
122122
* <li>@EnableFlamingock annotation is mandatory</li>
123-
* <li>Must specify either {@code pipelineFile} OR {@code stages} (mutually exclusive)</li>
123+
* <li>Must specify either {@code configFile} OR {@code stages} (mutually exclusive)</li>
124124
* <li>Maximum of 1 stage with type {@code StageType.SYSTEM} is allowed</li>
125125
* <li>Maximum of 1 stage with type {@code StageType.LEGACY} is allowed</li>
126126
* <li>Unlimited stages with type {@code StageType.DEFAULT} are allowed</li>
@@ -204,8 +204,8 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
204204
);
205205
Serializer serializer = new Serializer(processingEnv, logger);
206206
String setup = flamingockAnnotation.setup().toString();
207-
String pipelineFile = flamingockAnnotation.pipelineFile();
208-
FlamingockMetadata flamingockMetadata = new FlamingockMetadata(pipeline, setup, pipelineFile);
207+
String configFile = flamingockAnnotation.configFile();
208+
FlamingockMetadata flamingockMetadata = new FlamingockMetadata(pipeline, setup, configFile);
209209
serializer.serializeFullPipeline(flamingockMetadata);
210210
logger.info("Finished processing annotated classes and generating metadata.");
211211
return true;
@@ -220,16 +220,16 @@ private PreviewPipeline getPipelineFromProcessChanges(Map<String, List<AbstractP
220220
throw new RuntimeException("@EnableFlamingock annotation is mandatory. Please annotate a class with @EnableFlamingock to configure the pipeline.");
221221
}
222222

223-
boolean hasFileInAnnotation = !pipelineAnnotation.pipelineFile().isEmpty();
223+
boolean hasFileInAnnotation = !pipelineAnnotation.configFile().isEmpty();
224224
boolean hasStagesInAnnotation = pipelineAnnotation.stages().length > 0;
225225

226226
// Validate mutually exclusive modes
227227
if (hasFileInAnnotation && hasStagesInAnnotation) {
228-
throw new RuntimeException("@EnableFlamingock annotation cannot have both pipelineFile and stages configured. Choose one: either specify pipelineFile OR stages.");
228+
throw new RuntimeException("@EnableFlamingock annotation cannot have both configFile and stages configured. Choose one: either specify configFile OR stages.");
229229
}
230230

231231
if (!hasFileInAnnotation && !hasStagesInAnnotation) {
232-
throw new RuntimeException("@EnableFlamingock annotation must specify either pipelineFile OR stages configuration.");
232+
throw new RuntimeException("@EnableFlamingock annotation must specify either configFile OR stages configuration.");
233233
}
234234

235235
// Validate stage type restrictions when using annotation-based configuration
@@ -238,8 +238,8 @@ private PreviewPipeline getPipelineFromProcessChanges(Map<String, List<AbstractP
238238
}
239239

240240
if (hasFileInAnnotation) {
241-
logger.info("Reading flamingock pipeline from file specified in @EnableFlamingock annotation: '" + pipelineAnnotation.pipelineFile() + "'");
242-
File specifiedPipelineFile = resolvePipelineFile(pipelineAnnotation.pipelineFile());
241+
logger.info("Reading flamingock pipeline from file specified in @EnableFlamingock annotation: '" + pipelineAnnotation.configFile() + "'");
242+
File specifiedPipelineFile = resolvePipelineFile(pipelineAnnotation.configFile());
243243
return buildPipelineFromSpecifiedFile(specifiedPipelineFile, codedChangesByPackage);
244244
} else {
245245
logger.info("Reading flamingock pipeline from @EnableFlamingock annotation stages configuration");
@@ -428,29 +428,29 @@ private PreviewStage mapAnnotationToStage(Map<String, List<AbstractPreviewTask>>
428428
* Resolves a pipeline file path from the @EnableFlamingock annotation, supporting both absolute file paths
429429
* and classpath resources. This method provides resource resolution for the Flamingock library.
430430
*
431-
* @param pipelineFilePath the file path specified in the @EnableFlamingock annotation
431+
* @param configFilePath the file path specified in the @EnableFlamingock annotation
432432
* @return a File object representing the resolved pipeline file
433433
* @throws RuntimeException if the file cannot be found in any of the supported locations
434434
*/
435-
private File resolvePipelineFile(String pipelineFilePath) {
435+
private File resolvePipelineFile(String configFilePath) {
436436
List<File> searchedFiles = new ArrayList<>();
437437

438438
// Try direct file path first (absolute or relative to current working directory)
439-
File result = tryResolveFile(new File(pipelineFilePath), "direct file path", searchedFiles);
439+
File result = tryResolveFile(new File(configFilePath), "direct file path", searchedFiles);
440440
if (result != null) return result;
441441

442442
// Try as classpath resource in main resources
443-
result = tryResolveFile(new File(resourcesRoot + "/" + pipelineFilePath), "main resources", searchedFiles);
443+
result = tryResolveFile(new File(resourcesRoot + "/" + configFilePath), "main resources", searchedFiles);
444444
if (result != null) return result;
445445

446446
// Try as classpath resource in test resources (for annotation processing during tests)
447447
String testResourcesRoot = resourcesRoot.replace("src/main/resources", "src/test/resources");
448-
result = tryResolveFile(new File(testResourcesRoot + "/" + pipelineFilePath), "test resources", searchedFiles);
448+
result = tryResolveFile(new File(testResourcesRoot + "/" + configFilePath), "test resources", searchedFiles);
449449
if (result != null) return result;
450450

451451
// Try with "resources/" prefix stripped (handle cases like "resources/flamingock/pipeline.yaml")
452-
if (pipelineFilePath.startsWith("resources/")) {
453-
String pathWithoutResourcesPrefix = pipelineFilePath.substring("resources/".length());
452+
if (configFilePath.startsWith("resources/")) {
453+
String pathWithoutResourcesPrefix = configFilePath.substring("resources/".length());
454454

455455
// Try in main resources without "resources/" prefix
456456
result = tryResolveFile(new File(resourcesRoot + "/" + pathWithoutResourcesPrefix), "main resources (stripped resources/ prefix)", searchedFiles);
@@ -468,7 +468,7 @@ private File resolvePipelineFile(String pipelineFilePath) {
468468
}
469469

470470
throw new RuntimeException(
471-
"Pipeline file specified in @EnableFlamingock annotation does not exist: " + pipelineFilePath + "\n" +
471+
"Pipeline file specified in @EnableFlamingock annotation does not exist: " + configFilePath + "\n" +
472472
searchedLocations
473473
);
474474
}

core/flamingock-processor/src/test/java/io/flamingock/core/processor/PipelinePreProcessorTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ void shouldThrowErrorForInvalidAnnotationConfiguration() throws Exception {
149149
// Check if it's wrapped in InvocationTargetException
150150
Throwable cause = exception.getCause();
151151
if (cause instanceof RuntimeException) {
152-
assertTrue(cause.getMessage().contains("must specify either pipelineFile OR stages"),
152+
assertTrue(cause.getMessage().contains("must specify either configFile OR stages"),
153153
"Should have error about missing configuration");
154154
} else {
155-
assertTrue(exception.getMessage().contains("must specify either pipelineFile OR stages"),
155+
assertTrue(exception.getMessage().contains("must specify either configFile OR stages"),
156156
"Should have error about missing configuration");
157157
}
158158
}
@@ -320,14 +320,14 @@ void shouldOrderStagesByTypePriorityLegacyBeforeDefault() throws Exception {
320320
@DisplayName("Should order YAML stages by type priority: LEGACY before DEFAULT")
321321
void shouldOrderYamlStagesByTypePriorityLegacyBeforeDefault() throws Exception {
322322
// Given - create YAML file with stages in reverse order (DEFAULT first, LEGACY second)
323-
Path pipelineFile = tempDir.resolve("pipeline.yaml");
323+
Path configFile = tempDir.resolve("pipeline.yaml");
324324
String yamlContent = "pipeline:\n" +
325325
" stages:\n" +
326326
" - location: com.example.migrations\n" +
327327
" - location: com.example.init\n" +
328328
" type: legacy\n" +
329329
" - location: com.example.cleanup\n";
330-
Files.write(pipelineFile, yamlContent.getBytes());
330+
Files.write(configFile, yamlContent.getBytes());
331331

332332
EnableFlamingock annotation = createMockAnnotationWithFile("pipeline.yaml");
333333
Map<String, List<AbstractPreviewTask>> changes = createMockChangesMap();
@@ -364,15 +364,15 @@ void shouldOrderYamlStagesByTypePriorityLegacyBeforeDefault() throws Exception {
364364
@DisplayName("Should throw error for multiple SYSTEM stages in YAML configuration")
365365
void shouldThrowErrorForMultipleSystemStagesInYaml() throws Exception {
366366
// Given - create YAML file with multiple system stages
367-
Path pipelineFile = tempDir.resolve("pipeline.yaml");
367+
Path configFile = tempDir.resolve("pipeline.yaml");
368368
String yamlContent = "pipeline:\n" +
369369
" stages:\n" +
370370
" - location: com.example.system1\n" +
371371
" type: importer\n" +
372372
" - location: com.example.system2\n" +
373373
" type: importer\n" +
374374
" - location: com.example.changes\n";
375-
Files.write(pipelineFile, yamlContent.getBytes());
375+
Files.write(configFile, yamlContent.getBytes());
376376

377377
EnableFlamingock annotation = createMockAnnotationWithFile("pipeline.yaml");
378378
Map<String, List<AbstractPreviewTask>> changes = createMockChangesMap();
@@ -436,8 +436,8 @@ private PreviewPipeline buildPipelineFromFile(FlamingockAnnotationProcessor proc
436436
"buildPipelineFromSpecifiedFile", File.class, Map.class);
437437
method.setAccessible(true);
438438

439-
File pipelineFile = tempDir.resolve("pipeline.yaml").toFile();
440-
return (PreviewPipeline) method.invoke(processor, pipelineFile, changes);
439+
File configFile = tempDir.resolve("pipeline.yaml").toFile();
440+
return (PreviewPipeline) method.invoke(processor, configFile, changes);
441441
}
442442

443443
private void setProcessorField(FlamingockAnnotationProcessor processor, String fieldName, Object value) throws Exception {
@@ -506,13 +506,13 @@ public java.util.Locale getLocale() {
506506
}
507507

508508
private void createPipelineYamlFile() throws IOException {
509-
Path pipelineFile = tempDir.resolve("pipeline.yaml");
509+
Path configFile = tempDir.resolve("pipeline.yaml");
510510
String yamlContent = "pipeline:\n" +
511511
" stages:\n" +
512512
" - location: com.example.system\n" +
513513
" type: importer\n" +
514514
" - location: com.example.changes\n";
515-
Files.write(pipelineFile, yamlContent.getBytes());
515+
Files.write(configFile, yamlContent.getBytes());
516516
}
517517

518518
private Map<String, List<AbstractPreviewTask>> createMockChangesMap() {
@@ -569,22 +569,22 @@ private Stage createMockStage(String name, StageType type, String location) {
569569

570570
private static class MockFlamingockBuilder {
571571
private Stage[] stages = new Stage[0];
572-
private String pipelineFile = "";
572+
private String configFile = "";
573573

574574
public MockFlamingockBuilder withStages(Stage... stages) {
575575
this.stages = stages;
576576
return this;
577577
}
578578

579-
public MockFlamingockBuilder withPipelineFile(String pipelineFile) {
580-
this.pipelineFile = pipelineFile;
579+
public MockFlamingockBuilder withPipelineFile(String configFile) {
580+
this.configFile = configFile;
581581
return this;
582582
}
583583

584584
public EnableFlamingock build() {
585585
return new EnableFlamingock() {
586586
@Override public Stage[] stages() { return stages; }
587-
@Override public String pipelineFile() { return pipelineFile; }
587+
@Override public String configFile() { return configFile; }
588588
@Override public io.flamingock.api.SetupType setup() { return io.flamingock.api.SetupType.DEFAULT; }
589589
@Override public Class<? extends java.lang.annotation.Annotation> annotationType() { return EnableFlamingock.class; }
590590
};

core/flamingock-processor/src/test/java/io/flamingock/core/processor/ResolvePipelineFileTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ private void createYamlFile(File file, String content) throws IOException {
270270
java.nio.file.Files.write(file.toPath(), yamlContent.getBytes());
271271
}
272272

273-
private File invokeResolvePipelineFile(String pipelineFilePath) throws Exception {
273+
private File invokeResolvePipelineFile(String configFilePath) throws Exception {
274274
Method method = FlamingockAnnotationProcessor.class.getDeclaredMethod("resolvePipelineFile", String.class);
275275
method.setAccessible(true);
276-
return (File) method.invoke(processor, pipelineFilePath);
276+
return (File) method.invoke(processor, configFilePath);
277277
}
278278

279279
private void setPrivateField(String fieldName, Object value) throws Exception {

platform-plugins/flamingock-springboot-integration/src/test/resources/META-INF/flamingock/metadata-builder.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
]
1212
},
1313
"setup": "BUILDER",
14-
"pipelineFile": ""
14+
"configFile": ""
1515
}

platform-plugins/flamingock-springboot-integration/src/test/resources/META-INF/flamingock/metadata-default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
]
1212
},
1313
"setup": "DEFAULT",
14-
"pipelineFile": ""
14+
"configFile": ""
1515
}

platform-plugins/flamingock-springboot-integration/src/test/resources/META-INF/flamingock/metadata-no-setup.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
}
1111
]
1212
},
13-
"pipelineFile": ""
13+
"configFile": ""
1414
}

templates/flamingock-mongodb-sync-template/src/test/java/io/flamingock/template/mongodb/MongoChangeTemplateTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import static io.flamingock.internal.util.constants.CommunityPersistenceConstants.DEFAULT_AUDIT_STORE_NAME;
4242
import static org.junit.jupiter.api.Assertions.assertEquals;
4343

44-
@EnableFlamingock(pipelineFile = "flamingock/pipeline.yaml")
44+
@EnableFlamingock(configFile = "flamingock/pipeline.yaml")
4545
@Testcontainers
4646
class MongoChangeTemplateTest {
4747

0 commit comments

Comments
 (0)