Commit 3a17befe54cb5c323182b59c299c6366ccf5b708
Exists in
master
Resolução dos conflitos nas versões dos artefatos
Showing
15 changed files
with
145 additions
and
53 deletions
Show diff stats
documentation/reference/pt-BR/paginacao.xml
... | ... | @@ -93,10 +93,10 @@ public class PaginationContext { |
93 | 93 | @Configuration |
94 | 94 | public class PaginationConfig { |
95 | 95 | |
96 | - @Key("default_page_size") | |
96 | + @Name("default_page_size") | |
97 | 97 | private int defaultPageSize = 10; |
98 | 98 | |
99 | - @Key("max_page_links") | |
99 | + @Name("max_page_links") | |
100 | 100 | private int maxPageLinks = 5; |
101 | 101 | }]]></programlisting> |
102 | 102 | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/util/Beans.java
... | ... | @@ -74,12 +74,11 @@ public final class Beans { |
74 | 74 | return manager; |
75 | 75 | } |
76 | 76 | |
77 | - @SuppressWarnings("unchecked") | |
78 | 77 | public static <T> T getReference(final Class<T> beanClass, Annotation... qualifiers) { |
79 | 78 | T instance; |
80 | 79 | |
81 | 80 | try { |
82 | - instance = (T) getReference(manager.getBeans(beanClass, qualifiers)); | |
81 | + instance = (T) getReference(manager.getBeans(beanClass, qualifiers), beanClass); | |
83 | 82 | |
84 | 83 | } catch (NoSuchElementException cause) { |
85 | 84 | StringBuffer buffer = new StringBuffer(); |
... | ... | @@ -97,12 +96,11 @@ public final class Beans { |
97 | 96 | return instance; |
98 | 97 | } |
99 | 98 | |
100 | - @SuppressWarnings("unchecked") | |
101 | 99 | public static <T> T getReference(final Class<T> beanClass) { |
102 | 100 | T instance; |
103 | 101 | |
104 | 102 | try { |
105 | - instance = (T) getReference(manager.getBeans(beanClass)); | |
103 | + instance = (T) getReference(manager.getBeans(beanClass), beanClass); | |
106 | 104 | |
107 | 105 | } catch (NoSuchElementException cause) { |
108 | 106 | String message = getBundle().getString("bean-not-found", beanClass.getCanonicalName()); |
... | ... | @@ -128,12 +126,17 @@ public final class Beans { |
128 | 126 | } |
129 | 127 | |
130 | 128 | @SuppressWarnings("unchecked") |
131 | - private static <T> T getReference(Set<Bean<?>> beans) { | |
129 | + private static <T> T getReference(Set<Bean<?>> beans, Class<T> beanClass) { | |
132 | 130 | Bean<?> bean = beans.iterator().next(); |
133 | - return (T) manager.getReference(bean, bean.getBeanClass(), manager.createCreationalContext(bean)); | |
131 | + return (T) manager.getReference(bean, beanClass == null ? bean.getBeanClass() : beanClass, | |
132 | + manager.createCreationalContext(bean)); | |
133 | + } | |
134 | + | |
135 | + private static <T> T getReference(Set<Bean<?>> beans) { | |
136 | + return getReference(beans, (Class<T>) null); | |
134 | 137 | } |
135 | 138 | |
136 | 139 | private static ResourceBundle getBundle() { |
137 | 140 | return ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); |
138 | 141 | } |
139 | 142 | -} |
143 | +} | |
140 | 144 | \ No newline at end of file | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/util/BeansTest.java
... | ... | @@ -50,6 +50,7 @@ import javax.enterprise.inject.spi.Bean; |
50 | 50 | import javax.enterprise.inject.spi.BeanManager; |
51 | 51 | |
52 | 52 | import org.easymock.EasyMock; |
53 | +import org.junit.Ignore; | |
53 | 54 | import org.junit.Test; |
54 | 55 | import org.junit.runner.RunWith; |
55 | 56 | import org.powermock.api.easymock.PowerMock; |
... | ... | @@ -73,10 +74,9 @@ public class BeansTest { |
73 | 74 | |
74 | 75 | expect(beanManager.createCreationalContext(EasyMock.anyObject(Contextual.class))).andReturn(null); |
75 | 76 | expect(beanManager.getBeans(EasyMock.anyObject(Class.class))).andReturn(collection); |
76 | - expect(beanManager.getReference(EasyMock.anyObject(Bean.class), EasyMock.anyObject(Class.class), | |
77 | + expect( | |
78 | + beanManager.getReference(EasyMock.anyObject(Bean.class), EasyMock.anyObject(Class.class), | |
77 | 79 | EasyMock.anyObject(CreationalContext.class))).andReturn(object); |
78 | - | |
79 | - expect(bean.getBeanClass()).andReturn(null); | |
80 | 80 | |
81 | 81 | replayAll(beanManager, bean); |
82 | 82 | |
... | ... | @@ -103,7 +103,8 @@ public class BeansTest { |
103 | 103 | expect(bean.getBeanClass()).andReturn(null); |
104 | 104 | expect(beanManager.createCreationalContext(EasyMock.anyObject(Contextual.class))).andReturn(null); |
105 | 105 | expect(beanManager.getBeans("something")).andReturn(collection); |
106 | - expect(beanManager.getReference(EasyMock.anyObject(Bean.class), EasyMock.anyObject(Class.class), | |
106 | + expect( | |
107 | + beanManager.getReference(EasyMock.anyObject(Bean.class), EasyMock.anyObject(Class.class), | |
107 | 108 | EasyMock.anyObject(CreationalContext.class))).andReturn(object); |
108 | 109 | |
109 | 110 | replayAll(beanManager, bean); | ... | ... |
impl/extension/jpa/src/test/java/br/gov/frameworkdemoiselle/domain/Contact.java
0 → 100644
... | ... | @@ -0,0 +1,28 @@ |
1 | +package br.gov.frameworkdemoiselle.domain; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | + | |
5 | +import javax.persistence.Column; | |
6 | +import javax.persistence.Entity; | |
7 | +import javax.persistence.GeneratedValue; | |
8 | +import javax.persistence.Id; | |
9 | + | |
10 | +@Entity | |
11 | +public class Contact implements Serializable { | |
12 | + | |
13 | + private static final long serialVersionUID = 1L; | |
14 | + | |
15 | + @Id | |
16 | + @GeneratedValue | |
17 | + @Column | |
18 | + private Long id; | |
19 | + | |
20 | + public void setId(Long id) { | |
21 | + this.id = id; | |
22 | + } | |
23 | + | |
24 | + public Long getId() { | |
25 | + return id; | |
26 | + } | |
27 | + | |
28 | +} | ... | ... |
impl/extension/jpa/src/test/java/br/gov/frameworkdemoiselle/template/JPACrudTest.java
... | ... | @@ -45,19 +45,14 @@ import static org.powermock.api.easymock.PowerMock.replayAll; |
45 | 45 | import static org.powermock.api.easymock.PowerMock.verifyAll; |
46 | 46 | import static org.powermock.reflect.Whitebox.setInternalState; |
47 | 47 | |
48 | -import java.io.Serializable; | |
49 | 48 | import java.util.ArrayList; |
50 | 49 | import java.util.HashMap; |
51 | 50 | import java.util.List; |
52 | 51 | import java.util.Map; |
53 | 52 | |
54 | 53 | import javax.enterprise.inject.Instance; |
55 | -import javax.persistence.Column; | |
56 | -import javax.persistence.Entity; | |
57 | 54 | import javax.persistence.EntityManager; |
58 | 55 | import javax.persistence.EntityManagerFactory; |
59 | -import javax.persistence.GeneratedValue; | |
60 | -import javax.persistence.Id; | |
61 | 56 | import javax.persistence.Persistence; |
62 | 57 | import javax.persistence.Query; |
63 | 58 | import javax.persistence.TransactionRequiredException; |
... | ... | @@ -80,6 +75,7 @@ import org.powermock.reflect.Whitebox; |
80 | 75 | |
81 | 76 | import br.gov.frameworkdemoiselle.DemoiselleException; |
82 | 77 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
78 | +import br.gov.frameworkdemoiselle.domain.Contact; | |
83 | 79 | import br.gov.frameworkdemoiselle.internal.implementation.PaginationImpl; |
84 | 80 | import br.gov.frameworkdemoiselle.pagination.Pagination; |
85 | 81 | import br.gov.frameworkdemoiselle.pagination.PaginationContext; |
... | ... | @@ -110,26 +106,6 @@ public class JPACrudTest { |
110 | 106 | setInternalState(this.contactDAO, EntityManager.class, this.entityManager); |
111 | 107 | } |
112 | 108 | |
113 | - @Entity | |
114 | - class Contact implements Serializable { | |
115 | - | |
116 | - private static final long serialVersionUID = 1L; | |
117 | - | |
118 | - @Id | |
119 | - @GeneratedValue | |
120 | - @Column | |
121 | - private Long id; | |
122 | - | |
123 | - public void setId(Long id) { | |
124 | - this.id = id; | |
125 | - } | |
126 | - | |
127 | - public Long getId() { | |
128 | - return id; | |
129 | - } | |
130 | - | |
131 | - } | |
132 | - | |
133 | 109 | @Test |
134 | 110 | public void testDelete() { |
135 | 111 | expect(this.entityManager.getReference(Contact.class, null)).andReturn(null); | ... | ... |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/AbstractExceptionHandler.java
... | ... | @@ -80,7 +80,7 @@ public abstract class AbstractExceptionHandler extends ExceptionHandlerWrapper { |
80 | 80 | |
81 | 81 | protected abstract boolean handleException(final Throwable cause, FacesContext facesContext); |
82 | 82 | |
83 | - private Throwable getRoot(final Throwable throwable) { | |
83 | + protected Throwable getRoot(final Throwable throwable) { | |
84 | 84 | Throwable root = throwable; |
85 | 85 | |
86 | 86 | while (root.getCause() != null) { | ... | ... |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ApplicationExceptionHandler.java
... | ... | @@ -104,4 +104,14 @@ public class ApplicationExceptionHandler extends AbstractExceptionHandler { |
104 | 104 | } |
105 | 105 | return handled; |
106 | 106 | } |
107 | + | |
108 | + protected Throwable getRoot(final Throwable throwable) { | |
109 | + Throwable root = throwable; | |
110 | + | |
111 | + while (!Exceptions.isApplicationException(root)) { | |
112 | + root = root.getCause(); | |
113 | + } | |
114 | + | |
115 | + return root; | |
116 | + } | |
107 | 117 | } | ... | ... |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/SecurityObserver.java
... | ... | @@ -61,8 +61,7 @@ public class SecurityObserver implements Serializable { |
61 | 61 | |
62 | 62 | private static final long serialVersionUID = 1L; |
63 | 63 | |
64 | - @Inject | |
65 | - private JsfSecurityConfig config; | |
64 | + private transient JsfSecurityConfig config; | |
66 | 65 | |
67 | 66 | private transient Map<String, Object> savedParams; |
68 | 67 | |
... | ... | @@ -83,11 +82,19 @@ public class SecurityObserver implements Serializable { |
83 | 82 | return this.savedParams; |
84 | 83 | } |
85 | 84 | |
85 | + public JsfSecurityConfig getConfig() { | |
86 | + if (this.config == null) { | |
87 | + this.config = Beans.getReference(JsfSecurityConfig.class); | |
88 | + } | |
89 | + | |
90 | + return this.config; | |
91 | + } | |
92 | + | |
86 | 93 | private void saveCurrentState() { |
87 | 94 | clear(); |
88 | 95 | FacesContext facesContext = Beans.getReference(FacesContext.class); |
89 | 96 | |
90 | - if (!config.getLoginPage().equals(facesContext.getViewRoot().getViewId())) { | |
97 | + if (!getConfig().getLoginPage().equals(facesContext.getViewRoot().getViewId())) { | |
91 | 98 | getSavedParams().putAll(facesContext.getExternalContext().getRequestParameterMap()); |
92 | 99 | savedViewId = facesContext.getViewRoot().getViewId(); |
93 | 100 | } |
... | ... | @@ -97,7 +104,7 @@ public class SecurityObserver implements Serializable { |
97 | 104 | saveCurrentState(); |
98 | 105 | |
99 | 106 | try { |
100 | - Redirector.redirect(config.getLoginPage()); | |
107 | + Redirector.redirect(getConfig().getLoginPage()); | |
101 | 108 | |
102 | 109 | } catch (PageNotFoundException cause) { |
103 | 110 | // TODO Colocar a mensagem no bundle |
... | ... | @@ -116,9 +123,9 @@ public class SecurityObserver implements Serializable { |
116 | 123 | if (savedViewId != null) { |
117 | 124 | Redirector.redirect(savedViewId, getSavedParams()); |
118 | 125 | |
119 | - } else if (config.isRedirectEnabled()) { | |
126 | + } else if (getConfig().isRedirectEnabled()) { | |
120 | 127 | redirectedFromConfig = true; |
121 | - Redirector.redirect(config.getRedirectAfterLogin(), getSavedParams()); | |
128 | + Redirector.redirect(getConfig().getRedirectAfterLogin(), getSavedParams()); | |
122 | 129 | } |
123 | 130 | |
124 | 131 | } catch (PageNotFoundException cause) { |
... | ... | @@ -140,8 +147,8 @@ public class SecurityObserver implements Serializable { |
140 | 147 | |
141 | 148 | public void onLogoutSuccessful(@Observes final AfterLogoutSuccessful event) { |
142 | 149 | try { |
143 | - if (config.isRedirectEnabled()) { | |
144 | - Redirector.redirect(config.getRedirectAfterLogout()); | |
150 | + if (getConfig().isRedirectEnabled()) { | |
151 | + Redirector.redirect(getConfig().getRedirectAfterLogout()); | |
145 | 152 | } |
146 | 153 | |
147 | 154 | } catch (PageNotFoundException cause) { |
... | ... | @@ -165,4 +172,5 @@ public class SecurityObserver implements Serializable { |
165 | 172 | savedViewId = null; |
166 | 173 | getSavedParams().clear(); |
167 | 174 | } |
175 | + | |
168 | 176 | } | ... | ... |
impl/extension/jta/pom.xml
impl/extension/jta/src/main/java/br/gov/frameworkdemoiselle/transaction/JTATransaction.java
... | ... | @@ -37,8 +37,10 @@ |
37 | 37 | package br.gov.frameworkdemoiselle.transaction; |
38 | 38 | |
39 | 39 | import static br.gov.frameworkdemoiselle.internal.implementation.StrategySelector.EXTENSIONS_L2_PRIORITY; |
40 | +import static javax.transaction.Status.STATUS_MARKED_ROLLBACK; | |
41 | +import static javax.transaction.Status.STATUS_NO_TRANSACTION; | |
42 | +import static javax.transaction.Status.STATUS_ROLLEDBACK; | |
40 | 43 | |
41 | -import javax.transaction.Status; | |
42 | 44 | import javax.transaction.SystemException; |
43 | 45 | import javax.transaction.UserTransaction; |
44 | 46 | |
... | ... | @@ -64,7 +66,7 @@ public class JTATransaction implements Transaction { |
64 | 66 | @Override |
65 | 67 | public boolean isActive() { |
66 | 68 | try { |
67 | - return getDelegate().getStatus() == Status.STATUS_ACTIVE || isMarkedRollback(); | |
69 | + return getDelegate().getStatus() != STATUS_NO_TRANSACTION; | |
68 | 70 | |
69 | 71 | } catch (SystemException cause) { |
70 | 72 | throw new TransactionException(cause); |
... | ... | @@ -74,7 +76,8 @@ public class JTATransaction implements Transaction { |
74 | 76 | @Override |
75 | 77 | public boolean isMarkedRollback() { |
76 | 78 | try { |
77 | - return getDelegate().getStatus() == Status.STATUS_MARKED_ROLLBACK; | |
79 | + return getDelegate().getStatus() == STATUS_MARKED_ROLLBACK | |
80 | + || getDelegate().getStatus() == STATUS_ROLLEDBACK; | |
78 | 81 | |
79 | 82 | } catch (SystemException cause) { |
80 | 83 | throw new TransactionException(cause); | ... | ... |
impl/extension/jta/src/test/java/br/gov/frameworkdemoiselle/transaction/JTATransactionTest.java
... | ... | @@ -46,6 +46,8 @@ import static org.powermock.api.easymock.PowerMock.replayAll; |
46 | 46 | import static org.powermock.api.easymock.PowerMock.verify; |
47 | 47 | import static org.powermock.reflect.Whitebox.setInternalState; |
48 | 48 | |
49 | +import java.util.Locale; | |
50 | + | |
49 | 51 | import javax.transaction.HeuristicMixedException; |
50 | 52 | import javax.transaction.HeuristicRollbackException; |
51 | 53 | import javax.transaction.NotSupportedException; |
... | ... | @@ -60,8 +62,11 @@ import org.junit.Test; |
60 | 62 | import org.junit.runner.RunWith; |
61 | 63 | import org.powermock.core.classloader.annotations.PrepareForTest; |
62 | 64 | import org.powermock.modules.junit4.PowerMockRunner; |
65 | +import org.slf4j.Logger; | |
66 | +import org.slf4j.LoggerFactory; | |
63 | 67 | |
64 | 68 | import br.gov.frameworkdemoiselle.util.Beans; |
69 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
65 | 70 | |
66 | 71 | @RunWith(PowerMockRunner.class) |
67 | 72 | @PrepareForTest({ Beans.class }) |
... | ... | @@ -70,14 +75,22 @@ public class JTATransactionTest { |
70 | 75 | private UserTransaction userTransaction; |
71 | 76 | |
72 | 77 | private JTATransaction jtaTransaction; |
78 | + | |
79 | + private Logger logger; | |
80 | + | |
81 | + private ResourceBundle bundle; | |
73 | 82 | |
74 | 83 | @Before |
75 | 84 | public void setUp() { |
76 | 85 | |
77 | 86 | userTransaction = createMock(UserTransaction.class); |
78 | 87 | jtaTransaction = new JTATransaction(); |
88 | + logger = LoggerFactory.getLogger(JTATransaction.class); | |
89 | + bundle = new ResourceBundle("demoiselle-jta-bundle",Locale.getDefault()); | |
79 | 90 | |
80 | 91 | setInternalState(jtaTransaction, UserTransaction.class, userTransaction); |
92 | + setInternalState(jtaTransaction, Logger.class, logger); | |
93 | + setInternalState(jtaTransaction, ResourceBundle.class, bundle); | |
81 | 94 | } |
82 | 95 | |
83 | 96 | @Test | ... | ... |
... | ... | @@ -0,0 +1,42 @@ |
1 | +# Demoiselle Framework | |
2 | +# Copyright (C) 2010 SERPRO | |
3 | +# ---------------------------------------------------------------------------- | |
4 | +# This file is part of Demoiselle Framework. | |
5 | +# | |
6 | +# Demoiselle Framework is free software; you can redistribute it and/or | |
7 | +# modify it under the terms of the GNU Lesser General Public License version 3 | |
8 | +# as published by the Free Software Foundation. | |
9 | +# | |
10 | +# This program is distributed in the hope that it will be useful, | |
11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +# GNU General Public License for more details. | |
14 | +# | |
15 | +# You should have received a copy of the GNU Lesser General Public License version 3 | |
16 | +# along with this program; if not, see <http://www.gnu.org/licenses/> | |
17 | +# or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
18 | +# Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | +# ---------------------------------------------------------------------------- | |
20 | +# Este arquivo é parte do Framework Demoiselle. | |
21 | +# | |
22 | +# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
23 | +# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
24 | +# do Software Livre (FSF). | |
25 | +# | |
26 | +# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
27 | +# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
28 | +# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
29 | +# para maiores detalhes. | |
30 | +# | |
31 | +# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
32 | +# "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
33 | +# ou escreva para a Fundação do Software Livre (FSF) Inc., | |
34 | +# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
35 | + | |
36 | +log4j.rootCategory=INFO, stdout | |
37 | + | |
38 | +log4j.logger.br.gov.frameworkdemoiselle=TRACE | |
39 | + | |
40 | +log4j.appender.stdout=org.apache.log4j.ConsoleAppender | |
41 | +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | |
42 | +log4j.appender.stdout.layout.ConversionPattern=%-5p [%c{1}] %m%n | ... | ... |
parent/extension/pom.xml
pom.xml
... | ... | @@ -39,7 +39,11 @@ |
39 | 39 | <modelVersion>4.0.0</modelVersion> |
40 | 40 | |
41 | 41 | <artifactId>demoiselle-framework-build</artifactId> |
42 | +<<<<<<< HEAD | |
42 | 43 | <version>2.4.0-ALPHA1-SNAPSHOT</version> |
44 | +======= | |
45 | + <version>2.3.2-SNAPSHOT</version> | |
46 | +>>>>>>> master | |
43 | 47 | <packaging>pom</packaging> |
44 | 48 | |
45 | 49 | <parent> | ... | ... |
site/apt/release-notes.apt
... | ... | @@ -38,7 +38,11 @@ |
38 | 38 | |
39 | 39 | Notas de Versão |
40 | 40 | |
41 | -* v2.3.0 | |
41 | +* v2.3.1 | |
42 | + | |
43 | + * {{{http://demoiselle.atlassian.net/secure/ReleaseNote.jspa?projectId=10007&version=10218}Notas de Versão no JIRA}} | |
44 | + | |
45 | +* {{{../2.3.0/}v2.3.0}} | |
42 | 46 | |
43 | 47 | * {{{http://demoiselle.atlassian.net/secure/ReleaseNote.jspa?projectId=10007&version=10101}Notas de Versão no JIRA}} |
44 | 48 | ... | ... |