Hi,
I am trying to run a refactored version of the subject test (see below)
In the method, assertTrue(postCount > preCount); fails, whereas I want it to
pass, since the number of files "Rolled" are greater than the initial file
count
Could it be file.length? that is the problem?.
Could anyone give me a clue why?
Thanks,
-Kamal.
public void testBasicRollingFunctionality() {
PatternLayout layout = new PatternLayout("%m%n");
wmDfa = new WmDailyFileAppender();
wmDfa.setName("KEEP_THE_PRICES_ROLLING");
wmDfa.setLayout(layout);
wmDfa.setAppend(false);
wmDfa.setFile("./log/BASICROLLINGAPPTEST.log");
wmDfa.setDatePattern("'.'yyyy-MM-dd-HH-mm");
logger.addAppender(wmDfa);
wmDfa.activateOptions();
int preCount = getFileCount("log",
"BASICROLLINGAPPENDERTEST.log.");
System.out.println("preCount : " + preCount);
for (int i = 0; i < 25; i++) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
logger.debug("Hello---" + i);
}
int postCount = getFileCount("log",
"BASICROLLINGAPPENDERTEST.log.");
System.out.println("postCount : " + postCount);
assertTrue(postCount > preCount);
}
/**
* Helper Method, getFileCount
*/
private int getFileCount(String dir, String initial) {
String[] files = new File(dir).list();
int count = 0;
for (int i = 0; i < files.length; i++) {
if (files[i].startsWith(initial)) {
count++;
}
}
return count;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]