utPLSQL / utPLSQL-maven-plugin

Maven plugin for running Unit Tests with utPLSQL v3
Apache License 2.0
13 stars 10 forks source link

utPLSQL maven plugin fails to run the utplsql test, I am able to run tests manually using same user #53

Closed getshravan closed 4 years ago

getshravan commented 4 years ago

Describe the bug I have installed utplsql on a db docker image, when I am trying to run the build using utplsql-maven plugin, I am getting the below error. When I run the below query manually by logging in as the same dbUser (In my case it is ceradm), I am able to run select ut_runner.version() from dual; successfully. I am also able to run manually all the utplsql tests using the ceradm user, not sure why the maven plugin is failing. Any help on this will be much appreciated.

org.utplsql.api.exception.UtPLSQLNotInstalledException: utPLSQL framework is not installed on your database or not accessable to the user you are connected with at org.utplsql.api.DBHelper.getDatabaseFrameworkVersion(DBHelper.java:67) at org.utplsql.maven.plugin.UtPLSQLMojo.execute(UtPLSQLMojo.java:147) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:190) at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:186) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "UT_RUNNER"."VERSION": invalid identifier

    at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)
    at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1054)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:226)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:59)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:747)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:904)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1082)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780)
    at oracle.jdbc.driver.T4CPreparedStatement.executeInternal(T4CPreparedStatement.java:1343)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3822)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1165)
    at org.utplsql.api.DBHelper.getDatabaseFrameworkVersion(DBHelper.java:59)
    ... 14 more

Caused by: Error : 904, Position : 7, Sql = select ut_runner.version() from dual, OriginalSql = select ut_runner.version() from dual, Error Msg = ORA-00904: "UT_RUNNER"."VERSION": invalid identifier Provide version info Information about utPLSQL and Database version,

set serveroutput on declare l_version varchar2(255); l_compatibility varchar2(255); begin dbms_utility.db_version( l_version, l_compatibility ); dbms_output.put_line( l_version ); dbms_output.put_line( l_compatibility ); end; / 11.2.0.2.0 11.2.0.0.0

select substr(ut.version(),1,60) as ut_version from dual; v3.1.10.3349

select * from v$version; Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production PL/SQL Release 11.2.0.2.0 - Production "CORE 11.2.0.2.0 Production" TNS for Linux: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 - Production

select * from nls_session_parameters; NLS_LANGUAGE AMERICAN NLS_TERRITORY AMERICA NLS_CURRENCY $ NLS_ISO_CURRENCY AMERICA NLS_NUMERIC_CHARACTERS ., NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE AMERICAN NLS_SORT BINARY NLS_TIME_FORMAT HH.MI.SSXFF AM NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR NLS_DUAL_CURRENCY $ NLS_COMP BINARY NLS_LENGTH_SEMANTICS BYTE NLS_NCHAR_CONV_EXCP FALSE

select substr(dbms_utility.port_string,1,60) as port_string from dual; x86_64/Linux 2.4.xx Information about client software SQL Developer-19.2.1.247

To Reproduce Steps to reproduce the behavior:

Go to '...' Click on '....' Scroll down to '....' See error Expected behavior

Example code

jdbc:oracle:thin:@${docker.host.address}:${oracle.listener.port}/${installsol.docker.oracle.sid} ceradm CERADM org.utplsql utplsql-maven-plugin 3.1.3-SNAPSHOT com.oracle.jdbc ojdbc8 12.2.0.1 compile test pre-integration-test schema_name ../installation-schema-deployment/src/main/resources/database ceradm-manage-header.sql ceradm-manage-body.sql ../installation-schema-deployment/src/test/resources/database **/*sql

Additional context I have a schema named ceradm where all the package and test packages are installed. I have installed UTPLSQL under ut3 schema. Also, provided UT3 public access to all the other users. I installed UT3 using install_headless.sql. I am able to manually run the utplsql tests from the ceradm user, but when I try to run the utplsql maven build plugin I am getting the above error.

Screen Shot 2020-04-08 at 7 11 58 PM

Able to run test manually

Screen Shot 2020-04-08 at 7 24 20 PM
getshravan commented 4 years ago

Updating utplsql-maven-plugin to version 3.1.3-SNAPSHOT resolved the issue and providing the correct schema name in <path>schema-name</path> resolved the issue.