-
1. Re: Seam Phase Listener in bundled arquillian-jsfunit.jar/META-INF/faces-config.xml
jjfraney Aug 10, 2011 8:55 PM (in response to jjfraney)Well, I discovered that the faces-config.xml which jsfunit puts into its auxillary jsfunit-arquillian.jar comes from the jboss-seam-2.2.2.jar file on my build classpath. See: org.jboss.jsfunit.arquillian.JSFUnitArchiveAppender.
Well, I have to put jboss-seam jar into my deploy archive. And, I can't avoid JSFUnitArchiveAppender from bringing in a copy of that same file. So, I think I am officially stuck.
-
2. Re: Seam Phase Listener in bundled arquillian-jsfunit.jar/META-INF/faces-config.xml
jjfraney Aug 10, 2011 9:45 PM (in response to jjfraney)I discovered I can do this to create a deployable archive including a jboss-seam jar with faces-config.xml stripped out. This is a hack needed for as long as jsfunit copies the faces-config.xml from the jboss-seam jar file I have to include in my deployable. ShrinkWrap is cool.
{code}
private static void addSeamJar(final WebArchive war) {
JavaArchive originalSeamjar = ShrinkWrap.createFromZipFile(JavaArchive.class,
MavenArtifactResolver.resolve("org.jboss.seam:jboss-seam:2.2.2.Final"));
final JavaArchive seamjar = stripFacesConfig(originalSeamjar);
war.addLibraries(seamjar);
}
private static JavaArchive stripFacesConfig(JavaArchive originalSeamjar) {
final ArchivePath facesConfigPath = ArchivePaths.create("/META-INF/faces-config.xml");
final JavaArchive seamjar = ShrinkWrap.create(JavaArchive.class, "jboss-seam.jar");
seamjar.merge(originalSeamjar, new Filter<ArchivePath>() {
@Override
public boolean include(ArchivePath arg0) {
if(arg0.compareTo(facesConfigPath) == 0) {
System.out.println("rejecting: " + arg0.toString());
}
return arg0.compareTo(facesConfigPath) != 0;
}
});
return seamjar;
}
{code}
-
3. Re: Seam Phase Listener in bundled arquillian-jsfunit.jar/META-INF/faces-config.xml
jjfraney Aug 12, 2011 1:37 PM (in response to jjfraney)Ok. That worked, but then I found the answer to the question: What faces-config.xml did jsfunit want to add if not seam's?
There is a faces-config in the source code of jsfunit 2.0.0.Beta1. It defines a factory. The factory can create a jsfunit's specific faces context object. This is needed to retain the faces context after the request ends (I read that usually the faces context is desroyed at the end of jsf request and all the asserts in a jsfunit test are performed after the jsf request ends).
To work around, I create a src/test/webapp/WEB-INF/faces-config.xml which is a merge of my application's faces-config.xml and the definition in 2.0.0.Beta1's faces-config.xml. Then, I added this cooked faces-config.xml (not the my application's) into my test war. Now, a call to server.getFacesContext() does not return null.