[seam-commits] Seam SVN: r15409 - in branches/enterprise/WFK-2_1/seam-integration-tests/src/test: resources and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Feb 19 11:05:00 EST 2013
Author: manaRH
Date: 2013-02-19 11:04:59 -0500 (Tue, 19 Feb 2013)
New Revision: 15409
Added:
branches/enterprise/WFK-2_1/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/RealLocaleTest.java
branches/enterprise/WFK-2_1/seam-integration-tests/src/test/resources/locale.xhtml
Log:
real localization test added
Added: branches/enterprise/WFK-2_1/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/RealLocaleTest.java
===================================================================
--- branches/enterprise/WFK-2_1/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/RealLocaleTest.java (rev 0)
+++ branches/enterprise/WFK-2_1/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/RealLocaleTest.java 2013-02-19 16:04:59 UTC (rev 15409)
@@ -0,0 +1,100 @@
+package org.jboss.seam.test.integration.i8ln;
+
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.test.integration.Deployments;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+
+ at RunWith(Arquillian.class)
+ at RunAsClient
+public class RealLocaleTest {
+
+ @Deployment(name="RealLocaleTest")
+ @OverProtocol("Servlet 3.0")
+ public static Archive<?> createDeployment()
+ {
+ return Deployments.realSeamDeployment()
+ .addClass(TestBean.class)
+ .addAsWebResource("locale.xhtml","locale.xhtml");
+ }
+
+ @ArquillianResource
+ URL url;
+
+ @Test
+ public void testDefaultLocale() throws Exception{
+
+ WebClient client = new WebClient();
+ HtmlPage page = client.getPage(url+"locale.seam");
+
+ String pageBody = page.getBody().asText();
+ assertTrue("Default locale is not set correctly!",pageBody.contains("Default locale: fr_CA"));
+
+ }
+
+ @Test
+ public void testSupportedLocale() throws Exception{
+
+ WebClient client = new WebClient();
+ HtmlPage page = client.getPage(url+"locale.seam");
+
+ String pageBody = page.getBody().asText();
+ String[] locales = new String [] {"fr_CA", "fr_FR" , "en"};
+
+ for (String locale : locales) {
+ assertTrue("Supported locale is not set correctly!", pageBody.contains("Supported locale: "+locale));
+ }
+
+ }
+
+ @Name("testBean")
+ public static class TestBean
+ {
+ Application app = FacesContext.getCurrentInstance().getApplication();
+
+ public String getDefaultLocale(){
+
+ if(app.getDefaultLocale() == null){
+ return "";
+ }
+ return app.getDefaultLocale().toString();
+ }
+
+ public List<Locale> getSupportedLocale(){
+
+ List<Locale> locales = new ArrayList<Locale>();
+
+ if(app.getSupportedLocales() == null){
+ return locales;
+ }
+
+ Iterator<Locale> it = app.getSupportedLocales();
+
+ while(it.hasNext()){
+ locales.add(it.next());
+ }
+ return locales;
+ }
+ }
+}
Added: branches/enterprise/WFK-2_1/seam-integration-tests/src/test/resources/locale.xhtml
===================================================================
--- branches/enterprise/WFK-2_1/seam-integration-tests/src/test/resources/locale.xhtml (rev 0)
+++ branches/enterprise/WFK-2_1/seam-integration-tests/src/test/resources/locale.xhtml 2013-02-19 16:04:59 UTC (rev 15409)
@@ -0,0 +1,17 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<h:head></h:head>
+<h:body>
+ <h:outputText value='Default locale: #{testBean.defaultLocale}' />
+
+ <h:dataTable id="locale" value="#{testBean.supportedLocale}" var="loc" >
+ <h:column>
+ Supported locale: #{loc.toString()}
+ </h:column>
+ </h:dataTable>
+
+</h:body>
+</html>
\ No newline at end of file
More information about the seam-commits
mailing list