I'm running a test from Junit and get the following error:
(1)Steps in test: Sandbox.sandboxTest :
Mar 18, 2009 9:34:32 AM jsystem.framework.report.RunnerListenersManager addTestInfo
WARNING: Fail to load test code./root/develop/test_workspace/ManagerTest/tests/com/finjan/testing/helpers/Sandbox.java
Mar 18, 2009 9:34:32 AM junit.framework.SystemTestCaseImpl jsystemTestPreExecution
INFO: Running test: sandboxTest
the path /root/develop/test_workspace/ManagerTest/tests/com/finjan/testing/helpers/Sandbox.java is not accurate (I moved everything to another path), yet I don't know how to tell it to get to the correct place.
In the JRunner the test runs well.
10x,
Shira
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well - I closed the JRunner and that solved the problem.
Now I've got another problem (which was the first problem for which I ran the test in JUnit the first place):
I have a method named remoteCopy(src,dest) that knows to copy files to/From DUT, according to the source and destination given. it creates a FTPFileTransfer object, copies the file to the right direction, and closes the FTPFileTransfer object (ftpFileTransfer.close()).
If I do:
remoteCopy(remoteMachine, localMachine);
remoteCopy(localMachine, remoteMachine);
everything works fine.
If I do:
remoteCopy(localMachine, remoteMachine);
remoteCopy(remoteMachine, localMachine);
the second copy, from the remote to the local, does not work. I get a timeout. This is why I needed to run the test in JUnit to try to find the problem.
Here is the full log of the JUnit:
---------------------------------------------------Start of Log-----------------------------------------------------------------------------------
Mar 18, 2009 4:14:43 PM jsystem.framework.JSystemProperties initLogger
INFO: Logger was init
Test: Sandbox.sandboxTest
(1)Steps in test: Sandbox.sandboxTest :
Mar 18, 2009 4:14:44 PM junit.framework.SystemTestCaseImpl jsystemTestPreExecution
INFO: Running test: sandboxTest
16:14:44: ManagerSystemObject - In init method
16:14:44: Init cli, host: 192.168.120.52
publickey
password
Last login: Wed Mar 18 17:40:51 2009 from shira-linux.finjan.com
Linux vs-52 2.6.23.17-686 #1 SMP Tue Feb 26 12:06:23 UTC 2008 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
vs-52:~#
16:14:46: why copying files does not work
16:14:46: Copying from local /tmp/file_from_local to DUT /tmp/file_from_local
16:14:46: Getting FTPFileTransfer system object
16:14:46: Init cli, host: 192.168.120.52
publickey
password
Last login: Wed Mar 18 18:02:46 2009 from shira-linux.finjan.com
Linux vs-52 2.6.23.17-686 #1 SMP Tue Feb 26 12:06:23 UTC 2008 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
vs-52:~#
16:14:47: FTP Server is listening on all ips. port: 21
Server ready :: Apache FTP Server
Mar 18, 2009 4:14:48 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ------- Apache FTP Server started ------
16:14:48: Setting parameters for FTPFileTransfer
16:14:48: Initializing FTPFileTransfer
16:14:48: FTP Server is listening on all ips. port: 21
16:14:48: Another FTP server is already active.
16:14:48: Another FTP server is already active. Ignoring startServer operation
16:14:48: Copying from local machine to remote machine
vs-52:~# ftp 10.194.5.69
Connected to 10.194.5.69.
Mar 18, 2009 4:14:48 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Open connection - 192.168.120.52
220 Service ready for new user.
Name (10.194.5.69:root): aqua
331 User name okay, need password for aqua.
Password:Mar 18, 2009 4:14:48 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Login success - aqua
230 User logged in, proceed.
Remote system type is UNIX.
ftp> binary
200 Command TYPE okay.
ftp> Mar 18, 2009 4:14:49 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: File download : aqua - /1237392888142
get 1237392888142 /tmp/file_from_local
local: /tmp/file_from_local remote: 1237392888142
200 Command PORT okay.
150 File status okay; about to open data connection.
226 Transfer complete.
ftp> Mar 18, 2009 4:14:49 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Close connection : 192.168.120.52 - aqua
bye
221 Goodbye.
vs-52:~#
16:14:52: Could not find prompt after closing session. timeout: 2000
16:14:52: Copying from DUT /tmp/file_from_remote to local /tmp/file_from_remote
16:14:52: Getting FTPFileTransfer system object
16:14:52: Init cli, host: 192.168.120.52
publickey
password
Last login: Wed Mar 18 18:02:47 2009 from shira-linux.finjan.com
Linux vs-52 2.6.23.17-686 #1 SMP Tue Feb 26 12:06:23 UTC 2008 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
vs-52:~#
16:14:53: Setting parameters for FTPFileTransfer
16:14:53: Initializing FTPFileTransfer
16:14:53: FTP Server is listening on all ips. port: 21
16:14:53: Another FTP server is already active.
16:14:53: Another FTP server is already active. Ignoring startServer operation
16:14:53: Copying from remote machine to local machine
vs-52:~# ftp 10.194.5.69
ConnecteMar 18, 2009 4:14:54 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Open connection - 192.168.120.52
d to 10.194.5.69.
220 Service ready for new user.
Name (10.194.5.69:root): aqua
331 User name okay, need password for aqua.
Password:Mar 18, 2009 4:14:54 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Login success - aqua
230 User logged in, proceed.
Remote system type is UNIX.
ftp> binary
200 Command TYPE okay.
ftp> Mar 18, 2009 4:14:55 PM sun.reflect.NativeMethodAccessorImpl invoke0
WARNING: FtpDataConnection.getDataSocket()
java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.Socket.bind(Socket.java:564)
at java.net.Socket.<init>(Socket.java:363)
at java.net.Socket.<init>(Socket.java:266)
at org.apache.ftpserver.FtpDataConnection.getDataSocket(FtpDataConnection.java:205)
at org.apache.ftpserver.FtpRequestImpl.getDataInputStream(FtpRequestImpl.java:307)
at org.apache.ftpserver.command.STOR.execute(STOR.java:109)
at org.apache.ftpserver.RequestHandler.service(RequestHandler.java:277)
at org.apache.ftpserver.RequestHandler.run(RequestHandler.java:242)
at java.lang.Thread.run(Thread.java:619)
put /tmp/file_from_remote 1237392893719
local: /tmp/file_from_remote remote: 1237392893719
200 Command PORT okay.
150 File status okay; about to open data connection.
16:19:55: ManagerSystemObject - In close method
bye
16:19:57: Could not find prompt after closing session. timeout: 2000
----------------------------------------End of Log-----------------------------------------------------------------------------------------------
As you can see - there is a BindException - address already in use. How does it happen? Do I need to change something in remoteCopy
10x,
Shira
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My guess is you are running the test from the quick-launch (drop down) menu of the run\debug in the eclipse.
If so, then you should be aware eclipse is trying to run the test using the last defined parameters when you first executed the test (before moving it to a new location).
you can either:
1) open the run dialog from the drop down run menu, select the test and fix the path.
OR
2) run the test by selecting it and choosing the run a junit test - this will create a new entry in the drop down list with correct values.
let me know if this works
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I run the test by clicking on it, then right click and then Run As.
I opened Run Configuration, and didn't find anywhere to change the path of the test. I tried deleting the configuration of the test and re-running it again - got the same result.
Any more ideas?
10x,
Shira
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The error you have is in adding the test code to the Html summary.
as you can see, it is only a warning and not an error.
in order to accurately answer your question please specify the new path to which you moved your test source code.
10x,
Nizan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And one more problem I get in this test when running via JUnit:
In my system object (ManagerSystemObject) there is a method for copying files to the DUT. In this method I use a system object of type FTPFileTransfer.
ManagerSystemObject is initialized well, but when coming to initializing FTPFileTransfer, I get the following error:
I think the problem is with your "tests.src" property in the jsystem.properties file.
when running from the runner the properties file read is the one in the runner root.
when running from the eclipse it's the one in the project root.
please look at both file property values and let me know
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well - both suggestions have solved the problem. But then I got another one:
14:17:47: Copying from local machine to remote machine
vs-52:~# ftp 10.194.5.69
Connected to 10.194.5.69.
220 Service ready for new user.
Name (10.194.5.69:root): aqua
331 User name okay, need password for aqua.
Password:
230 User logged in, proceed.
Remote system type is UNIX.
ftp> binary
200 Command TYPE okay.
ftp> get 1237385867358 /tmp/file_from_local
local: /tmp/file_from_local remote: 1237385867358
200 Command PORT okay.
550 /1237385867358: No such file or directory.
ftp>
14:17:48: Fail: Failed in file transfer
SystemObject error line: com.aqua.filetransfer.ftp.FTPRemoteClient.copyFileFromLocalMachineToRemoteClient(FTPRemoteClient.java:165)
10.194.5.69 is the local machine. line 165 in FTPRemoteClient.java states: "stringbuffer.append(" ");" which is a bit weird that the error is there.
BTW - the code that calls copyFileFromLocalMachineToRemoteClient is
public void copyFileFromLocalMachineToRemoteMachine(InputStream source,File destination) throws Exception {
String fileName = destination.getPath();
File f = new File(getFtpServerHome(),""+System.currentTimeMillis());
f.deleteOnExit();
org.apache.commons.io.IOUtils.copy(source,new FileOutputStream(f));
remoteHostClient.setAscii(isAscii());
remoteHostClient.setPromptOn(isPrompt());
remoteHostClient.copyFileFromLocalMachineToRemoteClient(f.getName(), fileName);
}
from FTPFileTransfer.java.
Maybe there was a problem creating /1237385867358 (f) ?
Shira
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Usually you get this error when there is another FTP server open on runner's machine.
Look if there is another FTP server active, shut it down and run the test again.
A little bit background:
The FTPFileTransfer system object starts an FTP server, opens a telnet/ssh session to the remote machine and in the remote machine it activates FTP client (using telnet/ssh).
If there is another FTP server open on your machine, the internal FTP server is not started and files are copied to the already active FTP server root folder and the system object can't find them.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
I'm running a test from Junit and get the following error:
(1)Steps in test: Sandbox.sandboxTest :
Mar 18, 2009 9:34:32 AM jsystem.framework.report.RunnerListenersManager addTestInfo
WARNING: Fail to load test code./root/develop/test_workspace/ManagerTest/tests/com/finjan/testing/helpers/Sandbox.java
Mar 18, 2009 9:34:32 AM junit.framework.SystemTestCaseImpl jsystemTestPreExecution
INFO: Running test: sandboxTest
the path /root/develop/test_workspace/ManagerTest/tests/com/finjan/testing/helpers/Sandbox.java is not accurate (I moved everything to another path), yet I don't know how to tell it to get to the correct place.
In the JRunner the test runs well.
10x,
Shira
HI there!
Well - I closed the JRunner and that solved the problem.
Now I've got another problem (which was the first problem for which I ran the test in JUnit the first place):
I have a method named remoteCopy(src,dest) that knows to copy files to/From DUT, according to the source and destination given. it creates a FTPFileTransfer object, copies the file to the right direction, and closes the FTPFileTransfer object (ftpFileTransfer.close()).
If I do:
remoteCopy(remoteMachine, localMachine);
remoteCopy(localMachine, remoteMachine);
everything works fine.
If I do:
remoteCopy(localMachine, remoteMachine);
remoteCopy(remoteMachine, localMachine);
the second copy, from the remote to the local, does not work. I get a timeout. This is why I needed to run the test in JUnit to try to find the problem.
Here is the full log of the JUnit:
---------------------------------------------------Start of Log-----------------------------------------------------------------------------------
Mar 18, 2009 4:14:43 PM jsystem.framework.JSystemProperties initLogger
INFO: Logger was init
Test: Sandbox.sandboxTest
(1)Steps in test: Sandbox.sandboxTest :
Mar 18, 2009 4:14:44 PM junit.framework.SystemTestCaseImpl jsystemTestPreExecution
INFO: Running test: sandboxTest
16:14:44: ManagerSystemObject - In init method
16:14:44: Init cli, host: 192.168.120.52
publickey
password
Last login: Wed Mar 18 17:40:51 2009 from shira-linux.finjan.com
Linux vs-52 2.6.23.17-686 #1 SMP Tue Feb 26 12:06:23 UTC 2008 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
vs-52:~#
16:14:46: why copying files does not work
16:14:46: Copying from local /tmp/file_from_local to DUT /tmp/file_from_local
16:14:46: Getting FTPFileTransfer system object
16:14:46: Init cli, host: 192.168.120.52
publickey
password
Last login: Wed Mar 18 18:02:46 2009 from shira-linux.finjan.com
Linux vs-52 2.6.23.17-686 #1 SMP Tue Feb 26 12:06:23 UTC 2008 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
vs-52:~#
16:14:47: FTP Server is listening on all ips. port: 21
Server ready :: Apache FTP Server
Mar 18, 2009 4:14:48 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ------- Apache FTP Server started ------
16:14:48: Setting parameters for FTPFileTransfer
16:14:48: Initializing FTPFileTransfer
16:14:48: FTP Server is listening on all ips. port: 21
16:14:48: Another FTP server is already active.
16:14:48: Another FTP server is already active. Ignoring startServer operation
16:14:48: Copying from local machine to remote machine
vs-52:~# ftp 10.194.5.69
Connected to 10.194.5.69.
Mar 18, 2009 4:14:48 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Open connection - 192.168.120.52
220 Service ready for new user.
Name (10.194.5.69:root): aqua
331 User name okay, need password for aqua.
Password:Mar 18, 2009 4:14:48 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Login success - aqua
230 User logged in, proceed.
Remote system type is UNIX.
ftp> binary
200 Command TYPE okay.
ftp> Mar 18, 2009 4:14:49 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: File download : aqua - /1237392888142
get 1237392888142 /tmp/file_from_local
local: /tmp/file_from_local remote: 1237392888142
200 Command PORT okay.
150 File status okay; about to open data connection.
226 Transfer complete.
ftp> Mar 18, 2009 4:14:49 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Close connection : 192.168.120.52 - aqua
bye
221 Goodbye.
vs-52:~#
16:14:52: Could not find prompt after closing session. timeout: 2000
16:14:52: Copying from DUT /tmp/file_from_remote to local /tmp/file_from_remote
16:14:52: Getting FTPFileTransfer system object
16:14:52: Init cli, host: 192.168.120.52
publickey
password
Last login: Wed Mar 18 18:02:47 2009 from shira-linux.finjan.com
Linux vs-52 2.6.23.17-686 #1 SMP Tue Feb 26 12:06:23 UTC 2008 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
vs-52:~#
16:14:53: Setting parameters for FTPFileTransfer
16:14:53: Initializing FTPFileTransfer
16:14:53: FTP Server is listening on all ips. port: 21
16:14:53: Another FTP server is already active.
16:14:53: Another FTP server is already active. Ignoring startServer operation
16:14:53: Copying from remote machine to local machine
vs-52:~# ftp 10.194.5.69
ConnecteMar 18, 2009 4:14:54 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Open connection - 192.168.120.52
d to 10.194.5.69.
220 Service ready for new user.
Name (10.194.5.69:root): aqua
331 User name okay, need password for aqua.
Password:Mar 18, 2009 4:14:54 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Login success - aqua
230 User logged in, proceed.
Remote system type is UNIX.
ftp> binary
200 Command TYPE okay.
ftp> Mar 18, 2009 4:14:55 PM sun.reflect.NativeMethodAccessorImpl invoke0
WARNING: FtpDataConnection.getDataSocket()
java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.Socket.bind(Socket.java:564)
at java.net.Socket.<init>(Socket.java:363)
at java.net.Socket.<init>(Socket.java:266)
at org.apache.ftpserver.FtpDataConnection.getDataSocket(FtpDataConnection.java:205)
at org.apache.ftpserver.FtpRequestImpl.getDataInputStream(FtpRequestImpl.java:307)
at org.apache.ftpserver.command.STOR.execute(STOR.java:109)
at org.apache.ftpserver.RequestHandler.service(RequestHandler.java:277)
at org.apache.ftpserver.RequestHandler.run(RequestHandler.java:242)
at java.lang.Thread.run(Thread.java:619)
put /tmp/file_from_remote 1237392893719
local: /tmp/file_from_remote remote: 1237392893719
200 Command PORT okay.
150 File status okay; about to open data connection.
16:19:55: Fail: timeout: 300000
SystemObject error line: com.aqua.filetransfer.ftp.FTPRemoteClient.copyFileFromRemoteClientToLocalMachine(FTPRemoteClient.java:182)
Start time: Wed Mar 18 16:14:44 UTC 2009
End time : Wed Mar 18 16:19:55 UTC 2009
Test running time: 310 sec.
16:19:55: Fixture: root failTearDown
16:19:55: ManagerSystemObject - In close method
bye
16:19:57: Could not find prompt after closing session. timeout: 2000
----------------------------------------End of Log-----------------------------------------------------------------------------------------------
As you can see - there is a BindException - address already in use. How does it happen? Do I need to change something in remoteCopy
10x,
Shira
please send a clean and simple test that reproduces the problem to jsystemtest.com
We will look at it.
My guess is you are running the test from the quick-launch (drop down) menu of the run\debug in the eclipse.
If so, then you should be aware eclipse is trying to run the test using the last defined parameters when you first executed the test (before moving it to a new location).
you can either:
1) open the run dialog from the drop down run menu, select the test and fix the path.
OR
2) run the test by selecting it and choosing the run a junit test - this will create a new entry in the drop down list with correct values.
let me know if this works
Actually - it didn't work :)
I run the test by clicking on it, then right click and then Run As.
I opened Run Configuration, and didn't find anywhere to change the path of the test. I tried deleting the configuration of the test and re-running it again - got the same result.
Any more ideas?
10x,
Shira
My mistake,
I thought you had a different error.
The error you have is in adding the test code to the Html summary.
as you can see, it is only a warning and not an error.
in order to accurately answer your question please specify the new path to which you moved your test source code.
10x,
Nizan
Hi Nizan!
The new location of my source is:
/sandbox/src/Manager/test/MAT/ManagerTest/tests/com/finjan/testing/helpers/Sandbox.java
10x,
Shira
And one more problem I get in this test when running via JUnit:
In my system object (ManagerSystemObject) there is a method for copying files to the DUT. In this method I use a system object of type FTPFileTransfer.
ManagerSystemObject is initialized well, but when coming to initializing FTPFileTransfer, I get the following error:
11:28:06: Fail: org/apache/ftpserver/ftplet/User
SystemObject error line: com.aqua.filetransfer.ftp.FTPFileTransfer.init(FTPFileTransfer.java:122)
Again - this problem does not occur when running the test from JRunner. Is it related to the previous problem or has nothing to do with it?
10x,
Shira
I don't think they are related.
just so I get the full picture.
1) does the test run ok? and the only problem is the warning + no source code in html summary?
2) can you add
report.report("User directory = " + System.getProperty("user.dir"));
to your test code and send me the output of that line?
regarding the ftp - I need to check it out....
I think the problem is with your "tests.src" property in the jsystem.properties file.
when running from the runner the properties file read is the one in the runner root.
when running from the eclipse it's the one in the project root.
please look at both file property values and let me know
Regarding the Ftp issue, according to Golan,
please check the the following jars in in your project classpath:
commons-io-1.3.1.jar
commons-logging-1.0.4.jar
commons-net.jar
ftpserver-dev.jar
if not, they can all be found in the runner\thirdparty\commonlib folder
Hi Nizan!
Well - both suggestions have solved the problem. But then I got another one:
14:17:47: Copying from local machine to remote machine
vs-52:~# ftp 10.194.5.69
Connected to 10.194.5.69.
220 Service ready for new user.
Name (10.194.5.69:root): aqua
331 User name okay, need password for aqua.
Password:
230 User logged in, proceed.
Remote system type is UNIX.
ftp> binary
200 Command TYPE okay.
ftp> get 1237385867358 /tmp/file_from_local
local: /tmp/file_from_local remote: 1237385867358
200 Command PORT okay.
550 /1237385867358: No such file or directory.
ftp>
14:17:48: Fail: Failed in file transfer
SystemObject error line: com.aqua.filetransfer.ftp.FTPRemoteClient.copyFileFromLocalMachineToRemoteClient(FTPRemoteClient.java:165)
10.194.5.69 is the local machine. line 165 in FTPRemoteClient.java states: "stringbuffer.append(" ");" which is a bit weird that the error is there.
BTW - the code that calls copyFileFromLocalMachineToRemoteClient is
public void copyFileFromLocalMachineToRemoteMachine(InputStream source,File destination) throws Exception {
String fileName = destination.getPath();
File f = new File(getFtpServerHome(),""+System.currentTimeMillis());
f.deleteOnExit();
org.apache.commons.io.IOUtils.copy(source,new FileOutputStream(f));
remoteHostClient.setAscii(isAscii());
remoteHostClient.setPromptOn(isPrompt());
remoteHostClient.copyFileFromLocalMachineToRemoteClient(f.getName(), fileName);
}
from FTPFileTransfer.java.
Maybe there was a problem creating /1237385867358 (f) ?
Shira
Usually you get this error when there is another FTP server open on runner's machine.
Look if there is another FTP server active, shut it down and run the test again.
A little bit background:
The FTPFileTransfer system object starts an FTP server, opens a telnet/ssh session to the remote machine and in the remote machine it activates FTP client (using telnet/ssh).
If there is another FTP server open on your machine, the internal FTP server is not started and files are copied to the already active FTP server root folder and the system object can't find them.