JUnit unable to retrieve all properties from a property file

A

Alexandra Stehman

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
 
C

Chris Smith

Alexandra said:
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
 
A

Alexandra Stehman

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=?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top