Tuesday, March 29, 2005

Turning On Remote X Access

By default, KDE (on SuSE, anyway) turns off remote Xserver access. This means that you can't run an X app on another box (say, hopper) and have the display window show up on your own.

To enable this, edit:


and change at least the first line to not have the "-nolisten tcp" option, then log out of X (back to kdm).

You'll still need to point the remote box to yours for display, i.e. "export DISPLAY=yourbox.foo.com:0.0" before running your app.

This is pretty simple, so you may wonder why I'm mentioning it. Seems that there's a file /etc/X11/xinit/xserverrc with a line in it that mentions a variable called $DISPLAYMANAGER_XSERVER_TCP_PORT_6000_OPEN. This is set in /etc/sysconfig/displaymanager, which is sourced right above it. So I set this var in /etc/sysconfig/displaymanager, and it had no effect. I eventually grepped for "-nolisten tcp", which appeared to be the culprit, and found /etc/X11/xdm/Xservers, but changing that did nothing, either. Nor did the file /etc/opt/kde/share/config/kdm/Xservers, which was just a symlink back to /etc/X11/xdm/Xservers.

As always, Google was my friend, and I found a post that pointed me to the right file, so I'm posting this, in case it might be of some use to a fellow traveler.

Wednesday, March 09, 2005

Eclipse Not Finding My TestCase

I wrestled with Eclipse yesterday, regarding a JUnit TestCase. I had always just added a class derived from TestCase, implemented my test methods, and Eclipse has always just run it. I have a Run task that runs all test cases in the project, and I've never had to do anything special. Until today. (Well, sort of.)

Today, I added a new TestCase-derived class. And because I try to write (at least) one test method for each method in the tested class, I copied my actual methods over to the test class, and renamed the methods to start with 'test'. (Yes, I know I should have tested first. Sorry.) I then added an implementation, and ran it. And it passed.

Hmm. My tests usually don't run right the first time, and frequently I sabotage them to make sure they don't, so I know they're being run. I check Eclipse's run window, and sure enough, they're not being run. I go into the Run dialog, and I can't even specify the class in the single-test option.

After much wrestling and wrangling, it turns out that my flaw was in copying the methods over. Seems I forgot to take the parms out. Seems that Eclipse saw no void methods w/no parms starting w/'test', and assumed that this wasn't a TestCase. And wouldn't even show it.

Now, if it sounds like I'm a little miffed at Eclipse, I suppose I am. But what *should* Eclipse have done? Ideally, I suppose a failure could have come up, saying "cannot run anything in this TestCase". Or at least show the class in the Run-single mode, and complain when I try to save it that there aren't any methods with the required signature.

Anyway, now I know. And I'll go back to writing the test cases first. I promise. <sulk>