assertNotNull( "app", app );
assertEquals( "app.name", "Portlet Application", app.getName( ) );
assertEquals( "app.contextParameter[param1]", "value1", app.getContextParameter( "param1" ) );
PortletDescriptor portlet = app.getPortletDescriptor( "portlet1" );
assertNotNull( "portlet1 not found", portlet );
assertEquals( "portlet.name", "portlet1", portlet.getName( ) );
assertEquals( "portlet.portletClass", PortletAdapter.class, portlet.getPortletClass( ) );
assertEquals( "portlet.actionListenerClass", ApplicationDescriptorLoaderTest.class, portlet.getActionListenerClass( ) );
assertEquals( "portlet.messageListenerClass", ApplicationDescriptorLoaderTest.class, portlet.getMessageListenerClass( ) );
assertEquals( "portlet.defaultLocale", Locale.ENGLISH.toString( ), portlet.getDefaultLocale( ) );
assertEquals( "portlet.initParameter[param1]", "value1", portlet.getInitParameter( "param1" ) );
/* Markup support */
assertTrue( "portlet.supports(html,view)", portlet.supports( Portlet.Mode.VIEW, Portlet.Markup.HTML ) );
assertTrue( "portlet.supports(html,edit)", portlet.supports( Portlet.Mode.EDIT, Portlet.Markup.HTML ) );
assertTrue( "portlet.supports(html,help)", portlet.supports( Portlet.Mode.HELP, Portlet.Markup.HTML ) );
assertTrue( "portlet.supports(html,configure)", portlet.supports( Portlet.Mode.CONFIGURE, Portlet.Markup.HTML ) );
assertTrue( "portlet.supports(html,view)", portlet.supports( Portlet.Mode.VIEW, Portlet.Markup.WML ) );
assertFalse( "portlet.supports(wml,edit)", portlet.supports( Portlet.Mode.EDIT, Portlet.Markup.WML ) );
assertFalse( "portlet.supports(wml,help)", portlet.supports( Portlet.Mode.HELP, Portlet.Markup.WML ) );
assertFalse( "portlet.supports(wml,configure)", portlet.supports( Portlet.Mode.CONFIGURE, Portlet.Markup.WML ) );
/* Language */
LanguageDescriptor lang = portlet.getLanguageDescriptor( Locale.ENGLISH );
assertNotNull( "lang[en]", lang );
assertEquals( "lang[en].title", "Portlet #1", lang.getTitle( ) );
assertEquals( "lang[en].titleShort", "P #1", lang.getTitleShort( ) );
assertEquals( "lang[en].description", "Description of Portlet #1", lang.getDescription( ) );
assertEquals( "lang[en].keywords", "test,portlet", lang.getKeywords( ) );
LanguageDescriptor lang2 = portlet.getLanguageDescriptor( new Locale( "en", "US" ) );
assertNotNull( "lang[en_US]", lang );
assertEquals( "lang[en] != lang[en_US]", lang, lang2 );
lang = portlet.getLanguageDescriptor( Locale.FRENCH );
assertNotNull( "lang[fr]", lang );
assertEquals( "lang[fr].title", "Portlet No1", lang.getTitle( ) );
/* Cache */
CacheDescriptor cache = portlet.getCacheDescriptor( Portlet.Mode.VIEW );
assertNotNull( "cache[view]", cache );
assertEquals( "cache[view].expires", 300, cache.getExpires( ) );
assertFalse( "cache[view].shared", cache.isShared( ) );
cache = portlet.getCacheDescriptor( Portlet.Mode.HELP );
assertNotNull( "cache[help]", cache );
assertEquals( "cache[help].expires", -1, cache.getExpires( ) );
assertTrue( "cache[help].shared", cache.isShared( ) );
/* auth */
AuthConstraintDescriptor auth = portlet.getAuthConstraintDescriptor( Portlet.Mode.VIEW );
assertNotNull( "auth[view]", auth );
assertTrue( "auth[view].allowAnonymous", auth.isAllowAnonymous( ) );
assertTrue( "auth[view].role[author]", auth.containsRole( "author" ) );
assertTrue( "auth[view].role[admin]", auth.containsRole( "admin" ) );
auth = portlet.getAuthConstraintDescriptor( Portlet.Mode.CONFIGURE );
assertNotNull( "auth[configure]", auth );
assertFalse( "auth[configure].allowAnonymous", auth.isAllowAnonymous( ) );
assertFalse( "auth[configure].role[author]", auth.containsRole( "author" ) );
assertTrue( "auth[configure].role[admin]", auth.containsRole( "admin" ) );
WebflowActionDescriptor wf = portlet.getWebflowAction( "view" );
assertNotNull( "webflow[view]", wf );
assertEquals( "webflow[view].success", "/success.jsp", wf.getReturnURI("success"));
assertEquals( "webflow[view].input", "/portlet/capital/mode/view/state/maximized", wf.getReturnURI("input"));
assertNull( "webflow[view].???", wf.getReturnURI("???"));
wf = portlet.getWebflowAction( "???" );
assertNull( "webflow[???]", wf );
}