Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cleanup base on IDEA Code Inspector and small refactoring#59

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
pesse merged 3 commits intoutPLSQL:developfromPazus:feature/cleanup
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes fromall 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
1 change: 0 additions & 1 deletionsrc/main/java/org/utplsql/api/DBHelper.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
package org.utplsql.api;

import oracle.jdbc.OracleTypes;
import org.utplsql.api.exception.DatabaseNotCompatibleException;
import org.utplsql.api.exception.UtPLSQLNotInstalledException;

import java.sql.*;
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,8 @@
*/
public class EnvironmentVariableUtil {

private EnvironmentVariableUtil() {}

/**
* Returns the value for a given key from environment (see class description)
*
Expand All@@ -43,4 +45,6 @@ public static String getEnvValue(String key, String defaultValue) {

return val;
}


}
2 changes: 1 addition & 1 deletionsrc/main/java/org/utplsql/api/FileMapper.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ public static Array buildFileMappingArray(
Connection conn, FileMapperOptions mapperOptions) throws SQLException {
OracleConnection oraConn = conn.unwrap(OracleConnection.class);

Map typeMap = conn.getTypeMap();
Map<String, Class<?>> typeMap = conn.getTypeMap();
typeMap.put(CustomTypes.UT_FILE_MAPPING, FileMapping.class);
typeMap.put(CustomTypes.UT_KEY_VALUE_PAIR, KeyValuePair.class);
conn.setTypeMap(typeMap);
Expand Down
15 changes: 11 additions & 4 deletionssrc/main/java/org/utplsql/api/FileMapping.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,35 +17,42 @@ public class FileMapping implements SQLData {

public FileMapping() {}

public FileMapping(String fileName, String objectOwner, String objectName, String objectType) {
this.fileName = fileName;
this.objectOwner = objectOwner;
this.objectName = objectName;
this.objectType = objectType;
}

public String getFileName() {
return fileName;
}

public void setFileName(String fileName) {
private void setFileName(String fileName) {
this.fileName = fileName;
}

public String getObjectOwner() {
return objectOwner;
}

public void setObjectOwner(String objectOwner) {
private void setObjectOwner(String objectOwner) {
this.objectOwner = objectOwner;
}

public String getObjectName() {
return objectName;
}

public void setObjectName(String objectName) {
private void setObjectName(String objectName) {
this.objectName = objectName;
}

public String getObjectType() {
return objectType;
}

public void setObjectType(String objectType) {
private void setObjectType(String objectType) {
this.objectType = objectType;
}

Expand Down
2 changes: 2 additions & 0 deletionssrc/main/java/org/utplsql/api/JavaApiVersionInfo.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,8 @@
*/
public class JavaApiVersionInfo {

private JavaApiVersionInfo() { }

private static final String BUILD_NO = "123";
private static final String MAVEN_PROJECT_NAME = "utPLSQL-java-api";
private static final String MAVEN_PROJECT_VERSION = "3.1.1-SNAPSHOT";
Expand Down
18 changes: 5 additions & 13 deletionssrc/main/java/org/utplsql/api/KeyValuePair.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,38 +22,30 @@ public String getKey() {
return key;
}

public void setKey(String key) {
this.key = key;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

@Override
public String getSQLTypeName() throws SQLException {
return CustomTypes.UT_KEY_VALUE_PAIR;
}

@Override
public void readSQL(SQLInput stream, String typeName) throws SQLException {
setKey(stream.readString());
setValue(stream.readString());
key =stream.readString();
value =stream.readString();
}

@Override
public void writeSQL(SQLOutput stream) throws SQLException {
stream.writeString(getKey());
stream.writeString(getValue());
stream.writeString(key);
stream.writeString(value);
}

@Override
public String toString() {
return String.format("%s => %s",getKey(), getValue());
return String.format("%s => %s",key, value);
}

}
2 changes: 2 additions & 0 deletionssrc/main/java/org/utplsql/api/ResourceUtil.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,6 +21,8 @@
*/
public class ResourceUtil {

private ResourceUtil() {}

/**
* Returns the Path to a resource so it is walkable no matter if it's inside a jar or on the file system
*
Expand Down
23 changes: 6 additions & 17 deletionssrc/main/java/org/utplsql/api/TestRunner.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
package org.utplsql.api;

import oracle.jdbc.OracleConnection;
import org.utplsql.api.compatibility.CompatibilityProxy;
import org.utplsql.api.exception.DatabaseNotCompatibleException;
import org.utplsql.api.exception.SomeTestsFailedException;
Expand All@@ -10,7 +9,6 @@
import org.utplsql.api.reporter.ReporterFactory;
import org.utplsql.api.testRunner.TestRunnerStatement;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
Expand All@@ -24,18 +22,18 @@
*/
public class TestRunner {

private TestRunnerOptions options = new TestRunnerOptions();
privatefinalTestRunnerOptions options = new TestRunnerOptions();
private CompatibilityProxy compatibilityProxy;
private ReporterFactory reporterFactory;
private List<String> reporterNames = new ArrayList<>();
privatefinalList<String> reporterNames = new ArrayList<>();

public TestRunner addPath(String path) {
options.pathList.add(path);
return this;
}

public TestRunner addPathList(List<String> paths) {
if (options.pathList != null)options.pathList.addAll(paths);
options.pathList.addAll(paths);
return this;
}

Expand DownExpand Up@@ -115,7 +113,7 @@ public TestRunner setReporterFactory( ReporterFactory reporterFactory ) {

private void delayedAddReporters() {
if ( reporterFactory != null )
reporterNames.stream().forEach( this::addReporter );
reporterNames.forEach( this::addReporter );
else
throw new IllegalStateException("ReporterFactory must be set to add delayed Reporters!");
}
Expand All@@ -142,13 +140,8 @@ public void run(Connection conn) throws SomeTestsFailedException, SQLException,
options.reporterList.add(new DocumentationReporter().init(conn));
}

TestRunnerStatement testRunnerStatement = null;

try {
DBHelper.enableDBMSOutput(conn);

testRunnerStatement = compatibilityProxy.getTestRunnerStatement(options, conn);

DBHelper.enableDBMSOutput(conn);
try(TestRunnerStatement testRunnerStatement = compatibilityProxy.getTestRunnerStatement(options, conn)) {
testRunnerStatement.execute();
} catch (SQLException e) {
if (e.getErrorCode() == SomeTestsFailedException.ERROR_CODE) {
Expand All@@ -161,10 +154,6 @@ else if (e.getErrorCode() == UtPLSQLNotInstalledException.ERROR_CODE) {
throw e;
}
} finally {
if (testRunnerStatement != null) {
testRunnerStatement.close();
}

DBHelper.disableDBMSOutput(conn);
}
}
Expand Down
15 changes: 7 additions & 8 deletionssrc/main/java/org/utplsql/api/TestRunnerOptions.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,6 @@
import org.utplsql.api.reporter.Reporter;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

Expand All@@ -12,14 +11,14 @@
* @author pesse
*/
public class TestRunnerOptions {
public List<String> pathList = new ArrayList<>();
public List<Reporter> reporterList = new ArrayList<>();
publicfinalList<String> pathList = new ArrayList<>();
publicfinalList<Reporter> reporterList = new ArrayList<>();
public boolean colorConsole = false;
public List<String> coverageSchemes = new ArrayList<>();
public List<String> sourceFiles = new ArrayList<>();
public List<String> testFiles = new ArrayList<>();
public List<String> includeObjects = new ArrayList<>();
public List<String> excludeObjects = new ArrayList<>();
publicfinalList<String> coverageSchemes = new ArrayList<>();
publicfinalList<String> sourceFiles = new ArrayList<>();
publicfinalList<String> testFiles = new ArrayList<>();
publicfinalList<String> includeObjects = new ArrayList<>();
publicfinalList<String> excludeObjects = new ArrayList<>();
public FileMapperOptions sourceMappingOptions;
public FileMapperOptions testMappingOptions;
public boolean failOnErrors = false;
Expand Down
68 changes: 32 additions & 36 deletionssrc/main/java/org/utplsql/api/Version.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,44 +10,52 @@
* @author pesse
*/
public class Version implements Comparable<Version> {
private String origString;
private Integer major;
private Integer minor;
private Integer bugfix;
private Integer build;
private boolean valid = false;
privatefinalString origString;
privatefinalInteger major;
privatefinalInteger minor;
privatefinalInteger bugfix;
privatefinalInteger build;
privatefinalboolean valid;

public Version( String versionString ) {
assert versionString != null;
this.origString = versionString;
parseVersionString();
}
this.origString = versionString.trim();

private void parseVersionString()
{
Pattern p = Pattern.compile("([0-9]+)\\.?([0-9]+)?\\.?([0-9]+)?\\.?([0-9]+)?");

Matcher m = p.matcher(origString);

Integer major = null;
Integer minor = null;
Integer bugfix = null;
Integer build = null;
boolean valid = false;

try {
if (m.find()) {
if (m.group(1) != null )
if (m.group(1) != null )
major = Integer.valueOf(m.group(1));
if (m.group(2) != null )
if (m.group(2) != null )
minor = Integer.valueOf(m.group(2));
if (m.group(3) != null )
if (m.group(3) != null )
bugfix = Integer.valueOf(m.group(3));
if (m.group(4) != null )
if (m.group(4) != null )
build = Integer.valueOf(m.group(4));

if ( major != null ) // We need a valid major version as minimum requirement for a Version object to be valid
valid = true;
// We need a valid major version as minimum requirement for a Version object to be valid
valid = major != null;
}
}
catch ( NumberFormatException e )
{
valid = false;
}

this.major = major;
this.minor = minor;
this.bugfix = bugfix;
this.build = build;
this.valid = valid;
}

@Override
Expand DownExpand Up@@ -85,11 +93,11 @@ public String getNormalizedString()
StringBuilder sb = new StringBuilder();
sb.append(String.valueOf(major));
if ( minor != null )
sb.append("." +String.valueOf(minor));
sb.append(".").append(String.valueOf(minor));
if ( bugfix != null )
sb.append("." +String.valueOf(bugfix));
sb.append(".").append(String.valueOf(bugfix));
if ( build != null )
sb.append("." +String.valueOf(build));
sb.append(".").append(String.valueOf(build));

return sb.toString();
}
Expand DownExpand Up@@ -152,41 +160,29 @@ public boolean isGreaterOrEqualThan( Version v ) throws InvalidVersionException

versionsAreValid(v);

if ( compareTo(v) >= 0 )
return true;
else
return false;
return compareTo(v) >= 0;
}


public boolean isGreaterThan( Version v) throws InvalidVersionException
{
versionsAreValid(v);

if ( compareTo(v) > 0 )
return true;
else
return false;
return compareTo(v) > 0;
}

public boolean isLessOrEqualThan( Version v ) throws InvalidVersionException
{

versionsAreValid(v);

if ( compareTo(v) <= 0 )
return true;
else
return false;
return compareTo(v) <= 0;
}

public boolean isLessThan( Version v) throws InvalidVersionException
{
versionsAreValid(v);

if ( compareTo(v) < 0 )
return true;
else
return false;
return compareTo(v) < 0;
}
}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp