27 August 2007

Javadoc fun

Teach us the holy knowledge of writing funny javadocs :)) - taken from the jUnit 3.8.1 Javadoc.

25 August 2007

jUnit, testing, testing

I finally wrote and succesfully run my first jUnit test :) Yay! (in fact that was a couple of days ago, but who counts?) In a way it was easier than I expected, but in some other ways, getting it to run and give the proper results was quite a tedious work.
It was easier than I expected, because all my previous contact with unit testing was a couple of years back, when I attended a short presentation about TDD with Visual Studio 2005 Beta2. And at the time everything was quite fuzzy for me. But the official documentation and the actual jUnit package for the dummy Gibberish protocol in SIP-Communicator proved to be quite a source of excelent samples :) .
Getting it run, and with the proper results was, though a totally different chore, mainly because of all the OSGi stuff inside SIP-Communicator (which, I must admit, I still don't fully understand). It took me a couple of hours and some help from Emil to edit the 3 (or was it 4) configuration files needed for the tests to be properly run. All in all it wasn't big thing, but getting it right from the first try might be tricky. That's way, and because it was mainly a trial-and-error process, I'll make a quick outline below:
  1. make sure your package mainfest file is correct (for the RSS this was rss.provider.slick.manifest.mf ). Care should be taken about which packages are imported using the Import-Package directive. No java.* (that includes packages like java.util or java.net) package should be included or Felix will throw an exception and won't load your bundle. This alone gave me a headache :D
  2. Edit lib/felix.unit.test.properties in order both to include aditional packages you might use and also to include your slick bundle (in this case file:sc-bundles/protocol-rss-slick.jar) in the list of bundles started by the ant build test. Again, include only packages not provided by the runtime. One important thing to note here is that you must also include the bundle that provides your protocol implementation (in this case file:sc-bundles/protocol-rss.jar). Even if it may be outright obvious, I had some rough time figuring out why it couldn't find any protocol provider for the RSS implementation.
  3. Create an Ant build target for your testing bundle and include it in the list of run targets.
  4. If you want to run just your tests, you might edit lib/testing.properties and comment the lines corresponding to the other tests and add only your package.
If you made the above steps right you should have no problems running your tests and with the right outcome.
Happy testing! :)

08 August 2007

check out. again...

It seems I do have a strange problem when it comes to using CVS. It's not version control systems in general, but CVS. Or at least, the CVS I'm using here, on Sip Communicator. Somehow, I never get it right. Each and every time I try to update my sources to the latest version in the repository something goes wrong and I end up with an uncompilable sandbox and a ton of error messages. And the final solution is always cvs co sip-communicator.
That was a little digression just to release some frustrations :D
The midterm review went fine, and I'm pretty pleased with the results so far. The reader looks a lot nicer now and I thinks it's a little more useful too. You can get to see a screenshot of the new plugin in the news section on www.sip-communicator.org. But, as the midterm went and passed the final evaluation is coming in pretty fast.
After some discussions with Vincent (of which I haven't seen that much recently) and Emil, the main things that should be ready by around 20 August are:
  • a meaningful way of uniquely identifying items within a RSS feed (that's work in progress, hopefully I'll finish this tonight)
  • making the online/offline button really work (right now you can sign-in/sign-out your RSS account but that will make no difference)
  • marking unreachable feeds as offline (timeouts, HTTP 404's, HTTP 403's, HTTP 500's, you name it)
  • least but not last, writing unit tests for the protocol
Hopefully, with a little help and counseling all the above bullets will get a checkmark. I had a block for the last dozen of days or so, and a problem on confidence (like being unable to write anything useful, with LOTS of times asking myself if I can do this or not), but Emil proved to be a great mentor, not only technically, but also on the more human side of open-source developement in GSoC :) Thanks man!
That's kinda all for today, I gotta go finish that patch.