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.util.BatchTestRunner; 24 import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest; 25 26 /** 27 *<B>Title:</B> Setting Flags With Transaction instance 28 *<BR> 29 *<B>Keywords: 30 *<BR> 31 *<B>Assertion ID:</B> A12.5.2-3. 32 *<BR> 33 *<B>Assertion Description: </B> 34 Even if the Transaction instance returned by PersistenceManager.currentTransaction 35 cannot be used for transaction completion (due to external transaction management), it still can be used to set flags. 36 37 */ 38 39 public class SettingFlagsWithTransactionInstance extends PersistenceManagerTest { 40 41 /** */ 42 private static final String ASSERTION_FAILED = 43 "Assertion A12.5.2-3 (SettingFlagsWithTransactionInstance) 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(SettingFlagsWithTransactionInstance.class); 52 } 53 54 /** */ 55 public void test() { 56 pm = getPM(); 57 58 runTestSettingFlagsWithTransactionInstance(pm); 59 60 pm.close(); 61 pm = null; 62 } 63 64 65 /** */ 66 private void runTestSettingFlagsWithTransactionInstance(PersistenceManager pm) { 67 Transaction tx = pm.currentTransaction(); 68 tx.setNontransactionalRead(false); 69 tx.setNontransactionalWrite(false); 70 tx.setRetainValues(false); 71 tx.setOptimistic(false); 72 } 73 }