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
Next Next commit
Improvement of tests
  • Loading branch information
pesse committed Mar 15, 2019
commit 7fa4a72b71fca4a3cde2cf68d333b75063bae9a0
8 changes: 8 additions & 0 deletions src/test/java/org/utplsql/cli/DataSourceProviderIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ void connectToDatabase() throws SQLException {
assertNotNull(dataSource);
}

//@Test
void connectAsSysdba() throws SQLException {
ConnectionConfig config = new ConnectionConfig("sys as sysdba/oracle@localhost:1522/ORCLPDB1");
DataSource dataSource = new TestedDataSourceProvider(config).getDataSource();

assertNotNull(dataSource);
}

@Test
void initNlsLang() throws SQLException {
System.setProperty("NLS_LANG", "BRAZILIAN PORTUGUESE_BRAZIL.WE8ISO8859P1");
Expand Down
26 changes: 14 additions & 12 deletions src/test/java/org/utplsql/cli/RunCommandIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.utplsql.api.reporter.CoreReporters;

import java.nio.file.Paths;
import java.sql.SQLException;

import static org.junit.jupiter.api.Assertions.assertEquals;

Expand All @@ -13,6 +14,14 @@
*/
class RunCommandIT extends AbstractFileOutputTest {

private void assertValidReturnCode(int returnCode) throws SQLException {
// Only expect failure-exit-code to work on several framework versions
if (OptionalFeatures.FAIL_ON_ERROR.isAvailableFor(TestHelper.getFrameworkVersion()))
assertEquals(2, returnCode);
else
assertEquals(0, returnCode);
}

@Test
void run_Default() throws Exception {

Expand All @@ -23,21 +32,18 @@ void run_Default() throws Exception {
"-c",
"--failure-exit-code=2");

// Only expect failure-exit-code to work on several framework versions
if (OptionalFeatures.FAIL_ON_ERROR.isAvailableFor(TestHelper.getFrameworkVersion()))
assertEquals(2, result);
else
assertEquals(0, result);
assertValidReturnCode(result);
}

@Test
void run_Debug() throws Exception {

int result = TestHelper.runApp("run",
TestHelper.getConnectionString(),
"--debug");
"--debug",
"--failure-exit-code=2");

assertEquals(1, result);
assertValidReturnCode(result);
}

@Test
Expand All @@ -55,11 +61,7 @@ void run_MultipleReporters() throws Exception {
"-c",
"--failure-exit-code=2");

// Only expect failure-exit-code to work on several framework versions
if (OptionalFeatures.FAIL_ON_ERROR.isAvailableFor(TestHelper.getFrameworkVersion()))
assertEquals(2, result);
else
assertEquals(0, result);
assertValidReturnCode(result);
}


Expand Down
12 changes: 12 additions & 0 deletions src/test/java/org/utplsql/cli/TestHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,16 @@ static Version getFrameworkVersion() throws SQLException {
static String getConnectionString() {
return sUser + "/" + sPass + "@" + sUrl;
}

static String getUser() {
return sUser;
}

static String getPass() {
return sPass;
}

static String getUrl() {
return sUrl;
}
}