db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karan malhi <karan.ma...@gmail.com>
Subject Writing TestCase for Sequence Assertions
Date Thu, 15 Sep 2005 01:33:32 GMT
I am trying to follow Michelle's instructions and writing a test case 
for Sequence Assertions. I have the following question:
1. What package should i put my Test Case in?
2. Which .jdo file should i add the <sequence> element to?
3. I have specified my own .conf file, below are the contents of that file:
-------aaa.conf------------------------------------------
jdo.tck.description = Run one test for debugging
jdo.tck.testdata =
jdo.tck.standarddata =
jdo.tck.mapping = 0
jdo.tck.classes = org.apache.jdo.tck.api.persistencemanager.Test # 
Change the name of the class once the Test Case runs successfully
--------------------------------------------------------------------
As you can see from above, i was trying to run the Test Case so i 
temporarily made a Test Case named "Test" and put it in package 
org.apache.jdo.tck.api.persistencemanager. Then i  inserted the 
<sequence> element in
/test/applicationidentity/jdo/org/apache/jdo/tck/pc/company/package.jdo.

        <sequence name="TestSequence" datastore-sequence="TEST_SEQ" 
strategy="contiguous"/>

--------------Below is my test() method.---------------------

   public void test() {
        pm = getPM();
        Transaction tx = pm.currentTransaction();
        tx.begin();
        Sequence seq = 
pm.getSequence("org.apache.jdo.tck.pc.company.TestSequence");
//
//            fail(ASSERTION_FAILED,
//                     "Expected a sequence named 
org.apache.jdo.tck.pc.company.ProductSequence but got null instead");
//
        tx.commit();
        pm.close();
        pm = null;
        }
---------------------------------------------------------------
When i run the test i get  the following error (I know i am testing for 
this error if sequence not found, i just want to make sure i am doing 
stuff properly):

   [java] 1) 
test(org.apache.jdo.tck.api.persistencemanager.Test)javax.jdo.JDOUserException: 
The requested sequence "org.apache.jdo.tck.pc.company.ProductSequence" 
could not be found. Please mak
 sure that it is specified in a valid Meta-Data file.
   [java]      at 
org.jpox.AbstractPersistenceManager.getSequence(AbstractPersistenceManager.java:3133)
   [java]      at 
org.apache.jdo.tck.api.persistencemanager.Test.test(Test.java:65)
   [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 org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:204)
   [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:115)

Michelle: One issue here is that your instructions say that i should 
invoke maven -Djdo.tck.cfglist=aaa.conf installSchema first. If i do 
that with a mapping of jdo.tck.mapping=0, then it takes a long time to 
install the schema. Do we really need to installSchema everytime for the 
value 0. In my case, i am simply trying to test 
pm.getSequence("org.apache.jdo.tck.pc.company.TestSequence"), can i 
simply put a jdo.tck.mapping = 1 instead?

An early response would be appreciated

-- 
Karan Singh


Mime
View raw message