db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject Re: Junit Issues
Date Tue, 05 Feb 2008 00:33:40 GMT
Hi Carlos,

thanks for testing the RC using postgresql (I don't use this DB for 
testing) and the detailed feedback.
The main test database is hsql and some tests use specific 
syntax/keywords not supported by all databases.
My local test-suit results against different databases are:

database    PB   ODMG
hsql        0    0
mysql       0    0
oracleXE    0/1  0
maxDB       5/3  0

oracle fail on a locking test because of a date/timestamp issue (oracle 
specific date/timestamp precision).
maxDB fail/errors are caused by the jdbc-driver which show bad paging 
support (seems that maxDB returns wrong results when using 'offset')
I don't want to fix these issues, because the tests will became too 
complex if we always check for the current database.

Carlos Chávez wrote:
> Hello Armin,
> Hello All.
>  I ran the junit test cases of OJB, i found some issues; my environment
> is: postgresql 8.2.6, java 1.5.0_14, ant 1.7.0, branch OJB_1_0_RELEASE
> revision 616989.
> 1. In the profile for postgresql (profile/postgresql.profile) the
> variables torque.database.createUrl and torque.database.buildUrl have the
> wrong values.
>  the value of torque.database.createUrl is
> ${urlProtocol}:${urlSubprotocol}://${torque.database.host}/template1, but
> it shoul be
> ${urlProtocol}:${urlSubprotocol}://${torque.database.host}/${urlDbalias}.
>  the value of torque.database.buildUrl is
> ${urlProtocol}:${urlSubprotocol}://${torque.database.host}/${urlDbalias},
> but it should be
> ${urlProtocol}:${urlSubprotocol}://${torque.database.host}/template1
>  Basically the torque.database.createUrl is used to indicate the database
> test to create and torque.database.buildUrl looks like we need to
> indicate some other database via ODBC in order to create a database as
> far i understand, so the test try to create the database template1, but
> this is wrong because that database already exists and is created by
> postgresql.

Did you run the OJB test suite with default call
'ant junit'?
In this case ddlutils is used to setup the database.
Only if you call
'ant -Duse-torque=y junit'
torque is used.
The ddlutils task only use the torque.database.createUrl property. I
don't know why we need both properties (buildUrl/createUrl), seems that
except of postgresql they are always the same.

> 2. The other issue is related to the table/field name quoted, in the file
> src/test/org/apache/ojb/repository_junit.xml, we are quoting the table
> name QUOTED_ARTICLE, in posrtgresql when we quote a identifier this become
> case sensitive, so if we have the table quoted_article and we try for
> example select * from "QUOTED_ARTICLE", the identifier is not the same
> because the quote, without the quote QUOTED_ARTICLE and quoted_article are
> the same, but they are not the same if we use the quote. so the test cases
> fail because the table "QUOTED_ARTICLE" does not exists. we are quoting
> the fields ARTICLE_ID, ARTICLE_NAME and UNIT in the same descriptor.

This sounds strange. In file src/schema/ojbtest-schema.xml (this file
contains the sql metadata to create the test database tables) all names
are in upper case:

<table name="QUOTED_ARTICLE">
         <column name="ARTICLE_ID" required="true" primaryKey="true"
         <column name="ARTICLE_NAME" type="VARCHAR" size="150"/>
         <column name="GROUP_ID" type="INTEGER"/>
         <column name="UNIT" type="VARCHAR" size="150"/>
         <column name="PRICE" type="FLOAT"/>
         <column name="STOCK" type="INTEGER"/>
         <foreign-key foreignTable="Kategorien">
           <reference local="GROUP_ID" foreign="Kategorie_Nr"/>

and in the repository file the quoted name is in upper case too:
Does ddlutils/torque create the table QUOTED_ARTICLE in upper case or is 
the upper case ignored?

> 3. The following test case fail because the function curdate() does not
> exists in postgresql, the correct function is CURRENT_DATE.

The test pass with the function CURRENT_DATE? As said above I don't want 
to write database tests for all databases.

> 4. The following test case fail because the argument for the abs()
> function is a string variable:
> testQuery	Error	 * SQLException during execution of sql-statement: * sql
> statement: SELECT
> ((A2.SUM_ = ?) AND mod(A0.MAX_, A0.MOD_) < ?) AND abs(A0.AS_) > ? *
> Exception message: ERROR: no existe la función abs(character varying) *
> Vendor error code: 0 * SQL state code: 42883 **

This seems to be a bug in the test. Querying for the absolute value of a 
string is absolute nonsense (written by myself ;-)). I will fix this ASAP!

> 5. some other test that is failing:
> at
> org.apache.ojb.broker.accesslayer.ReportQueryRsIterator.getObjectFromResultSet(ReportQueryRsIterator.java:89)
> at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:282)
> at org.apache.ojb.broker.lob.LOBTest.testReportQuery(LOBTest.java:120)
> Caused by: org.postgresql.util.PSQLException: Bad value for type long :

All other failures are Blob/Clob and Java_Object type related failures. 
Seems that the postgresql Platform implementation class doesn't proper 
support these types.
I will start working on this ASAP - help is welcome.


To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org

View raw message