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
Calling right function to run tests and typo fix
  • Loading branch information
viniciusam committed Apr 14, 2017
commit b04f4be60d373e6e344292cdb882e88b16a0a17a
10 changes: 5 additions & 5 deletions src/main/java/io/github/utplsql/OutputBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ public static List<String> getAllLines(String reporterId) throws SQLException {
ResultSet resultSet = null;
try {
callableStatement = UTPLSQL.getConnection()
.prepareCall("BEGIN :lines := ut_output_buffer.get_lines_cursor(:reporter_id); END;");
.prepareCall("BEGIN ? := ut_output_buffer.get_lines_cursor(?); END;");

callableStatement.registerOutParameter(":lines", OracleTypes.CURSOR);
callableStatement.setString(":reporter_id", reporterId);
callableStatement.registerOutParameter(1, OracleTypes.CURSOR);
callableStatement.setString(2, reporterId);
callableStatement.execute();

resultSet = (ResultSet) callableStatement.getObject(":lines");
resultSet = (ResultSet) callableStatement.getObject(1);

List<String> outputLines = new ArrayList<>();
while (resultSet.next()) {
outputLines.add(resultSet.getString(0));
outputLines.add(resultSet.getString("text"));
}
return outputLines;
} finally {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/utplsql/TestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static void run() throws SQLException {
CallableStatement callableStatement = null;
try {
callableStatement = UTPLSQL.getConnection()
.prepareCall("BEGIN ut.run(); END;");
.prepareCall("BEGIN ut_runner.run(); END;");
callableStatement.execute();
} finally {
if (callableStatement != null)
Expand All @@ -32,7 +32,7 @@ public static void run(String path, BaseReporter reporter) throws SQLException {
CallableStatement callableStatement = null;
try {
callableStatement = UTPLSQL.getConnection()
.prepareCall("BEGIN ut.run(:path, :reporter); END;");
.prepareCall("BEGIN ut_runner.run(:path, :reporter); END;");
callableStatement.setString(":path", path);
callableStatement.setObject(":reporter", reporter);
callableStatement.execute();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/utplsql/types/CustomTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public enum CustomTypes {
// Object names must be upper case.
UT_DOCUMENTATION_REPORTER("UT_DOCUMENTATION_REPORTER"),
UT_VARCHAF2_LIST("UT_VARCHAF2_LIST");
UT_VARCHAF2_LIST("UT_VARCHAR2_LIST");

private String typeName;

Expand Down
11 changes: 4 additions & 7 deletions src/test/java/io/github/utplsql/OutputBufferTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.junit.ClassRule;
import org.junit.Test;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

Expand All @@ -22,19 +21,17 @@ public class OutputBufferTest {
@Test
public void getLinesFromOutputBuffer() {
try {
Connection conn = UTPLSQL.getConnection();
conn.setAutoCommit(false);

BaseReporter reporter = new DocumentationReporter();
reporter.setReporterId(UTPLSQL.newSysGuid());
TestRunner.run("", reporter);

List<String> outputLines = OutputBuffer.getAllLines(reporter.getReporterId());

// Debug
System.out.println("Reporter ID: " + reporter.getReporterId());
for (int i = 0; i < outputLines.size(); i++) {
System.out.println(outputLines.get(0));
System.out.println(outputLines.get(i));
}

conn.commit();
} catch (SQLException e) {
Assert.fail(e.getMessage());
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/io/github/utplsql/rules/DatabaseRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public class DatabaseRule extends ExternalResource {

@Override
protected void before() throws Throwable {
UTPLSQL.init("jdbc:oracle:thin:@docker:1521:xe", "app", "app");
// TODO: Options file.
UTPLSQL.init("jdbc:oracle:thin:@127.0.0.1:1521:xe", "ut3", "ut3");
}

@Override
Expand Down