Skip to content
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

99 test coverage for new generator mpschema #100

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Fixed

- test coverage for MicroProfileSchemaWrapperGenerator <https://github.com/fugerit-org/fj-daogen/issues/99>

## [1.8.6] - 2024-11-15

### Added

- added attributes to field : *openapiEnumeration* and *openapiFormat*
- added attributes to field : *openapiEnumeration* and *openapiFormat* <https://github.com/fugerit-org/fj-daogen/issues/97>

### Changed

- field attribute : *exampleData* renamed to *openapiExample*
- field attribute : *exampleData* renamed to *openapiExample*

## [1.8.5] - 2024-11-14

### Added

- package-helper-microprofile, to add model wrapper with openapi annotation.
- package-helper-microprofile, to add model wrapper with openapi annotation. <https://github.com/fugerit-org/fj-daogen/issues/95>

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ public String getEntityWrapperName() {
return DaogenCatalogConstants.wrapperName( this.getCurrentEntity() );
}

public String getEntityMpSchemaName() {
return DaogenCatalogConstants.mpSchemaName( this.getCurrentEntity() );
}

public String getEntityFacadeDefName() {
return DaogenCatalogConstants.facadeDefName( this.getCurrentEntity() );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public static void genInitBasicTest( DaogenBasicGenerator gen, int junitLevel )
gen.getDaogenConfig().getGeneralProp( DaogenCatalogConstants.GEN_PROP_PACKAGE_MODEL )+"."+gen.getEntityModelName(),
gen.getDaogenConfig().getGeneralProp( DaogenCatalogConstants.GEN_PROP_PACKAGE_HELPER )+"."+gen.getEntityHelperName(),
gen.getDaogenConfig().getGeneralProp( DaogenCatalogConstants.GEN_PROP_PACKAGE_HELPER )+"."+gen.getEntityWrapperName() );
if ( StringUtils.isNotEmpty( gen.getDaogenConfig().getGeneralProp( DaogenCatalogConstants.GEN_PROP_PACKAGE_HELPER_MICROPROFILE ) ) ) {
gen.getImportList().add( gen.getDaogenConfig().getGeneralProp( DaogenCatalogConstants.GEN_PROP_PACKAGE_HELPER_MICROPROFILE )+"."+gen.getEntityMpSchemaName() );
}
if ( StringUtils.isNotEmpty( gen.getDaogenConfig().getGeneralProp( DaogenCatalogConstants.GEN_PROP_PACKAGE_FACADE_DEF ) ) ) {
GenUtils.addAll( gen.getImportList(),
gen.getDaogenConfig().getGeneralProp( DaogenCatalogConstants.GEN_PROP_PACKAGE_FACADE_DEF )+"."+gen.getEntityFinderName() );
Expand Down Expand Up @@ -93,7 +96,13 @@ private static void createSampleEntityPrintAllMethod( DaogenBasicGenerator gen )
private static void createSampleEntityInstanceMethod( DaogenBasicGenerator gen, String assertionClass ) {
// creates a new instance
gen.getWriter().println( DaogenBasicGenerator.TAB+"public "+gen.getEntityModelName()+" newInstance() { " );
gen.getWriter().println( DaogenBasicGenerator.TAB_2+""+gen.getEntityWrapperName()+" current = new "+gen.getEntityWrapperName()+"( new "+gen.getEntityHelperName()+DaogenBasicGenerator.COMMA_END_LIT );
gen.getWriter().println( DaogenBasicGenerator.TAB_2+gen.getEntityModelName()+" model = new "+gen.getEntityHelperName()+"();" );
if ( StringUtils.isNotEmpty( gen.getDaogenConfig().getGeneralProp( DaogenCatalogConstants.GEN_PROP_PACKAGE_HELPER_MICROPROFILE ) ) ) {
gen.getWriter().println( DaogenBasicGenerator.TAB_2+gen.getEntityMpSchemaName()+" microprofile = new "+gen.getEntityMpSchemaName()+"( model );" );
gen.getWriter().println( DaogenBasicGenerator.TAB_2+"model = microprofile;" );
gen.getWriter().println( DaogenBasicGenerator.TAB_2+"logger.info( \"unwrap : {}\", microprofile.unwrap( microprofile ) );" );
}
gen.getWriter().println( DaogenBasicGenerator.TAB_2+gen.getEntityWrapperName()+" current = new "+gen.getEntityWrapperName()+"( model );" );
boolean checkIsEmpty = BooleanUtils.isTrue( gen.getDaogenConfig().getGeneralProp( DaogenCatalogConstants.GEN_PROP_CHECK_EMPTY_INTERFACE ) );
if ( checkIsEmpty ) {
gen.getWriter().println( DaogenBasicGenerator.TAB_2+assertionClass+".assertTrue( current.isEmpty() );" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public void testDaoGenerationJdk17SpringBoot() throws IOException, ConfigExcepti
DaogenCatalogConstants.GEN_PROP_CHECK_EMPTY_INTERFACE , BooleanUtils.BOOLEAN_FALSE );
overrideProperties.setProperty(
DaogenCatalogConstants.GEN_PROP_DISABLE_SINGLETON , DaogenCatalogConstants.GEN_PROP_DISABLE_SINGLETON_ENABLED );
overrideProperties.setProperty(
DaogenCatalogConstants.GEN_PROP_PACKAGE_HELPER_MICROPROFILE , "org.fugerit.java.daogen.sample.impl.helper" );
int result = this.testDaoGenerationWorker(file, overrideProperties);
Assert.assertTrue( file.exists() );
Assert.assertEquals( Result.RESULT_CODE_OK, result );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
struct_prefix="OBJ_"
package-model="org.fugerit.java.daogen.sample.def.model"
package-helper="org.fugerit.java.daogen.sample.impl.helper"
package-helper-microprofile="org.fugerit.java.daogen.sample.impl.helper"
dao-helper-ng-mode="enabled"
dao-wrapper-ng-mode="enabled"
dao-finder-ng-mode="enabled"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public void printAll( ModelAddress current ) {
}

public ModelAddress newInstance() {
WrapperAddress current = new WrapperAddress( new HelperAddress() );
ModelAddress model = new HelperAddress();
WrapperAddress current = new WrapperAddress( model );
Assert.assertTrue( current.isEmpty() );
current.setId(new java.math.BigDecimal( "1" ));
Assert.assertFalse( current.isEmpty() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void printAll( ModelLogData current ) {
}

public ModelLogData newInstance() {
WrapperLogData current = new WrapperLogData( new HelperLogData() );
ModelLogData model = new HelperLogData();
WrapperLogData current = new WrapperLogData( model );
Assert.assertTrue( current.isEmpty() );
current.setId(new java.math.BigDecimal( "1" ));
Assert.assertFalse( current.isEmpty() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public void printAll( ModelTestTwoFieldKey current ) {
}

public ModelTestTwoFieldKey newInstance() {
WrapperTestTwoFieldKey current = new WrapperTestTwoFieldKey( new HelperTestTwoFieldKey() );
ModelTestTwoFieldKey model = new HelperTestTwoFieldKey();
WrapperTestTwoFieldKey current = new WrapperTestTwoFieldKey( model );
Assert.assertTrue( current.isEmpty() );
current.setIdOne(new java.math.BigDecimal( "1" ));
Assert.assertFalse( current.isEmpty() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public void printAll( ModelUpload current ) {
}

public ModelUpload newInstance() {
WrapperUpload current = new WrapperUpload( new HelperUpload() );
ModelUpload model = new HelperUpload();
WrapperUpload current = new WrapperUpload( model );
Assert.assertTrue( current.isEmpty() );
current.setId(new java.math.BigDecimal( "1" ));
Assert.assertFalse( current.isEmpty() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public void printAll( ModelUserData current ) {
}

public ModelUserData newInstance() {
WrapperUserData current = new WrapperUserData( new HelperUserData() );
ModelUserData model = new HelperUserData();
WrapperUserData current = new WrapperUserData( model );
Assert.assertTrue( current.isEmpty() );
current.setId(new java.math.BigDecimal( "1" ));
Assert.assertFalse( current.isEmpty() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public void printAll( ModelUser current ) {
}

public ModelUser newInstance() {
WrapperUser current = new WrapperUser( new HelperUser() );
ModelUser model = new HelperUser();
WrapperUser current = new WrapperUser( model );
Assert.assertTrue( current.isEmpty() );
current.setId(new java.math.BigDecimal( "1" ));
Assert.assertFalse( current.isEmpty() );
Expand Down
Loading