Hi Craig, hi Karan,
my $0.02:
I like the idea of adding a new parameter to the EqualityHelper.equals
method specifying the instance and the field being compared.
The EqualityHelper could manage a list of differences. The list is
updated each time EqualityHelper.equals returns false. A new method
getDifferences (maybe you know a better name) returns th current list of
differences managed by the EqualityHelper instance. This allows us to
give a better error message in case the CompletenessTest fails because
of unexpected instances in the datastore.
As Craig already pointed out: any == comparison needs to be replaced by
EqualityHelper.equals calls. That means, we need to add equals methods
for primitives types. And we cannot use a conditional and (&&) anymore,
because we want to know all the differences.
Regards Michael
Hi,
So here's the deepEquals method for Address, updated from:
public boolean deepCompareFields(DeepEquality other,
EqualityHelper helper) {
Address otherAddress = (Address)other;
return (addrid == otherAddress.addrid) &&
helper.equals(street, otherAddress.street) &&
helper.equals(city, otherAddress.city) &&
helper.equals(state, otherAddress.state) &&
helper.equals(zipcode, otherAddress.zipcode) &&
helper.equals(country, otherAddress.country);
}
to:
public boolean deepCompareFields(DeepEquality other,
EqualityHelper helper) {
Address otherAddress = (Address)other;
String instanceId = "Address." + addrid + " "; // instance identifier
return helper.equals(addrid, otherAddress.addrid, instanceId +
"addrid") &
helper.equals(street, otherAddress.street, instanceid +
"street") &
helper.equals(city, otherAddress.city, instanceid + "city:) &
helper.equals(state, otherAddress.state, instanceid +
"state") &
helper.equals(zipcode, otherAddress.zipcode, instanceid +
"zipcode") &
helper.equals(country, otherAddress.country, instanceid +
"country");
}
A few notes. The && is replaced with & to guarantee that all of the
equals methods are executed and there is not an early return from the
method because of an inequality. This way, all inequalities can be
reported, not just the first one.
The helper.equals method needs another parameter that tell what
instance and field are being compared.
Craig
On Aug 13, 2005, at 12:05 PM, Craig Russell wrote:
Hi Karan,
The tck20 doesn't yet pass all tests with JPOX. It's definitely a
work-in-progress.
The number that was reported on Friday is in the minutes of the TCK
meeting.
Application identity 18 failures, 24 errors Datastore identity 17
failures 25 errors.
There is a summary of the failures and errors at the end of the run.
All of them should be represented by JIRA issues. And we're not
finished writing TCK tests yet either.
On Aug 13, 2005, at 11:32 AM, Karan Malhi wrote:
Hi Craig,
I looked into the maven goals and realized that i did not setup the
database. So i ran installSchema goal and setup the database .
However, now when i run the tests i get errors for a few of them and
Exceptions, some of the exceptions are JDOExceptions which state
that two
objects were not equal. I guess this is what you were talking about
with the
109 issues as to how we could know which fields of which objects
were not
equal.
Exactly. It's a little tough to track down whether it's a field
mismatch, or the contents of a collection or map that's the problem.
That's why 109 is going to be important to fix to help the JPOX team
figure out what's wrong. With the detail information, we might look
at the mapping and see a mapping error. Or it might be a JPOX bug.
Knowing exactly which field is causing the problem will be a big help
in debugging the TCK.
Thanks,
Craig
On 8/13/05, Craig Russell <[EMAIL PROTECTED]> wrote:
Hi Karan,
Before you run the tck, you need to set up the database. This is done
by the maven build goal but not done by the runtck.jdori goal.
The reason is that setting up the database takes some number of
minutes, and when running, you don't want to spend the time running
this goal. And there's no easy way to tell if you need to run the
goal.
If running maven installSchema doesn't do the trick for you, please
run maven build and see if that fixes it.
Craig
On Aug 13, 2005, at 6:56 AM, Karan Malhi wrote:
Thanks Michael,
This definitely helped. I ran maven runtck.jdori and it gave me
errors. It
could not establish a connection to the database. Below is the
partial
output:
[java] java.sql.SQLException: Connections could not be acquired
from the
underlying database!
[java] at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:
104)
[java] at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledCon
nec
tion(
C3P0PooledConnectionPool.java:236)
[java] at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(
PoolBackedDataSource.java:94)
[java] at com.mchange.v2.c3p0.ComboPooledDataSource.getConnection(
ComboPooledDataSource.java:521)
[java] at org.jpox.store.rdbms.RDBMSManager.<init>
(RDBMSManager.java:215)
[java] at org.jpox.store.rdbms.RDBMSManagerFactory.getStoreManager(
RDBMSManagerFactory.java:59)
[java] at org.jpox.AbstractPersistenceManager.<init>(
AbstractPersistenceManager.java:194)
[java] at org.jpox.PersistenceManagerImpl.<init>
(PersistenceManagerImpl.java
:34)
[java] at
org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager(
PersistenceManagerFactoryImpl.java:811)
[java] at
org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager(
PersistenceManagerFactoryImpl.java:786)
[java] at org.apache.jdo.tck.JDO_Test.getPM(JDO_Test.java:421)
[java] at org.apache.jdo.tck.JDO_Test.deleteTearDownClasses
(JDO_Test.java:367)
[java] at org.apache.jdo.tck.JDO_Test.localTearDown
(JDO_Test.java:293)
[java] at org.apache.jdo.tck.JDO_Test.tearDown(JDO_Test.java:263)
[java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:211)
[java] at junit.framework.TestResult$1.protect(TestResult.java:106)
[java] at junit.framework.TestResult.runProtected
(TestResult.java:124)
[java] at junit.framework.TestResult.run(TestResult.java:109)
[java] at junit.framework.TestCase.run(TestCase.java:118)
[java] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[java] at junit.framework.TestSuite.run(TestSuite.java:203)
[java] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[java] at junit.framework.TestSuite.run(TestSuite.java:203)
[java] at junit.textui.TestRunner.doRun(TestRunner.java:116)
[java] at junit.textui.TestRunner.doRun(TestRunner.java:109)
[java] at org.apache.jdo.tck.util.BatchTestRunner.start
(BatchTestRunner.java
:128)
[java] at org.apache.jdo.tck.util.BatchTestRunner.main
(BatchTestRunner.java
:106)
[java] Caused by:
com.mchange.v2.resourcepool.CannotAcquireResourceException:
A ResourcePool could not acquire a resource from its primary
factory or
source.
[java] at com.mchange.v2.resourcepool.BasicResourcePool.awaitAcquire(
BasicResourcePool.java:970)
[java] at
com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(
BasicResourcePool.java:208)
[java] at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledCon
nec
tion(
C3P0PooledConnectionPool.java:232)
[java] ... 25 more
On 8/13/05, Michael Bouschen <[EMAIL PROTECTED]> wrote:
Hi Karan,
Hi,
I guess this is a maven issue. I am getting a lot of errors when
i run
maven
-o runtck.iut. The errors say that it couldnt find plugin for
c3p0 in
classpath. Where do i set that? Below is the partial output:
please run maven without the -o option. Maven runs in offline
mode in
case option -o is specified. This means maven does not check the
remote
repository for any dependencies to be downloaded. It sounds like
you do
not have the c3p0 jar in you local repository under
~/.maven/repository/c3p0/libs/c2p0-0.9.0.jar. Maven automatically
adds
this to the classpath, so there is no need to do this manually.
BTW, did you intend to run tck20 with the reference implementation,
meaning with JPOX? If yes, please use the goal runtck.jdori: maven
runtck.jdori. The goal runtck.iut is used if you want to run the tck
against an JDO implementation (called iut: implementation under
test)
to check whether it is JDO compliant.
I hope this helps.
Regards Michael
doRuntck.iut:
[echo] Run JDO TCK on the IUT with configuration
Overriding previous definition of reference to
this.project.class.path
[java] RUN CompletenessTest.test ERROR
[java] Description: Completeness test with standard mapping, basic
testdata
with all relationships and embedded objects.
[java] Time: 0.552
[java] There was 1 error:
[java] 1) test(org.apache.jdo.tck.mapping
.CompletenessTest)javax.jdo.JDOFatalUserException:
The connection pool plugin of type "C3P0" was not found in the
CLASSPATH!
[java] at
org.jpox.AbstractPersistenceManagerFactory.freezeConfiguration(
AbstractPersistenceManagerFactory.java:232)
[java] at
org.jpox.PersistenceManagerFactoryImpl.getPersistenceManagerFacto
ry(
PersistenceManagerFactoryImpl.java:119)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
[java] at javax.jdo.JDOHelper.getPersistenceManagerFactory
(JDOHelper.java
:472)
[java] at javax.jdo.JDOHelper.getPersistenceManagerFactory
(JDOHelper.java
:423)
[java] at org.apache.jdo.tck.JDO_Test.getPMF(JDO_Test.java:410)
[java] at org.apache.jdo.tck.JDO_Test.setUp(JDO_Test.java:179)
[java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:196)
[java] at org.apache.jdo.tck.util.BatchTestRunner.start(
BatchTestRunner.java
:128)
[java] at org.apache.jdo.tck.util.BatchTestRunner.main(
BatchTestRunner.java
:106)
[java] FAILURES!!!
[java] Error summary:
[java] 001 error: javax.jdo.JDOFatalUserException: The connection
pool
plugin of type "C3P0" was not found in the CLASSPATH!
[java] Tests run: 1, Failures: 0, Errors: 1, Time: 0.552 seconds.
[java] Excluded tests: [
org.apache.jdo.tck.enhancement.FieldAccessModified,
org.apache.jdo.tck.enhancement.ImplementsPersistenceCapable]
[java] [ERROR] Java Result: 1
--
Michael Bouschen [EMAIL PROTECTED] Engineering GmbH
mailto:[EMAIL PROTECTED] http://www.tech.spree.de/
Tel.:++49/30/235 520-33 Buelowstr. 66
Fax.:++49/30/2175 2012 D-10783 Berlin
--
Karan Malhi
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/ products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!
--
Karan Malhi
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!
--
Michael Bouschen [EMAIL PROTECTED] Engineering GmbH
mailto:[EMAIL PROTECTED] http://www.tech.spree.de/
Tel.:++49/30/235 520-33 Buelowstr. 66
Fax.:++49/30/2175 2012 D-10783 Berlin