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

[MNG-7138] Proper verify of plugin configuration Bean set method call #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void testitMNG0828()
checkLog( log, "[DEBUG] (f) aliasDefaultExpressionParam = test" );
checkLog( log, "[DEBUG] (f) basedir = " + testDir.getCanonicalPath() );
checkLog( log,
"[DEBUG] (f) beanParam = org.apache.maven.plugin.coreit.Bean[fieldParam=field, setterParam=setter, setterCalled=true]" );
"[DEBUG] (f) beanParam = org.apache.maven.plugin.coreit.Bean[fieldParam=field, setterParam=setter, setterCalled=true, setCalled=false]" );
checkLog( log, "[DEBUG] (f) booleanParam = true" );
checkLog( log, "[DEBUG] (f) byteParam = 42" );
checkLog( log, "[DEBUG] (f) byteParam = 42" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public void testitMNG3827()

assertEquals( "field", props.getProperty( "beanParam.fieldParam" ) );
assertEquals( "setter", props.getProperty( "beanParam.setterParam" ) );
assertEquals( "false", props.getProperty( "beanParam.setCalled" ) );
assertEquals( "true", props.getProperty( "beanParam.setterCalled" ) );

assertEquals( "4", props.getProperty( "domParam.children" ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public void testitMNG3864()

assertEquals( "field", props.getProperty( "beanParam.fieldParam" ) );
assertEquals( "setter", props.getProperty( "beanParam.setterParam" ) );
assertEquals( "false", props.getProperty( "beanParam.setCalled" ) );
assertEquals( "true", props.getProperty( "beanParam.setterCalled" ) );

assertEquals( "4", props.getProperty( "domParam.children" ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public void testit()

Properties props = verifier.loadProperties( "target/config.properties" );
assertEquals( "PASSED", props.getProperty( "beanParam.fieldParam" ) );
assertEquals( "true", props.getProperty( "beanParam.setterCalled" ) );
assertEquals( "true", props.getProperty( "beanParam.setCalled" ) );
assertEquals( "false", props.getProperty( "beanParam.setterCalled" ) );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@ public class Bean

String setterParam;

/**
* default method of bean was called
*/
boolean setCalled;

/**
* setter method of ben was called
*/
boolean setterCalled;

public void set( String value )
{
fieldParam = value;
setterCalled = true;
setCalled = true;
}

public void setSetterParam( String value )
Expand All @@ -49,7 +57,7 @@ public void setSetterParam( String value )
public String toString()
{
return getClass().getName() + "[fieldParam=" + fieldParam + ", setterParam=" + setterParam
+ ", setterCalled=" + setterCalled + "]";
+ ", setterCalled=" + setterCalled + ", setCalled=" + setCalled + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ public class ConfigMojo
*
* @parameter
*/

private Bean beanParam;

/**
Expand Down Expand Up @@ -335,6 +336,7 @@ private void dumpConfiguration( Properties props )
{
PropertiesUtil.serialize( props, "beanParam.fieldParam", beanParam.fieldParam );
PropertiesUtil.serialize( props, "beanParam.setterParam", beanParam.setterParam );
PropertiesUtil.serialize( props, "beanParam.setCalled", beanParam.setCalled );
PropertiesUtil.serialize( props, "beanParam.setterCalled", beanParam.setterCalled );
}
}
Expand Down