continuum-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brill Pappin <br...@pappin.ca>
Subject Re: unit testing headache
Date Fri, 01 Sep 2006 01:23:24 GMT
Ok... I'll take another crack at it tonight. I've included all output, 
and the process I'm going through untrimmed (sorry for the long post).

First my environment:
Windows XP, Eclipse 3.2, maven 2.0.4 (I think the Maven eclipse plugin 
is actually using 2.0.3).
I read the notes and checked out the source tree in my drive root (note 
about long paths) however I don't think thats the problem as the 
exception is directly related to JPOX and something it doesn't like in 
the generated mapping document.

to reproduce:

check out the continuum parent project (and the maven pom project 
because it refers to it) and run the build.bat to get the initial 
environment going. Now drop the following test in:

package org.apache.maven.continuum.configuration;

import org.apache.maven.continuum.AbstractContinuumTest;

public class FailingTest extends AbstractContinuumTest
{
    public void testExpectingToFailButGetError()
    {
        fail("expect a fail, but never get that far.");
    }
}

run the test (in eclipse by hand or shotcut Shift+Alt+X, T).
the test will begin to run and generate the following output:

21:15:04,206 INFO  JPOX.JDO             
[org.jpox.AbstractPersistenceManagerFactory] PersistenceManagerFactory - 
Vendor: JPOX  Version: 1.1.1
21:15:04,222 INFO  JPOX.JDO             
[org.jpox.AbstractPersistenceManagerFactory] PersistenceManagerFactory 
initialised for datastore 
URL=jdbc:hsqldb:mem:org.apache.maven.continuum.configuration.FailingTest.testDoNothing 
driver=org.hsqldb.jdbcDriver userName=sa
21:15:05,113 INFO  JPOX.RDBMS           
[org.jpox.store.rdbms.adapter.RDBMSAdapterFactory] RDBMS Adapter 
initialised : HSQLAdapter : HSQL Database Engine version=1.7.3, major=1, 
minor=7, revision=3
Identifier Names : UPPERCASE
Driver name=HSQL Database Engine Driver, version=1.7.3, major=1, minor=7
Identifier Max Lengths : Table=128  Column=128  Constraint=128  
Index=128  Delimeters="
Identifier Support in DDL : catalog=false  schema=false
21:15:05,300 INFO  JPOX.RDBMS           
[org.jpox.store.rdbms.table.AbstractTable] Creating table 
DELETEME1157073305238
21:15:05,347 INFO  JPOX.RDBMS.SCHEMA    
[org.jpox.store.rdbms.table.ProbeTable] Catalog Name could not be 
determined for this datastore
21:15:05,347 INFO  JPOX.RDBMS.SCHEMA    
[org.jpox.store.rdbms.table.ProbeTable] Schema Name could not be 
determined for this datastore
21:15:05,347 INFO  JPOX.RDBMS           
[org.jpox.store.rdbms.table.AbstractTable] Dropping table 
DELETEME1157073305238
21:15:05,363 INFO  JPOX.RDBMS.SCHEMA    
[org.jpox.store.rdbms.RDBMSManager] Initialising Catalog "", Schema "" 
using "None" auto-start option
21:15:05,363 INFO  JPOX.RDBMS.SCHEMA    
[org.jpox.store.rdbms.RDBMSManager] Catalog "", Schema "" initialised - 
managing 0 classes
21:15:05,644 INFO  JPOX.MetaData        
[org.jpox.metadata.MetaDataParser] Parsing MetaData from file 
"file:/C:/continuum-parent/bin/META-INF/package.jdo"

You should then get an exception as follows:

org.jpox.metadata.InvalidMetaDataException: Error in MetaData for field 
"projectGroup" in class "Project" : this is declared as 
org.apache.maven.continuum.model.project.ProjectGroup with 
"persistence-modifier=none" yet has either "default-fetch-group=true" or 
"primary-key=true" specified! These should be false.
    at 
org.jpox.metadata.AbstractPropertyMetaData.populate(AbstractPropertyMetaData.java:818)
    at 
org.jpox.metadata.ClassMetaData.populatePropertyMetaData(ClassMetaData.java:418)
    at org.jpox.metadata.ClassMetaData.populate(ClassMetaData.java:238)
    at 
org.jpox.metadata.MetaDataManager.populateClassesInterfacesInFile(MetaDataManager.java:1308)
    at 
org.jpox.metadata.MetaDataManager.loadMetaDataForClass(MetaDataManager.java:1430)
    at 
org.jpox.metadata.MetaDataManager.getMetaDataForClassOrInterface(MetaDataManager.java:544)
    at 
org.jpox.metadata.MetaDataManager.getMetaDataForClassInternal(MetaDataManager.java:509)
    at 
org.jpox.metadata.MetaDataManager.getMetaDataForClass(MetaDataManager.java:392)
    at 
org.jpox.metadata.MetaDataManager.getMetaDataForClass(MetaDataManager.java:378)
    at 
org.jpox.store.rdbms.RDBMSManager$ClassAdder.getReferencedClasses(RDBMSManager.java:2852)
    at 
org.jpox.store.rdbms.RDBMSManager$ClassAdder.addClassTables(RDBMSManager.java:2603)
    at 
org.jpox.store.rdbms.RDBMSManager$ClassAdder.addClassTablesAndValidate(RDBMSManager.java:2915)
    at 
org.jpox.store.rdbms.RDBMSManager$ClassAdder.run(RDBMSManager.java:2540)
    at 
org.jpox.store.rdbms.RDBMSManager$MgmtTransaction.execute(RDBMSManager.java:2397)
    at org.jpox.store.rdbms.RDBMSManager.addClasses(RDBMSManager.java:603)
    at org.jpox.SchemaTool.createSchemaTables(SchemaTool.java:279)
    at 
org.apache.maven.continuum.AbstractContinuumTest.getStore(AbstractContinuumTest.java:132)
    at 
org.apache.maven.continuum.AbstractContinuumTest.setUp(AbstractContinuumTest.java:62)
    at junit.framework.TestCase.runBare(TestCase.java:125)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
    at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)



Now... if you go and edit the package.jdo and fix what it's complaining 
about, rerun the same test and you get the same error but on a different 
mapping. this can go on all night as I can attest to.

- Brill Pappin



Jesse McConnell wrote:
> could you generate a diff with what you are trying to do and I'll
> apply the to a fresh checkout and see what I can figure out
>
> can't help much unless I can see what your trying to do specifically :)
>
> jesse
>
> On 8/30/06, Brill Pappin <brill@pappin.ca> wrote:
>> all I want to do it write a regression test for some code before I make
>> any changes...
>> But I seem to be unable to inject my fakes into the code under test
>> (members not exposed).
>>
>> So I took a look at some of the other test that use an abstract base
>> test... however it initializes a whole in memory database.
>>
>> it also doesn't seem to work as I keep getting a jpox error about bad
>> mappings:
>>
>> org.jpox.metadata.InvalidMetaDataException: Error in MetaData for field
>> "projectGroup" in class "Project" : this is declared as
>> org.apache.maven.continuum.model.project.ProjectGroup with
>> "persistence-modifier=none" yet has either "default-fetch-group=true" or
>> "primary-key=true" specified! These should be false.
>>     at
>> org.jpox.metadata.AbstractPropertyMetaData.populate(AbstractPropertyMetaData.java:818)

>>
>>     at
>> org.jpox.metadata.ClassMetaData.populatePropertyMetaData(ClassMetaData.java:418)

>>
>>     at org.jpox.metadata.ClassMetaData.populate(ClassMetaData.java:238)
>>     at
>> org.jpox.metadata.MetaDataManager.populateClassesInterfacesInFile(MetaDataManager.java:1308)

>>
>>     at
>> org.jpox.metadata.MetaDataManager.loadMetaDataForClass(MetaDataManager.java:1430)

>>
>>     at
>> org.jpox.metadata.MetaDataManager.getMetaDataForClassOrInterface(MetaDataManager.java:544)

>>
>>     at
>> org.jpox.metadata.MetaDataManager.getMetaDataForClassInternal(MetaDataManager.java:509)

>>
>>     at
>> org.jpox.metadata.MetaDataManager.getMetaDataForClass(MetaDataManager.java:392) 
>>
>>     at
>> org.jpox.metadata.MetaDataManager.getMetaDataForClass(MetaDataManager.java:378) 
>>
>>     at
>> org.jpox.store.rdbms.RDBMSManager$ClassAdder.getReferencedClasses(RDBMSManager.java:2852)

>>
>>     at
>> org.jpox.store.rdbms.RDBMSManager$ClassAdder.addClassTables(RDBMSManager.java:2603)

>>
>>     at
>> org.jpox.store.rdbms.RDBMSManager$ClassAdder.addClassTablesAndValidate(RDBMSManager.java:2915)

>>
>>     at
>> org.jpox.store.rdbms.RDBMSManager$ClassAdder.run(RDBMSManager.java:2540)
>>     at
>> org.jpox.store.rdbms.RDBMSManager$MgmtTransaction.execute(RDBMSManager.java:2397)

>>
>>     at 
>> org.jpox.store.rdbms.RDBMSManager.addClasses(RDBMSManager.java:603)
>>     at org.jpox.SchemaTool.createSchemaTables(SchemaTool.java:279)
>>     at
>> org.apache.maven.continuum.AbstractContinuumTest.getStore(AbstractContinuumTest.java:132)

>>
>>     at
>> org.apache.maven.continuum.AbstractContinuumTest.setUp(AbstractContinuumTest.java:62)

>>
>>     at
>> org.apache.maven.continuum.buildcontroller.DefaultBuildControllerTest.setUp(DefaultBuildControllerTest.java:26)

>>
>>
>>
>> If i fix the jdo file manually, I get another one just like this for
>> another mapping... and so on, and so on...
>>
>> Do I really need to use this base test, or does someone have a way to
>> write a simple unit test?
>>
>> - Brill Pappin
>>
>>
>>
>
>


Mime
View raw message