Skip to main content
Last updated February 17, 2013 21:15, by Timon Veenstra
Feedicon  

Introduction

This page contains various useful sections for developers.


Version Control

Mercurial hg

On windows: Install TortoiseHG or use the netbeans plugin. Edit C:\Users\username\mercurial.ini. Add the following under "ui":

username = DisplayName <emailaddress@gmail.com>

Sources

Netbeans plugin 'Team Server' - is all you need

The only thing to get in contact with java.net is the plugin 'Team Server' ( located under 'Tools'-'Plugins', tab 'Available plugins' ). You do not have to install additional Mercurial, the plugin handles this.

After you have installed the plugin, a new menu-item ( 'Team Server' ) will appear under the top-menu 'Team'.

Here you can login to your java.net account. After that you have logged in, all your java.net-projects will be visible in the Team-Window.

Double click on the bar 'AgroSense: Modular Farm Manager', you will see a node named 'Sources'. Open that node and fetch the 'Core Source Code Repository' by pressing the link 'get'

Howto contribute code

  # *create a local clone of your serverside clone*
    * $hg clone ssh://@hg.java.net/agrosense~core (or use  https://hg.java.net/hg/agrosense~core )
    * or use a tool like tortoise hg
    * *if you already have a serverside and local clone, pull in the latest changes from the main repo*
      # https://hg.java.net/hg/agrosense~core 
      # $hg merge
  # *write a test for the problem you want to solve*
    * locate the module the problem exists in
    * add a test to an existing test class or create a new one
  # *make the code changes so the test succeeds and the problem is solved*
    * use the default netbeans java code formatter to format your newly written code
    * add usefull comments to your code
    * add javadoc to new methods
    * code will also be checked by sonar, you can request a hudson sonar job with a committer
  # *commit your changes*
    * $hg commit
  # *push your changes to your serverside clone*
    * $hg push
    * start your hudson build if you have requested one
  # *request a review*
    * for code reviews we use the rietveld review tool, located at: http://cloudfarming-review.appspot.com/
    * use the upload.py script to create your review request
    * UploadPyUsage
    * $upload.py --send_mail -r <email of a committer> --rev=<revisions you made changes on>
    * revision id is usually one of the revisions listed here
  # *process review comments*
    * comment on the review comment to indicate what you have done with it, or why you disagree.
  # *update review request*
    * do NOT for get to add the -i parameter when you add additional code to the review, otherwise a new review request will be made, which makes it very hard to keep track of the changes.
    * $upload.py --send_mail -i <review id> -r <email of a committer> --rev=<revisions you made changes on>

Merging

Todo.

Definition of done

  # It compiles
  # There are no unit test failures (nor @Ignored tests)
  # There are no integration test failures (nor @Ignored tests)
  # The test coverage is atleast 80% (line and branch)
  # The code changes have been reviewed
  # The code is well documented (by choosing good names and adding comments)
  # The usermanual have been updated
  # The change have been tested in a running application (with success)
  # the code changes have been merged into the main repository
  # No new blockers/criticals/majors appeared in sonar
  # A happy dance have been performed in public (we suggest the funky chicken, but own creations are encouraged)


Know development issues

[WARNING] Overriding profile: 'default' (source: pom) with new instance from source: pom

issue: [WARNING] Overriding profile: 'default' (source: pom) with new instance from source: pom

cause: MIGLayout does not use an id in its maven profiles.

java.lang.UnsatisfiedLinkError: sun.awt.motif.MToolkit.init(Ljava/lang/String;)

issue: java.lang.UnsatisfiedLinkError: sun.awt.motif.MToolkit.init(Ljava/lang/String;)

when running tests on a linux environment

Solution: -Dawt.toolkit=sun.awt.motif.MToolkit

To solve this in Netbeans, go to Tools->options->Miscellaneous->Maven

Put -Dawt.toolkit=sun.awt.motif.MToolkit in Global Execution Options

This only happens when there is more then 1 initialization block:

    static{
        // there can be only one of these calls, put in superclass if more needed
        UISpec4J.init();
    }
Move static initialization to a superclass if more then one test class is needed

Missing libraries (flamengo and trident)


issue: Two dependency's of lib-flamengo are not in maven central

solution: http://java.net/projects/nb-library-wrappers/pages/Home#lib-flamengo

Missing library for Greenseeker

Not applicable anymore, library has been published on maven central
The Greenseeker sensor module uses a library that has not yet been published on Maven Central; JavaDBF. To be able to build this module, you need to inject the library into your local Maven repository:

$ wget http://sarovar.org/frs/download.php/257/javadbf-0.4.0.jar
$ mvn install:install-file -Dfile=javadbf-0.4.0.jar -DgroupId=com.linuxense -DartifactId=javadbf -Dversion=0.4.0 -Dpackaging=jar

Releases

Howto make a release

Requirments

  • a registered pgp key guide
  • a oss.sonatype.org account linked to nl.cloudfarming, read the guide
  • be able to upload artifacts (ie not be behind a proxy)
  • oss servers should be configured in your ~/.m2/settings.xml

  <servers>
    <server>
      <id>sonatype-nexus-snapshots</id>
      <username>user</username>
      <password>password</password>
    </server>
    <server>
      <id>sonatype-nexus-staging</id>
      <username>user</username>
      <password>password</password>
    </server>
  </servers>

release process


The release note: repeat this for agrosense~extra

  1. $mvn release:prepare #note: accept defaults for versions and tag
  2. $mvn clean install #to correct the missing db exception, should be fixed
  3. $mvn release:prepare -Dresume
  4. $mvn release:perform
  5. @oss.sonatype.org >- close the release repository
  6. @oss.sonatype.org - >release the release repository

Update the updatecenter

  1. $hg update <release tag> #for example hg update parent-core-1.0.12
  2. $cd modules-core
  3. $mvn clean package -Pdeployment
  4. update the update center (upload the catalog.xml and .gz to agrosense.nl/updates/core/1.0/)
  5. files can be found in : ../../agrosense~core/modules-core/target/netbeans_site/catalog.* stable/
  6. $hg commit;hg push

Let people know about the releasenext part is incorrect

  1. Upload the application
    1. $hg update <release tag> #for example hg update cloudfarming-client-1.0.9
    2. open the project in the netbeans IDE
    3. select the application module and choose build installers. When it does not create all installers, open up the project properties for the application module and enable them all under "installer".
    4. create download folder @ http://java.net/projects/agrosense/downloads/
    5. upload the installers (found in application/target) and the zip in the download folder
  2. create a release notes wiki page with the jira release notes
  3. release the version in jira and move open issues to the next version
  4. send a release mail to dev@agrosense.java.net, announce@agrosense.java.net and the old cloudfarming mailing lists
  5. tweet about the release

hotfix release process

this part needs verification


Make the changes

  1. $ hg update <tag of the release you want to hotfix>
  2. $ hg branch <tag of the release you want to hotfix>
  3. apply the patch ( do not forget to apply the patch to the default branch aswell!)
    1. for example to apply patch which is committed as revision 756 -> $hg diff -c 756 -g | patch -p1
  4. change the version of the changed module in the pom (1.0.9 becomes 1.0.9.1), if version attribute is missing, add it. Do not change parent version!
    1. if the module pom contains ${project.version} entries, they need to be changed to the origional version
  5. $hg commit; hg push
  6. follow this guide
    1. only follow the 7b section
    2. login to oss.sonatype.org -> goto Staging Repositories -> close and release the snapshot repository
  7. check if we can use the release plugin or we need to do it manually

Update the updatecenter

  1. wait untill the release repository have been synced to maven central (search for the artifact in search.maven.org) THIS MAY TAKE A WHILE! Be patient, try again in 10 mins.
  2. $cd application (check if the pom in application also contains the right patched module version, the patched module should be clean installed before this)
  3. $mvn clean package -Pdeployment
  4. update or clone the update center repository (1 for clone, 2 for update)
    1. $cd workspace/cloudfarming-update; hg pull; hg update;
    2. $cd workspace; hg clone https://code.google.com/p/cloudfarming.update/ cloudfarming-update
  5. $ cp ../../agrosense~core/applciation/target/netbeans_site/catalog.* stable/
  6. $hg commit;hg push

Let people know about the release

  1. Update the original release wiki page and add section with the problem and that we have fixed it in module version ....
  2. if its a critical patch, send a note to the mailing lists
  3. tweet about the patch

update hot updatesite

Hot updatecenter is not working because netbeans cannot retrieve snapshot artifacts due to their changed name

cloudfarming/application$ mvn clean package -Psnapshot copy target/netbeans_site/catalog.xml* cloudfarming-update/hot/ hg commit/push

update stable updatesite

cloudfarming/application$ mvn clean package -Pdeployment

copy target/netbeans_site/catalog.xml* cloudfarming-update/stable/

hg commit/push

Conventions

naming of resource bundle keys

[module].[sub].[component].[label]

example: planning.wizard_spray.summary.some_item_on_the_summary_panel

Testing

Integration tests

Integration tests are test that go beyond the scope of the class they are testing.

For example accessing the filesystem or a database. Junit tests should be fast and test isolated functionality. To remain optimal test speed we have separated the unit tests from the integration tests. Unit tests should start or end with Test (for example TestSomething.java or SomethingTest.java). Unit tests are run with the command:

mvn clean test

Integration test should end with IT (for example SomeIT.java). Integration tests are run with either one of the commands:

mvn clean test -Pintegration-test

Maven

use both dependency on nbjunit as junit.

the junit dep from nbunit is disabled because it wheels in an old version of junit wich does not support expected exceptions very well.

        
        

Hints

 # http://netbeans.org/bugzilla/show_bug.cgi?id=198770

Troubleshooting

Out of PermGen during building

Add: export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m" to your netbeans.conf (in ~/netbeans/etc/)
 
 
Close
loading
Please Confirm
Close