Xml DB Installation
  1. Follow the installation instructions from http://www.oracle.com/technology/software/products/berkeley-db/index.html
  2. Download the appropriate version: Berkeley DB XML 2.5.16
  3. For Mac-OS, please follow the installation instructions in $PTII/ptdb/doc/OracleBerkeleyXMLDBMacOSXBuildInstructions.htm

Setting Environment Variables

For Windows
  • Add Installation\Berkeley DB XML 2.5.16\bin to the System PATH environment variable by doing Start Menu -> Settings -> Control Panels -> System -> Advanced -> Environment Variables and adding the value.

For Mac-OS

  • Add InstallationDirector/dbxml-2.5.16/install/lib to the DYLD_LIBRARY_PATH
    export DYLD_LIBRARY_PATH=${PTII}/vendors/misc/dbxml-2.5.16/install/lib:${DYLD_LIBRARY_PATH}
    export PATH=${PTII}/vendors/misc/dbxml-2.5.16/install/bin:${PATH}
    
If you place the above commands in ~/.bashrc, then you will not need to type them each time.

XML DB Setup

  1. Start up a command shell
    Mac OS X: Utilities | Terminal
    Windows: Start | Run | cmd
  2. cd to the ptdb/config/database/testdata director:
    Mac OS X:
     cd $PTII/ptdb/config/database/testdata
     

    Windows:
     cd %PTII%\ptdb\config\database\testdata
     
  3. Start up XML DB by running the dbxml command:
      dbxml
      
    Note: The testing script is configured to create a container (database file) with the name Testing.dbxml and it will also add some default models we used for testing our code. These models will ensure that the JUnits run correctly.

Creating a new database environment

  • Type run create_script.txt - the output of this command should be:
    dbxml> run create_script.txt
    Creating node storage container
    Document added, name = ReferenceFile.ptdbxml
    Document added, name = ModelContainsBothAttributes
    Document added, name = X
    Document added, name = Y
    Document added, name = NoNamesNoValues
    Document added, name = ContainsBothNamesButExchangedValues
    Document added, name = ContainsBothNamesOneValue
    Document added, name = ContainsOneNameValue
    Document added, name = NoNamesAllValues
    Document added, name = ModelB
    Document added, name = ModelA
    Document added, name = NoReferences
    Document added, name = modeltt
    Document added, name = CompositeActor
    
    dbxml>
    
  • Type the quit command to exit the environment and commit the data.
  • In $PTII/ptdb/config/ptdb-params.properties:
    1. Set DB_Url to the location where the Testing.dbxml file was created - This should be $PTII/ptdb/config/database/testdata.
    2. Set DB_Container_Name to the name of the container file: Testing.dbxml.
    For example
    DB_Class_Name = ptdb.kernel.database.OracleXMLDBConnection
    DB_Url = /Users/ptolemy/ptII/ptdb/config/database/testdata
    DB_Container_Name = Testing.dbxml
    Cache_Container_Name = temp_cache.dbxml
    
    You are done and may run the tests

    Updating a preexisting database environment. If you already have a database and want to add the test database infrastructure, start up dbxml as above and then type run update_script.txt. The output should be like:
    dbxml> run update_script.txt
    Document deleted, name = ReferenceFile.ptdbxml
    Document deleted, name = ModelContainsBothAttributes
    Document deleted, name = X
    Document deleted, name = Y
    Document deleted, name = NoNamesNoValues
    Document deleted, name = ContainsBothNamesButExchangedValues
    Document deleted, name = ContainsBothNamesOneValue
    Document deleted, name = ContainsOneNameValue
    Document deleted, name = NoNamesAllValues
    Document deleted, name = ModelB
    Document deleted, name = ModelA
    Document deleted, name = NoReferences
    Document deleted, name = modeltt
    Document deleted, name = CompositeActor
    Document added, name = ReferenceFile.ptdbxml
    Document added, name = ModelContainsBothAttributes
    Document added, name = X
    Document added, name = Y
    Document added, name = NoNamesNoValues
    Document added, name = ContainsBothNamesButExchangedValues
    Document added, name = ContainsBothNamesOneValue
    Document added, name = ContainsOneNameValue
    Document added, name = NoNamesAllValues
    Document added, name = ModelB
    Document added, name = ModelA
    Document added, name = NoReferences
    Document added, name = modeltt
    Document added, name = CompositeActor
    
  • Type the quit command to exit the environment and commit the data.