Skip to content

Commit 6568089

Browse files
committed
additional cleanup, fix typos
1 parent 722d3d3 commit 6568089

File tree

6 files changed

+24
-47
lines changed

6 files changed

+24
-47
lines changed

src/main/java/org/utplsql/cli/CliVersionInfo.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@
1414
*/
1515
public class CliVersionInfo {
1616

17-
private static final String MAVEN_PROJECT_NAME = "utPLSL-cli";
17+
private static final String MAVEN_PROJECT_NAME = "utPLSQL-cli";
1818
private static String MAVEN_PROJECT_VERSION = "unknown";
1919

2020
static {
2121
try {
22-
try ( InputStream in = JavaApiVersionInfo.class.getClassLoader().getResourceAsStream("utplsql-cli.version")) {
23-
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
22+
try ( InputStream in = JavaApiVersionInfo.class.getClassLoader().getResourceAsStream("utplsql-cli.version");
23+
BufferedReader reader = new BufferedReader(new InputStreamReader(in)) ) {
2424
MAVEN_PROJECT_VERSION = reader.readLine();
25-
26-
reader.close();
2725
}
2826
}
2927
catch ( IOException e ) {

src/main/java/org/utplsql/cli/CommandProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.util.Map;
77
import java.util.stream.Stream;
88

9-
public class CommandProvider {
9+
class CommandProvider {
1010

1111
private final Map<String, ICommand> commands = new HashMap<>();
1212
private final JCommander jCommander;

src/main/java/org/utplsql/cli/ReporterFactoryProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* @author pesse
1414
*/
15-
public class ReporterFactoryProvider {
15+
class ReporterFactoryProvider {
1616

1717
public static ReporterFactory createReporterFactory(CompatibilityProxy proxy ) {
1818
ReporterFactory reporterFactory = ReporterFactory.createDefault(proxy);

src/main/java/org/utplsql/cli/RunCommand.java

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,10 @@ public class RunCommand implements ICommand {
116116
private ReporterFactory reporterFactory;
117117
private ReporterManager reporterManager;
118118

119-
public ConnectionInfo getConnectionInfo() {
119+
private ConnectionInfo getConnectionInfo() {
120120
return connectionInfoList.get(0);
121121
}
122122

123-
public List<String> getTestPaths() {
124-
return testPaths;
125-
}
126-
127123
void init() {
128124

129125
LoggerConfiguration.ConfigLevel level = LoggerConfiguration.ConfigLevel.BASIC;
@@ -144,7 +140,6 @@ public int run() {
144140
try {
145141

146142
final List<Reporter> reporterList;
147-
final List<String> testPaths = getTestPaths();
148143

149144
final File baseDir = new File("").getAbsoluteFile();
150145
final FileMapperOptions[] sourceMappingOptions = {null};
@@ -155,23 +150,8 @@ public int run() {
155150
sourceMappingOptions[0] = getFileMapperOptionsByParamListItem(this.sourcePathParams, baseDir);
156151
testMappingOptions[0] = getFileMapperOptionsByParamListItem(this.testPathParams, baseDir);
157152

158-
ArrayList<String> includeObjectsList;
159-
ArrayList<String> excludeObjectsList;
160-
161-
if (includeObjects != null && !includeObjects.isEmpty()) {
162-
includeObjectsList = new ArrayList<>(Arrays.asList(includeObjects.split(",")));
163-
} else {
164-
includeObjectsList = new ArrayList<>();
165-
}
166-
167-
if (excludeObjects != null && !excludeObjects.isEmpty()) {
168-
excludeObjectsList = new ArrayList<>(Arrays.asList(excludeObjects.split(",")));
169-
} else {
170-
excludeObjectsList = new ArrayList<>();
171-
}
172-
173-
final ArrayList<String> finalIncludeObjectsList = includeObjectsList;
174-
final ArrayList<String> finalExcludeObjectsList = excludeObjectsList;
153+
final List<String> finalIncludeObjectsList = getObjectList(includeObjects);
154+
final List<String> finalExcludeObjectsList = getObjectList(excludeObjects);
175155

176156
final DataSource dataSource = DataSourceProvider.getDataSource(getConnectionInfo(), getReporterManager().getNumberOfReporters() + 1);
177157

@@ -231,6 +211,16 @@ public int run() {
231211
return 1;
232212
}
233213

214+
private ArrayList<String> getObjectList(String includeObjects) {
215+
ArrayList<String> includeObjectsList;
216+
if (includeObjects != null && !includeObjects.isEmpty()) {
217+
includeObjectsList = new ArrayList<>(Arrays.asList(includeObjects.split(",")));
218+
} else {
219+
includeObjectsList = new ArrayList<>();
220+
}
221+
return includeObjectsList;
222+
}
223+
234224
@Override
235225
public String getCommand() {
236226
return "run";
@@ -239,7 +229,7 @@ public String getCommand() {
239229

240230
private void outputMainInformation() {
241231

242-
StringBlockFormatter formatter = new StringBlockFormatter("utPLCSL cli");
232+
StringBlockFormatter formatter = new StringBlockFormatter("utPLSQL cli");
243233
formatter.appendLine(CliVersionInfo.getInfo());
244234
formatter.appendLine(JavaApiVersionInfo.getInfo());
245235
formatter.appendLine("Java-Version: " + System.getProperty("java.version"));
@@ -317,7 +307,7 @@ private CompatibilityProxy checkFrameworkCompatibility(Connection conn) throws S
317307
return proxy;
318308
}
319309

320-
public FileMapperOptions getMapperOptions(List<String> mappingParams, List<String> filePaths) {
310+
private FileMapperOptions getMapperOptions(List<String> mappingParams, List<String> filePaths) {
321311
FileMapperOptions mapperOptions = new FileMapperOptions(filePaths);
322312

323313
final String OPT_OWNER="-owner=";
@@ -364,25 +354,14 @@ public FileMapperOptions getMapperOptions(List<String> mappingParams, List<Strin
364354
return mapperOptions;
365355
}
366356

367-
/** Returns the version of the database framework if available
368-
*
369-
* @return
370-
*/
371-
public Version getDatabaseVersion() {
372-
if ( compatibilityProxy != null )
373-
return compatibilityProxy.getDatabaseVersion();
374-
375-
return null;
376-
}
377-
378357
private ReporterManager getReporterManager() {
379358
if ( reporterManager == null )
380359
reporterManager = new ReporterManager(reporterParams);
381360

382361
return reporterManager;
383362
}
384363

385-
public List<ReporterOptions> getReporterOptionsList() {
364+
List<ReporterOptions> getReporterOptionsList() {
386365
return getReporterManager().getReporterOptionsList();
387366
}
388367
}

src/main/java/org/utplsql/cli/VersionInfoCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class VersionInfoCommand implements ICommand {
2323
description = ConnectionInfo.COMMANDLINE_PARAM_DESCRIPTION)
2424
private List<ConnectionInfo> connectionInfoList = new ArrayList<>();
2525

26-
public ConnectionInfo getConnectionInfo() {
26+
private ConnectionInfo getConnectionInfo() {
2727
if ( connectionInfoList != null && connectionInfoList.size() > 0 )
2828
return connectionInfoList.get(0);
2929
else

src/main/java/org/utplsql/cli/datasource/TestedDataSourceProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ private void setThickOrThinJdbcUrl(HikariDataSource ds ) throws SQLException
5252

5353
for (ConnectStringPossibility possibility : possibilities) {
5454
ds.setJdbcUrl(possibility.getConnectString(config));
55-
try (Connection con = ds.getConnection()) {
56-
logger.info("Use connectstring {}", possibility.getMaskedConnectString(config));
55+
try (Connection ignored = ds.getConnection()) {
56+
logger.info("Use connection string {}", possibility.getMaskedConnectString(config));
5757
return;
5858
} catch (UnsatisfiedLinkError | Exception e) {
5959
errors.add(possibility.getMaskedConnectString(config) + ": " + e.getMessage());

0 commit comments

Comments
 (0)