Save This Page
Home » jdo2-tck-2.3-ea-src » org.apache.jdo.tck.api.persistencemanagerfactory » [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.persistencemanagerfactory;
   19   
   20   import javax.jdo.JDOHelper;
   21   import javax.jdo.PersistenceManagerFactory;
   22   
   23   import org.apache.jdo.tck.util.BatchTestRunner;
   24   
   25   /**
   26    *<B>Title:</B>GetPMFByResource of PersistenceManagerFactory  
   27    *<BR>
   28    *<B>Keywords:</B> persistencemanagerfactory
   29    *<BR>
   30    *<B>Assertion IDs:</B> A8.6-15.
   31    *<BR>
   32    *<B>Assertion Description: </B>
   33    * Uses the parameter(s) passed as arguments to construct a Properties 
   34    * instance, and then delegates to the static method 
   35    * getPersistenceManagerFactory in the class named in the property 
   36    * javax.jdo.PersistenceManagerFactoryClass. 
   37    * If there are any exceptions while trying to construct the Properties
   38    * instance or to call the static method, 
   39    * then either A8.6-4 [JDOFatalUserException] or 
   40    * A8.6-5 [JDOFatalInternalException is thrown], 
   41    * depending on whether the exception is due to the user 
   42    * or the implementation. 
   43    * The nested exception indicates the cause of the exception.
   44    * 
   45    * @author Michael Watzek
   46    */
   47   
   48   public class GetPMFByResource extends AbstractGetPMF {
   49       
   50       /** */
   51       private static final String ASSERTION_FAILED = 
   52           "Assertion A8.6-15 (GetPMFByResource) failed: ";
   53       
   54       /**
   55        * The <code>main</code> is called when the class
   56        * is directly executed from the command line.
   57        * @param args The arguments passed to the program.
   58        */
   59       public static void main(String[] args) {
   60           BatchTestRunner.run(GetPMFByResource.class);
   61       }
   62   
   63       /** */
   64       public void testInvalidGetPMF() {
   65           checkGetPMFWithInvalidProperties(ASSERTION_FAILED);
   66       }
   67   
   68       /** */
   69       public void testValidGetPMF() {
   70           checkGetPMFWithValidProperties();
   71       }
   72   
   73       /** */
   74       protected PersistenceManagerFactory getPMF(String name) {
   75           return JDOHelper.getPersistenceManagerFactory(removePathPrefix(name));
   76       }
   77   }

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