Tuesday, April 05, 2005

SimpleForm portlet can now be submitted

With the latest checkin to CVS, a portlet now responds properly to a form submit. That is the processAction is called followed by a call to doView.

Release 0.2.1

I have uploaded a new release to source forge: portletUnit-0.2.1. It no longer needs pluto and the portlets can be tested in place.

This zip file contains the following:
* build.xml - a sample build file that shows how to use portletunit. [ant all] will run all the tests
* lib - the portletunit.jar file is in here.
* jars - the jar files that portletUnit depends upon.
* portlets - a sample portlet application with 4 portlets and test code. These are what are used to test portletUnit. The sample unit tests are in portlets/examples/WEB-INF/src/net/sf/portletunit/test TestPreferencePortlet.java is a good one to get started on.

Notes:
** Place all the jars in the lib and jars directory into the classpath. It is necessary to use the httpunit.jar from the jars directory because it has been modified.

** The call to PortletRunner.createPortletRunner has changed. It now takes 2 arguments:
* File portletDir - the directory where the WEB-INF is.
* String portletApplicationName - In the web.xml, for each portlet, there is a servlet defined. Each servlet has an init-param, portlet-guid. The format of the portlet-guid is
[portletApplicationName].[portletName]

Wednesday, March 23, 2005

portletUnit-0.1.2 release file corrupt

The portletunit-src.tar is corrupt. I will put a new one up in the next few days. In the meantime, checkout the source from CVS using the instructions on:
http://sourceforge.net/cvs/?group_id=125370

Wednesday, March 16, 2005

README now available

I submitted the README to the SourceForge project. The README includes a quick start on how to download, configure and use portletUnit.

Tuesday, February 22, 2005

How a fragment is loaded

A fragment is defined in portletregistry.xml as

<fragment name="welcome" type="page">
<navigation>
<title>PHC Welcome Portlet</title>
<description>Welcome to PHC</description>
</navigation>

<fragment name="row3" type="row">
<fragment name="col3" type="column">
<fragment name="p4" type="portlet">
<property name="portlet" value="5.1"/>
</fragment>
</fragment>
</fragment>
</fragment>

The following fragements get added to PageResistry:

welcome=org.apache.pluto.portalImpl.aggregation.PageFragment@1f10a67
welcome_row3=org.apache.pluto.portalImpl.aggregation.RowFragment@1e2161d
welcome_row3_col3=org.apache.pluto.portalImpl.aggregation.ColumnFragment@1f2af1c
welcome_row3_col3_p4=org.apache.pluto.portalImpl.aggregation.PortletFragment@1a3e41f

And this is what the debugger sees:

dump fragments.get("welcome");
fragments.get("welcome"); = {
org.apache.pluto.portalImpl.aggregation.AbstractFragmentContainer.children: instance of java.util.ArrayList(id=1449)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.BASE_ROOT: "/WEB-INF/aggregation/"
org.apache.pluto.portalImpl.aggregation.AbstractFragment.id: "welcome"
org.apache.pluto.portalImpl.aggregation.AbstractFragment.config: instance of com.meterware.servletunit.ServletUnitServletConfig(id=1452)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.parent: instance of org.apache.pluto.portalImpl.aggregation.RootFragment(id=1453)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.fragDesc: instance of org.apache.pluto.portalImpl.om.page.impl.FragmentImpl(id=1454)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.initParameters: instance of org.apache.pluto.portalImpl.util.Parameters(id=1455)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.navigation: instance of org.apache.pluto.portalImpl.aggregation.navigation.Navigation(id=1456)
}
main[1] dump fragments.get("welcome_row3");
fragments.get("welcome_row3"); = {
org.apache.pluto.portalImpl.aggregation.AbstractFragmentContainer.children: instance of java.util.ArrayList(id=1459)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.BASE_ROOT: "/WEB-INF/aggregation/"
org.apache.pluto.portalImpl.aggregation.AbstractFragment.id: "welcome_row3"
org.apache.pluto.portalImpl.aggregation.AbstractFragment.config: instance of com.meterware.servletunit.ServletUnitServletConfig(id=1452)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.parent: instance of org.apache.pluto.portalImpl.aggregation.PageFragment(id=1446)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.fragDesc: instance of org.apache.pluto.portalImpl.om.page.impl.FragmentImpl(id=1461)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.initParameters: instance of org.apache.pluto.portalImpl.util.Parameters(id=1462)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.navigation: instance of org.apache.pluto.portalImpl.aggregation.navigation.Navigation(id=1456)
}
main[1] dump fragments.get("welcome_row3_col3");
fragments.get("welcome_row3_col3"); = {
org.apache.pluto.portalImpl.aggregation.AbstractFragmentContainer.children: instance of java.util.ArrayList(id=1465)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.BASE_ROOT: "/WEB-INF/aggregation/"
org.apache.pluto.portalImpl.aggregation.AbstractFragment.id: "welcome_row3_col3"
org.apache.pluto.portalImpl.aggregation.AbstractFragment.config: instance of com.meterware.servletunit.ServletUnitServletConfig(id=1452)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.parent: instance of org.apache.pluto.portalImpl.aggregation.RowFragment(id=1458)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.fragDesc: instance of org.apache.pluto.portalImpl.om.page.impl.FragmentImpl(id=1467)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.initParameters: instance of org.apache.pluto.portalImpl.util.Parameters(id=1468)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.navigation: instance of org.apache.pluto.portalImpl.aggregation.navigation.Navigation(id=1456)
}
main[1] dump fragments.get("welcome_row3_col3_p4");
fragments.get("welcome_row3_col3_p4"); = {
portletWindow: instance of org.apache.pluto.portalImpl.om.window.impl.PortletWindowImpl(id=1471)
log: instance of org.apache.pluto.portalImpl.services.log.LoggerImpl(id=1472)
PORTLET_ERROR_MSG: "Error occurred in portlet!"
class$org$apache$pluto$portalImpl$aggregation$PortletFragment$PortletWindowStateInfo: null
class$org$apache$pluto$portalImpl$aggregation$PortletFragment$PortletModeInfo: null
org.apache.pluto.portalImpl.aggregation.AbstractFragment.BASE_ROOT: "/WEB-INF/aggregation/"
org.apache.pluto.portalImpl.aggregation.AbstractFragment.id: "welcome_row3_col3_p4"
org.apache.pluto.portalImpl.aggregation.AbstractFragment.config: instance of com.meterware.servletunit.ServletUnitServletConfig(id=1452)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.parent: instance of org.apache.pluto.portalImpl.aggregation.ColumnFragment(id=1464)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.fragDesc: instance of org.apache.pluto.portalImpl.om.page.impl.FragmentImpl(id=1475)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.initParameters: instance of org.apache.pluto.portalImpl.util.Parameters(id=1476)
org.apache.pluto.portalImpl.aggregation.AbstractFragment.navigation: instance of org.apache.pluto.portalImpl.aggregation.navigation.Navigation(id=1456)
}
main[1] print fragments.get("welcome_row3_col3_p4").initParameters.iEntries
fragments.get("welcome_row3_col3_p4").initParameters.iEntries = "[portlet = 5.1]"
main[1]

Adding form handling

I have been working on adding form handling so you can do form.submit() and get it to call the processAction() method of the portlet. It looks like I need to add a org.apache.pluto.portalImpl.aggregation.Fragment for the portlet to live in. The fragment needs to be added to org.apache.pluto.portalImpl.services.pageregistry.PageRegistry.addFragment() which is a static method.

Now to figure out how to create a Fragment in Pluto ...

Friday, February 11, 2005

javax.servlet.UnavailableException: Initialization of one or more services failed.

What do you do if you see:
javax.servlet.UnavailableException: Initialization of one or more services failed.
You enable logging with
PortletRunner.setLogging( System.out );
This will show the stack trace of the problem, usually a ClassNotFound type problem.

Tuesday, January 11, 2005

Two new classes: PortletUnitPortletRequest and PortletUnitPortletSession

Two new files have been added to the CVS tree, PortletUnitPortletSession and PortletUnitPortletRequest. These objects implement the PortletSession and PortletRequest objects. The only method implemented on the PortletRequest is getPortletSession and the PortletSession can only get and set APPLICATION_SCOPE attributes. The rest of the methods are all stubbed and will be implemented as needed.

Wednesday, December 22, 2004

portletUnit now works with pluto-1.0.1-rc2

There were two problems

1 - In webapps/pluto/WEB-INF/data/portletcontext.txt you need to add the portlets that pluto is going to see. What you add is the name of the directory under webapps that contains the portlet deployed to pluto. This will be automated in a later release.

2 - servletUnit returns null from ServletUnitServletContext.getContext(). Pluto is now using this method and expects it to return something other than null. This has been fixed and the fixed httpunit.jar is now included with portletUnit. The fix has also been sent to the httpUnit team.