Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Testing RMI with Eclipse support

 
Paulo Crestani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Friends,

I am using Eclipse IDE to code my SCJD solution to take advantage of JUnit and other IDE tools during the coding phase.

Now I am up to start testing my network layer, but I�m having problems to accomplish this with Eclipse support. I downloaded an RMI plug in at http://www.genady.net/rmi/v20/ that should be working, but I am receiving a null pointer exception when trying to access my remote methods.

It seems that when the methods are invoked they are not found, but both my classes for server registration and client connection executed without exceptions. I suppose I am having trouble to create the remote class stub. If anyone has had the same problem or can help me somehow, that would be great.

Thank you,

Paulo C.
 
Marius Snyman
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this for testing purposes only? I see the spec defines sun java only for all development.
 
Paulo Crestani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,

It is for testing only. All my assignment code is pure Java and the testing tools would be just a way to make unit tests easier. In the end I will compile all the assignment classes by hand and apply system tests out of Eclipse. But so far I could not put RMI to work in Eclipse.

Paulo C.
 
Paulo Crestani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This post does not seem to have attracted much attention after all.

For those who may be interested in the future, I generated a class stub by hand with rmic, but still got a nullPointerException when invoking a remote method from JUnit.

Then I tried a test class with a main() method that I could run by command line and containing the same methods of the JUnit class (except that I suppressed the JUnit assertions). This time I could invoke the remote method without the nullPointerException.

Well, it seems I will have to test my RMI connection this way. It works. I don�t know why JUnit did not work. It is a question I leave for the generations to come.

Paulo C.
[ January 07, 2008: Message edited by: Paulo Crestani ]
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You are right, I didn't pay to much attention, mostly because it is not among the things I know or did

I used ant to generate the stubs.

As for unit test, even tho I didn't unit test the RMI part, I guess I would simply start rmiregistry from my unit test and access the methods as normal unit tests would. I'm not too sure what are the additional features provided by your plugin/library.

Could you please extrapolate and tell me the benefits of that plugin/library (for my personal interests)?

Regards,
Alex
 
Paulo Crestani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok Alex,

The benefits of the plugin are NONE in my opinion. I just thought they would help me put RMI to work, but then I realized that the problem was in the JUnit framework. So I uninstalled the plugin. Just forget about it, because all it does is some debug support.

Thanks,

Paulo C.
 
MarioAixel Rodriguez Jaen
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using eclipse 3.1 and 3.2 for my development. I used UnicastRemoteObject.exportObject to register my rmiserver. Then, I used the LocateRegistry to start the registry (although there are other methods to actually start and create a new one if needed). In order to have it running I added the VM arguments to define: codebase, security.policy, and server.hostname.

For the Client I did the same. I declared the VM arguments for codebase and security policy and executed the class as a java application.

I did not use any plugin to execute the RMI server nor the client. If you use the java Logger and set the log level to fine, there is plenty of info to be displayed.

Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic