assertEquals(event1.getValueType(), "java.lang.String");
QName q = event1.getQName();
// if the event definition is registered without QName, then the default namespace of app will be used.
assertEquals(q.getNamespaceURI(), "http:apache.org/events");
assertEquals(q.getPrefix(), "");
Description en = event1.getDescription(new Locale("en"));
assertEquals(en.getDescription(), "The Plain Old Event");
Description fr = event1.getDescription(new Locale("fr"));
assertEquals(fr.getDescription(), "Le Vieux Ordinaire �v�nement");
EventDefinition event2 = events.get(1);
assertNotNull(event2);
QName qname = event2.getQName();
assertEquals(qname.getNamespaceURI(), "http:portals.apache.org/events");
assertEquals(qname.getLocalPart(), "qualifiedEvent");
assertEquals(event2.getValueType(), "java.lang.String");
assertEquals(qname.getPrefix(), "");
EventDefinition event3 = events.get(2);
assertNotNull(event3);
QName qname3 = event3.getQName();
assertEquals(qname3.getNamespaceURI(), "http:portals.apache.org/events");
assertEquals(qname3.getLocalPart(), "prefixedEvent");
assertEquals(qname3.getPrefix(), "x");
assertEquals(event3.getValueType(), "java.lang.String");
QName alias1 = event3.getAliases().get(0);
assertEquals(alias1.getLocalPart(), "local-1");
QName alias2 = event3.getAliases().get(1);
assertEquals(alias2.getLocalPart(), "local-2");
assertEquals(alias2.getNamespaceURI(), "http:2portals.apache.org/events");
QName alias3 = event3.getAliases().get(2);
assertEquals(alias3.getLocalPart(), "local-3");
assertEquals(alias3.getNamespaceURI(), "http:3portals.apache.org/events");
assertEquals(alias3.getPrefix(), "p");
List<EventDefinitionReference> refs = portlet.getSupportedProcessingEvents();
assertEquals(refs.size(), 2);
EventDefinitionReference ref1 = refs.get(0);
assertEquals(ref1.getName(), "plainOldEvent");
EventDefinitionReference ref2 = refs.get(1);
QName ref2QName = ref2.getQName();
assertEquals(ref2QName, new QName("http:portals.apache.org/events", "prefixedEvent", "x"));
List<EventDefinitionReference> pubRefs = portlet.getSupportedPublishingEvents();
assertEquals(pubRefs.size(), 2);
EventDefinitionReference pubRef1 = pubRefs.get(0);
assertEquals(pubRef1.getName(), "local-1");
EventDefinitionReference pubRef2 = pubRefs.get(1);
QName pubRef2QName = pubRef2.getQName();
assertEquals(pubRef2QName, new QName("http:portals.apache.org/events", "qualifiedEvent"));
List<String> supportedRenderParams = portlet.getSupportedPublicRenderParameters();
assertEquals(supportedRenderParams.size(), 2);
String p1 = supportedRenderParams.get(0);
assertEquals(p1, "city");
String p2 = supportedRenderParams.get(1);
assertEquals(p2, "zipcode");
List<ContainerRuntimeOption> portletOptions = portlet.getContainerRuntimeOptions();
assertEquals(portletOptions.size(), 2);
ContainerRuntimeOption opt1 = portlet.getContainerRuntimeOption("PortletOption1");
assertEquals(opt1.getName(), "PortletOption1");
assertEquals(opt1.getValues().size(), 3);
assertEquals(opt1.getValues().get(0), "p-value-1");
assertEquals(opt1.getValues().get(1), "p-value-2");
assertEquals(opt1.getValues().get(2), "p-value-3");
ContainerRuntimeOption opt2 = portlet.getContainerRuntimeOption("PortletOption2");
assertEquals(opt2.getName(), "PortletOption2");
assertEquals(opt2.getValues().size(), 2);
assertEquals(opt2.getValues().get(0), "p-value-4");
assertEquals(opt2.getValues().get(1), "p-value-5");
List<ContainerRuntimeOption> appOptions = app.getContainerRuntimeOptions();
assertEquals(appOptions.size(), 2);
ContainerRuntimeOption opt3 = app.getContainerRuntimeOption("AppOption1");
assertEquals(opt3.getName(), "AppOption1");
assertEquals(opt3.getValues().size(), 3);
assertEquals(opt3.getValues().get(0), "a-value-1");
assertEquals(opt3.getValues().get(1), "a-value-2");
assertEquals(opt3.getValues().get(2), "a-value-3");
ContainerRuntimeOption opt4 = app.getContainerRuntimeOption("AppOption2");
assertEquals(opt4.getName(), "AppOption2");
assertEquals(opt4.getValues().size(), 1);
assertEquals(opt4.getValues().get(0), "a-value-4");
PublicRenderParameter x = app.getPublicRenderParameter("prp1-id");
assertNotNull(x);
assertEquals(x.getName(), "prp1");
List<PublicRenderParameter> xs = app.getPublicRenderParameters();
assertEquals(xs.size(), 1);
Description d1 = x.getDescription(new Locale("en"));
assertEquals(d1.getDescription(), "dog");
Description d2 = x.getDescription(new Locale("fr"));
assertEquals(d2.getDescription(), "chien");
List<QName> aliases = x.getAliases();
assertEquals(aliases.size(), 1);
assertEquals(aliases.get(0).getLocalPart(), "alias-1");
List<Filter> filters = app.getFilters();
assertEquals(filters.size(), 1);
Filter filter = filters.get(0);
assertEquals(filter.getFilterName(), "filter-1");
assertEquals(filter.getFilterClass(), "org.apache.filter.FilterOne");
List<Description> descs = filter.getDescriptions();
assertEquals(descs.size(), 2);
Description d3 = descs.get(0);
assertEquals(d3.getLang(), "en");
assertEquals(d3.getDescription(), "My Filter 1");
Description d4 = descs.get(1);
assertEquals(d4.getLang(), "fr");
assertEquals(d4.getDescription(), "Mon Filtre 1");
List<DisplayName> dnames = filter.getDisplayNames();
assertEquals(dnames.size(), 2);
DisplayName dn3 = dnames.get(0);
assertEquals(dn3.getLang(), "en");
assertEquals(dn3.getDisplayName(), "This is my filter 1");
DisplayName dn4 = dnames.get(1);
assertEquals(dn4.getLang(), "fr");
assertEquals(dn4.getDisplayName(), "Ceci est mon filtre 1");
List<InitParam> iparams = filter.getInitParams();
assertEquals(iparams.size(), 2);
InitParam ip3 = iparams.get(0);
assertEquals(ip3.getParamName(),"filter init param 1");
assertEquals(ip3.getParamValue(), "value for filter init param 1");
InitParam ip4 = iparams.get(1);
assertEquals(ip4.getParamName(), "filter init param 2");
assertEquals(ip4.getParamValue(), "value for filter init param 2");
List<String> lcycles = filter.getLifecycles();
assertEquals(lcycles.size(), 3);
assertEquals(lcycles.get(0), "lifecycle-1");
assertEquals(lcycles.get(1), "lifecycle-2");
assertEquals(lcycles.get(2), "lifecycle-3");
List<Listener> listeners = app.getListeners();
assertEquals(listeners.size(), 2);
Listener listener1 = listeners.get(0);
assertEquals(listener1.getListenerClass(), "org.apache.listener.ListenerOne");
descs = listener1.getDescriptions();
assertEquals(descs.size(), 2);
Description d5 = descs.get(0);
assertEquals(d5.getLang(), "en");
assertEquals(d5.getDescription(), "Listen to me once");
Description d6 = descs.get(1);
assertEquals(d6.getLang(), "fr");
assertEquals(d6.getDescription(), "�coutez moi une fois");
dnames = listener1.getDisplayNames();
assertEquals(dnames.size(), 2);
DisplayName dn5 = dnames.get(0);
assertEquals(dn5.getLang(), "en");
assertEquals(dn5.getDisplayName(), "Listen to me twice");
DisplayName dn6 = dnames.get(1);
assertEquals(dn6.getLang(), "fr");
assertEquals(dn6.getDisplayName(), "�coutez moi deux fois");
Listener listener2 = listeners.get(1);
assertEquals(listener2.getListenerClass(), "org.apache.listener.ListenerTwo");
descs = listener2.getDescriptions();
assertEquals(descs.size(), 2);
d5 = descs.get(0);
assertEquals(d5.getLang(), "en");
assertEquals(d5.getDescription(), "Don't listen to me");
d6 = descs.get(1);
assertEquals(d6.getLang(), "fr");
assertEquals(d6.getDescription(), "N'�coutez pas moi");
dnames = listener2.getDisplayNames();
assertEquals(dnames.size(), 2);
dn5 = dnames.get(0);
assertEquals(dn5.getLang(), "en");
assertEquals(dn5.getDisplayName(), "Listen!");
dn6 = dnames.get(1);
assertEquals(dn6.getLang(), "fr");
assertEquals(dn6.getDisplayName(), "�coutez!");
List<SecurityConstraint> scs = app.getSecurityConstraints();
assertEquals(scs.size(), 2);
SecurityConstraint sc1 = scs.get(0);
assertEquals(sc1.getUserDataConstraint().getTransportGuarantee(), UserDataConstraint.INTEGRAL);
DisplayName scdn1 = sc1.getDisplayName(new Locale("en"));
assertEquals(scdn1.getLang(), "en");
assertEquals(scdn1.getDisplayName(), "Integral Security Transport");
DisplayName scdn2 = sc1.getDisplayName(new Locale("fr"));
assertEquals(scdn2.getDisplayName(), "Transport Int�gral de S�curit�");
assertEquals(sc1.getPortletNames().get(0), "PortletOne");
assertEquals(sc1.getPortletNames().get(1), "PortletTwo");
assertEquals(sc1.getPortletNames().get(2), "PortletThree");
Description des1 = sc1.getUserDataConstraint().getDescription(new Locale("en"));
assertEquals(des1.getLang(), "en");
assertEquals(des1.getDescription(), "This is the Integral Security Transport");
Description des2 = sc1.getUserDataConstraint().getDescription(new Locale("fr"));
assertEquals(des2.getLang(), "fr");
assertEquals(des2.getDescription(), "Ceci est le Transport Int�gral de S�curit�");
SecurityConstraint sc2 = scs.get(1);
assertEquals(sc2.getUserDataConstraint().getTransportGuarantee(), UserDataConstraint.CONFIDENTIAL);
scdn1 = sc2.getDisplayName(new Locale("en"));
assertEquals(scdn1.getLang(), "en");
assertEquals(scdn1.getDisplayName(), "Confidential Security Transport");
scdn2 = sc2.getDisplayName(new Locale("fr"));
assertEquals(scdn2.getDisplayName(), "Transport Confidentiel de S�curit�");
assertEquals(sc2.getPortletNames().get(0), "PortletA");
assertEquals(sc2.getPortletNames().get(1), "PortletB");
des1 = sc2.getUserDataConstraint().getDescription(new Locale("en"));
assertEquals(des1.getLang(), "en");
assertEquals(des1.getDescription(), "This is the Confidential Security Transport");
des2 = sc2.getUserDataConstraint().getDescription(new Locale("fr"));
assertEquals(des2.getLang(), "fr");
assertEquals(des2.getDescription(), "Ceci est le Transport Confidentiel de S�curit�");
}