Commit c84cbc412597e5ee356b4ed0ccb6acfe678cf163
1 parent
7883c577
Exists in
master
Adaptação no produtor de Locale para ficar mais aderente à
especificação
Showing
7 changed files
with
38 additions
and
44 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/producer/LocaleProducer.java
| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | -package br.gov.frameworkdemoiselle.internal.producer; | |
| 2 | - | |
| 3 | -import java.util.Locale; | |
| 4 | - | |
| 5 | -import javax.enterprise.inject.Default; | |
| 6 | -import javax.enterprise.inject.Produces; | |
| 7 | - | |
| 8 | -public class LocaleProducer { | |
| 9 | - | |
| 10 | - @Produces | |
| 11 | - @Default | |
| 12 | - public Locale create() { | |
| 13 | - return Locale.getDefault(); | |
| 14 | - } | |
| 15 | - | |
| 16 | -} |
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/producer/LocaleProducerTest.java
| ... | ... | @@ -1,20 +0,0 @@ |
| 1 | -package br.gov.frameworkdemoiselle.internal.producer; | |
| 2 | - | |
| 3 | -import java.util.Locale; | |
| 4 | - | |
| 5 | -import junit.framework.Assert; | |
| 6 | - | |
| 7 | -import org.junit.Test; | |
| 8 | - | |
| 9 | -public class LocaleProducerTest { | |
| 10 | - | |
| 11 | - @Test | |
| 12 | - public void testCreate() { | |
| 13 | - | |
| 14 | - Locale locale = (new LocaleProducer()).create(); | |
| 15 | - | |
| 16 | - Assert.assertNotNull(locale); | |
| 17 | - | |
| 18 | - } | |
| 19 | - | |
| 20 | -} |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/producer/JsfLocaleProducer.java
| ... | ... | @@ -22,7 +22,6 @@ import java.io.Serializable; |
| 22 | 22 | import java.util.Locale; |
| 23 | 23 | |
| 24 | 24 | import javax.enterprise.context.RequestScoped; |
| 25 | -import javax.enterprise.inject.Alternative; | |
| 26 | 25 | import javax.enterprise.inject.Default; |
| 27 | 26 | import javax.enterprise.inject.Produces; |
| 28 | 27 | import javax.faces.context.FacesContext; |
| ... | ... | @@ -32,7 +31,6 @@ import javax.servlet.http.HttpServletRequest; |
| 32 | 31 | import br.gov.frameworkdemoiselle.util.Beans; |
| 33 | 32 | |
| 34 | 33 | @RequestScoped |
| 35 | -@Alternative | |
| 36 | 34 | public class JsfLocaleProducer implements Serializable { |
| 37 | 35 | |
| 38 | 36 | private static final long serialVersionUID = 1L; |
| ... | ... | @@ -44,7 +42,7 @@ public class JsfLocaleProducer implements Serializable { |
| 44 | 42 | @Named("currentLocale") |
| 45 | 43 | public Locale create() { |
| 46 | 44 | Locale locale; |
| 47 | - | |
| 45 | + | |
| 48 | 46 | try { |
| 49 | 47 | FacesContext facesContext = Beans.getReference(FacesContext.class); |
| 50 | 48 | ... | ... |
impl/extension/jsf/src/main/resources/META-INF/beans.xml
| ... | ... | @@ -37,8 +37,4 @@ |
| 37 | 37 | <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 38 | 38 | xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> |
| 39 | 39 | |
| 40 | - <alternatives> | |
| 41 | - <class>br.gov.frameworkdemoiselle.internal.producer.JsfLocaleProducer</class> | |
| 42 | - </alternatives> | |
| 43 | - | |
| 44 | 40 | </beans> |
| 45 | 41 | \ No newline at end of file | ... | ... |
impl/extension/se/src/main/java/br/gov/frameworkdemoiselle/internal/producer/SeLocaleProducer.java
0 → 100644
| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | +package br.gov.frameworkdemoiselle.internal.producer; | |
| 2 | + | |
| 3 | +import java.util.Locale; | |
| 4 | + | |
| 5 | +import javax.enterprise.inject.Default; | |
| 6 | +import javax.enterprise.inject.Produces; | |
| 7 | + | |
| 8 | +public class SeLocaleProducer { | |
| 9 | + | |
| 10 | + @Produces | |
| 11 | + @Default | |
| 12 | + public Locale create() { | |
| 13 | + return Locale.getDefault(); | |
| 14 | + } | |
| 15 | + | |
| 16 | +} | ... | ... |
impl/extension/se/src/test/java/br/gov/frameworkdemoiselle/internal/producer/SeLocaleProducerTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +package br.gov.frameworkdemoiselle.internal.producer; | |
| 2 | + | |
| 3 | +import java.util.Locale; | |
| 4 | + | |
| 5 | +import junit.framework.Assert; | |
| 6 | + | |
| 7 | +import org.junit.Test; | |
| 8 | + | |
| 9 | +public class SeLocaleProducerTest { | |
| 10 | + | |
| 11 | + @Test | |
| 12 | + public void testCreate() { | |
| 13 | + | |
| 14 | + Locale locale = (new SeLocaleProducer()).create(); | |
| 15 | + | |
| 16 | + Assert.assertNotNull(locale); | |
| 17 | + | |
| 18 | + } | |
| 19 | + | |
| 20 | +} | ... | ... |
parent/framework/pom.xml
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | <parent> |
| 10 | 10 | <groupId>br.gov.frameworkdemoiselle</groupId> |
| 11 | 11 | <artifactId>demoiselle-parent</artifactId> |
| 12 | - <version>3</version> | |
| 12 | + <version>4-SNAPSHOT</version> | |
| 13 | 13 | <relativePath>../../../internal/parent/demoiselle/pom.xml</relativePath> |
| 14 | 14 | </parent> |
| 15 | 15 | ... | ... |