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.Transaction; 21 22 import org.apache.jdo.tck.pc.mylib.PCPoint; 23 import org.apache.jdo.tck.util.BatchTestRunner; 24 import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest; 25 26 /** 27 *<B>Title:</B> Get IgnoreCache Value from PersistenceManager 28 *<BR> 29 *<B>Keywords:</B> 30 *<BR> 31 *<B>Assertion ID:</B> A12.5.3-1. 32 *<BR> 33 *<B>Assertion Description: </B> 34 The PersistenceManager.getIgnoreCache method returns the current value of the 35 IgnoreCache option. 36 37 */ 38 39 public class GetIgnoreCache extends PersistenceManagerTest { 40 41 /** */ 42 private static final String ASSERTION_FAILED = 43 "Assertion A12.5.3-1 (GetIgnoreCache) failed: "; 44 45 /** 46 * The <code>main</code> is called when the class 47 * is directly executed from the command line. 48 * @param args The arguments passed to the program. 49 */ 50 public static void main(String[] args) { 51 BatchTestRunner.run(GetIgnoreCache.class); 52 } 53 54 /** */ 55 public void testGetIgnoreCache() { 56 pm = getPM(); 57 Transaction tx = pm.currentTransaction(); 58 try { 59 PCPoint p1 = new PCPoint(); 60 tx.begin(); 61 pm.setIgnoreCache(true); 62 boolean returnValue = pm.getIgnoreCache(); 63 64 if (!returnValue) 65 fail(ASSERTION_FAILED, 66 "pm.getIgnoreCache() returns false after setting the falg to true"); 67 tx.commit(); 68 } 69 finally { 70 if (tx.isActive()) 71 tx.rollback(); 72 } 73 pm.close(); 74 pm = null; 75 } 76 }