Skip to content

Commit

Permalink
PBR-536 Modify testsuite structure to better enable IDE testing
Browse files Browse the repository at this point in the history
 - Add Jetty container for JSF 2.1 and fix broken test for FlashScope
  • Loading branch information
kenfinnigan committed Aug 16, 2013
1 parent 63c6cb3 commit 8bc9ff7
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 2 deletions.
Expand Up @@ -113,6 +113,8 @@ public abstract class AbstractExternalContext extends ExternalContext {

private Object context;

protected boolean overrideHttpResponseForFlash = false;

private Flash flash = null;

public static final String CONVERSATION_ID_PARAMETER = "conversationId";
Expand Down Expand Up @@ -430,7 +432,7 @@ public Object getResponse() {
}

protected boolean isServletResponseRequiredForFlash() {
return (!BridgeContext.getCurrentInstance().getBridgeConfig().isJsf22Runtime() && PortletFlash.needHttpResponse.get());
return (!BridgeContext.getCurrentInstance().getBridgeConfig().isJsf22Runtime() && !overrideHttpResponseForFlash && PortletFlash.needHttpResponse.get());
}

/**
Expand Down
Expand Up @@ -210,7 +210,18 @@ public Writer getResponseOutputWriter() throws IOException {

@Override
public boolean isResponseCommitted() {
return getMimeResponse().isCommitted();
boolean committed;

// Override ServletResponse for Flash to ensure getMimeResponse() does throw ClassCastException
if (isServletResponseRequiredForFlash()) {
overrideHttpResponseForFlash = true;
committed = getMimeResponse().isCommitted();
overrideHttpResponseForFlash = false;
} else {
committed = getMimeResponse().isCommitted();
}

return committed;
}

@Override
Expand Down
51 changes: 51 additions & 0 deletions pom.xml
Expand Up @@ -900,6 +900,57 @@
</plugins>
</build>
</profile>

<profile>
<id>jetty8-jsf21</id>
<activation>
<property>
<name>integration</name>
<value>jetty8-jsf21</value>
</property>
</activation>
<properties>
<arquillian.launch.jetty8>true</arquillian.launch.jetty8>
<testCategory.excluded.container>,category.GateInOnly</testCategory.excluded.container>
<version.mojarra2>2.1.19</version.mojarra2>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.portletbridge.testing.pluto</groupId>
<artifactId>pluto-jetty-bom</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.portletbridge.testing.pluto</groupId>
<artifactId>pluto-extension-jsf</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.plugin.surefire}</version>
<executions>
<execution>
<id>integration-tests</id>
<phase>verify</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<useSystemClassLoader>true</useSystemClassLoader>
<useManifestOnlyJar>false</useManifestOnlyJar>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>

0 comments on commit 8bc9ff7

Please sign in to comment.