Skip to content

Commit

Permalink
WELD-493 Converted TxEventTest to Arquillian
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakknutsen committed Aug 1, 2010
1 parent cfe7cb3 commit 95a2871
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 33 deletions.
Expand Up @@ -29,8 +29,9 @@
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.weld.tests.contexts.errorpage.ErrorPageTest;
import org.jboss.weld.tests.category.Integration;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import com.gargoylesoftware.htmlunit.WebClient;
Expand All @@ -45,14 +46,7 @@
* @author Pete Muir
*
*/
//@Artifact(addCurrentPackage=false)
//@Classes({Storm.class,SomeBean.class})
//@IntegrationTest(runLocally=true)
//@Resources({
// @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
// @Resource(destination="storm.jspx", source="storm.jsf"),
// @Resource(destination="/WEB-INF/faces-config.xml", source="faces-config.xml")
//})
@Category(Integration.class)
@RunWith(Arquillian.class)
@Run(RunModeType.AS_CLIENT)
public class InvalidateSessionTest
Expand Down
Expand Up @@ -19,12 +19,10 @@
import java.util.HashSet;
import java.util.Set;

import org.jboss.weld.test.AbstractWeldTest;

import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;

public abstract class AbstractHtmlUnitTest extends AbstractWeldTest
public abstract class AbstractHtmlUnitTest
{

public AbstractHtmlUnitTest()
Expand Down
Expand Up @@ -17,39 +17,53 @@
package org.jboss.weld.tests.event.tx;


import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.testharness.impl.packaging.IntegrationTest;
import org.jboss.testharness.impl.packaging.Resource;
import org.jboss.testharness.impl.packaging.Resources;
import org.jboss.testharness.impl.packaging.war.WarArtifactDescriptor;
import org.testng.annotations.Test;
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.api.Run;
import org.jboss.arquillian.api.RunModeType;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.weld.tests.category.Integration;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;

@Artifact(addCurrentPackage=false)
@IntegrationTest(runLocally=true)
@Resources({
@Resource(source="faces-config.xml", destination="WEB-INF/faces-config.xml"),
@Resource(source="web.xml", destination=WarArtifactDescriptor.WEB_XML_DESTINATION),
@Resource(source="home.xhtml", destination="home.xhtml")
})
@Classes({
Foo.class,
Updated.class
})
@Category(Integration.class)
@RunWith(Arquillian.class)
@Run(RunModeType.AS_CLIENT)
public class TxEventTest extends AbstractHtmlUnitTest
{

@Test(description="WBRI-401")
@Deployment
public static WebArchive createDeployment()
{
return ShrinkWrap.create(WebArchive.class, "test.war")
.addClasses(Foo.class, Updated.class)
.addWebResource(TxEventTest.class.getPackage(), "web.xml", "web.xml")
.addWebResource(TxEventTest.class.getPackage(), "faces-config.xml", "faces-config.xml")
.addResource(TxEventTest.class.getPackage(), "home.xhtml", "home.xhtml")
.addWebResource(EmptyAsset.INSTANCE, "beans.xml");
}

/*
* description = "WBRI-401"
*/
@Test
public void testRequestContextLifecycle() throws Exception
{
WebClient webClient = new WebClient();
HtmlPage home = webClient.getPage(getPath("/home.jsf"));
HtmlSubmitInput beginConversationButton = getFirstMatchingElement(home, HtmlSubmitInput.class, "SaveButton");
beginConversationButton.click();
}


protected String getPath(String page)
{
// TODO: this should be moved out and be handled by Arquillian
return "http://localhost:8080/test/" + page;
}
}

0 comments on commit 95a2871

Please sign in to comment.