Skip to content

Commit

Permalink
Codestart support merging application profile yaml files
Browse files Browse the repository at this point in the history
  • Loading branch information
vsevel committed Aug 15, 2024
1 parent 1466fcc commit ee79fce
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ output-strategy:
".gitignore": append
"src/main/resources/META-INF/resources/index.html": content-merge
"src/main/resources/application.yml": smart-config-merge
"src/main/resources/application-*.yml": smart-config-merge
"src/main/resources/application.properties": forbidden
"src/test/resources/application.yml": smart-config-merge
"src/test/resources/application-*.yml": smart-config-merge
"src/test/resources/application.properties": forbidden
"*.java": smart-package
"*.kt": smart-package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public boolean test(String t) {
return true;
}
}
int index = filter.indexOf("*");
if (index != -1 && filter.length() > 1) {
String part1 = filter.substring(0, index);
String part2 = filter.substring(index + 1);
if (t.startsWith(part1) && t.endsWith(part2)) {
return true;
}
}
return filter.equals(t);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ void testFilterEnd() {
assertThat(strategy.test("")).isFalse();
}

@Test
void testFilterMiddle() {
final CodestartFileStrategy strategy = new CodestartFileStrategy("/foo/bar/my*.txt",
mock(CodestartFileStrategyHandler.class));
assertThat(strategy.test("/foo/bar/myfile.txt")).isTrue();
assertThat(strategy.test("/foo/bar/baz/anoter_file")).isFalse();
assertThat(strategy.test(null)).isFalse();
assertThat(strategy.test("foo/bar/myfile.txt")).isFalse();
assertThat(strategy.test("something")).isFalse();
assertThat(strategy.test("")).isFalse();
}

@Test
void testFilter() {
final CodestartFileStrategy strategy = new CodestartFileStrategy("/foo/bar/myfile.txt",
Expand Down

0 comments on commit ee79fce

Please sign in to comment.