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 java.util.Enumeration;
   21   import java.util.Properties;
   22   
   23   import javax.jdo.PersistenceManagerFactory;
   24   
   25   import org.apache.jdo.tck.JDO_Test;
   26   import org.apache.jdo.tck.util.BatchTestRunner;
   27   
   28   
   29   /**
   30    *<B>Title:</B>Get properties of PersistenceManagerFactory
   31    *<BR>
   32    *<B>Keywords:</B> persistencemanagerfactory
   33    *<BR>
   34    *<B>Assertion IDs:</B> A11.4-1.
   35    *<BR>
   36    *<B>Assertion Description: </B>
   37     PersistenceManagerFactory.getProperties() returns a Properties instance 
   38     containing two standard JDO implementation properties
   39     VendorName: The name of the JDO vendor. 
   40     VersionNumber: The version number string. 
   41    */
   42   
   43   public class GetProperties extends JDO_Test {
   44       
   45       /** */
   46       private static final String ASSERTION_FAILED = 
   47           "Assertion A11.4-1 (GetProperties) failed: ";
   48       
   49       /**
   50        * The <code>main</code> is called when the class
   51        * is directly executed from the command line.
   52        * @param args The arguments passed to the program.
   53        */
   54       public static void main(String[] args) {
   55           BatchTestRunner.run(GetProperties.class);
   56       }
   57   
   58       /** */
   59       public void test() {
   60          PersistenceManagerFactory pmf = getPMF();
   61          int foundStandardProperties = 0;
   62   
   63          Properties p = pmf.getProperties();
   64          for (Enumeration e = p.propertyNames(); e.hasMoreElements(); ) {
   65              String s = (String) e.nextElement();
   66              if (debug) logger.debug ("\t" + s + ": " + p.getProperty(s));
   67              
   68              if (s.equals("VendorName") || s.equals("VersionNumber")) {
   69                  foundStandardProperties++;
   70              }
   71          }
   72          
   73          if (foundStandardProperties != 2) {
   74              fail(ASSERTION_FAILED,
   75                   "Standard properties not found.");
   76          }
   77       }  
   78   }

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