Wednesday, April 11, 2012

Unit testing POF

Hello world!(still looking for that better greeting...), It has become a recurrent topic here in the blog, ok, this is the first post and nothing is recurrent, however I hope it will be.

POF is probably the most used type of serialization for coherence, because of its performance (it is around 10-12 times faster, which saves a lot on CPU cycles and the generated Binaries are about six times smaller than in normal serialization.) is far better than normal java serialization, however POF requires some configuration and implementation, as explained in the documentation.

Another factor that need to be considered is the maintenance cost to the development process. It is important  to make sure that mappings are up-to date to avoid, at best wasting time to fix something and at worst ending up with missing data or inverting two fields.

Proposed solutions:
The easiest and crudest way to do this is to simply have a unit test that puts all of your objects to their respective caches, then gets them and compares them to assert if they are equal. This however will take some time, as you must start a cache server, and, for these tests to be effective they must always be run at build time, and as you add more domain classes this will increase even more and your co-workers will no doubt plot to murder you.

When you are testing POF there is something simpler you can do, something I picked up from Dr. Alberto Forti on a project we worked together a while ago.

You can easily create and use the configurable POF context directly. The ability to do that also opens up some interesting possibilities in using POF with external systems, a topic I will cover on a later post.

Below is an example of a unit test using Configurable POF context:


7 comments:

  1. Nice post Guilherme! Had no idea about this way of accessing the POF serializer.
    And nice blog too!

    Cheers

    ReplyDelete
  2. Wow, thanks! This is exactly what I was looking for!

    ReplyDelete
  3. then found that the tablet ran fine but would not charge. To solve this, I soldered the whiteOR yellow OR blue ( thermister ) wire to the black wire. Seems to be charging now. flashlight batteries

    ReplyDelete
  4. These batteries are not suitable for smaller products as the battery has been designed to work in situations which require lots of energy.How to recondition batteries

    ReplyDelete
  5. Actually I read it yesterday but I had some thoughts about it and today I wanted to read it again because it is very well written. best 6 volts batteries

    ReplyDelete
  6. Harrah's Casino in Atlantic City, NJ - Mapyro
    Get directions, 상주 출장마사지 reviews 춘천 출장마사지 and information 광명 출장샵 for Harrah's Casino in Atlantic City, NJ. 나주 출장안마 Harrah's Philadelphia Casino & Racetrack, 양산 출장마사지 Philadelphia

    ReplyDelete
  7. After getting into your personal information, be ready to share a piece of identification earlier than activating your account. We are committed path of|in course of} customer satisfaction, and high quality service. Cale Makar says the early portion of Avalanche schedule is “ridiculous.” Here’s how it’s showing. Whatever you resolve to do, remember that that|do not forget that} playing can be 카지노 problematic.

    ReplyDelete