Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
additional cleanup, fix typos
  • Loading branch information
Pazus committed Feb 14, 2019
commit 656808930b986344e156298f3201fec5a8437070
8 changes: 3 additions & 5 deletions src/main/java/org/utplsql/cli/CliVersionInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@
*/
public class CliVersionInfo {

private static final String MAVEN_PROJECT_NAME = "utPLSL-cli";
private static final String MAVEN_PROJECT_NAME = "utPLSQL-cli";
private static String MAVEN_PROJECT_VERSION = "unknown";

static {
try {
try ( InputStream in = JavaApiVersionInfo.class.getClassLoader().getResourceAsStream("utplsql-cli.version")) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
try ( InputStream in = JavaApiVersionInfo.class.getClassLoader().getResourceAsStream("utplsql-cli.version");
BufferedReader reader = new BufferedReader(new InputStreamReader(in)) ) {
MAVEN_PROJECT_VERSION = reader.readLine();

reader.close();
}
}
catch ( IOException e ) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/utplsql/cli/CommandProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.Map;
import java.util.stream.Stream;

public class CommandProvider {
class CommandProvider {

private final Map<String, ICommand> commands = new HashMap<>();
private final JCommander jCommander;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/utplsql/cli/ReporterFactoryProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* @author pesse
*/
public class ReporterFactoryProvider {
class ReporterFactoryProvider {

public static ReporterFactory createReporterFactory(CompatibilityProxy proxy ) {
ReporterFactory reporterFactory = ReporterFactory.createDefault(proxy);
Expand Down
53 changes: 16 additions & 37 deletions src/main/java/org/utplsql/cli/RunCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,10 @@ public class RunCommand implements ICommand {
private ReporterFactory reporterFactory;
private ReporterManager reporterManager;

public ConnectionInfo getConnectionInfo() {
private ConnectionInfo getConnectionInfo() {
return connectionInfoList.get(0);
}

public List<String> getTestPaths() {
return testPaths;
}

void init() {

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

final List<Reporter> reporterList;
final List<String> testPaths = getTestPaths();

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

ArrayList<String> includeObjectsList;
ArrayList<String> excludeObjectsList;

if (includeObjects != null && !includeObjects.isEmpty()) {
includeObjectsList = new ArrayList<>(Arrays.asList(includeObjects.split(",")));
} else {
includeObjectsList = new ArrayList<>();
}

if (excludeObjects != null && !excludeObjects.isEmpty()) {
excludeObjectsList = new ArrayList<>(Arrays.asList(excludeObjects.split(",")));
} else {
excludeObjectsList = new ArrayList<>();
}

final ArrayList<String> finalIncludeObjectsList = includeObjectsList;
final ArrayList<String> finalExcludeObjectsList = excludeObjectsList;
final List<String> finalIncludeObjectsList = getObjectList(includeObjects);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 😅

final List<String> finalExcludeObjectsList = getObjectList(excludeObjects);

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

Expand Down Expand Up @@ -231,6 +211,16 @@ public int run() {
return 1;
}

private ArrayList<String> getObjectList(String includeObjects) {
ArrayList<String> includeObjectsList;
if (includeObjects != null && !includeObjects.isEmpty()) {
includeObjectsList = new ArrayList<>(Arrays.asList(includeObjects.split(",")));
} else {
includeObjectsList = new ArrayList<>();
}
return includeObjectsList;
}

@Override
public String getCommand() {
return "run";
Expand All @@ -239,7 +229,7 @@ public String getCommand() {

private void outputMainInformation() {

StringBlockFormatter formatter = new StringBlockFormatter("utPLCSL cli");
StringBlockFormatter formatter = new StringBlockFormatter("utPLSQL cli");
formatter.appendLine(CliVersionInfo.getInfo());
formatter.appendLine(JavaApiVersionInfo.getInfo());
formatter.appendLine("Java-Version: " + System.getProperty("java.version"));
Expand Down Expand Up @@ -317,7 +307,7 @@ private CompatibilityProxy checkFrameworkCompatibility(Connection conn) throws S
return proxy;
}

public FileMapperOptions getMapperOptions(List<String> mappingParams, List<String> filePaths) {
private FileMapperOptions getMapperOptions(List<String> mappingParams, List<String> filePaths) {
FileMapperOptions mapperOptions = new FileMapperOptions(filePaths);

final String OPT_OWNER="-owner=";
Expand Down Expand Up @@ -364,25 +354,14 @@ public FileMapperOptions getMapperOptions(List<String> mappingParams, List<Strin
return mapperOptions;
}

/** Returns the version of the database framework if available
*
* @return
*/
public Version getDatabaseVersion() {
if ( compatibilityProxy != null )
return compatibilityProxy.getDatabaseVersion();

return null;
}

private ReporterManager getReporterManager() {
if ( reporterManager == null )
reporterManager = new ReporterManager(reporterParams);

return reporterManager;
}

public List<ReporterOptions> getReporterOptionsList() {
List<ReporterOptions> getReporterOptionsList() {
return getReporterManager().getReporterOptionsList();
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/utplsql/cli/VersionInfoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class VersionInfoCommand implements ICommand {
description = ConnectionInfo.COMMANDLINE_PARAM_DESCRIPTION)
private List<ConnectionInfo> connectionInfoList = new ArrayList<>();

public ConnectionInfo getConnectionInfo() {
private ConnectionInfo getConnectionInfo() {
if ( connectionInfoList != null && connectionInfoList.size() > 0 )
return connectionInfoList.get(0);
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ private void setThickOrThinJdbcUrl(HikariDataSource ds ) throws SQLException

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