Here are some tips and tricks for developers of Sonar core.
Connect to Derby from command line
- download derby(the same version as used by sonar)
- set the DERBY_HOME property
- execute the command $DERBY_HOME/bin/ij
- connect to the database :
Compare XML files from JUnit
Use XMLUnit. The dependency is already defined into maven.
Override Object.equals() and hashCode()
You can use EqualsBuilder and HashCodeBuilder from commons-lang to simplify. Just define the fields to compare. Example on the Rule class :
How to map String to Clob fields into Hibernate
Example on the table RULES, mapped by the class Rule. The DESCRIPTION column is a CLOB whereas as the Java field is a String. The most frequent error is :
The solution is to add the @Type annotation :