JUnit-Testing and GAE APIs

Some issues I encountered when testing a new Java library for loading multiple URLs in parallel on the Google Apps Engine (GAE) (more about that library in another post).

Here are some of the typical errors you might encounter:

Missing timeout class

java.lang.NoSuchMethodError: org.mortbay.thread.Timeout

Context menu on project: Properties -> Build Path -> Order and Export: move GWT SDK *above* App Engine SDK (cf. here)

Compilation unit was not seen

com.google.gwt.junit.JUnitFatalLaunchException: The test class 'com.test.client.MyTest' was not found in module 'com.text.Module'; no compilation unit for that type was seen

  • The test class needs to be within a package that is configured in the module file (*.gwt.xml). You should create a new source folder (Context menu on project -> New -> Source Folder) and create the whole package structure you use within your project up to client, e.g. com.company.client, and put your GWT tests in it. This way you make sure that the tests are not going to be deployed to GAE later on.
  • If you are testing client-side code, your test class needs implement GWTUnit *and* be run as GWTUnitTest *not* as JUnitTest 😉

API package not found

java.util.concurrent.ExecutionException: com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'urlfetch' or call 'Fetch()' was not found.

The GAE environment has not been initialized.

  • Set up the required libraries for testing:
    • Context menu on project -> Properties -> Build Path -> Libraries -> Add Variable -> Configure Variables -> New…: Set "SDK_ROOT" as name and search you disk for "appengine-api-stubs.jar" and copy the part before "/lib/impl" into the text box named "Path"
    • Select "SDK_ROOT" from the previous dialog, click "Extend…", unfold lib and impl and select "…labs.jar", "…stubs.jar", and "…api.jar"; unfold "lib/testing" and select "…testing.jar" — done, whew.
  • Add following lines to your test class:
    private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig());
    @Before public void setUp() { helper.setUp(); }
    @After public void tearDown() { helper.tearDown(); }
  • Have a look in com.google.appengine.tools.development.testing to see all the services/APIs available for testing and replace LocalURLFetchServiceTestConfig with the one you need.

I tried to keep it as brief as possible, for more details have a look at this page.

Missing Digikam Themes w/t KDE

Digikam is a great tool to manage and work on photos — my personal favorite for some years already. But it’s made for KDE and uses a lot of KDE-related libs and stuff, therefore, installing it in Gnome, Xfce, Lxde and the like will cost about 1gb because of the depenedencies.
Nevertheless, worth it. But it comes with a bright default skin rendering it completely unusable for working seriously on light and color settings of photos.

To add themes, you will have to install an extra package (as decribed here) like this:
sudo apt-get install kde-workspace-data
Yes, this will add more data to your disk, but only 10mb this time. 😉

Happy photo-tweaking!