Save This Page
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 Multithreaded False
   29    *<BR>
   30    *<B>Keywords:</B> multithreaded
   31    *<BR>
   32    *<B>Assertion ID:</B> A12.7-2.
   33    *<BR>
   34    *<B>Assertion Description: </B>
   35   If PersistenceManager.setMultithreaded is called with a value of false, a value of false
   36   will be returned when getMultithreaded is called.
   37   
   38    */
   39   
   40   public class SetMultithreadedFalse extends PersistenceManagerTest{
   41       
   42       /** */
   43       private static final String ASSERTION_FAILED = 
   44           "Assertion A12.7-2 (SetMultithreadedFalse) failed: ";
   45       
   46       /**
   47        * The <code>main</code> is called when the class
   48        * is directly executed from the command line.
   49        * @param args The arguments passed to the program.
   50        */
   51       public static void main(String[] args) {
   52           BatchTestRunner.run(SetMultithreadedFalse.class);
   53       }
   54   
   55       /** */
   56       public void test() {
   57           pm = getPM();
   58           
   59           runTestSetMultithreadedFalse(pm);
   60           
   61           pm.close();
   62           pm = null;
   63       }
   64       
   65       /** */
   66       private void runTestSetMultithreadedFalse(PersistenceManager pm) {
   67           Transaction tx = pm.currentTransaction();
   68           try {
   69               PCPoint p1 = new PCPoint();
   70               tx.begin();
   71               pm.setMultithreaded(false);
   72               if (pm.getMultithreaded()) {
   73                   fail(ASSERTION_FAILED,
   74                        "pm.getMultithreaded() should false true after setting the flag to false.");
   75               }
   76               tx.commit();
   77               tx = null;
   78           }
   79           finally {
   80               if ((tx != null) && tx.isActive())
   81                   tx.rollback();
   82           }
   83       }
   84   }

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