JUnit unable to retrieve all properties from a property file

Discussion in 'Java' started by Alexandra Stehman, Apr 12, 2004.

  1. Hello,

    This sounds odd, but when I run a JUnit test it retrieves the first of
    several properties just fine.

    However, when it is reading the other properties, it returns:
    -------------TEST 9: obtainFileLock()START -------------
    Got all properties but the unlockFileByIDQuery and
    unlockFileByAttribsQuery

    Does this make any sense to anyone?

    Thanks so much,
    Alexandra
     
    Alexandra Stehman, Apr 12, 2004
    #1
    1. Advertising

  2. Alexandra Stehman

    Chris Smith Guest

    Alexandra Stehman wrote:
    > Hello,
    >
    > This sounds odd, but when I run a JUnit test it retrieves the first of
    > several properties just fine.
    >
    > However, when it is reading the other properties, it returns:
    > -------------TEST 9: obtainFileLock()START -------------
    > Got all properties but the unlockFileByIDQuery and
    > unlockFileByAttribsQuery
    >
    > Does this make any sense to anyone?


    Not without seeing the code and properties file contents. Can you post
    those?

    --
    www.designacourse.com
    The Easiest Way to Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, Apr 13, 2004
    #2
    1. Advertising

  3. code snippet & prop file

    Here's the snippet accessing the prop file, which exists at the top
    level of a JAR file in the project classpath (top level meaning, same
    level as com):

    private void initProperties()
    {
    properties =
    (PropertyResourceBundle)PropertyResourceBundle.getBundle("fileregistry");
    /**
    * set up the queries from the properties file
    */
    addQuery = properties.getString(addQueryAttribute);
    getQuery = properties.getString(getQueryAttribute);
    updateQuery =
    properties.getString(updateQueryAttribute);
    deleteQuery =
    properties.getString(deleteQueryAttribute);
    existsQuery =
    properties.getString(existsQueryAttribute);
    lockQueryOnId =
    properties.getString(lockQueryOnIdAttribute);
    lockQueryOnAttribs =
    properties.getString(lockQueryOnAttribsAttribute);
    System.out.println("Got all properties but the
    unlockFileByIDQuery and unlockFileByAttribsQuery");
    unlockFileByIDQuery =
    properties.getString(fileUnlockSQL1);
    unlockFileByAttribsQuery =
    properties.getString(fileUnlockSQL2);
    }


    The vars defined above:
    private final static String deleteQueryAttribute =
    "fileDeleteSQL";
    private final static String addQueryAttribute = "fileAddSQL";
    private final static String lockFileByAttributes =
    "fileUpdateLockAttribsSQL";
    private final static String getQueryAttribute = "fileGetSQL";
    private final static String updateQueryAttribute =
    "fileUpdateSQL";
    private final static String lockQueryOnIdAttribute =
    "fileLockSQL1";
    private final static String lockQueryOnAttribsAttribute =
    "fileLockSQL2";
    private final static String updateFileSizeSQL =
    "updateFileSizeSQL";
    private final static String fileErrorSQL = "fileErrorSQL";
    private final static String fileUnlockSQL1 = "fileUnlockSQL1";
    private final static String fileUnlockSQL2 = "fileUnlockSQL2";
    private String unlockFileByAttribsQuery = "";


    Here are the prop file contents:

    fileAddSQL = insert into core.global_file_registry (FILE_ID,
    FILE_NAME, FILE_SIZE, LOCATION, HOST_SERVER, DATE_UPLOADED, STATUS,
    ERROR_CODE) values (core.global_file_registry_seq.nextval, ?, ?, ?,
    ?, SYSDATE, ?, 0)
    fileLockSQL1 = select * from core.global_file_registry where file_id=?
    for update nowait
    fileLockSQL2 = select * from core.global_file_registry where
    host_server=? and location=? and file_name=? for update nowait
    fileGetSQL = select * from core.global_file_registry where
    host_server=? and location=? and file_name=?
    fileDeleteSQL = delete from core.global_file_registry where
    host_server=? and location=? and file_name=? and file_size=?
    fileUpdateSQL = update core.global_file_registry set file_size=?,
    host_server=?, location=?, file_name=?, status=? where file_id=?
    fileExistsSQL = select count(*) as rowcount from
    core.global_file_registry where host_server=? and location=? and
    file_name=? and file_size=?
    fileInProgressSQL = update core.global_file_registry set status='IN
    PROGRESS' where file_id=?
    fileErrorSQL = update core.global_file_registry set status='ERROR'
    where file_id=?
    fileUpdateLockAttribsSQL = update core.global_file_registry set
    STATUS='LOCKED', THREAD_ID=?, THREAD_NAME=?, TIME_LOCKED=SYSDATE where
    host_server=? and location=? and file_name=?
    fileUnlockSQL1 = update core.global_file_registry set
    STATUS='AVAILABLE' where file_id=?
    fileUnlockSQL2 = update core.global_file_registry set
    STATUS='AVAILABLE' where host_server=? and location=? and file_name=?



    (Alexandra Stehman) wrote in message news:<>...
    > Hello,
    >
    > This sounds odd, but when I run a JUnit test it retrieves the first of
    > several properties just fine.
    >
    > However, when it is reading the other properties, it returns:
    > -------------TEST 9: obtainFileLock()START -------------
    > Got all properties but the unlockFileByIDQuery and
    > unlockFileByAttribsQuery
    >
    > Does this make any sense to anyone?
    >
    > Thanks so much,
    > Alexandra
     
    Alexandra Stehman, Apr 13, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scout
    Replies:
    0
    Views:
    548
    Scout
    Aug 4, 2003
  2. chrono
    Replies:
    1
    Views:
    604
    Scott Conway
    Apr 27, 2005
  3. Alexander Higgins
    Replies:
    3
    Views:
    1,111
    Teemu Keiski
    Jul 30, 2007
  4. Alexander Higgins
    Replies:
    0
    Views:
    470
    Alexander Higgins
    Jul 21, 2007
  5. Jake Barnes
    Replies:
    6
    Views:
    447
    9.co.uk
    Feb 8, 2006
Loading...

Share This Page