Alfresco is a very good open source content management system, however there is only one problem with Alfresco, testing. It is a complete headache, writing an integration test, forget it! You will end up with functional tests;
- fire up an Alfresco instance
- use one of the existing interfaces to setup some test data
- and finally do your test
Unfortunately, starting from version 3.2 you cannot even do that and why?
Because starting from version 3.2 the sql scripts are out-dated and Alfresco is not working with any of the memory databases, not with Derby, not with hsqldb…
To see the related issue on this matter click here.
Luckily we have h2database and it can impersonate –thanks to compatibility mode– other databases that Alfresco has support for.
All you have to do is to add h2database to your classpath and change your driver, jdbc url and dialect. I did not test Oracle or MySQL compatibility modes but it is working with PostgreSQL.
<span class="na">db.driver</span><span class="o">=</span><span class="s">org.h2.Driver</span>
<span class="na">db.url</span><span class="o">=</span><span class="s">jdbc:h2:alf_data/h2_data/alfresco;MODE=PostgreSQL</span>
<span class="na">hibernate.dialect</span><span class="o">=</span><span class="s">org.hibernate.dialect.PostgreSQLDialect</span>
By this way you can still do your automated tests.