Skip to content

What if I want to write and test a new feature in my own portal?

Matteo E. Minnai edited this page Mar 22, 2013 · 11 revisions

What if I want to write and test a new feature in my own portal?

Writing and testing a feature which isn't using any Plugin

No panic.

entando-archetype-portal-generic comes with all the necessary to write and test your own feature.

If you want to do the testing in your IDE, just run mvn clean process-test-classes or ant Test-init, and then start JUnit as appropriate.

Else, you can run mvn clean test or ant Test .

Anyway, if you need to add some tables or custom data to your test database, just do it. Then, you can backup it in tar format using ant PG-db-backup, or in plain text using ant PG-db-export-SQL.

If it finds a tar db backup or custom plain test db backup, ant Test-init will use it instead of the usual test db backup coming from entando-core-engine.

Writing and testing a feature wich does use one or more Plugins

Same as above, but you have to add some dependencies as well.

Say your are writing a feature that uses entando-plugin-jpaddressbook, here is the POM snippet:

<!-- 
     For compile time, and with scope = provided because we need it only 
     at compile time (the real jar used at runtime comes within the 
     dependency of type = war)  
-->
<dependency>
  <groupId>org.entando.entando.plugins</groupId>
	<artifactId>entando-plugin-jpaddressbook</artifactId>
	<version>0.0.3-SNAPSHOT</version>
	<type>jar</type>
	<classifier>classes</classifier>
	<scope>provided</scope>
</dependency>

<!--
     Now, this is weird.
     If you want to test against a Plugin, you have to add the classes
     at scope = test for all of its dependencies.
     Quite sure this is a bug of Maven, or of Entando, or both.
-->
<dependency>
	<groupId>org.entando.entando.plugins</groupId>
	<artifactId>entando-plugin-jpuserprofile</artifactId>
	<version>0.0.2-SNAPSHOT</version>
	<type>jar</type>
	<classifier>classes</classifier>
	<scope>test</scope>
</dependency>
Clone this wiki locally