-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: CaveatEmptor version 3.1 alpha 5, 23.11.2005 defect repairs
PostPosted: Thu Dec 29, 2005 12:45 pm 
Newbie

Joined: Thu Dec 29, 2005 12:15 pm
Posts: 1
I'm just starting to learn Hibernate, downloaded the current CaveatEmptor example, and found defects in it. There doesn't seem to be a JIRA category for CaveatEmptor defects, so I'll report the issues here and hope they move to someplace they can be repaired permanently.

First, I'm running on a Windows workstation, where runCleanDatabase.sh won't do. Here's a runCleanDatabase.bat that works for me:

====== begin runCleanDatabase.bat =====
Code:
set java_home=c:\jdk1.5.0
if not exist database mkdir database

echo Removing database files...
del /s database\test.*

echo Starting database engine with %JAVA_HOME%\bin\java.exe ...
cd database
%JAVA_HOME%\bin\java.exe -classpath ..\lib\hsqldb.jar org.hsqldb.Server

===== end runCleanDatabase.bat =====

Second, there are defects in the test data which cause the junit tests to fail.

Specifically, when creating new Items, the Calendar manipulations used to create the endDate are creating bad data this week, the last week of 2005. inThreeDays.roll(Calendar.DAY_OF_YEAR,3) gets me to January 2005, which is an invalid endDate if the startDate is today, because according to the ITEM table constraints the startDate must come before the endDate. Changing cal.roll(...) to cal.add(...) solves the problem.

Changes made in TestCaseWithData.java and AuditTest.java:

TestCaseWithData.java about line 85
was
Code:
        inThreeDays.roll(Calendar.DAY_OF_YEAR, 3);
        Calendar inFiveDays = GregorianCalendar.getInstance();
        inFiveDays.roll(Calendar.DAY_OF_YEAR, 5);
        Calendar nextWeek = GregorianCalendar.getInstance();
        nextWeek.roll(Calendar.WEEK_OF_YEAR, true);

should be
Code:
        inThreeDays.add(Calendar.DAY_OF_YEAR, 3);
        Calendar inFiveDays = GregorianCalendar.getInstance();
        inFiveDays.add(Calendar.DAY_OF_YEAR, 5);
        Calendar nextWeek = GregorianCalendar.getInstance();
        nextWeek.add(Calendar.WEEK_OF_YEAR, 1);


AuditTest.java line 39+
was
Code:
        Calendar inThreeDays = GregorianCalendar.getInstance();
        inThreeDays.roll(Calendar.DAY_OF_YEAR, 3);

should be
Code:
        Calendar inThreeDays = GregorianCalendar.getInstance();
        inThreeDays.add(Calendar.DAY_OF_YEAR, 3);


and all the unit tests now pass.

Thanks for the example app. I'm finding it very informative to work through.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 29, 2005 1:05 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Since then all tests have been ported to TestNG.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.