-
Feature Request
-
Resolution: Unresolved
-
Major
-
None
-
None
Ultimately, we should be able to use following methods to describe resources as JSF/XHTML pages:
- in javadoc
- using ShrinkWrap asset
- using ShrinkWrap Descriptor for given format
- referencing external/classpath file
JavaDoc:
/** * @resource index.xhtml * * <h:commandLink action="list" /> * * @resource list.xhtml * * <rich:list value="#{...}"> */ @Test public void myTest() { ... }
The conflicts of same files between tests needs to be solved.
In JSF, we can leverage own Facelet factory to register XHTMLs for each test specifically.
The comments (JavaDoc) can be pre-processed by APT compiler (integrated to JDK >6).
ShrinkWrap asset:
TestAutocompleteBehaviors.java:
FaceletAsset p = new FaceletAsset(); p.body("<h:form id='form'>"); p.body(" <r:autocomplete id='autocomplete' autocompleteList='#{autocompleteBean.suggestions}'>"); p.body(" <r:ajax event='blur' listener='#{autocompleteBean.actionListener}' />"); p.body(" </r:autocomplete>"); p.body("</h:form>"); archive.addAsWebResource(p, "index.xhtml");
ShrinkWrap Descriptor:
Descriptors.create(RichFacesDescriptor.class) .autocomplete() .id("autocomplete") .autocompleteList("#{autocompleteBean.suggestions}") .behavior() .ajax() .event("blur") .listener("#{autocompleteBean.actionListener}");
referencing external file:
ShrinkWrap.create(WebArchive.class).addWebAppResource("index.xhtml")
note that the API is simplified from the version using addWebResource(File file, String path)