1- package org .utplsql ;
1+ package org .utplsql . maven . plugin ;
22
33import static java .lang .String .format ;
44
2323import org .utplsql .api .exception .SomeTestsFailedException ;
2424import org .utplsql .api .reporter .Reporter ;
2525import org .utplsql .api .reporter .ReporterFactory ;
26- import org .utplsql .helper .PluginDefault ;
27- import org .utplsql .helper .SQLScannerHelper ;
28- import org .utplsql .model .ReporterParameter ;
29- import org .utplsql .reporter .ReporterWriter ;
26+ import org .utplsql .maven . plugin . helper .PluginDefault ;
27+ import org .utplsql .maven . plugin . helper .SQLScannerHelper ;
28+ import org .utplsql .maven . plugin . model .ReporterParameter ;
29+ import org .utplsql .maven . plugin . reporter .ReporterWriter ;
3030
3131/**
3232 * This class expose the {@link TestRunner} interface to Maven.
3737@ Mojo (name = "test" , defaultPhase = LifecyclePhase .TEST )
3838public class UtPLSQLMojo extends AbstractMojo
3939{
40- @ Parameter (defaultValue = "${ dbUrl} " )
41- private String url ;
40+ @ Parameter (property = "dbUrl" )
41+ protected String url ;
4242
43- @ Parameter (defaultValue = "${ dbUser} " )
44- private String user ;
43+ @ Parameter (property = "dbUser" )
44+ protected String user ;
4545
46- @ Parameter (defaultValue = "${ dbPass} " )
47- private String password ;
46+ @ Parameter (property = "dbPass" )
47+ protected String password ;
4848
4949 @ Parameter
50- private String includeObject ;
50+ protected String includeObject ;
5151
5252 @ Parameter
53- private String excludeObject ;
53+ protected String excludeObject ;
5454
5555 @ Parameter (defaultValue = "false" )
56- private boolean skipCompatibilityCheck ;
56+ protected boolean skipCompatibilityCheck ;
5757
5858 @ Parameter
59- private List <ReporterParameter > reporters ;
59+ protected List <ReporterParameter > reporters ;
6060
6161 @ Parameter (defaultValue = "" )
62- private List <String > paths ;
62+ protected List <String > paths ;
6363
6464 @ Parameter
65- private List <Resource > sources = new ArrayList <>();
65+ protected List <Resource > sources = new ArrayList <>();
6666
6767 @ Parameter
68- private List <Resource > tests = new ArrayList <>();
68+ protected List <Resource > tests = new ArrayList <>();
6969
7070 @ Parameter (defaultValue = "${project.build.directory}" , readonly = true )
71- private String targetDir ;
71+ protected String targetDir ;
7272
7373 @ Parameter (defaultValue = "${maven.test.failure.ignore}" )
74- private boolean ignoreFailure ;
74+ protected boolean ignoreFailure ;
75+
7576
7677 // Color in the console, loaded by environment variables
7778 private boolean colorConsole = PluginDefault .resolveColor ();
@@ -87,6 +88,8 @@ public class UtPLSQLMojo extends AbstractMojo
8788 @ Override
8889 public void execute () throws MojoExecutionException
8990 {
91+ loadDefaultCredentials ();
92+
9093 Connection connection = null ;
9194 try
9295 {
@@ -137,14 +140,32 @@ public void execute() throws MojoExecutionException
137140 try
138141 {
139142 // Write Reporters
140- reporterWriter .writeReporters (connection );
143+ if (connection != null )
144+ reporterWriter .writeReporters (connection );
141145 }
142146 catch (Exception e )
143147 {
144148 getLog ().error (e .getMessage (), e );
145149 }
146150 }
147151 }
152+
153+ /**
154+ * Load
155+ *
156+ */
157+ private void loadDefaultCredentials ()
158+ {
159+ if (StringUtils .isEmpty (user ))
160+ {
161+ user = System .getProperty ("dbUser" );
162+ }
163+
164+ if (StringUtils .isEmpty (password ))
165+ {
166+ password = System .getProperty ("dbPass" );
167+ }
168+ }
148169
149170 /**
150171 *
0 commit comments