pgshiping / jforum2

Automatically exported from code.google.com/p/jforum2
Other
0 stars 0 forks source link

RESTAuthenticationTestCase fails on oracle #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. install jforum2.3.3 manually 
2. use oracle db, init the database with the sqls
3. run the testcases (mvn clean install)

What is the expected output? What do you see instead?
Expected is a successful build. But instead of that I got this for 
net.jforum.api.integration.rest.RESTAuthenticationTestCase:

java.sql.SQLException: ORA-01400: cannot insert NULL into 
("RISKOP_PGND"."JFORUM_API"."API_ID")

    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1190)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3454)
    at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
    at net.jforum.api.integration.rest.RESTAuthenticationTestCase.createApiKey(RESTAuthenticationTestCase.java:63)
    at net.jforum.api.integration.rest.RESTAuthenticationTestCase.setUp(RESTAuthenticationTestCase.java:99)
    at junit.framework.TestCase.runBare(TestCase.java:132)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Please use labels and text to provide additional information.

The problem is caused by the fact that on Oracle the api_id is not 
automatically calculated. There is a sequence for api_id but it is not used in 
the sql:

.prepareStatement("INSERT INTO jforum_api (api_key, api_validity) "
                        + " VALUES (?, ?)");

So in case of oracle the above should be something like this:

INSERT INTO jforum_api (api_id, api_key, api_validity) VALUES 
(jforum_api_seq.nextval, ?, ?)

Since the sqls needed for oracle and other databases are different, the 
statement
should be factored out to oracle.sql and generic_queries.sql instead of being in
the testcase itself.

Original issue reported on code.google.com by peter.ri...@gmail.com on 23 Apr 2012 at 9:00

GoogleCodeExporter commented 8 years ago
fix comitted with revision 177

commit -m "fix #26" 
/home/riskop/Documents/mins/jforum2/src/main/config/database/generic/generic_que
ries.sql 
/home/riskop/Documents/mins/jforum2/src/main/config/database/oracle/oracle.sql 
/home/riskop/Documents/mins/jforum2/src/test/java/net/jforum/api/integration/res
t/RESTAuthenticationTestCase.java
    Sending        /home/riskop/Documents/mins/jforum2/src/main/config/database/generic/generic_queries.sql
    Sending        /home/riskop/Documents/mins/jforum2/src/main/config/database/oracle/oracle.sql
    Sending        /home/riskop/Documents/mins/jforum2/src/test/java/net/jforum/api/integration/rest/RESTAuthenticationTestCase.java
    Transmitting file data ...
    Committed revision 177.

Original comment by peter.ri...@gmail.com on 23 Apr 2012 at 1:47

GoogleCodeExporter commented 8 years ago
commit -m "[ issue#26 ] fix for RESTAuthenticationTestCase. Note that the real 
fix was revision 177, this commit is just to let google match the issue with 
it." 
/home/riskop/Documents/mins/jforum2/src/test/java/net/jforum/api/integration/res
t/RESTAuthenticationTestCase.java
    Sending        /home/riskop/Documents/mins/jforum2/src/test/java/net/jforum/api/integration/rest/RESTAuthenticationTestCase.java
    Transmitting file data ...
    Committed revision 178.

Original comment by peter.ri...@gmail.com on 24 Apr 2012 at 6:32

GoogleCodeExporter commented 8 years ago

Original comment by andow...@gmail.com on 20 May 2012 at 4:32