New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #691 - Add Mongock support #1424
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1424 +/- ##
============================================
Coverage 100.00% 100.00%
- Complexity 1597 1612 +15
============================================
Files 305 317 +12
Lines 5227 5340 +113
Branches 106 106
============================================
+ Hits 5227 5340 +113
Continue to review full report at Codecov.
|
@pascalgrimaud can you please review this PR |
@beatfreaker : yes, will do it when possible. I'm a little bit late, as I have several PRs to review before this one. Just be patient :) |
@beatfreaker : can you resolve the conflict plz? |
# Conflicts: # src/main/resources/generator/dependencies/pom.xml
|
||
@Override | ||
public void addConfigurationJava(Project project) { | ||
String packageNamePath = project.getPackageNamePath().orElse(getPath("com/mycompany/myapp")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use constant DefaultConfig for com/mycompany/myapp
@Override | ||
public void addConfigurationJava(Project project) { | ||
String packageNamePath = project.getPackageNamePath().orElse(getPath("com/mycompany/myapp")); | ||
String mongockConfigPath = "technical/infrastructure/secondary/mongock"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use TECHNICAL_INFRASTRUCTURE_SECONDARY + mongock
@Override | ||
public void addChangelogJava(Project project) { | ||
project.addDefaultConfig(PACKAGE_NAME); | ||
String packageNamePath = project.getPackageNamePath().orElse(getPath("com/mycompany/myapp")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use constants in DefaultConfig
public void addChangelogJava(Project project) { | ||
project.addDefaultConfig(PACKAGE_NAME); | ||
String packageNamePath = project.getPackageNamePath().orElse(getPath("com/mycompany/myapp")); | ||
String mongockDBMigrationPath = "technical/infrastructure/secondary/mongock/dbmigration"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use TECHNICAL_INFRASTRUCTURE_SECONDARY
public void rollback() {} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public void rollback() {} | |
} | |
public void rollback() {} | |
} |
public InitialMigrationSetup(MongoTemplate template) { | ||
this.template = template; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public InitialMigrationSetup(MongoTemplate template) { | |
this.template = template; | |
} | |
public InitialMigrationSetup(MongoTemplate template) { | |
this.template = template; | |
} |
ProjectDTO projectDTO = TestUtils.readFileToObject("json/chips.json", ProjectDTO.class); | ||
if (projectDTO == null) { | ||
throw new GeneratorException("Error when reading file"); | ||
} | ||
projectDTO.folder(FileUtils.tmpDirForTest()); | ||
Project project = ProjectDTO.toProject(projectDTO); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ProjectDTO projectDTO = TestUtils.readFileToObject("json/chips.json", ProjectDTO.class); | |
if (projectDTO == null) { | |
throw new GeneratorException("Error when reading file"); | |
} | |
projectDTO.folder(FileUtils.tmpDirForTest()); | |
Project project = ProjectDTO.toProject(projectDTO); | |
ProjectDTO projectDTO = TestUtils.readFileToObject("json/chips.json", ProjectDTO.class).folder(tmpDirForTest()); | |
Project project = ProjectDTO.toProject(projectDTO); |
Very good job here, @beatfreaker
|
Hello @pascalgrimaud currently the build is failing for
As these generated files does not have any logic so I don't know what should we write in unit tests, could you please help me with it ? |
@beatfreaker : sure, what do you prefer? Suggestion in comment or commit directly to your branch ? |
@pascalgrimaud I am okay with both, If you have limited time then just add it here, I can put it in code and test it. |
@@ -0,0 +1,21 @@ | |||
package tech.jhipster.fullapp.technical.infrastructure.secondary.mongock.dbmigration; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad package here, you should use packageName
@@ -0,0 +1,8 @@ | |||
package tech.jhipster.fullapp.technical.infrastructure.secondary.mongock; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad package here
@beatfreaker : here the simple unit test you can use: @UnitTest
@ExtendWith(MockitoExtension.class)
class InitialMigrationSetupTest {
@InjectMocks
InitialMigrationSetup initialMigrationSetup;
@Test
void shouldChangeSet() {
assertThatCode(() -> initialMigrationSetup.changeSet()).doesNotThrowAnyException();
}
@Test
void shouldRollback() {
assertThatCode(() -> initialMigrationSetup.rollback()).doesNotThrowAnyException();
}
} |
This helps, thank you |
@pascalgrimaud |
Fine to remove it, in this initial migration file. |
|
||
## Maintainers | ||
|
||
- [Pascal Grimaud](https://github.com/pascalgrimaud) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you want to take the lead on this part @beatfreaker ? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can, updating it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes plz put your name :-)
Thanks for your work here @beatfreaker ❤️ |
@pascalgrimaud Bounty claimed at https://opencollective.com/generator-jhipster/expenses/74748 |
@beatfreaker : approved. If possible, can you contribute to the front part too? Otherwise, the feature won't be available |
@pascalgrimaud yeah sure I can make respective changes on frontend too, will create new ticket to handle it. |
Fix #691 - Add Mongock support