Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JUnit unable to retrieve all properties from a property file

Reply
Thread Tools

JUnit unable to retrieve all properties from a property file

 
 
Alexandra Stehman
Guest
Posts: n/a
 
      04-12-2004
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
 
Reply With Quote
 
 
 
 
Chris Smith
Guest
Posts: n/a
 
      04-13-2004
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
 
Reply With Quote
 
 
 
 
Alexandra Stehman
Guest
Posts: n/a
 
      04-13-2004
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.get Bundle("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=?



http://www.velocityreviews.com/forums/(E-Mail Removed) (Alexandra Stehman) wrote in message news:<(E-Mail Removed). com>...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to copy all properties using properties.putAll() method. Sonal Java 3 12-07-2007 03:08 AM
Designer Property Serialization -- Sycning inner properties to designer property window Alexander Higgins ASP .Net Building Controls 3 07-30-2007 09:09 PM
Designer Property Serialization -- Sycning inner properties to designer property window Alexander Higgins ASP .Net Web Controls 0 07-21-2007 12:58 AM
JUNIT testSuite .. need to print all errors to file .. HELP. chrono Java 1 04-27-2005 02:45 AM
junit ant task problems loading up a .properties file Scout Java 0 08-04-2003 05:30 PM



Advertisments