This repository has been archived by the owner on Apr 11, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored validation tests to fun tests + fix whole framework build
- Loading branch information
Lukas Fryc
committed
Mar 19, 2013
1 parent
f6752ca
commit bf0f460
Showing
23 changed files
with
241 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/photoalbum/src/main/java/org/richfaces/photoalbum/util/UIOutputPanelWorkaround.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
framework/src/test/integration/org/richfaces/ui/validation/FacesBeanValidatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.richfaces.ui.validation; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.container.test.api.RunAsClient; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor; | ||
import org.junit.runner.RunWith; | ||
import org.richfaces.deployment.FrameworkDeployment; | ||
|
||
import com.google.common.base.Function; | ||
|
||
@RunWith(Arquillian.class) | ||
@RunAsClient | ||
public class FacesBeanValidatorTest extends GraphValidationTestBase { | ||
|
||
@Deployment | ||
public static WebArchive deployment() { | ||
FrameworkDeployment deployment = new FrameworkDeployment(FacesBeanValidatorTest.class); | ||
|
||
deployment.archive().addClasses(GraphBean.class, Group.class); | ||
|
||
deployment.webXml(new Function<WebAppDescriptor, WebAppDescriptor>() { | ||
public WebAppDescriptor apply(WebAppDescriptor webXml) { | ||
webXml.createContextParam() | ||
.paramName("javax.faces.validator.DISABLE_DEFAULT_BEAN_VALIDATOR") | ||
.paramValue("true"); | ||
return webXml; | ||
} | ||
}); | ||
|
||
GraphValidationTest.addIndexPage(deployment); | ||
|
||
return deployment.getFinalArchive(); | ||
} | ||
} |
67 changes: 15 additions & 52 deletions
67
framework/src/test/integration/org/richfaces/ui/validation/GraphValidationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,24 @@ | ||
package org.richfaces.ui.validation; | ||
|
||
import com.gargoylesoftware.htmlunit.html.HtmlElement; | ||
import com.gargoylesoftware.htmlunit.html.HtmlInput; | ||
import com.gargoylesoftware.htmlunit.html.HtmlPage; | ||
import org.junit.Test; | ||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.container.test.api.RunAsClient; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.junit.runner.RunWith; | ||
import org.richfaces.deployment.FrameworkDeployment; | ||
|
||
import java.io.IOException; | ||
@RunWith(Arquillian.class) | ||
@RunAsClient | ||
public class GraphValidationTest extends GraphValidationTestBase { | ||
|
||
import static org.hamcrest.CoreMatchers.equalTo; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.matchers.JUnitMatchers.containsString; | ||
@Deployment | ||
public static WebArchive deployment() { | ||
FrameworkDeployment deployment = new FrameworkDeployment(GraphValidationTest.class); | ||
|
||
/** | ||
* Test for dynamic add/remove {@link org.richfaces.ui.core.UIScripts} as view resource. | ||
* | ||
* @author asmirnov | ||
* | ||
*/ | ||
public class GraphValidationTest extends ValidationTestBase { | ||
deployment.archive().addClasses(GraphBean.class, Group.class); | ||
|
||
protected String getFacesConfig() { | ||
return "graph-faces-config.xml"; | ||
} | ||
|
||
protected String getPageName() { | ||
return "graph-test"; | ||
} | ||
|
||
@Test | ||
public void testRequest() throws Exception { | ||
HtmlPage page = requestPage(); | ||
HtmlInput input = getInput(page); | ||
assertNotNull(input); | ||
} | ||
|
||
@Override | ||
protected HtmlPage submit(HtmlPage page) throws IOException { | ||
HtmlElement submit = page.getElementById("form:submit"); | ||
return submit.click(); | ||
} | ||
|
||
@Test | ||
public void testSubmitTooShortValue() throws Exception { | ||
HtmlPage page = submitValueAndCheckMessage("", containsString(GraphBean.SHORT_MSG)); | ||
checkMessage(page, "textMessage", containsString(GraphBean.SHORT_MSG)); | ||
checkMessage(page, "graphMessage", equalTo("")); | ||
} | ||
|
||
@Test | ||
public void testBeanLevelConstrain() throws Exception { | ||
HtmlPage page = submitValueAndCheckMessage("bar", equalTo(GraphBean.FOO_MSG)); | ||
checkMessage(page, "graphMessage", containsString(GraphBean.FOO_MSG)); | ||
checkMessage(page, "textMessage", equalTo("")); | ||
} | ||
addIndexPage(deployment); | ||
|
||
@Test | ||
public void testCorrectValue() throws Exception { | ||
submitValueAndCheckMessage("foobar", equalTo("")); | ||
return deployment.getFinalArchive(); | ||
} | ||
} |
Oops, something went wrong.