Exception java.io.File - Works with JUnit, Fails with JUnit TPTP [message #125317] |
Tue, 04 March 2008 16:23 |
Eclipse User |
|
|
|
Originally posted by: maxime.lem.gmail.com
Hello,
I'm accessing in JUnit script files located on a network folder.
When I execute my code as JUnit test or as Java application, code is
executed successfully.
After importing my JUnit script as TPTP JUnit, and executing it as "Test",
I can't access anymore files that are not local to the system.
By example :
import java.io.*;
public static void testFile() {
final String filename = "\\\\myServerName\\myNetworkShare";
File file = new File(filename);
String filesList[] = file.list();
System.out.println("There are " + filesList.length + " files");
}
I'm calling testFile() from a test method of a JUnit TestCase, converted
to TPTP. If I run this test as JUnit, it works. If I run it as TPTP test,
I've got a NullPointerException.
If filename variable is set to a local folder, by example, C:\\Program
Files, it works for TPTP.
It seems that there is a problem for accessing network resource within
TPTP JUnit.
Is my TPTP configuration is wrong ?
Can you help me ?
Thanks
|
|
|
Re: Exception java.io.File - Works with JUnit, Fails with JUnit TPTP [message #125391 is a reply to message #125317] |
Wed, 05 March 2008 10:46 |
Eclipse User |
|
|
|
Originally posted by: maxime.lem.gmail.com
Found the problem. I was right with "It seems that there is a problem for
accessing network resource within TPTP JUnit."
TPTP runs tests with Agent Controler account. By default, this account is
local System, and this account cannot access remote folders that require
an authentication.
Solution is to change the account used for running agent controler
service, with one authenticated by the domain controler.
|
|
|
Powered by
FUDForum. Page generated in 0.05250 seconds