Skip to content

Commit

Permalink
WELD-461
Browse files Browse the repository at this point in the history
  • Loading branch information
nickarls committed Mar 14, 2010
1 parent c7d435a commit f7d4cac
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
Expand Up @@ -195,6 +195,10 @@ private void setupContext(AbstractApplicationContext context, BeanStore beanStor

private void teardownContext(AbstractThreadLocalMapContext context)
{
if (context.getBeanStore() == null)
{
return;
}
context.setActive(true);
context.destroy();
context.setBeanStore(null);
Expand Down
Expand Up @@ -17,6 +17,8 @@

package org.jboss.weld.tests.contexts.sessionInvalidation;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.HashSet;
import java.util.Set;

Expand All @@ -29,6 +31,7 @@
import org.jboss.weld.test.AbstractWeldTest;
import org.testng.annotations.Test;

import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
Expand Down Expand Up @@ -70,6 +73,15 @@ public void testInvalidateSessionCalled() throws Exception
assert SomeBean.DEFAULT_PROPERTY_VALUE.equals(inputField.getValueAttribute());
}

@Test(description="WELD-461")
public void testNoDoubleDestructionOnExternalRedirect() throws Exception
{
WebClient client = new WebClient();
HtmlPage page = client.getPage(getPath("/storm.jsf"));
HtmlSubmitInput button = getFirstMatchingElement(page, HtmlSubmitInput.class, "redirectButton");
button.click();
}

protected <T> Set<T> getElements(HtmlElement rootElement, Class<T> elementClass)
{
Set<T> result = new HashSet<T>();
Expand Down
Expand Up @@ -16,6 +16,9 @@
*/
package org.jboss.weld.tests.contexts.sessionInvalidation;

import java.io.IOException;

import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;

Expand All @@ -37,5 +40,7 @@ public String invalidateSession()
return "success";
}


public void redirect() throws IOException {
FacesContext.getCurrentInstance().getExternalContext().redirect("storm.jsf");
}
}
Expand Up @@ -22,6 +22,7 @@
<hr/>
<h:form id="form">
<h:commandButton action="#{storm.invalidateSession}" value="Invalidate Session" id="invalidateSessionButton"/>
<h:commandButton action="#{storm.redirect}" value="Invalidate Session" id="redirectButton"/>
</h:form>
</f:view>
</body>
Expand Down

0 comments on commit f7d4cac

Please sign in to comment.