Arquillian Example Sample Portlet

The sample portlet calculates the sum of two numbers.

Figure 1: The Arquillian Sample Portlet calculates the sum of two numbers.

Figure 1: The Arquillian Sample Portlet calculates the sum of two numbers.

The portlet project comprises a portlet class, service classes, and JSPs. It follows the standard OSGi module folder structure with Java files in src/main/java/, resource files in src/main/resources/META-INF/resources, and build files in the project root.

Here are the primary files:

  • SampleService.java: Provides an interface that defines method public long add(final int addend1, final int addend2) for returning the sum of two numbers.

  • SampleServiceImpl.java: Uses OSGi Declarative Services to implement the SampleService interface.

  • SamplePortlet.java: Extends Liferay MVCPortlet and processes portlet action commands and renders the result of executing the add service.

  • bnd.bnd: Specifies the module’s name, symbolic name, and version.

  • init.jsp: Imports classes and tag libraries for the view layer.

  • view.jsp: Provides a form for calculating the sum of two numbers.

You’ll examine the tests next.

« Arquillian Extension for Liferay ExampleArquillian Integration Test Example »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0