Home » jdo2-tck-2.3-ea-src » org.apache.jdo.tck.api.persistencemanager.flags » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    * 
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    * 
   11    * Unless required by applicable law or agreed to in writing, software 
   12    * distributed under the License is distributed on an "AS IS" BASIS, 
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
   14    * See the License for the specific language governing permissions and 
   15    * limitations under the License.
   16    */
   17   
   18   package org.apache.jdo.tck.api.persistencemanager.flags;
   19   
   20   import javax.jdo.PersistenceManager;
   21   import javax.jdo.Transaction;
   22   
   23   import org.apache.jdo.tck.pc.mylib.PCPoint;
   24   import org.apache.jdo.tck.util.BatchTestRunner;
   25   import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
   26   
   27   /**
   28    *<B>Title:</B> Set IgnoreCache To False
   29    *<BR>
   30    *<B>Keywords:cache
   31    *<BR>
   32    *<B>Assertion ID:</B> A12.5.3-3.
   33    *<BR>
   34    *<B>Assertion Description: </B>
   35   The PersistenceManager.setIgnoreCache method called with a value of false instructs the
   36   query engine that the user expects queries to return results that reflect changed values in the cache.
   37   
   38   
   39    */
   40   
   41   public class SetIgnoreCacheToFalse extends PersistenceManagerTest {
   42       
   43       /** */
   44       private static final String ASSERTION_FAILED = 
   45           "Assertion A12.5.3-3 (SetIgnoreCacheToFalse) failed: ";
   46       
   47       /**
   48        * The <code>main</code> is called when the class
   49        * is directly executed from the command line.
   50        * @param args The arguments passed to the program.
   51        */
   52       public static void main(String[] args) {
   53           BatchTestRunner.run(SetIgnoreCacheToFalse.class);
   54       }
   55   
   56       /** */
   57       public void test() {
   58           pm = getPM();
   59       
   60           runTestSetIgnoreCacheToFalse(pm);
   61           
   62           pm.close();
   63           pm = null;
   64       }
   65   
   66       /** */
   67       private void runTestSetIgnoreCacheToFalse(PersistenceManager pm) {
   68           Transaction tx = pm.currentTransaction();
   69           try {
   70               PCPoint p1 = new PCPoint();
   71               tx.begin();
   72               pm.setIgnoreCache(false);
   73               if (pm.getIgnoreCache()) {
   74                   fail(ASSERTION_FAILED,
   75                        "pm.getIgnoreCache() should return false after setting the flag to false.");
   76               }
   77               tx.commit();
   78               tx = null;
   79           }
   80           finally {
   81               if ((tx != null) && tx.isActive())
   82                   tx.rollback();
   83           }
   84       }
   85   }

Home » jdo2-tck-2.3-ea-src » org.apache.jdo.tck.api.persistencemanager.flags » [javadoc | source]