Hi
As you can figure out based on the post title, I want to start to play with Mobile development using Java (no, I haven't gave up on .Net :); it just happens that I own an N95 and I want to write a little application for it1).
After downloading latest Nokia SDK I tried to follow the steps in the documentation (IDEs for Java Development) but I just get the infamous error:
Cannot start Series 60 SDK for MIDP
while importing the device.
Thanks God, it was just a matter of "googling" for the error message and I got the following page
http://wiki.urban.cens.ucla.edu/index.php?title=Nokia's_Java_Platform_(Carbide.j)
which fixed the issue (I just search in my hard disks and found 5 copies of the offending DLL).
Well, since my daughter has just born I guess this project will run really slowly but I hope it will not stall :)
Best
Adriano
1. I am planning to write an application that stores information about gym exercises in a db4o database.
As you probably already know :), Sharpen is a tool (developed by db4o) that aims at easing development efforts by translating java source code into C#. This tools make it easier to provide native solutions in either Java/.Net platforms.
While talking about how to run Sharpen test suite in this post I told that I'd show how to improve these tests startup time.
After a long wait, here it is. So let's go.
If you tried to run Sharpen tests you probably noticed that whenever you launch them a new Eclipse instance starts also (with it's full GUI) and this is one of the culprits for these tests to take longer than necessary to run. The good news is that it's (relatively) easy to configure Eclipse to not display any GUI at all (since all feedback will be given through the main Eclipse window).
To do this, once you checkout all required projects from db4o SVN, just Right Click sharpen.ui.tests project and select Run As / Run Configurations menu.
Now, in "Run Configuration" dialog, right click on "JUnit Plug-in Test" and select New.
If you followed the previous steps, "Run all tests ...." should contain the right value (sharpen.ui.tests). Just make sure that you have the latest JUnit selected on "Test Runner" dropdown.
We are almost there... :)
The next step is to click on "Main" tab (1), then select "Run as Application" checkbox and select "[No Application] - Headless mode" in the dropdown (2) and finally, click "Run" button (3).
That's it :)
Notice that now sharpen test suite starts faster.
Many thanks to a great friend (Rodrigo) for sharing this information with me.
See you.
Hi,
This morning a friend of mine send me this link about colaborative development in eclipse. Very interesting
Adriano
Hi.
If you start using sharpen, you'll probably find some limitation / bug and, maybe, want to take a look into the issue.
In this case the best approach (IMHO) would be to i) start a discussion in Sharpen Forum and, if appropriated (in the case there's no issue filed already), ii) file a new Jira issue into our issue tracking system.
Next, if you have the time, iii) try to replicate the behavior with a minimal test case. The last step iv) would be trying to fix the issue.
This post is all about iii, or to be more clear, on how to run / write unit tests for Sharpen.
Let's start by opening an empty eclipse workspace:
Next, open SVN perspective and add a new SVN repository pointing to
https://source.db4o.com/db4o/trunk/sharpen/
and checkout all projects.
No install the plugin (as explained here):
- In package explorer (Java perspective), right click on sharpen.core and select "Export" from the context menu.
- Expand the "Plug-in Development" folder and select "Deployable plug-ins and fragments".
- Set "Destination" to the root folder of your eclipse installation and click "Finish";
Now you can run Sharpen Tests by right clicking on "sharpen.ui.tests" and selecting "Run as / JUnit Plug-in Test";
after some processing your screen should look something like:
When the tests finishes you should see 0 (zero) errors and failures (as of today, there's some issue with sharpen.builder and sometimes you will get 2 errors in its tests but these errors don't prevent sharpen to work properly and, as you can see, when I executed the tests the errors didn't showed up).
Now let's explore the general look 'n' feel of a Sharpen test. In package explorer expand the node sharpen.ui.tests then testscases.
For each sharpen functionality there will be at least one pair of files (collectively called Test Case Resource):- One .java.txt that stores the java source to be converted;
- One .cs.txt storing the expected sharpened file;
In the above picture we are testing interface conversion. Take the time to poke around testcases folder checking some of the tests.
The next logical step is to add new tests. Basically to add a new tests we need to:
- Create the original java source (.java.txt)
- Create the expected cs file (.cs.txt)
- Plug these two files into the test engine. In the common scenarios, all we have to do is to call runResourceTestCase() function.
To see an example, just expand sharpen.ui.tests/src/sharpen.ui.tests folder and double click on NativeInterfacesTestCase.java.
In a future post (soon I hope) I want to take a look in a few other points such as:
- Getting a little better performance when starting sharpen using the approach presented in this post.
- How to debug sharpen.
- A trick to see the expected / actual values (useful when creating new tests).
Thoughts?
Adriano