Commit bab685f7d6a38dc77d06dd427e621c2113beca2d

Authored by Dancovich
2 parents 5fa39fa1 8753c457
Exists in master

Merge remote-tracking branch 'origin/2.4.0' into 2.4.0

Conflicts:
	impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/ContextManager.java
	impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/CustomContext.java
	impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/ManagedContext.java
	impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/ThreadLocalContext.java
Showing 90 changed files with 1385 additions and 1007 deletions   Show diff stats
documentation/reference/pt-BR/gerenciamento.xml
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 <para>Ao implantar um sistema para produção, muitas vezes é necessário monitorar aspectos sobre o funcionamento desse sistema. Quanta memória 11 <para>Ao implantar um sistema para produção, muitas vezes é necessário monitorar aspectos sobre o funcionamento desse sistema. Quanta memória
12 ele está utilizando? Qual o pico de MIPS utilizados? Quantas sessões estão autenticadas no momento?</para> 12 ele está utilizando? Qual o pico de MIPS utilizados? Quantas sessões estão autenticadas no momento?</para>
13 13
14 - <para>Além de monitorar um sistema, as vezes é necessário gerencia-lo alterando aspectos de seu comportamento. Se o sistema está implantado em um 14 + <para>Além de monitorar um sistema, as vezes é necessário gerenciá-lo alterando aspectos de seu comportamento. Se o sistema está implantado em um
15 servidor alugado, talvez seja necessário ajustar o uso de MIPS para reduzir custos ou talvez deseje-se solicitar que o sistema limpe dados de sessão 15 servidor alugado, talvez seja necessário ajustar o uso de MIPS para reduzir custos ou talvez deseje-se solicitar que o sistema limpe dados de sessão
16 de autenticação abandonados por usuários que desligaram suas estações sem efetuar "logoff".</para> 16 de autenticação abandonados por usuários que desligaram suas estações sem efetuar "logoff".</para>
17 17
@@ -20,8 +20,9 @@ @@ -20,8 +20,9 @@
20 <emphasis>Java Management Extension</emphasis> (JMX).</para> 20 <emphasis>Java Management Extension</emphasis> (JMX).</para>
21 21
22 <para>O <emphasis>Demoiselle Framework</emphasis> dispõe de uma série de ferramentas para nivelar 22 <para>O <emphasis>Demoiselle Framework</emphasis> dispõe de uma série de ferramentas para nivelar
23 - o conhecimento do desenvolvedor e facilitar o uso e integraçao de várias tecnologias de gerenciamento e monitoração. Através de seu  
24 - uso o desenvolvedor pode se despreocupar com detalhes de implementação de cada tecnologia individual e facilmente integrar tais tecnologias.</para> 23 + o conhecimento do desenvolvedor e facilitar o uso e integraçao de várias tecnologias de gerenciamento e
  24 + monitoração. Através de seu uso o desenvolvedor pode facilmente integrar tais tecnologias, despreocupando-se
  25 + com detalhes de implementação de cada uma delas.</para>
25 </section> 26 </section>
26 27
27 <section> 28 <section>
@@ -35,7 +36,7 @@ @@ -35,7 +36,7 @@
35 @ManagementController 36 @ManagementController
36 public class GerenciadorUsuarios]]></programlisting> 37 public class GerenciadorUsuarios]]></programlisting>
37 38
38 - <para>Essa anotação é suficiente para o mecanismo de gerenciamento descobrir sua classe e disponibiliza-la para ser monitorada e gerenciada.</para> 39 + <para>Essa anotação é suficiente para o mecanismo de gerenciamento descobrir sua classe e disponibilizá-la para ser monitorada e gerenciada.</para>
39 40
40 <para>Contudo, a simples anotação acima não informa ao mecanismo quais aspectos da classe serão expostos. Por padrão, um <emphasis>Management Controller</emphasis> 41 <para>Contudo, a simples anotação acima não informa ao mecanismo quais aspectos da classe serão expostos. Por padrão, um <emphasis>Management Controller</emphasis>
41 não expõe nenhum aspecto seu. Para selecionar quais aspectos serão expostos usamos as anotações 42 não expõe nenhum aspecto seu. Para selecionar quais aspectos serão expostos usamos as anotações
@@ -43,7 +44,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt; @@ -43,7 +44,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt;
43 de classes anotadas com <code>@ManagementController</code>.</para> 44 de classes anotadas com <code>@ManagementController</code>.</para>
44 45
45 <informaltable> 46 <informaltable>
46 - <tgroup cols="3"> 47 + <tgroup cols="3" rowsep="1" colsep="1">
47 <thead> 48 <thead>
48 <row> 49 <row>
49 <entry>Anotação</entry> 50 <entry>Anotação</entry>
@@ -53,7 +54,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt; @@ -53,7 +54,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt;
53 </thead> 54 </thead>
54 55
55 <tbody> 56 <tbody>
56 - <row> 57 + <row valign="top">
57 <entry> 58 <entry>
58 <emphasis role="BOLD">@ManagedProperty</emphasis> 59 <emphasis role="BOLD">@ManagedProperty</emphasis>
59 </entry> 60 </entry>
@@ -76,7 +77,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt; @@ -76,7 +77,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt;
76 </entry> 77 </entry>
77 </row> 78 </row>
78 79
79 - <row> 80 + <row valign="top">
80 <entry> 81 <entry>
81 <emphasis role="BOLD">@ManagedOperation</emphasis> 82 <emphasis role="BOLD">@ManagedOperation</emphasis>
82 </entry> 83 </entry>
@@ -98,7 +99,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt; @@ -98,7 +99,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt;
98 </entry> 99 </entry>
99 </row> 100 </row>
100 101
101 - <row> 102 + <row valign="top">
102 <entry> 103 <entry>
103 <emphasis role="BOLD">@OperationParameter</emphasis> 104 <emphasis role="BOLD">@OperationParameter</emphasis>
104 </entry> 105 </entry>
@@ -148,6 +149,24 @@ public class ControleAcesso{ @@ -148,6 +149,24 @@ public class ControleAcesso{
148 monitorLogin.setContadorLogin( monitorLogin.getContadorLogin() + 1 ); 149 monitorLogin.setContadorLogin( monitorLogin.getContadorLogin() + 1 );
149 } 150 }
150 }]]></programlisting> 151 }]]></programlisting>
  152 +
  153 + <programlisting role="JAVA"><![CDATA[
  154 +@ManagementController
  155 +public class MonitorLogin{
  156 +
  157 + @ManagedProperty
  158 + private int contadorLogin;
  159 +
  160 + @ManagedOperation
  161 + public void setContadorLogin(int qtdUsuarioLogados){
  162 + contadorLogin = qtdUsuarioLogados;
  163 + }
  164 +
  165 + @ManagedOperation
  166 + public int getContatorLogin(){
  167 + return contadorLogin;
  168 + }
  169 +}]]></programlisting>
151 170
152 <para>Como é possível ver, classes anotadas com <emphasis>@ManagementController</emphasis> podem ser injetadas em qualquer ponto do código. Valores definidos 171 <para>Como é possível ver, classes anotadas com <emphasis>@ManagementController</emphasis> podem ser injetadas em qualquer ponto do código. Valores definidos
153 para seus atributos retêm seu estado, então um cliente que acesse remotamente o sistema e monitore o valor do atributo <emphasis>contadorLogin</emphasis> verá 172 para seus atributos retêm seu estado, então um cliente que acesse remotamente o sistema e monitore o valor do atributo <emphasis>contadorLogin</emphasis> verá
@@ -181,7 +200,7 @@ public class ControleAcesso{ @@ -181,7 +200,7 @@ public class ControleAcesso{
181 individualmente, as classes monitoradas serão então expostas para todas as extensões escolhidas.</para> 200 individualmente, as classes monitoradas serão então expostas para todas as extensões escolhidas.</para>
182 </tip> 201 </tip>
183 202
184 - <para>A figura <xref linkend="exemplo_jconsole"/> mostra como uma classe monitorada na aplicação <emphasis>Bookmark</emphasis> é exibida no <emphasis>JConsole</emphasis>.</para> 203 + <para>A figura <xref linkend="exemplo_jconsole" /> mostra como uma classe monitorada na aplicação <emphasis>Bookmark</emphasis> é exibida no <emphasis>JConsole</emphasis>.</para>
185 204
186 <programlisting role="JAVA"><![CDATA[ 205 <programlisting role="JAVA"><![CDATA[
187 @ManagementController 206 @ManagementController
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ManagementBootstrap.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package br.gov.frameworkdemoiselle.internal.bootstrap; 37 package br.gov.frameworkdemoiselle.internal.bootstrap;
2 38
3 import java.lang.reflect.Modifier; 39 import java.lang.reflect.Modifier;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/CustomContext.java 0 → 100644
@@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package br.gov.frameworkdemoiselle.internal.context;
  38 +
  39 +import javax.enterprise.context.spi.Context;
  40 +
  41 +/**
  42 + *
  43 + * Base interface for contexts managed by the framework.
  44 + *
  45 + * @author serpro
  46 + *
  47 + */
  48 +public interface CustomContext extends Context {
  49 +
  50 + /**
  51 + * Activates a custom context
  52 + *
  53 + * @return <code>true</code> if context was activated, <code>false</code> if there was already another active
  54 + * context for the same scope and the activation of this scope failed.
  55 + */
  56 + boolean activate();
  57 +
  58 + /**
  59 + * Deactivates this context, it will clear all beans stored on this context.
  60 + */
  61 + void deactivate();
  62 +}
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/ThreadLocalContext.java 0 → 100644
@@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +/*
  38 + * Demoiselle Framework Copyright (c) 2010 Serpro and other contributors as indicated by the @author tag. See the
  39 + * copyright.txt in the distribution for a full listing of contributors. Demoiselle Framework is an open source Java EE
  40 + * library designed to accelerate the development of transactional database Web applications. Demoiselle Framework is
  41 + * released under the terms of the LGPL license 3 http://www.gnu.org/licenses/lgpl.html LGPL License 3 This file is part
  42 + * of Demoiselle Framework. Demoiselle Framework is free software: you can redistribute it and/or modify it under the
  43 + * terms of the GNU Lesser General Public License 3 as published by the Free Software Foundation. Demoiselle Framework
  44 + * is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  45 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You
  46 + * should have received a copy of the GNU Lesser General Public License along with Demoiselle Framework. If not, see
  47 + * <http://www.gnu.org/licenses/>.
  48 + */
  49 +package br.gov.frameworkdemoiselle.internal.context;
  50 +
  51 +import java.lang.annotation.Annotation;
  52 +
  53 +/**
  54 + * Base context that has a separated store for each thread
  55 + *
  56 + * @author SERPRO
  57 + */
  58 +public class ThreadLocalContext extends AbstractCustomContext {
  59 +
  60 + private final ThreadLocal<Store> threadLocal = new ThreadLocal<Store>();
  61 +
  62 + public ThreadLocalContext(final Class<? extends Annotation> scope) {
  63 + super(scope);
  64 + }
  65 +
  66 + @Override
  67 + protected boolean isStoreInitialized() {
  68 + return threadLocal.get()!=null;
  69 + }
  70 +
  71 + @Override
  72 + protected Store getStore() {
  73 + if (this.threadLocal.get() == null) {
  74 + this.threadLocal.set(createStore());
  75 + }
  76 +
  77 + return this.threadLocal.get();
  78 + }
  79 +}
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationImpl.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package br.gov.frameworkdemoiselle.internal.implementation; 37 package br.gov.frameworkdemoiselle.internal.implementation;
2 38
3 import java.io.Serializable; 39 import java.io.Serializable;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationLoader.java
@@ -193,8 +193,7 @@ public class ConfigurationLoader implements Serializable { @@ -193,8 +193,7 @@ public class ConfigurationLoader implements Serializable {
193 String prefix = this.object.getClass().getAnnotation(Configuration.class).prefix(); 193 String prefix = this.object.getClass().getAnnotation(Configuration.class).prefix();
194 194
195 if (prefix.endsWith(".")) { 195 if (prefix.endsWith(".")) {
196 - // prefix = prefix.substring(0, prefix.length() - 1);  
197 - // TODO Lançar warning pedindo para retirar o ponto (.)? 196 + getLogger().warn(getBundle().getString("configuration-dot-after-prefix", this.resource));
198 } else if (!prefix.isEmpty()) { 197 } else if (!prefix.isEmpty()) {
199 prefix += "."; 198 prefix += ".";
200 } 199 }
@@ -243,8 +242,7 @@ public class ConfigurationLoader implements Serializable { @@ -243,8 +242,7 @@ public class ConfigurationLoader implements Serializable {
243 } 242 }
244 243
245 catch (Exception cause) { 244 catch (Exception cause) {
246 - // TODO Lançar mensagem informando que houve erro ao tentar extrair o valor com o extrator tal.  
247 - throw new ConfigurationException("", cause); 245 + throw new ConfigurationException(getBundle().getString("configuration-generic-extraction-error", field.getType().toString(), getValueExtractor(field).getClass().getCanonicalName()), cause);
248 } 246 }
249 247
250 return value; 248 return value;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/NotificationManagerImpl.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package br.gov.frameworkdemoiselle.internal.implementation; 37 package br.gov.frameworkdemoiselle.internal.implementation;
2 38
3 import java.io.Serializable; 39 import java.io.Serializable;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/management/ManagedType.java
@@ -60,7 +60,7 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle; @@ -60,7 +60,7 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle;
60 * <p>Instances if this class are passed to each discovered management extension during bootstrap so they can have 60 * <p>Instances if this class are passed to each discovered management extension during bootstrap so they can have
61 * enough information to expose all discovered {@link ManagementController}'s to management clients.</p> 61 * enough information to expose all discovered {@link ManagementController}'s to management clients.</p>
62 * 62 *
63 - * @author serpro 63 + * @author SERPRO
64 */ 64 */
65 public class ManagedType { 65 public class ManagedType {
66 66
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/management/Management.java
@@ -72,7 +72,7 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle; @@ -72,7 +72,7 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle;
72 * Central class used by management extensions to obtain information, access properties and call operations over 72 * Central class used by management extensions to obtain information, access properties and call operations over
73 * discovered {@link ManagementController} classes. 73 * discovered {@link ManagementController} classes.
74 * 74 *
75 - * @author serpro 75 + * @author SERPRO
76 */ 76 */
77 @ApplicationScoped 77 @ApplicationScoped
78 public class Management implements Serializable { 78 public class Management implements Serializable {
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/management/ManagementNotificationEventImpl.java
@@ -44,7 +44,7 @@ import br.gov.frameworkdemoiselle.management.NotificationManager; @@ -44,7 +44,7 @@ import br.gov.frameworkdemoiselle.management.NotificationManager;
44 * Implementators can capture this event and be notified when the {@link NotificationManager} 44 * Implementators can capture this event and be notified when the {@link NotificationManager}
45 * sends notifications, so they can pass the notification to the underlying technology. 45 * sends notifications, so they can pass the notification to the underlying technology.
46 * 46 *
47 - * @author serpro 47 + * @author SERPRO
48 * 48 *
49 */ 49 */
50 public class ManagementNotificationEventImpl implements br.gov.frameworkdemoiselle.management.ManagementNotificationEvent { 50 public class ManagementNotificationEventImpl implements br.gov.frameworkdemoiselle.management.ManagementNotificationEvent {
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/management/qualifier/AttributeChange.java
@@ -51,7 +51,7 @@ import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; @@ -51,7 +51,7 @@ import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent;
51 * Enables {@link ManagementNotificationEvent} observers to trigger only with notifications 51 * Enables {@link ManagementNotificationEvent} observers to trigger only with notifications
52 * of the specialized type {@link AttributeChangeNotification}. 52 * of the specialized type {@link AttributeChangeNotification}.
53 * 53 *
54 - * @author serpro 54 + * @author SERPRO
55 * 55 *
56 */ 56 */
57 @Qualifier 57 @Qualifier
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/management/qualifier/Generic.java
@@ -51,7 +51,7 @@ import br.gov.frameworkdemoiselle.management.GenericNotification; @@ -51,7 +51,7 @@ import br.gov.frameworkdemoiselle.management.GenericNotification;
51 * Enables {@link ManagementNotificationEvent} observers to trigger only with notifications 51 * Enables {@link ManagementNotificationEvent} observers to trigger only with notifications
52 * of the base type {@link GenericNotification}. 52 * of the base type {@link GenericNotification}.
53 * 53 *
54 - * @author serpro 54 + * @author SERPRO
55 * 55 *
56 */ 56 */
57 @Qualifier 57 @Qualifier
impl/core/src/main/java/br/gov/frameworkdemoiselle/lifecycle/ManagementExtension.java
@@ -54,7 +54,7 @@ import br.gov.frameworkdemoiselle.stereotype.ManagementController; @@ -54,7 +54,7 @@ import br.gov.frameworkdemoiselle.stereotype.ManagementController;
54 * methods at the apropriate times. 54 * methods at the apropriate times.
55 * </p> 55 * </p>
56 * 56 *
57 - * @author serpro 57 + * @author SERPRO
58 */ 58 */
59 public interface ManagementExtension { 59 public interface ManagementExtension {
60 60
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/AttributeChangeNotification.java
@@ -40,7 +40,7 @@ package br.gov.frameworkdemoiselle.management; @@ -40,7 +40,7 @@ package br.gov.frameworkdemoiselle.management;
40 * Special notification to denote an attribute has changed values. 40 * Special notification to denote an attribute has changed values.
41 * 41 *
42 * @see GenericNotification 42 * @see GenericNotification
43 - * @author serpro 43 + * @author SERPRO
44 */ 44 */
45 public class AttributeChangeNotification extends GenericNotification { 45 public class AttributeChangeNotification extends GenericNotification {
46 46
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/GenericNotification.java
@@ -39,7 +39,7 @@ package br.gov.frameworkdemoiselle.management; @@ -39,7 +39,7 @@ package br.gov.frameworkdemoiselle.management;
39 /** 39 /**
40 * Notification that can be sent by the {@link NotificationManager}. 40 * Notification that can be sent by the {@link NotificationManager}.
41 * 41 *
42 - * @author serpro 42 + * @author SERPRO
43 */ 43 */
44 public class GenericNotification { 44 public class GenericNotification {
45 45
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedAttributeNotFoundException.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package br.gov.frameworkdemoiselle.management; 37 package br.gov.frameworkdemoiselle.management;
2 38
3 import br.gov.frameworkdemoiselle.DemoiselleException; 39 import br.gov.frameworkdemoiselle.DemoiselleException;
@@ -7,7 +43,7 @@ import br.gov.frameworkdemoiselle.DemoiselleException; @@ -7,7 +43,7 @@ import br.gov.frameworkdemoiselle.DemoiselleException;
7 * Thrown when a management client tries to read or write a property, but the 43 * Thrown when a management client tries to read or write a property, but the
8 * management engine has no knowledge of an attribute with the given name. 44 * management engine has no knowledge of an attribute with the given name.
9 * 45 *
10 - * @author serpro 46 + * @author SERPRO
11 * 47 *
12 */ 48 */
13 public class ManagedAttributeNotFoundException extends DemoiselleException { 49 public class ManagedAttributeNotFoundException extends DemoiselleException {
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedInvokationException.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package br.gov.frameworkdemoiselle.management; 37 package br.gov.frameworkdemoiselle.management;
2 38
3 import br.gov.frameworkdemoiselle.DemoiselleException; 39 import br.gov.frameworkdemoiselle.DemoiselleException;
4 40
5 - 41 +/**
  42 + *
  43 + * Thrown In case the operation doesn't exist or have a different signature
  44 + *
  45 + * @author SERPRO
  46 + *
  47 + */
6 public class ManagedInvokationException extends DemoiselleException { 48 public class ManagedInvokationException extends DemoiselleException {
7 49
8 private static final long serialVersionUID = -1542365184737242152L; 50 private static final long serialVersionUID = -1542365184737242152L;
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagementNotificationEvent.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package br.gov.frameworkdemoiselle.management; 37 package br.gov.frameworkdemoiselle.management;
2 38
3 /** 39 /**
@@ -5,7 +41,7 @@ package br.gov.frameworkdemoiselle.management; @@ -5,7 +41,7 @@ package br.gov.frameworkdemoiselle.management;
5 * Implementators can capture this event and be notified when the {@link NotificationManager} 41 * Implementators can capture this event and be notified when the {@link NotificationManager}
6 * sends notifications, so they can pass the notification to the underlying technology. 42 * sends notifications, so they can pass the notification to the underlying technology.
7 * 43 *
8 - * @author serpro 44 + * @author SERPRO
9 * 45 *
10 */ 46 */
11 public interface ManagementNotificationEvent { 47 public interface ManagementNotificationEvent {
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/NotificationManager.java
@@ -59,7 +59,7 @@ import br.gov.frameworkdemoiselle.util.Beans; @@ -59,7 +59,7 @@ import br.gov.frameworkdemoiselle.util.Beans;
59 * the implementator can use qualifiers like the {@link Generic} and {@link AttributeChange} qualifiers 59 * the implementator can use qualifiers like the {@link Generic} and {@link AttributeChange} qualifiers
60 * to filter what king of notifications they will handle. One example of an implementator is the <b>demoiselle-jmx</b> extension.</p> 60 * to filter what king of notifications they will handle. One example of an implementator is the <b>demoiselle-jmx</b> extension.</p>
61 * 61 *
62 - * @author serpro 62 + * @author SERPRO
63 * 63 *
64 */ 64 */
65 @ApplicationScoped 65 @ApplicationScoped
impl/core/src/main/resources/demoiselle-core-bundle.properties
@@ -60,6 +60,8 @@ loading-configuration-class=Carregando a classe de configura\u00E7\u00E3o {0} @@ -60,6 +60,8 @@ loading-configuration-class=Carregando a classe de configura\u00E7\u00E3o {0}
60 configuration-field-loaded=Configura\u00E7\u00E3o {0} atribu\u00EDda a {1} com o valor {2} 60 configuration-field-loaded=Configura\u00E7\u00E3o {0} atribu\u00EDda a {1} com o valor {2}
61 configuration-attribute-is-mandatory=A configura\u00E7\u00E3o {0} \u00E9 obrigat\u00F3ria, mas n\u00E3o foi encontrada em {1} 61 configuration-attribute-is-mandatory=A configura\u00E7\u00E3o {0} \u00E9 obrigat\u00F3ria, mas n\u00E3o foi encontrada em {1}
62 configuration-name-attribute-cant-be-empty=A nota\u00E7\u00E3o Name n\u00E3o pode estar em branco 62 configuration-name-attribute-cant-be-empty=A nota\u00E7\u00E3o Name n\u00E3o pode estar em branco
  63 +configuration-generic-extraction-error=Ocorreu um erro durante a extra\u00E7\u00E3o do tipo {0} com o extrator {1}
  64 +configuration-dot-after-prefix=N\u00E3o \u00E9 necess\u00E1rio adicionar o ponto ap\u00F3s o prefixo para uma classe de configura\u00E7\u00E3o. \u00C9 recomendado que sejam retirados, pois poder\u00E3o causar erros em vers\u00F5es futuras do Framework.
63 configuration-key-not-found=Chave de configura\u00E7\u00E3o {0} n\u00E3o encontrada 65 configuration-key-not-found=Chave de configura\u00E7\u00E3o {0} n\u00E3o encontrada
64 configuration-extractor-not-found=N\u00E3o foi poss\u00EDvel encontrar a classe extratora para o atributo {0}. Implemente a interface {1} para criar sua classe extratora. 66 configuration-extractor-not-found=N\u00E3o foi poss\u00EDvel encontrar a classe extratora para o atributo {0}. Implemente a interface {1} para criar sua classe extratora.
65 configuration-not-conversion=N\u00E3o \u00E9 poss\u00EDvel converter o valor {0} para o tipo {1} 67 configuration-not-conversion=N\u00E3o \u00E9 poss\u00EDvel converter o valor {0} para o tipo {1}
impl/core/src/test/java/management/basic/ManagementTest.java
@@ -57,7 +57,7 @@ import br.gov.frameworkdemoiselle.util.Beans; @@ -57,7 +57,7 @@ import br.gov.frameworkdemoiselle.util.Beans;
57 * Test case that simulates a management extension and tests if properties and operations on a managed class can be 57 * Test case that simulates a management extension and tests if properties and operations on a managed class can be
58 * easily accessed and invoked. 58 * easily accessed and invoked.
59 * 59 *
60 - * @author serpro 60 + * @author SERPRO
61 */ 61 */
62 @RunWith(Arquillian.class) 62 @RunWith(Arquillian.class)
63 public class ManagementTest { 63 public class ManagementTest {
impl/core/src/test/java/management/notification/NotificationTest.java
@@ -61,7 +61,7 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle; @@ -61,7 +61,7 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle;
61 /** 61 /**
62 * Test the {@link NotificationManager} with a dummy extension to check if notifications are correctly propagated 62 * Test the {@link NotificationManager} with a dummy extension to check if notifications are correctly propagated
63 * 63 *
64 - * @author serpro 64 + * @author SERPRO
65 */ 65 */
66 @RunWith(Arquillian.class) 66 @RunWith(Arquillian.class)
67 public class NotificationTest { 67 public class NotificationTest {
impl/core/src/test/java/management/testclasses/DummyManagedClassPropertyError.java
@@ -44,7 +44,7 @@ import br.gov.frameworkdemoiselle.stereotype.ManagementController; @@ -44,7 +44,7 @@ import br.gov.frameworkdemoiselle.stereotype.ManagementController;
44 * 44 *
45 * Used in tests to detect if the bootstrap detects wrong annotations 45 * Used in tests to detect if the bootstrap detects wrong annotations
46 * 46 *
47 - * @author serpro 47 + * @author SERPRO
48 * 48 *
49 */ 49 */
50 @ManagementController 50 @ManagementController
impl/core/src/test/java/management/testclasses/DummyNotificationListener.java
@@ -48,7 +48,7 @@ import br.gov.frameworkdemoiselle.management.NotificationManager; @@ -48,7 +48,7 @@ import br.gov.frameworkdemoiselle.management.NotificationManager;
48 /** 48 /**
49 * Dummy class to test receiving of notifications sent by the {@link NotificationManager} 49 * Dummy class to test receiving of notifications sent by the {@link NotificationManager}
50 * 50 *
51 - * @author serpro 51 + * @author SERPRO
52 * 52 *
53 */ 53 */
54 @ApplicationScoped 54 @ApplicationScoped
impl/core/src/test/java/management/testclasses/ManagedClassStore.java
@@ -51,7 +51,7 @@ import br.gov.frameworkdemoiselle.util.Beans; @@ -51,7 +51,7 @@ import br.gov.frameworkdemoiselle.util.Beans;
51 * and can read/write properties and invoke operations on them, simulating a management 51 * and can read/write properties and invoke operations on them, simulating a management
52 * extension like JMX or SNMP. 52 * extension like JMX or SNMP.
53 * 53 *
54 - * @author serpro 54 + * @author SERPRO
55 * 55 *
56 */ 56 */
57 @ApplicationScoped 57 @ApplicationScoped
impl/core/src/test/java/management/testclasses/RequestScopeBeanClient.java
@@ -2,21 +2,20 @@ package management.testclasses; @@ -2,21 +2,20 @@ package management.testclasses;
2 2
3 import br.gov.frameworkdemoiselle.util.Beans; 3 import br.gov.frameworkdemoiselle.util.Beans;
4 4
5 -  
6 public class RequestScopeBeanClient { 5 public class RequestScopeBeanClient {
7 -  
8 - public void operationOne(){  
9 - 6 +
  7 + public void operationOne() {
  8 +
10 RequestScopedClass bean = Beans.getReference(RequestScopedClass.class); 9 RequestScopedClass bean = Beans.getReference(RequestScopedClass.class);
11 - bean.setInfo( bean.getInfo() + "-OPERATION ONE CALLED-");  
12 - 10 + bean.setInfo(bean.getInfo() + "-OPERATION ONE CALLED-");
  11 +
13 } 12 }
14 -  
15 - public void operationTwo(){  
16 - 13 +
  14 + public void operationTwo() {
  15 +
17 RequestScopedClass bean = Beans.getReference(RequestScopedClass.class); 16 RequestScopedClass bean = Beans.getReference(RequestScopedClass.class);
18 - bean.setInfo( bean.getInfo() + "-OPERATION TWO CALLED-");  
19 - 17 + bean.setInfo(bean.getInfo() + "-OPERATION TWO CALLED-");
  18 +
20 } 19 }
21 20
22 } 21 }
impl/core/src/test/java/management/testclasses/RequestScopedClass.java
@@ -4,19 +4,15 @@ import javax.enterprise.context.RequestScoped; @@ -4,19 +4,15 @@ import javax.enterprise.context.RequestScoped;
4 4
5 @RequestScoped 5 @RequestScoped
6 public class RequestScopedClass { 6 public class RequestScopedClass {
7 - 7 +
8 private String info = ""; 8 private String info = "";
9 9
10 -  
11 public String getInfo() { 10 public String getInfo() {
12 return info; 11 return info;
13 } 12 }
14 13
15 -  
16 public void setInfo(String info) { 14 public void setInfo(String info) {
17 this.info = info; 15 this.info = info;
18 } 16 }
19 -  
20 -  
21 17
22 } 18 }
impl/extension/jdbc/src/main/java/br/gov/frameworkdemoiselle/internal/producer/ConnectionProducer.java
@@ -22,6 +22,8 @@ import br.gov.frameworkdemoiselle.DemoiselleException; @@ -22,6 +22,8 @@ import br.gov.frameworkdemoiselle.DemoiselleException;
22 import br.gov.frameworkdemoiselle.annotation.Name; 22 import br.gov.frameworkdemoiselle.annotation.Name;
23 import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig; 23 import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig;
24 import br.gov.frameworkdemoiselle.internal.proxy.ConnectionProxy; 24 import br.gov.frameworkdemoiselle.internal.proxy.ConnectionProxy;
  25 +import br.gov.frameworkdemoiselle.util.Beans;
  26 +import br.gov.frameworkdemoiselle.util.NameQualifier;
25 import br.gov.frameworkdemoiselle.util.ResourceBundle; 27 import br.gov.frameworkdemoiselle.util.ResourceBundle;
26 28
27 @RequestScoped 29 @RequestScoped
@@ -29,15 +31,29 @@ public class ConnectionProducer implements Serializable { @@ -29,15 +31,29 @@ public class ConnectionProducer implements Serializable {
29 31
30 private static final long serialVersionUID = 1L; 32 private static final long serialVersionUID = 1L;
31 33
32 - @Inject  
33 - private Logger logger; 34 + private transient Logger logger;
34 35
35 - @Inject  
36 - @Name("demoiselle-jdbc-bundle")  
37 - private ResourceBundle bundle; 36 + private transient ResourceBundle bundle;
  37 +
  38 + private ResourceBundle getBundle() {
  39 + if (bundle == null) {
  40 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-jdbc-bundle"));
  41 + }
  42 +
  43 + return bundle;
  44 + }
  45 +
  46 + private Logger getLogger() {
  47 + if (logger == null) {
  48 + logger = Beans.getReference(Logger.class, new NameQualifier(DataSourceProducer.class.getName()));
  49 + }
  50 +
  51 + return logger;
  52 + }
38 53
39 private final Map<String, Connection> cache = Collections.synchronizedMap(new HashMap<String, Connection>()); 54 private final Map<String, Connection> cache = Collections.synchronizedMap(new HashMap<String, Connection>());
40 - private final Map<Connection,Status> statusCache = Collections.synchronizedMap(new HashMap<Connection, Status>()); 55 +
  56 + private final Map<Connection, Status> statusCache = Collections.synchronizedMap(new HashMap<Connection, Status>());
41 57
42 @Inject 58 @Inject
43 private DataSourceProducer producer; 59 private DataSourceProducer producer;
@@ -81,10 +97,10 @@ public class ConnectionProducer implements Serializable { @@ -81,10 +97,10 @@ public class ConnectionProducer implements Serializable {
81 97
82 cache.put(name, connection); 98 cache.put(name, connection);
83 statusCache.put(connection, new Status()); 99 statusCache.put(connection, new Status());
84 - logger.info(bundle.getString("connection-was-created", name)); 100 + getLogger().info(getBundle().getString("connection-was-created", name));
85 101
86 } catch (Exception cause) { 102 } catch (Exception cause) {
87 - throw new DemoiselleException(bundle.getString("connection-creation-failed", name), cause); 103 + throw new DemoiselleException(getBundle().getString("connection-creation-failed", name), cause);
88 } 104 }
89 } 105 }
90 106
@@ -96,7 +112,7 @@ public class ConnectionProducer implements Serializable { @@ -96,7 +112,7 @@ public class ConnectionProducer implements Serializable {
96 connection.setAutoCommit(false); 112 connection.setAutoCommit(false);
97 113
98 } catch (SQLException cause) { 114 } catch (SQLException cause) {
99 - logger.debug(bundle.getString("set-autocommit-failed")); 115 + getLogger().debug(getBundle().getString("set-autocommit-failed"));
100 } 116 }
101 } 117 }
102 118
@@ -104,7 +120,7 @@ public class ConnectionProducer implements Serializable { @@ -104,7 +120,7 @@ public class ConnectionProducer implements Serializable {
104 String result = config.getDefaultDataSourceName(); 120 String result = config.getDefaultDataSourceName();
105 121
106 if (result != null) { 122 if (result != null) {
107 - logger.debug(bundle.getString("getting-default-datasource-name-from-properties", result)); 123 + getLogger().debug(getBundle().getString("getting-default-datasource-name-from-properties", result));
108 } 124 }
109 125
110 return result; 126 return result;
@@ -115,7 +131,7 @@ public class ConnectionProducer implements Serializable { @@ -115,7 +131,7 @@ public class ConnectionProducer implements Serializable {
115 Set<String> names = producer.getCache().keySet(); 131 Set<String> names = producer.getCache().keySet();
116 132
117 if (names.size() > 1) { 133 if (names.size() > 1) {
118 - throw new DemoiselleException(bundle.getString("more-than-one-datasource-defined", 134 + throw new DemoiselleException(getBundle().getString("more-than-one-datasource-defined",
119 Name.class.getSimpleName())); 135 Name.class.getSimpleName()));
120 } else { 136 } else {
121 result = names.iterator().next(); 137 result = names.iterator().next();
@@ -133,16 +149,16 @@ public class ConnectionProducer implements Serializable { @@ -133,16 +149,16 @@ public class ConnectionProducer implements Serializable {
133 149
134 try { 150 try {
135 if (connection.isClosed()) { 151 if (connection.isClosed()) {
136 - logger.warn(bundle.getString("connection-has-already-been-closed", key)); 152 + getLogger().warn(getBundle().getString("connection-has-already-been-closed", key));
137 153
138 } else { 154 } else {
139 connection.close(); 155 connection.close();
140 156
141 - logger.info(bundle.getString("connection-was-closed", key)); 157 + getLogger().info(getBundle().getString("connection-was-closed", key));
142 } 158 }
143 159
144 } catch (Exception cause) { 160 } catch (Exception cause) {
145 - throw new DemoiselleException(bundle.getString("connection-close-failed", key), cause); 161 + throw new DemoiselleException(getBundle().getString("connection-close-failed", key), cause);
146 } 162 }
147 } 163 }
148 164
@@ -152,11 +168,11 @@ public class ConnectionProducer implements Serializable { @@ -152,11 +168,11 @@ public class ConnectionProducer implements Serializable {
152 public Map<String, Connection> getCache() { 168 public Map<String, Connection> getCache() {
153 return cache; 169 return cache;
154 } 170 }
155 - 171 +
156 public Status getStatus(Connection connection) { 172 public Status getStatus(Connection connection) {
157 return statusCache.get(connection); 173 return statusCache.get(connection);
158 } 174 }
159 - 175 +
160 public static class Status implements Serializable { 176 public static class Status implements Serializable {
161 177
162 private static final long serialVersionUID = 1L; 178 private static final long serialVersionUID = 1L;
@@ -181,5 +197,4 @@ public class ConnectionProducer implements Serializable { @@ -181,5 +197,4 @@ public class ConnectionProducer implements Serializable {
181 this.markedRollback = markedRollback; 197 this.markedRollback = markedRollback;
182 } 198 }
183 } 199 }
184 -  
185 } 200 }
impl/extension/jdbc/src/main/java/br/gov/frameworkdemoiselle/internal/producer/DataSourceProducer.java
@@ -10,7 +10,6 @@ import java.util.Set; @@ -10,7 +10,6 @@ import java.util.Set;
10 import javax.annotation.PostConstruct; 10 import javax.annotation.PostConstruct;
11 import javax.annotation.PreDestroy; 11 import javax.annotation.PreDestroy;
12 import javax.enterprise.context.ApplicationScoped; 12 import javax.enterprise.context.ApplicationScoped;
13 -import javax.inject.Inject;  
14 import javax.naming.Context; 13 import javax.naming.Context;
15 import javax.naming.InitialContext; 14 import javax.naming.InitialContext;
16 import javax.naming.NamingException; 15 import javax.naming.NamingException;
@@ -19,10 +18,10 @@ import javax.sql.DataSource; @@ -19,10 +18,10 @@ import javax.sql.DataSource;
19 import org.slf4j.Logger; 18 import org.slf4j.Logger;
20 19
21 import br.gov.frameworkdemoiselle.DemoiselleException; 20 import br.gov.frameworkdemoiselle.DemoiselleException;
22 -import br.gov.frameworkdemoiselle.annotation.Name;  
23 import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig; 21 import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig;
24 import br.gov.frameworkdemoiselle.internal.proxy.BasicDataSourceProxy; 22 import br.gov.frameworkdemoiselle.internal.proxy.BasicDataSourceProxy;
25 import br.gov.frameworkdemoiselle.util.Beans; 23 import br.gov.frameworkdemoiselle.util.Beans;
  24 +import br.gov.frameworkdemoiselle.util.NameQualifier;
26 import br.gov.frameworkdemoiselle.util.ResourceBundle; 25 import br.gov.frameworkdemoiselle.util.ResourceBundle;
27 26
28 @ApplicationScoped 27 @ApplicationScoped
@@ -30,12 +29,25 @@ public class DataSourceProducer implements Serializable { @@ -30,12 +29,25 @@ public class DataSourceProducer implements Serializable {
30 29
31 private static final long serialVersionUID = 1L; 30 private static final long serialVersionUID = 1L;
32 31
33 - @Inject  
34 - private Logger logger; 32 + private transient Logger logger;
35 33
36 - @Inject  
37 - @Name("demoiselle-jdbc-bundle")  
38 - private ResourceBundle bundle; 34 + private transient ResourceBundle bundle;
  35 +
  36 + private ResourceBundle getBundle() {
  37 + if (bundle == null) {
  38 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-jdbc-bundle"));
  39 + }
  40 +
  41 + return bundle;
  42 + }
  43 +
  44 + private Logger getLogger() {
  45 + if (logger == null) {
  46 + logger = Beans.getReference(Logger.class, new NameQualifier(DataSourceProducer.class.getName()));
  47 + }
  48 +
  49 + return logger;
  50 + }
39 51
40 private final Map<ClassLoader, Map<String, DataSource>> cache = Collections 52 private final Map<ClassLoader, Map<String, DataSource>> cache = Collections
41 .synchronizedMap(new HashMap<ClassLoader, Map<String, DataSource>>()); 53 .synchronizedMap(new HashMap<ClassLoader, Map<String, DataSource>>());
@@ -52,7 +64,7 @@ public class DataSourceProducer implements Serializable { @@ -52,7 +64,7 @@ public class DataSourceProducer implements Serializable {
52 throw new DemoiselleException(cause); 64 throw new DemoiselleException(cause);
53 } 65 }
54 66
55 - logger.debug(bundle.getString("datasource-name-found", dataBaseName)); 67 + getLogger().debug(getBundle().getString("datasource-name-found", dataBaseName));
56 } 68 }
57 } 69 }
58 70
@@ -70,7 +82,7 @@ public class DataSourceProducer implements Serializable { @@ -70,7 +82,7 @@ public class DataSourceProducer implements Serializable {
70 } 82 }
71 83
72 if (result.isEmpty()) { 84 if (result.isEmpty()) {
73 - throw new DemoiselleException(bundle.getString("datasource-name-not-found")); 85 + throw new DemoiselleException(getBundle().getString("datasource-name-not-found"));
74 } 86 }
75 87
76 return result; 88 return result;
@@ -117,10 +129,10 @@ public class DataSourceProducer implements Serializable { @@ -117,10 +129,10 @@ public class DataSourceProducer implements Serializable {
117 result = initJNDIDataSource(dataSourceName, jndi); 129 result = initJNDIDataSource(dataSourceName, jndi);
118 130
119 } else if (url != null) { 131 } else if (url != null) {
120 - result = new BasicDataSourceProxy(dataSourceName, config, bundle);  
121 - 132 + result = new BasicDataSourceProxy(dataSourceName, config, getBundle());
  133 +
122 } else { 134 } else {
123 - throw new DemoiselleException(bundle.getString("uncompleted-datasource-configuration", dataSourceName)); 135 + throw new DemoiselleException(getBundle().getString("uncompleted-datasource-configuration", dataSourceName));
124 } 136 }
125 137
126 return result; 138 return result;
@@ -134,10 +146,11 @@ public class DataSourceProducer implements Serializable { @@ -134,10 +146,11 @@ public class DataSourceProducer implements Serializable {
134 result = (DataSource) context.lookup(jndi); 146 result = (DataSource) context.lookup(jndi);
135 147
136 } catch (NamingException cause) { 148 } catch (NamingException cause) {
137 - throw new DemoiselleException(bundle.getString("load-jndi-datasource-failed", dataSourceName, jndi), cause); 149 + throw new DemoiselleException(getBundle().getString("load-jndi-datasource-failed", dataSourceName, jndi),
  150 + cause);
138 151
139 } catch (ClassCastException cause) { 152 } catch (ClassCastException cause) {
140 - throw new DemoiselleException(bundle.getString("load-duplicated-configuration-failed"), cause); 153 + throw new DemoiselleException(getBundle().getString("load-duplicated-configuration-failed"), cause);
141 } 154 }
142 155
143 return result; 156 return result;
@@ -153,7 +166,7 @@ public class DataSourceProducer implements Serializable { @@ -153,7 +166,7 @@ public class DataSourceProducer implements Serializable {
153 Map<String, DataSource> result = cache.get(classLoader); 166 Map<String, DataSource> result = cache.get(classLoader);
154 167
155 if (result == null || result.isEmpty()) { 168 if (result == null || result.isEmpty()) {
156 - logger.debug(bundle.getString("datasource-not-found-in-cache")); 169 + getLogger().debug(getBundle().getString("datasource-not-found-in-cache"));
157 170
158 for (String name : getDataSourceNames(classLoader)) { 171 for (String name : getDataSourceNames(classLoader)) {
159 create(name); 172 create(name);
impl/extension/jdbc/src/test/java/test/Tests.java
@@ -67,7 +67,7 @@ public final class Tests { @@ -67,7 +67,7 @@ public final class Tests {
67 67
68 private static WebArchive createDeployment() { 68 private static WebArchive createDeployment() {
69 File[] libs = Maven.resolver().offline().loadPomFromFile("pom.xml", "arquillian-test") 69 File[] libs = Maven.resolver().offline().loadPomFromFile("pom.xml", "arquillian-test")
70 - .importCompileAndRuntimeDependencies().importTestDependencies().resolve().withTransitivity().asFile(); 70 + .importCompileAndRuntimeDependencies().resolve().withTransitivity().asFile();
71 71
72 return ShrinkWrap 72 return ShrinkWrap
73 .create(WebArchive.class) 73 .create(WebArchive.class)
impl/extension/jdbc/src/test/resources/.glassfish.profile 0 → 100644
impl/extension/jmx/src/test/resources/.weldse.profile 0 → 100644
impl/extension/jpa/src/test/java/producer/MyEntity.java 0 → 100644
@@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
  1 +package producer;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +
  6 +@Entity
  7 +public class MyEntity {
  8 +
  9 + @Id
  10 + private String id;
  11 +
  12 + private String description;
  13 +
  14 + public String getId() {
  15 + return id;
  16 + }
  17 +
  18 + public void setId(String id) {
  19 + this.id = id;
  20 + }
  21 +
  22 + public String getDescription() {
  23 + return description;
  24 + }
  25 +
  26 + public void setDescription(String description) {
  27 + this.description = description;
  28 + }
  29 +}
impl/extension/jpa/src/test/java/producer/ProducerTest.java 0 → 100644
@@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
  1 +package producer;
  2 +
  3 +import static org.junit.Assert.assertEquals;
  4 +import static org.junit.Assert.assertNotNull;
  5 +import static org.junit.Assert.assertTrue;
  6 +
  7 +import javax.persistence.EntityManager;
  8 +
  9 +import org.jboss.arquillian.container.test.api.Deployment;
  10 +import org.jboss.arquillian.junit.Arquillian;
  11 +import org.jboss.shrinkwrap.api.spec.WebArchive;
  12 +import org.junit.Test;
  13 +import org.junit.runner.RunWith;
  14 +
  15 +import test.Tests;
  16 +import br.gov.frameworkdemoiselle.internal.proxy.EntityManagerProxy;
  17 +import br.gov.frameworkdemoiselle.util.Beans;
  18 +import br.gov.frameworkdemoiselle.util.NameQualifier;
  19 +
  20 +@RunWith(Arquillian.class)
  21 +public class ProducerTest {
  22 +
  23 + private static final String PATH = "src/test/resources/producer";
  24 +
  25 + @Deployment
  26 + public static WebArchive createDeployment() {
  27 + WebArchive deployment = Tests.createDeployment(ProducerTest.class);
  28 + deployment.addAsResource(Tests.createFileAsset(PATH + "/persistence.xml"), "META-INF/persistence.xml");
  29 + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties");
  30 +
  31 + return deployment;
  32 + }
  33 +
  34 + @Test
  35 + public void produceEntityManager() {
  36 + EntityManager manager = Beans.getReference(EntityManager.class);
  37 +
  38 + assertNotNull(manager);
  39 + assertEquals(EntityManagerProxy.class, manager.getClass());
  40 + }
  41 +
  42 + @Test
  43 + public void produceMultipleEntityManagers() {
  44 + EntityManager m1 = Beans.getReference(EntityManager.class, new NameQualifier("pu"));
  45 +
  46 + assertNotNull(m1);
  47 + assertEquals(EntityManagerProxy.class, m1.getClass());
  48 +
  49 + EntityManager m2 = Beans.getReference(EntityManager.class, new NameQualifier("pu2"));
  50 +
  51 + assertNotNull(m2);
  52 + assertEquals(EntityManagerProxy.class, m2.getClass());
  53 + }
  54 +
  55 + @Test
  56 + public void produceOneEntityManagerPerRequest() {
  57 + EntityManager m1 = Beans.getReference(EntityManager.class, new NameQualifier("pu"));
  58 +
  59 + assertNotNull(m1);
  60 + assertEquals(EntityManagerProxy.class, m1.getClass());
  61 +
  62 + EntityManager m2 = Beans.getReference(EntityManager.class, new NameQualifier("pu"));
  63 +
  64 + assertNotNull(m2);
  65 + assertEquals(EntityManagerProxy.class, m2.getClass());
  66 +
  67 + MyEntity entity = new MyEntity();
  68 + entity.setId(createId("testID"));
  69 +
  70 + m1.persist(entity);
  71 +
  72 + assertTrue(m2.contains(entity));
  73 + }
  74 +
  75 + private String createId(String id) {
  76 + return this.getClass().getName() + "_" + id;
  77 + }
  78 +
  79 +}
impl/extension/jpa/src/test/java/productor/MyEntity.java
@@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
1 -package productor;  
2 -  
3 -import javax.persistence.Entity;  
4 -import javax.persistence.Id;  
5 -  
6 -@Entity  
7 -public class MyEntity {  
8 -  
9 - @Id  
10 - private String id;  
11 -  
12 - private String description;  
13 -  
14 - public String getId() {  
15 - return id;  
16 - }  
17 -  
18 - public void setId(String id) {  
19 - this.id = id;  
20 - }  
21 -  
22 - public String getDescription() {  
23 - return description;  
24 - }  
25 -  
26 - public void setDescription(String description) {  
27 - this.description = description;  
28 - }  
29 -}  
impl/extension/jpa/src/test/java/productor/ProductorTest.java
@@ -1,80 +0,0 @@ @@ -1,80 +0,0 @@
1 -package productor;  
2 -  
3 -import javax.persistence.EntityManager;  
4 -  
5 -import org.jboss.arquillian.container.test.api.Deployment;  
6 -import org.jboss.arquillian.junit.Arquillian;  
7 -import org.jboss.shrinkwrap.api.spec.WebArchive;  
8 -import org.junit.Assert;  
9 -import org.junit.Test;  
10 -import org.junit.runner.RunWith;  
11 -  
12 -import test.Tests;  
13 -import br.gov.frameworkdemoiselle.internal.proxy.EntityManagerProxy;  
14 -import br.gov.frameworkdemoiselle.util.Beans;  
15 -import br.gov.frameworkdemoiselle.util.NameQualifier;  
16 -  
17 -  
18 -@RunWith(Arquillian.class)  
19 -public class ProductorTest {  
20 -  
21 - private static final String PATH = "src/test/resources/productor";  
22 -  
23 - @Deployment  
24 - public static WebArchive createDeployment() {  
25 - WebArchive deployment = Tests.createDeployment(ProductorTest.class);  
26 - deployment.addAsResource(Tests.createFileAsset(PATH + "/persistence.xml"), "META-INF/persistence.xml");  
27 - deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties");  
28 -  
29 - return deployment;  
30 - }  
31 -  
32 - @Test  
33 - public void produceEntityManager(){  
34 -  
35 - EntityManager manager = Beans.getReference(EntityManager.class);  
36 - Assert.assertNotNull(manager);  
37 - Assert.assertEquals(EntityManagerProxy.class,manager.getClass());  
38 -  
39 - }  
40 -  
41 - @Test  
42 - public void produceMultipleEntityManagers(){  
43 -  
44 - EntityManager m1 = Beans.getReference(EntityManager.class,new NameQualifier("pu"));  
45 -  
46 - Assert.assertNotNull(m1);  
47 - Assert.assertEquals(EntityManagerProxy.class,m1.getClass());  
48 -  
49 - EntityManager m2 = Beans.getReference(EntityManager.class,new NameQualifier("pu2"));  
50 -  
51 - Assert.assertNotNull(m2);  
52 - Assert.assertEquals(EntityManagerProxy.class,m2.getClass());  
53 -  
54 - }  
55 -  
56 - @Test  
57 - public void produceOneEntityManagerPerRequest(){  
58 - EntityManager m1 = Beans.getReference(EntityManager.class,new NameQualifier("pu"));  
59 -  
60 - Assert.assertNotNull(m1);  
61 - Assert.assertEquals(EntityManagerProxy.class,m1.getClass());  
62 -  
63 - EntityManager m2 = Beans.getReference(EntityManager.class,new NameQualifier("pu"));  
64 -  
65 - Assert.assertNotNull(m2);  
66 - Assert.assertEquals(EntityManagerProxy.class,m2.getClass());  
67 -  
68 - MyEntity entity = new MyEntity();  
69 - entity.setId(createId("testID"));  
70 -  
71 - m1.persist(entity);  
72 -  
73 - Assert.assertTrue( m2.contains(entity) );  
74 - }  
75 -  
76 - private String createId(String id) {  
77 - return this.getClass().getName() + "_" + id;  
78 - }  
79 -  
80 -}  
impl/extension/jpa/src/test/java/transaction/interceptor/JPATransactionTest.java
1 package transaction.interceptor; 1 package transaction.interceptor;
2 2
  3 +import static junit.framework.Assert.assertEquals;
  4 +import static junit.framework.Assert.assertFalse;
  5 +import static junit.framework.Assert.assertNull;
  6 +import static junit.framework.Assert.assertTrue;
  7 +
3 import javax.inject.Inject; 8 import javax.inject.Inject;
4 import javax.persistence.EntityManager; 9 import javax.persistence.EntityManager;
5 10
6 -import junit.framework.Assert;  
7 -  
8 import org.jboss.arquillian.container.test.api.Deployment; 11 import org.jboss.arquillian.container.test.api.Deployment;
9 import org.jboss.arquillian.junit.Arquillian; 12 import org.jboss.arquillian.junit.Arquillian;
10 import org.jboss.shrinkwrap.api.spec.WebArchive; 13 import org.jboss.shrinkwrap.api.spec.WebArchive;
@@ -20,10 +23,10 @@ import br.gov.frameworkdemoiselle.transaction.TransactionContext; @@ -20,10 +23,10 @@ import br.gov.frameworkdemoiselle.transaction.TransactionContext;
20 public class JPATransactionTest { 23 public class JPATransactionTest {
21 24
22 private static final String PATH = "src/test/resources/transaction/interceptor"; 25 private static final String PATH = "src/test/resources/transaction/interceptor";
23 - 26 +
24 @Inject 27 @Inject
25 private TransactionalBusiness tb; 28 private TransactionalBusiness tb;
26 - 29 +
27 @Inject 30 @Inject
28 @Name("pu1") 31 @Name("pu1")
29 private EntityManager em1; 32 private EntityManager em1;
@@ -31,7 +34,7 @@ public class JPATransactionTest { @@ -31,7 +34,7 @@ public class JPATransactionTest {
31 @Inject 34 @Inject
32 @Name("pu2") 35 @Name("pu2")
33 private EntityManager em2; 36 private EntityManager em2;
34 - 37 +
35 @Inject 38 @Inject
36 private TransactionContext transactionContext; 39 private TransactionContext transactionContext;
37 40
@@ -42,52 +45,51 @@ public class JPATransactionTest { @@ -42,52 +45,51 @@ public class JPATransactionTest {
42 45
43 return deployment; 46 return deployment;
44 } 47 }
45 - 48 +
46 @Before 49 @Before
47 - public void eraseDatabases(){ 50 + public void eraseDatabases() {
48 transactionContext.getCurrentTransaction().begin(); 51 transactionContext.getCurrentTransaction().begin();
49 em1.createQuery("DELETE FROM MyEntity1").executeUpdate(); 52 em1.createQuery("DELETE FROM MyEntity1").executeUpdate();
50 em2.createQuery("DELETE FROM MyEntity2").executeUpdate(); 53 em2.createQuery("DELETE FROM MyEntity2").executeUpdate();
51 transactionContext.getCurrentTransaction().commit(); 54 transactionContext.getCurrentTransaction().commit();
52 } 55 }
53 - 56 +
54 @Test 57 @Test
55 - public void isTransactionActiveWithInterceptor(){  
56 - Assert.assertTrue(tb.isTransactionActiveWithInterceptor()); 58 + public void isTransactionActiveWithInterceptor() {
  59 + assertTrue(tb.isTransactionActiveWithInterceptor());
57 } 60 }
58 - 61 +
59 @Test 62 @Test
60 - public void isTransactionActiveWithoutInterceptor(){  
61 - Assert.assertFalse(tb.isTransactionActiveWithoutInterceptor()); 63 + public void isTransactionActiveWithoutInterceptor() {
  64 + assertFalse(tb.isTransactionActiveWithoutInterceptor());
62 } 65 }
63 66
64 @Test 67 @Test
65 public void commitWithSuccess() { 68 public void commitWithSuccess() {
66 - 69 +
67 tb.commitWithSuccess(); 70 tb.commitWithSuccess();
68 71
69 MyEntity1 entity1 = em1.find(MyEntity1.class, tb.createId("id-1")); 72 MyEntity1 entity1 = em1.find(MyEntity1.class, tb.createId("id-1"));
70 MyEntity2 entity2 = em2.find(MyEntity2.class, tb.createId("id-2")); 73 MyEntity2 entity2 = em2.find(MyEntity2.class, tb.createId("id-2"));
71 -  
72 - Assert.assertEquals("desc-1", entity1.getDescription());  
73 - Assert.assertEquals("desc-2", entity2.getDescription()); 74 +
  75 + assertEquals("desc-1", entity1.getDescription());
  76 + assertEquals("desc-2", entity2.getDescription());
74 } 77 }
75 78
76 @Test 79 @Test
77 public void rollbackWithSuccess() { 80 public void rollbackWithSuccess() {
78 -  
79 - try{ 81 +
  82 + try {
80 tb.rollbackWithSuccess(); 83 tb.rollbackWithSuccess();
81 } catch (Exception e) { 84 } catch (Exception e) {
82 - Assert.assertEquals("Exceção criada para marcar transação para rollback", e.getMessage());  
83 - }  
84 - finally{ 85 + assertEquals("Exceção criada para marcar transação para rollback", e.getMessage());
  86 + } finally {
85 MyEntity1 entity1 = em1.find(MyEntity1.class, tb.createId("id-3")); 87 MyEntity1 entity1 = em1.find(MyEntity1.class, tb.createId("id-3"));
86 MyEntity2 entity2 = em2.find(MyEntity2.class, tb.createId("id-4")); 88 MyEntity2 entity2 = em2.find(MyEntity2.class, tb.createId("id-4"));
87 -  
88 - Assert.assertNull(entity1);  
89 - Assert.assertNull(entity2); 89 +
  90 + assertNull(entity1);
  91 + assertNull(entity2);
90 } 92 }
91 } 93 }
92 -  
93 -}  
94 \ No newline at end of file 94 \ No newline at end of file
  95 +
  96 +}
impl/extension/jpa/src/test/resources/.glassfish.profile 0 → 100644
impl/extension/jpa/src/test/resources/producer/demoiselle.properties 0 → 100644
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +frameworkdemoiselle.persistence.default.unit.name=pu
0 \ No newline at end of file 2 \ No newline at end of file
impl/extension/jpa/src/test/resources/producer/persistence.xml 0 → 100644
@@ -0,0 +1,76 @@ @@ -0,0 +1,76 @@
  1 +<!--
  2 + Demoiselle Framework
  3 + Copyright (C) 2010 SERPRO
  4 + ============================================================================
  5 + This file is part of Demoiselle Framework.
  6 +
  7 + Demoiselle Framework is free software; you can redistribute it and/or
  8 + modify it under the terms of the GNU Lesser General Public License version 3
  9 + as published by the Free Software Foundation.
  10 +
  11 + This program is distributed in the hope that it will be useful,
  12 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + GNU General Public License for more details.
  15 +
  16 + You should have received a copy of the GNU Lesser General Public License version 3
  17 + along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + Fifth Floor, Boston, MA 02110-1301, USA.
  20 + ============================================================================
  21 + Este arquivo é parte do Framework Demoiselle.
  22 +
  23 + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + do Software Livre (FSF).
  26 +
  27 + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + para maiores detalhes.
  31 +
  32 + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 +-->
  37 +<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  38 + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  39 +
  40 + <persistence-unit name="pu" transaction-type="RESOURCE_LOCAL">
  41 + <non-jta-data-source>jdbc/__default</non-jta-data-source>
  42 +
  43 + <class>producer.MyEntity</class>
  44 +
  45 + <properties>
  46 + <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
  47 + <property name="eclipselink.logging.level.sql" value="FINE" />
  48 + <property name="eclipselink.logging.parameters" value="true" />
  49 +
  50 + <!--
  51 + <property name="hibernate.show_sql" value="true" />
  52 + <property name="hibernate.format_sql" value="false" />
  53 + <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  54 + -->
  55 + </properties>
  56 + </persistence-unit>
  57 +
  58 + <persistence-unit name="pu2" transaction-type="RESOURCE_LOCAL">
  59 + <non-jta-data-source>jdbc/__default</non-jta-data-source>
  60 +
  61 + <class>producer.MyEntity</class>
  62 +
  63 + <properties>
  64 + <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
  65 + <property name="eclipselink.logging.level.sql" value="FINE" />
  66 + <property name="eclipselink.logging.parameters" value="true" />
  67 +
  68 + <!--
  69 + <property name="hibernate.show_sql" value="true" />
  70 + <property name="hibernate.format_sql" value="false" />
  71 + <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  72 + -->
  73 + </properties>
  74 + </persistence-unit>
  75 +
  76 +</persistence>
0 \ No newline at end of file 77 \ No newline at end of file
impl/extension/jpa/src/test/resources/productor/demoiselle.properties
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -frameworkdemoiselle.persistence.default.unit.name=pu  
2 \ No newline at end of file 0 \ No newline at end of file
impl/extension/jpa/src/test/resources/productor/persistence.xml
@@ -1,64 +0,0 @@ @@ -1,64 +0,0 @@
1 -<!--  
2 - Demoiselle Framework  
3 - Copyright (C) 2010 SERPRO  
4 - ============================================================================  
5 - This file is part of Demoiselle Framework.  
6 -  
7 - Demoiselle Framework is free software; you can redistribute it and/or  
8 - modify it under the terms of the GNU Lesser General Public License version 3  
9 - as published by the Free Software Foundation.  
10 -  
11 - This program is distributed in the hope that it will be useful,  
12 - but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - GNU General Public License for more details.  
15 -  
16 - You should have received a copy of the GNU Lesser General Public License version 3  
17 - along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - Fifth Floor, Boston, MA 02110-1301, USA.  
20 - ============================================================================  
21 - Este arquivo é parte do Framework Demoiselle.  
22 -  
23 - O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - do Software Livre (FSF).  
26 -  
27 - Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - para maiores detalhes.  
31 -  
32 - Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 --->  
37 -<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
38 - xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">  
39 -  
40 - <persistence-unit name="pu" transaction-type="RESOURCE_LOCAL">  
41 - <non-jta-data-source>jdbc/__default</non-jta-data-source>  
42 -  
43 - <class>productor.MyEntity</class>  
44 -  
45 - <properties>  
46 - <property name="hibernate.show_sql" value="true" />  
47 - <property name="hibernate.format_sql" value="false" />  
48 - <property name="hibernate.hbm2ddl.auto" value="create-drop" />  
49 - </properties>  
50 - </persistence-unit>  
51 -  
52 - <persistence-unit name="pu2" transaction-type="RESOURCE_LOCAL">  
53 - <non-jta-data-source>jdbc/__default</non-jta-data-source>  
54 -  
55 - <class>productor.MyEntity</class>  
56 -  
57 - <properties>  
58 - <property name="hibernate.show_sql" value="true" />  
59 - <property name="hibernate.format_sql" value="false" />  
60 - <property name="hibernate.hbm2ddl.auto" value="create-drop" />  
61 - </properties>  
62 - </persistence-unit>  
63 -  
64 -</persistence>  
65 \ No newline at end of file 0 \ No newline at end of file
impl/extension/jpa/src/test/resources/template/persistence.xml
@@ -37,9 +37,8 @@ @@ -37,9 +37,8 @@
37 <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 37 <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
38 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> 38 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
39 39
40 - <!--  
41 <persistence-unit name="pu" transaction-type="RESOURCE_LOCAL"> 40 <persistence-unit name="pu" transaction-type="RESOURCE_LOCAL">
42 - <non-jta-data-source>jdbc/arquillian1</non-jta-data-source> 41 + <non-jta-data-source>jdbc/__default</non-jta-data-source>
43 42
44 <class>template.MyEntity</class> 43 <class>template.MyEntity</class>
45 44
@@ -47,21 +46,12 @@ @@ -47,21 +46,12 @@
47 <property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> 46 <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
48 <property name="eclipselink.logging.level.sql" value="FINE" /> 47 <property name="eclipselink.logging.level.sql" value="FINE" />
49 <property name="eclipselink.logging.parameters" value="true" /> 48 <property name="eclipselink.logging.parameters" value="true" />
50 - </properties>  
51 - </persistence-unit>  
52 - -->  
53 -  
54 - <!--  
55 - -->  
56 - <persistence-unit name="pu" transaction-type="RESOURCE_LOCAL">  
57 - <non-jta-data-source>jdbc/__default</non-jta-data-source>  
58 -  
59 - <class>template.MyEntity</class>  
60 -  
61 - <properties> 49 +
  50 + <!--
62 <property name="hibernate.show_sql" value="true" /> 51 <property name="hibernate.show_sql" value="true" />
63 <property name="hibernate.format_sql" value="false" /> 52 <property name="hibernate.format_sql" value="false" />
64 <property name="hibernate.hbm2ddl.auto" value="create-drop" /> 53 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  54 + -->
65 </properties> 55 </properties>
66 </persistence-unit> 56 </persistence-unit>
67 57
impl/extension/jpa/src/test/resources/test/beans.xml
1 -<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
2 - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> 1 +<!--
  2 + Demoiselle Framework
  3 + Copyright (C) 2010 SERPRO
  4 + ============================================================================
  5 + This file is part of Demoiselle Framework.
  6 +
  7 + Demoiselle Framework is free software; you can redistribute it and/or
  8 + modify it under the terms of the GNU Lesser General Public License version 3
  9 + as published by the Free Software Foundation.
  10 +
  11 + This program is distributed in the hope that it will be useful,
  12 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + GNU General Public License for more details.
  15 +
  16 + You should have received a copy of the GNU Lesser General Public License version 3
  17 + along with this program; if not, see <http://www.gnu.org/licenses />
  18 + or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + Fifth Floor, Boston, MA 02110-1301, USA.
  20 + ============================================================================
  21 + Este arquivo é parte do Framework Demoiselle.
  22 +
  23 + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + do Software Livre (FSF).
  26 +
  27 + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + para maiores detalhes.
  31 +
  32 + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses />
  34 + ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 +-->
  37 +<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
3 38
4 <interceptors> 39 <interceptors>
5 <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class> 40 <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class>
impl/extension/jpa/src/test/resources/transaction/interceptor/persistence.xml
@@ -37,36 +37,6 @@ @@ -37,36 +37,6 @@
37 <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 37 <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
38 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> 38 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
39 39
40 - <!--  
41 - <persistence-unit name="pu1" transaction-type="RESOURCE_LOCAL">  
42 - <non-jta-data-source>jdbc/arquillian1</non-jta-data-source>  
43 -  
44 - <class>transaction.manual.MyEntity1</class>  
45 - <class>transaction.manual.MyEntity2</class>  
46 -  
47 - <properties>  
48 - <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />  
49 - <property name="eclipselink.logging.level.sql" value="FINE" />  
50 - <property name="eclipselink.logging.parameters" value="true" />  
51 - </properties>  
52 - </persistence-unit>  
53 -  
54 - <persistence-unit name="pu2" transaction-type="RESOURCE_LOCAL">  
55 - <non-jta-data-source>jdbc/arquillian2</non-jta-data-source>  
56 -  
57 - <class>transaction.manual.MyEntity1</class>  
58 - <class>transaction.manual.MyEntity2</class>  
59 -  
60 - <properties>  
61 - <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />  
62 - <property name="eclipselink.logging.level.sql" value="FINE" />  
63 - <property name="eclipselink.logging.parameters" value="true" />  
64 - </properties>  
65 - </persistence-unit>  
66 - -->  
67 -  
68 - <!--  
69 - -->  
70 <persistence-unit name="pu1" transaction-type="RESOURCE_LOCAL"> 40 <persistence-unit name="pu1" transaction-type="RESOURCE_LOCAL">
71 <non-jta-data-source>jdbc/__default</non-jta-data-source> 41 <non-jta-data-source>jdbc/__default</non-jta-data-source>
72 42
@@ -74,9 +44,15 @@ @@ -74,9 +44,15 @@
74 <class>transaction.interceptor.MyEntity2</class> 44 <class>transaction.interceptor.MyEntity2</class>
75 45
76 <properties> 46 <properties>
  47 + <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
  48 + <property name="eclipselink.logging.level.sql" value="FINE" />
  49 + <property name="eclipselink.logging.parameters" value="true" />
  50 +
  51 + <!--
77 <property name="hibernate.show_sql" value="true" /> 52 <property name="hibernate.show_sql" value="true" />
78 <property name="hibernate.format_sql" value="false" /> 53 <property name="hibernate.format_sql" value="false" />
79 <property name="hibernate.hbm2ddl.auto" value="create-drop" /> 54 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  55 + -->
80 </properties> 56 </properties>
81 </persistence-unit> 57 </persistence-unit>
82 58
@@ -87,10 +63,16 @@ @@ -87,10 +63,16 @@
87 <class>transaction.interceptor.MyEntity2</class> 63 <class>transaction.interceptor.MyEntity2</class>
88 64
89 <properties> 65 <properties>
  66 + <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
  67 + <property name="eclipselink.logging.level.sql" value="FINE" />
  68 + <property name="eclipselink.logging.parameters" value="true" />
  69 +
  70 + <!--
90 <property name="hibernate.show_sql" value="true" /> 71 <property name="hibernate.show_sql" value="true" />
91 <property name="hibernate.format_sql" value="false" /> 72 <property name="hibernate.format_sql" value="false" />
92 <property name="hibernate.hbm2ddl.auto" value="create-drop" /> 73 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  74 + -->
93 </properties> 75 </properties>
94 </persistence-unit> 76 </persistence-unit>
95 - 77 +
96 </persistence> 78 </persistence>
97 \ No newline at end of file 79 \ No newline at end of file
impl/extension/jpa/src/test/resources/transaction/manual/persistence.xml
@@ -37,22 +37,8 @@ @@ -37,22 +37,8 @@
37 <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 37 <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
38 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> 38 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
39 39
40 - <!--  
41 <persistence-unit name="pu1" transaction-type="RESOURCE_LOCAL"> 40 <persistence-unit name="pu1" transaction-type="RESOURCE_LOCAL">
42 - <non-jta-data-source>jdbc/arquillian1</non-jta-data-source>  
43 -  
44 - <class>transaction.manual.MyEntity1</class>  
45 - <class>transaction.manual.MyEntity2</class>  
46 -  
47 - <properties>  
48 - <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />  
49 - <property name="eclipselink.logging.level.sql" value="FINE" />  
50 - <property name="eclipselink.logging.parameters" value="true" />  
51 - </properties>  
52 - </persistence-unit>  
53 -  
54 - <persistence-unit name="pu2" transaction-type="RESOURCE_LOCAL">  
55 - <non-jta-data-source>jdbc/arquillian2</non-jta-data-source> 41 + <non-jta-data-source>jdbc/__default</non-jta-data-source>
56 42
57 <class>transaction.manual.MyEntity1</class> 43 <class>transaction.manual.MyEntity1</class>
58 <class>transaction.manual.MyEntity2</class> 44 <class>transaction.manual.MyEntity2</class>
@@ -61,22 +47,12 @@ @@ -61,22 +47,12 @@
61 <property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> 47 <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
62 <property name="eclipselink.logging.level.sql" value="FINE" /> 48 <property name="eclipselink.logging.level.sql" value="FINE" />
63 <property name="eclipselink.logging.parameters" value="true" /> 49 <property name="eclipselink.logging.parameters" value="true" />
64 - </properties>  
65 - </persistence-unit>  
66 - -->  
67 -  
68 - <!--  
69 - -->  
70 - <persistence-unit name="pu1" transaction-type="RESOURCE_LOCAL">  
71 - <non-jta-data-source>jdbc/__default</non-jta-data-source>  
72 -  
73 - <class>transaction.manual.MyEntity1</class>  
74 - <class>transaction.manual.MyEntity2</class>  
75 -  
76 - <properties> 50 +
  51 + <!--
77 <property name="hibernate.show_sql" value="true" /> 52 <property name="hibernate.show_sql" value="true" />
78 <property name="hibernate.format_sql" value="false" /> 53 <property name="hibernate.format_sql" value="false" />
79 <property name="hibernate.hbm2ddl.auto" value="create-drop" /> 54 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  55 + -->
80 </properties> 56 </properties>
81 </persistence-unit> 57 </persistence-unit>
82 58
@@ -87,12 +63,18 @@ @@ -87,12 +63,18 @@
87 <class>transaction.manual.MyEntity2</class> 63 <class>transaction.manual.MyEntity2</class>
88 64
89 <properties> 65 <properties>
  66 + <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
  67 + <property name="eclipselink.logging.level.sql" value="FINE" />
  68 + <property name="eclipselink.logging.parameters" value="true" />
  69 +
  70 + <!--
90 <property name="hibernate.show_sql" value="true" /> 71 <property name="hibernate.show_sql" value="true" />
91 <property name="hibernate.format_sql" value="false" /> 72 <property name="hibernate.format_sql" value="false" />
92 <property name="hibernate.hbm2ddl.auto" value="create-drop" /> 73 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  74 + -->
93 </properties> 75 </properties>
94 </persistence-unit> 76 </persistence-unit>
95 - 77 +
96 <persistence-unit name="pu3" transaction-type="RESOURCE_LOCAL"> 78 <persistence-unit name="pu3" transaction-type="RESOURCE_LOCAL">
97 <non-jta-data-source>jdbc/__default</non-jta-data-source> 79 <non-jta-data-source>jdbc/__default</non-jta-data-source>
98 80
@@ -100,9 +82,15 @@ @@ -100,9 +82,15 @@
100 <class>transaction.manual.MyEntity2</class> 82 <class>transaction.manual.MyEntity2</class>
101 83
102 <properties> 84 <properties>
  85 + <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
  86 + <property name="eclipselink.logging.level.sql" value="FINE" />
  87 + <property name="eclipselink.logging.parameters" value="true" />
  88 +
  89 + <!--
103 <property name="hibernate.show_sql" value="true" /> 90 <property name="hibernate.show_sql" value="true" />
104 <property name="hibernate.format_sql" value="false" /> 91 <property name="hibernate.format_sql" value="false" />
105 <property name="hibernate.hbm2ddl.auto" value="create-drop" /> 92 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  93 + -->
106 </properties> 94 </properties>
107 </persistence-unit> 95 </persistence-unit>
108 96
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/annotation/NextView.java
@@ -47,8 +47,12 @@ import java.lang.annotation.Inherited; @@ -47,8 +47,12 @@ import java.lang.annotation.Inherited;
47 import java.lang.annotation.Retention; 47 import java.lang.annotation.Retention;
48 import java.lang.annotation.Target; 48 import java.lang.annotation.Target;
49 49
  50 +/**
  51 + * Used to indicate which page to redirect after the execution of some method.
  52 + *
  53 + * @author SERPRO
  54 + */
50 55
51 -// TODO Este qualifier é realmente necessário? Verificar também na anotação PreviousView.  
52 @Inherited 56 @Inherited
53 @Documented 57 @Documented
54 @Target({ TYPE, FIELD, METHOD, PARAMETER }) 58 @Target({ TYPE, FIELD, METHOD, PARAMETER })
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/annotation/PreviousView.java
@@ -47,6 +47,11 @@ import java.lang.annotation.Inherited; @@ -47,6 +47,11 @@ import java.lang.annotation.Inherited;
47 import java.lang.annotation.Retention; 47 import java.lang.annotation.Retention;
48 import java.lang.annotation.Target; 48 import java.lang.annotation.Target;
49 49
  50 +/**
  51 + * Used to indicate which page to return after the execution of some method.
  52 + *
  53 + * @author SERPRO
  54 + */
50 @Inherited 55 @Inherited
51 @Documented 56 @Documented
52 @Target({ TYPE, FIELD, METHOD, PARAMETER }) 57 @Target({ TYPE, FIELD, METHOD, PARAMETER })
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/AbstractEditPageBean.java
@@ -48,6 +48,17 @@ import br.gov.frameworkdemoiselle.util.Parameter; @@ -48,6 +48,17 @@ import br.gov.frameworkdemoiselle.util.Parameter;
48 import br.gov.frameworkdemoiselle.util.Reflections; 48 import br.gov.frameworkdemoiselle.util.Reflections;
49 import br.gov.frameworkdemoiselle.util.ResourceBundle; 49 import br.gov.frameworkdemoiselle.util.ResourceBundle;
50 50
  51 +/**
  52 + * Template Managed Bean class that implements the methods defined by the interface EditPageBean.
  53 + *
  54 + * @param <T>
  55 + * bean object type
  56 + * @param <I>
  57 + * bean id type
  58 + *
  59 + * @author SERPRO
  60 + * @see EditPageBean
  61 + */
51 public abstract class AbstractEditPageBean<T, I> extends AbstractPageBean implements EditPageBean<T> { 62 public abstract class AbstractEditPageBean<T, I> extends AbstractPageBean implements EditPageBean<T> {
52 63
53 private static final long serialVersionUID = 1L; 64 private static final long serialVersionUID = 1L;
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/AbstractListPageBean.java
@@ -49,7 +49,17 @@ import javax.inject.Inject; @@ -49,7 +49,17 @@ import javax.inject.Inject;
49 import br.gov.frameworkdemoiselle.pagination.Pagination; 49 import br.gov.frameworkdemoiselle.pagination.Pagination;
50 import br.gov.frameworkdemoiselle.pagination.PaginationContext; 50 import br.gov.frameworkdemoiselle.pagination.PaginationContext;
51 import br.gov.frameworkdemoiselle.util.Reflections; 51 import br.gov.frameworkdemoiselle.util.Reflections;
52 - 52 +/**
  53 + * Template Managed Bean class that implements the methods defined by the interface ListPageBean.
  54 + *
  55 + * @param <T>
  56 + * bean object type
  57 + * @param <I>
  58 + * bean id type
  59 + *
  60 + * @author SERPRO
  61 + * @see ListPageBean
  62 + */
53 public abstract class AbstractListPageBean<T, I> extends AbstractPageBean implements ListPageBean<T, I> { 63 public abstract class AbstractListPageBean<T, I> extends AbstractPageBean implements ListPageBean<T, I> {
54 64
55 private static final long serialVersionUID = 1L; 65 private static final long serialVersionUID = 1L;
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/AbstractPageBean.java
@@ -42,6 +42,12 @@ import javax.inject.Inject; @@ -42,6 +42,12 @@ import javax.inject.Inject;
42 import br.gov.frameworkdemoiselle.annotation.NextView; 42 import br.gov.frameworkdemoiselle.annotation.NextView;
43 import br.gov.frameworkdemoiselle.annotation.PreviousView; 43 import br.gov.frameworkdemoiselle.annotation.PreviousView;
44 44
  45 +/**
  46 + * Template Managed Bean class that implements the methods defined by the interface PageBean.
  47 + *
  48 + * @author SERPRO
  49 + * @see PageBean
  50 + */
45 public abstract class AbstractPageBean implements PageBean { 51 public abstract class AbstractPageBean implements PageBean {
46 52
47 private static final long serialVersionUID = 1L; 53 private static final long serialVersionUID = 1L;
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/EditPageBean.java
@@ -36,6 +36,15 @@ @@ -36,6 +36,15 @@
36 */ 36 */
37 package br.gov.frameworkdemoiselle.template; 37 package br.gov.frameworkdemoiselle.template;
38 38
  39 +/**
  40 + * Interface that defines a contract of facilities that a page with funcionalities of insert, edit and delete could implement.
  41 + *
  42 + * @param <T>
  43 + * bean object type
  44 + *
  45 + * @author SERPRO
  46 + *
  47 + */
39 public interface EditPageBean<T> extends PageBean { 48 public interface EditPageBean<T> extends PageBean {
40 49
41 String delete(); 50 String delete();
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/ListPageBean.java
@@ -41,6 +41,17 @@ import java.util.Map; @@ -41,6 +41,17 @@ import java.util.Map;
41 41
42 import javax.faces.model.DataModel; 42 import javax.faces.model.DataModel;
43 43
  44 +/**
  45 + * Interface that defines a contract of facilities that a page with the funcionality of list could implement.
  46 + *
  47 + * @param <T>
  48 + * bean object type
  49 + * @param <I>
  50 + * bean id type
  51 + *
  52 + * @author SERPRO
  53 + *
  54 + */
44 public interface ListPageBean<T, I> extends PageBean { 55 public interface ListPageBean<T, I> extends PageBean {
45 56
46 DataModel<T> getDataModel(); 57 DataModel<T> getDataModel();
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/PageBean.java
@@ -38,6 +38,12 @@ package br.gov.frameworkdemoiselle.template; @@ -38,6 +38,12 @@ package br.gov.frameworkdemoiselle.template;
38 38
39 import java.io.Serializable; 39 import java.io.Serializable;
40 40
  41 +/**
  42 + * Interface that defines a contract of facilities that all pages could implement.
  43 + *
  44 + * @author SERPRO
  45 + *
  46 + */
41 public interface PageBean extends Serializable { 47 public interface PageBean extends Serializable {
42 48
43 String getCurrentView(); 49 String getCurrentView();
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Faces.java
@@ -55,6 +55,11 @@ import br.gov.frameworkdemoiselle.exception.ApplicationException; @@ -55,6 +55,11 @@ import br.gov.frameworkdemoiselle.exception.ApplicationException;
55 import br.gov.frameworkdemoiselle.message.Message; 55 import br.gov.frameworkdemoiselle.message.Message;
56 import br.gov.frameworkdemoiselle.message.SeverityType; 56 import br.gov.frameworkdemoiselle.message.SeverityType;
57 57
  58 +/**
  59 + * Utility class to insert messages in the FacesContext.
  60 + *
  61 + * @author SERPRO
  62 + * */
58 public class Faces { 63 public class Faces {
59 64
60 private Faces() { 65 private Faces() {
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Locales.java
@@ -43,6 +43,11 @@ import javax.faces.context.FacesContext; @@ -43,6 +43,11 @@ import javax.faces.context.FacesContext;
43 import javax.inject.Inject; 43 import javax.inject.Inject;
44 import javax.inject.Named; 44 import javax.inject.Named;
45 45
  46 +/**
  47 + * Utility class to configure the Locale.
  48 + *
  49 + * @author SERPRO
  50 + * */
46 @Named 51 @Named
47 public class Locales implements Serializable { 52 public class Locales implements Serializable {
48 53
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/PageNotFoundException.java
@@ -38,6 +38,12 @@ package br.gov.frameworkdemoiselle.util; @@ -38,6 +38,12 @@ package br.gov.frameworkdemoiselle.util;
38 38
39 import br.gov.frameworkdemoiselle.DemoiselleException; 39 import br.gov.frameworkdemoiselle.DemoiselleException;
40 40
  41 +/**
  42 + *
  43 + * Utility class that serves as the exception to be thrown when a page is not found.
  44 + *
  45 + * @author SERPRO
  46 + * */
41 public class PageNotFoundException extends DemoiselleException { 47 public class PageNotFoundException extends DemoiselleException {
42 48
43 private static final long serialVersionUID = 1L; 49 private static final long serialVersionUID = 1L;
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Parameter.java
@@ -40,6 +40,15 @@ import java.io.Serializable; @@ -40,6 +40,15 @@ import java.io.Serializable;
40 40
41 import javax.faces.convert.Converter; 41 import javax.faces.convert.Converter;
42 42
  43 +/**
  44 + *
  45 + * Interface that defines the methods to be implemented to get and set values on a parameter.
  46 + *
  47 + * @param <T>
  48 + * bean object type
  49 + *
  50 + * @author SERPRO
  51 + * */
43 public interface Parameter<T extends Serializable> { 52 public interface Parameter<T extends Serializable> {
44 53
45 void setValue(T value); 54 void setValue(T value);
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Redirector.java
@@ -47,6 +47,12 @@ import javax.faces.FacesException; @@ -47,6 +47,12 @@ import javax.faces.FacesException;
47 import javax.faces.application.ViewHandler; 47 import javax.faces.application.ViewHandler;
48 import javax.faces.context.FacesContext; 48 import javax.faces.context.FacesContext;
49 49
  50 +/**
  51 + *
  52 + * Utility class to redirect determined page to another one.
  53 + *
  54 + * @author SERPRO
  55 + * */
50 public class Redirector { 56 public class Redirector {
51 57
52 private Redirector() { 58 private Redirector() {
impl/extension/jsf/src/test/resources/.drone.profile 0 → 100644
impl/extension/jsf/src/test/resources/.glassfish.profile 0 → 100644
impl/extension/jta/src/test/java/test/Tests.java
@@ -71,7 +71,7 @@ public final class Tests { @@ -71,7 +71,7 @@ public final class Tests {
71 .addClass(JTATransaction.class) 71 .addClass(JTATransaction.class)
72 .addAsResource(createFileAsset("src/main/resources/demoiselle-jta-bundle.properties") , "demoiselle-jta-bundle.properties" ) 72 .addAsResource(createFileAsset("src/main/resources/demoiselle-jta-bundle.properties") , "demoiselle-jta-bundle.properties" )
73 .addAsResource(createFileAsset("src/test/resources/log/log4j.properties") , "log4j.properties" ) 73 .addAsResource(createFileAsset("src/test/resources/log/log4j.properties") , "log4j.properties" )
74 - .addAsWebInfResource(createFileAsset("src/test/resources/beans.xml"), "beans.xml") 74 + .addAsWebInfResource(createFileAsset("src/test/resources/test/beans.xml"), "beans.xml")
75 .addAsLibraries(libs); 75 .addAsLibraries(libs);
76 } 76 }
77 77
impl/extension/jta/src/test/resources/.glassfish.profile 0 → 100644
impl/extension/jta/src/test/resources/beans.xml
@@ -1,46 +0,0 @@ @@ -1,46 +0,0 @@
1 -<!--  
2 - Demoiselle Framework  
3 - Copyright (C) 2010 SERPRO  
4 - ============================================================================  
5 - This file is part of Demoiselle Framework.  
6 -  
7 - Demoiselle Framework is free software; you can redistribute it and/or  
8 - modify it under the terms of the GNU Lesser General Public License version 3  
9 - as published by the Free Software Foundation.  
10 -  
11 - This program is distributed in the hope that it will be useful,  
12 - but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - GNU General Public License for more details.  
15 -  
16 - You should have received a copy of the GNU Lesser General Public License version 3  
17 - along with this program; if not, see <http://www.gnu.org/licenses />  
18 - or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - Fifth Floor, Boston, MA 02110-1301, USA.  
20 - ============================================================================  
21 - Este arquivo é parte do Framework Demoiselle.  
22 -  
23 - O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - do Software Livre (FSF).  
26 -  
27 - Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - para maiores detalhes.  
31 -  
32 - Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses />  
34 - ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 --->  
37 -<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">  
38 -  
39 - <interceptors>  
40 - <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class>  
41 - <class>br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor</class>  
42 - <class>br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor</class>  
43 - <class>br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor</class>  
44 - </interceptors>  
45 -  
46 -</beans>  
impl/extension/jta/src/test/resources/test/beans.xml 0 → 100644
@@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
  1 +<!--
  2 + Demoiselle Framework
  3 + Copyright (C) 2010 SERPRO
  4 + ============================================================================
  5 + This file is part of Demoiselle Framework.
  6 +
  7 + Demoiselle Framework is free software; you can redistribute it and/or
  8 + modify it under the terms of the GNU Lesser General Public License version 3
  9 + as published by the Free Software Foundation.
  10 +
  11 + This program is distributed in the hope that it will be useful,
  12 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + GNU General Public License for more details.
  15 +
  16 + You should have received a copy of the GNU Lesser General Public License version 3
  17 + along with this program; if not, see <http://www.gnu.org/licenses />
  18 + or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + Fifth Floor, Boston, MA 02110-1301, USA.
  20 + ============================================================================
  21 + Este arquivo é parte do Framework Demoiselle.
  22 +
  23 + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + do Software Livre (FSF).
  26 +
  27 + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + para maiores detalhes.
  31 +
  32 + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses />
  34 + ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 +-->
  37 +<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
  38 +
  39 + <interceptors>
  40 + <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class>
  41 + <class>br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor</class>
  42 + <class>br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor</class>
  43 + <class>br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor</class>
  44 + </interceptors>
  45 +
  46 +</beans>
impl/extension/se/.arquillian-weld-se-embedded
impl/extension/se/src/test/resources/.weldse.profile 0 → 100644
impl/extension/servlet/pom.xml
@@ -77,11 +77,13 @@ @@ -77,11 +77,13 @@
77 <version>1.4</version> 77 <version>1.4</version>
78 </dependency> 78 </dependency>
79 79
  80 + <!--
80 <dependency> 81 <dependency>
81 <groupId>javax.el</groupId> 82 <groupId>javax.el</groupId>
82 <artifactId>el-api</artifactId> 83 <artifactId>el-api</artifactId>
83 <scope>test</scope> 84 <scope>test</scope>
84 </dependency> 85 </dependency>
  86 + -->
85 </dependencies> 87 </dependencies>
86 88
87 <repositories> 89 <repositories>
@@ -108,4 +110,17 @@ @@ -108,4 +110,17 @@
108 </releases> 110 </releases>
109 </repository> 111 </repository>
110 </repositories> 112 </repositories>
  113 +
  114 + <profiles>
  115 + <profile>
  116 + <id>arquillian-test</id>
  117 + <dependencies>
  118 + <dependency>
  119 + <groupId>javax.servlet</groupId>
  120 + <artifactId>javax.servlet-api</artifactId>
  121 + <scope>provided</scope>
  122 + </dependency>
  123 + </dependencies>
  124 + </profile>
  125 + </profiles>
111 </project> 126 </project>
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/Credentials.java
@@ -41,6 +41,13 @@ import java.io.Serializable; @@ -41,6 +41,13 @@ import java.io.Serializable;
41 import javax.enterprise.context.RequestScoped; 41 import javax.enterprise.context.RequestScoped;
42 import javax.inject.Named; 42 import javax.inject.Named;
43 43
  44 +/**
  45 + * This classes keeps credential informations, username and password.
  46 + *
  47 + * @author SERPRO
  48 + *
  49 + */
  50 +
44 @Named 51 @Named
45 @RequestScoped 52 @RequestScoped
46 public class Credentials implements Serializable { 53 public class Credentials implements Serializable {
@@ -51,6 +58,9 @@ public class Credentials implements Serializable { @@ -51,6 +58,9 @@ public class Credentials implements Serializable {
51 58
52 private String password; 59 private String password;
53 60
  61 + /**
  62 + * Cleans the stored information, setting username and password to null.
  63 + */
54 public void clear() { 64 public void clear() {
55 this.username = null; 65 this.username = null;
56 this.password = null; 66 this.password = null;
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/ServletAuthenticator.java
@@ -48,6 +48,13 @@ import br.gov.frameworkdemoiselle.util.Beans; @@ -48,6 +48,13 @@ import br.gov.frameworkdemoiselle.util.Beans;
48 import br.gov.frameworkdemoiselle.util.NameQualifier; 48 import br.gov.frameworkdemoiselle.util.NameQualifier;
49 import br.gov.frameworkdemoiselle.util.ResourceBundle; 49 import br.gov.frameworkdemoiselle.util.ResourceBundle;
50 50
  51 +/**
  52 + * Implements the {@link Authenticator} interface, offering a way to implement offering a manner to use the
  53 + * authenticator's functionalities.
  54 + *
  55 + * @author SERPRO
  56 + */
  57 +
51 @Priority(L2_PRIORITY) 58 @Priority(L2_PRIORITY)
52 public class ServletAuthenticator implements Authenticator { 59 public class ServletAuthenticator implements Authenticator {
53 60
@@ -82,30 +89,30 @@ public class ServletAuthenticator implements Authenticator { @@ -82,30 +89,30 @@ public class ServletAuthenticator implements Authenticator {
82 @Override 89 @Override
83 public User getUser() { 90 public User getUser() {
84 final Principal principal = getRequest().getUserPrincipal(); 91 final Principal principal = getRequest().getUserPrincipal();
85 - 92 +
86 User user = null; 93 User user = null;
87 -  
88 - if (principal!=null) {  
89 - user = new User() {  
90 - 94 +
  95 + if (principal != null) {
  96 + user = new User() {
  97 +
91 private static final long serialVersionUID = 1L; 98 private static final long serialVersionUID = 1L;
92 - 99 +
93 @Override 100 @Override
94 public String getId() { 101 public String getId() {
95 return principal.getName(); 102 return principal.getName();
96 } 103 }
97 - 104 +
98 @Override 105 @Override
99 public void setAttribute(Object key, Object value) { 106 public void setAttribute(Object key, Object value) {
100 } 107 }
101 - 108 +
102 @Override 109 @Override
103 public Object getAttribute(Object key) { 110 public Object getAttribute(Object key) {
104 return null; 111 return null;
105 } 112 }
106 }; 113 };
107 } 114 }
108 - 115 +
109 return user; 116 return user;
110 } 117 }
111 118
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/ServletAuthorizer.java
@@ -42,16 +42,23 @@ import javax.servlet.http.HttpServletRequest; @@ -42,16 +42,23 @@ import javax.servlet.http.HttpServletRequest;
42 42
43 import br.gov.frameworkdemoiselle.DemoiselleException; 43 import br.gov.frameworkdemoiselle.DemoiselleException;
44 import br.gov.frameworkdemoiselle.annotation.Priority; 44 import br.gov.frameworkdemoiselle.annotation.Priority;
45 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
46 import br.gov.frameworkdemoiselle.util.Beans; 45 import br.gov.frameworkdemoiselle.util.Beans;
  46 +import br.gov.frameworkdemoiselle.util.NameQualifier;
47 import br.gov.frameworkdemoiselle.util.ResourceBundle; 47 import br.gov.frameworkdemoiselle.util.ResourceBundle;
48 48
  49 +/**
  50 + * Implements the {@link Authorizer} interface, offering a way to implement offering a manner to use the authorizer's
  51 + * functionalities.
  52 + *
  53 + * @author SERPRO
  54 + */
  55 +
49 @Priority(L2_PRIORITY) 56 @Priority(L2_PRIORITY)
50 public class ServletAuthorizer implements Authorizer { 57 public class ServletAuthorizer implements Authorizer {
51 58
52 private static final long serialVersionUID = 1L; 59 private static final long serialVersionUID = 1L;
53 60
54 - private static ResourceBundle bundle; 61 + private transient ResourceBundle bundle;
55 62
56 @Override 63 @Override
57 public boolean hasRole(String role) { 64 public boolean hasRole(String role) {
@@ -68,9 +75,9 @@ public class ServletAuthorizer implements Authorizer { @@ -68,9 +75,9 @@ public class ServletAuthorizer implements Authorizer {
68 return Beans.getReference(HttpServletRequest.class); 75 return Beans.getReference(HttpServletRequest.class);
69 } 76 }
70 77
71 - private static ResourceBundle getBundle() { 78 + private ResourceBundle getBundle() {
72 if (bundle == null) { 79 if (bundle == null) {
73 - bundle = new ResourceBundleProducer().create("demoiselle-servlet-bundle"); 80 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-servlet-bundle"));
74 } 81 }
75 82
76 return bundle; 83 return bundle;
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/util/ServletFilter.java
@@ -45,6 +45,13 @@ import javax.servlet.ServletException; @@ -45,6 +45,13 @@ import javax.servlet.ServletException;
45 import javax.servlet.ServletRequest; 45 import javax.servlet.ServletRequest;
46 import javax.servlet.ServletResponse; 46 import javax.servlet.ServletResponse;
47 47
  48 +/**
  49 + * Implements the {@link javax.servlet.Filter} interface.
  50 + *
  51 + * @author SERPRO
  52 + *
  53 + */
  54 +
48 public class ServletFilter implements Filter { 55 public class ServletFilter implements Filter {
49 56
50 @Override 57 @Override
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/util/ServletListener.java
@@ -41,6 +41,14 @@ import javax.servlet.ServletContextEvent; @@ -41,6 +41,14 @@ import javax.servlet.ServletContextEvent;
41 import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; 41 import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess;
42 import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess; 42 import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess;
43 43
  44 +/**
  45 + * Implements the {@link javax.servlet.ServletContextListener} interface, and fire two events:
  46 + * {@link AfterStartupProccess} and {@link AfterShutdownProccess}.
  47 + *
  48 + * @author SERPRO
  49 + *
  50 + */
  51 +
44 public class ServletListener implements javax.servlet.ServletContextListener { 52 public class ServletListener implements javax.servlet.ServletContextListener {
45 53
46 @Override 54 @Override
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/internal/producer/HttpServletRequestProducerTest.java
@@ -1,82 +0,0 @@ @@ -1,82 +0,0 @@
1 -///*  
2 -// * Demoiselle Framework  
3 -// * Copyright (C) 2010 SERPRO  
4 -// * ----------------------------------------------------------------------------  
5 -// * This file is part of Demoiselle Framework.  
6 -// *  
7 -// * Demoiselle Framework is free software; you can redistribute it and/or  
8 -// * modify it under the terms of the GNU Lesser General Public License version 3  
9 -// * as published by the Free Software Foundation.  
10 -// *  
11 -// * This program is distributed in the hope that it will be useful,  
12 -// * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 -// * GNU General Public License for more details.  
15 -// *  
16 -// * You should have received a copy of the GNU Lesser General Public License version 3  
17 -// * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 -// * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 -// * Fifth Floor, Boston, MA 02110-1301, USA.  
20 -// * ----------------------------------------------------------------------------  
21 -// * Este arquivo é parte do Framework Demoiselle.  
22 -// *  
23 -// * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 -// * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 -// * do Software Livre (FSF).  
26 -// *  
27 -// * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 -// * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 -// * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 -// * para maiores detalhes.  
31 -// *  
32 -// * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 -// * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 -// * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 -// * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 -// */  
37 -//package br.gov.frameworkdemoiselle.internal.producer;  
38 -//  
39 -//import static org.easymock.EasyMock.replay;  
40 -//import static org.powermock.api.easymock.PowerMock.createMock;  
41 -//import static org.powermock.api.easymock.PowerMock.verifyAll;  
42 -//  
43 -//import javax.servlet.http.HttpServletRequest;  
44 -//  
45 -//import junit.framework.Assert;  
46 -//  
47 -//import org.junit.Test;  
48 -//import org.powermock.reflect.Whitebox;  
49 -//  
50 -//public class HttpServletRequestProducerTest {  
51 -//  
52 -// private HttpServletRequestProducer httpServletRequestProducer;  
53 -//  
54 -// private HttpServletRequest request;  
55 -//  
56 -// @Test  
57 -// public void testCreate() {  
58 -// request = createMock(HttpServletRequest.class);  
59 -// replay(request);  
60 -//  
61 -// httpServletRequestProducer = new HttpServletRequestProducer();  
62 -// Whitebox.setInternalState(httpServletRequestProducer, "request", request);  
63 -//  
64 -// Assert.assertEquals(httpServletRequestProducer.create(), request);  
65 -//  
66 -// verifyAll();  
67 -// }  
68 -//  
69 -// @Test  
70 -// public void testSetDelegate() {  
71 -// request = createMock(HttpServletRequest.class);  
72 -// replay(request);  
73 -//  
74 -// httpServletRequestProducer = new HttpServletRequestProducer();  
75 -//  
76 -// httpServletRequestProducer.setDelegate(request);  
77 -// Assert.assertEquals(Whitebox.getInternalState(httpServletRequestProducer, "request"), request);  
78 -//  
79 -// verifyAll();  
80 -// }  
81 -//  
82 -//}  
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/internal/producer/HttpServletResponseProducerTest.java
@@ -1,82 +0,0 @@ @@ -1,82 +0,0 @@
1 -///*  
2 -// * Demoiselle Framework  
3 -// * Copyright (C) 2010 SERPRO  
4 -// * ----------------------------------------------------------------------------  
5 -// * This file is part of Demoiselle Framework.  
6 -// *  
7 -// * Demoiselle Framework is free software; you can redistribute it and/or  
8 -// * modify it under the terms of the GNU Lesser General Public License version 3  
9 -// * as published by the Free Software Foundation.  
10 -// *  
11 -// * This program is distributed in the hope that it will be useful,  
12 -// * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 -// * GNU General Public License for more details.  
15 -// *  
16 -// * You should have received a copy of the GNU Lesser General Public License version 3  
17 -// * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 -// * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 -// * Fifth Floor, Boston, MA 02110-1301, USA.  
20 -// * ----------------------------------------------------------------------------  
21 -// * Este arquivo é parte do Framework Demoiselle.  
22 -// *  
23 -// * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 -// * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 -// * do Software Livre (FSF).  
26 -// *  
27 -// * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 -// * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 -// * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 -// * para maiores detalhes.  
31 -// *  
32 -// * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 -// * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 -// * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 -// * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 -// */  
37 -//package br.gov.frameworkdemoiselle.internal.producer;  
38 -//  
39 -//import static org.easymock.EasyMock.replay;  
40 -//import static org.powermock.api.easymock.PowerMock.createMock;  
41 -//import static org.powermock.api.easymock.PowerMock.verifyAll;  
42 -//  
43 -//import javax.servlet.http.HttpServletResponse;  
44 -//  
45 -//import junit.framework.Assert;  
46 -//  
47 -//import org.junit.Test;  
48 -//import org.powermock.reflect.Whitebox;  
49 -//  
50 -//public class HttpServletResponseProducerTest {  
51 -//  
52 -// private HttpServletResponseProducer httpServletResponseProducer;  
53 -//  
54 -// private HttpServletResponse response;  
55 -//  
56 -// @Test  
57 -// public void testCreate() {  
58 -// response = createMock(HttpServletResponse.class);  
59 -// replay(response);  
60 -//  
61 -// httpServletResponseProducer = new HttpServletResponseProducer();  
62 -// Whitebox.setInternalState(httpServletResponseProducer, "response", response);  
63 -//  
64 -// Assert.assertEquals(httpServletResponseProducer.create(), response);  
65 -//  
66 -// verifyAll();  
67 -// }  
68 -//  
69 -// @Test  
70 -// public void testSetDelegate() {  
71 -// response = createMock(HttpServletResponse.class);  
72 -// replay(response);  
73 -//  
74 -// httpServletResponseProducer = new HttpServletResponseProducer();  
75 -//  
76 -// httpServletResponseProducer.setDelegate(response);  
77 -// Assert.assertEquals(Whitebox.getInternalState(httpServletResponseProducer, "response"), response);  
78 -//  
79 -// verifyAll();  
80 -// }  
81 -//  
82 -//}  
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/internal/producer/HttpSessionProducerTest.java
@@ -1,79 +0,0 @@ @@ -1,79 +0,0 @@
1 -///*  
2 -// * Demoiselle Framework  
3 -// * Copyright (C) 2010 SERPRO  
4 -// * ----------------------------------------------------------------------------  
5 -// * This file is part of Demoiselle Framework.  
6 -// *  
7 -// * Demoiselle Framework is free software; you can redistribute it and/or  
8 -// * modify it under the terms of the GNU Lesser General Public License version 3  
9 -// * as published by the Free Software Foundation.  
10 -// *  
11 -// * This program is distributed in the hope that it will be useful,  
12 -// * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 -// * GNU General Public License for more details.  
15 -// *  
16 -// * You should have received a copy of the GNU Lesser General Public License version 3  
17 -// * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 -// * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 -// * Fifth Floor, Boston, MA 02110-1301, USA.  
20 -// * ----------------------------------------------------------------------------  
21 -// * Este arquivo é parte do Framework Demoiselle.  
22 -// *  
23 -// * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 -// * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 -// * do Software Livre (FSF).  
26 -// *  
27 -// * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 -// * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 -// * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 -// * para maiores detalhes.  
31 -// *  
32 -// * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 -// * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 -// * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 -// * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 -// */  
37 -//package br.gov.frameworkdemoiselle.internal.producer;  
38 -//  
39 -//import static org.easymock.EasyMock.createMock;  
40 -//import static org.easymock.EasyMock.replay;  
41 -//import static org.powermock.api.easymock.PowerMock.verifyAll;  
42 -//  
43 -//import javax.servlet.http.HttpServletRequest;  
44 -//import javax.servlet.http.HttpSession;  
45 -//  
46 -//import junit.framework.Assert;  
47 -//  
48 -//import org.easymock.EasyMock;  
49 -//import org.junit.Test;  
50 -//  
51 -//public class HttpSessionProducerTest {  
52 -//  
53 -// private HttpSessionProducer httpSessionProducer;  
54 -//  
55 -// private HttpServletRequest request;  
56 -//  
57 -// @Test  
58 -// public void testCreateWithRequestNull() {  
59 -// httpSessionProducer = new HttpSessionProducer();  
60 -// Assert.assertNull(httpSessionProducer.create(null));  
61 -//  
62 -// verifyAll();  
63 -// }  
64 -//  
65 -// @Test  
66 -// public void testCreateWithRequest() {  
67 -// request = createMock(HttpServletRequest.class);  
68 -// HttpSession session = createMock(HttpSession.class);  
69 -// EasyMock.expect(request.getSession()).andReturn(session);  
70 -// replay(request, session);  
71 -//  
72 -// httpSessionProducer = new HttpSessionProducer();  
73 -// Assert.assertNotNull(httpSessionProducer.create(request));  
74 -//  
75 -// verifyAll();  
76 -//  
77 -// }  
78 -//  
79 -//}  
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/internal/producer/ServletLocaleProducerTest.java
@@ -1,84 +0,0 @@ @@ -1,84 +0,0 @@
1 -///*  
2 -// * Demoiselle Framework  
3 -// * Copyright (C) 2010 SERPRO  
4 -// * ----------------------------------------------------------------------------  
5 -// * This file is part of Demoiselle Framework.  
6 -// *  
7 -// * Demoiselle Framework is free software; you can redistribute it and/or  
8 -// * modify it under the terms of the GNU Lesser General Public License version 3  
9 -// * as published by the Free Software Foundation.  
10 -// *  
11 -// * This program is distributed in the hope that it will be useful,  
12 -// * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 -// * GNU General Public License for more details.  
15 -// *  
16 -// * You should have received a copy of the GNU Lesser General Public License version 3  
17 -// * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 -// * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 -// * Fifth Floor, Boston, MA 02110-1301, USA.  
20 -// * ----------------------------------------------------------------------------  
21 -// * Este arquivo é parte do Framework Demoiselle.  
22 -// *  
23 -// * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 -// * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 -// * do Software Livre (FSF).  
26 -// *  
27 -// * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 -// * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 -// * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 -// * para maiores detalhes.  
31 -// *  
32 -// * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 -// * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 -// * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 -// * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 -// */  
37 -//package br.gov.frameworkdemoiselle.internal.producer;  
38 -//  
39 -//import static org.easymock.EasyMock.createMock;  
40 -//import static org.easymock.EasyMock.expect;  
41 -//import static org.powermock.api.easymock.PowerMock.mockStatic;  
42 -//import static org.powermock.api.easymock.PowerMock.replay;  
43 -//import static org.powermock.api.easymock.PowerMock.verifyAll;  
44 -//  
45 -//import javax.servlet.http.HttpServletRequest;  
46 -//  
47 -//import org.junit.Test;  
48 -//import org.junit.runner.RunWith;  
49 -//import org.powermock.core.classloader.annotations.PrepareForTest;  
50 -//import org.powermock.modules.junit4.PowerMockRunner;  
51 -//  
52 -//import br.gov.frameworkdemoiselle.util.Beans;  
53 -//  
54 -//@RunWith(PowerMockRunner.class)  
55 -//@PrepareForTest(Beans.class)  
56 -//public class ServletLocaleProducerTest {  
57 -//  
58 -// private ServletLocaleProducer servletLocaleProducer;  
59 -//  
60 -// private HttpServletRequest request;  
61 -//  
62 -// @Test  
63 -// public void testCreate() {  
64 -// request = createMock(HttpServletRequest.class);  
65 -//  
66 -// mockStatic(Beans.class);  
67 -// expect(Beans.getReference(HttpServletRequest.class)).andReturn(request);  
68 -// replay(Beans.class);  
69 -//  
70 -// servletLocaleProducer = new ServletLocaleProducer();  
71 -// servletLocaleProducer.create();  
72 -//  
73 -// verifyAll();  
74 -// }  
75 -//  
76 -// @Test  
77 -// public void testCreate2() {  
78 -// servletLocaleProducer = new ServletLocaleProducer();  
79 -// servletLocaleProducer.create();  
80 -//  
81 -// verifyAll();  
82 -// }  
83 -//  
84 -//}  
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/internal/proxy/HttpServletRequestProxyTest.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -///*  
2 -// * Demoiselle Framework  
3 -// * Copyright (C) 2010 SERPRO  
4 -// * ----------------------------------------------------------------------------  
5 -// * This file is part of Demoiselle Framework.  
6 -// *  
7 -// * Demoiselle Framework is free software; you can redistribute it and/or  
8 -// * modify it under the terms of the GNU Lesser General Public License version 3  
9 -// * as published by the Free Software Foundation.  
10 -// *  
11 -// * This program is distributed in the hope that it will be useful,  
12 -// * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 -// * GNU General Public License for more details.  
15 -// *  
16 -// * You should have received a copy of the GNU Lesser General Public License version 3  
17 -// * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 -// * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 -// * Fifth Floor, Boston, MA 02110-1301, USA.  
20 -// * ----------------------------------------------------------------------------  
21 -// * Este arquivo é parte do Framework Demoiselle.  
22 -// *  
23 -// * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 -// * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 -// * do Software Livre (FSF).  
26 -// *  
27 -// * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 -// * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 -// * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 -// * para maiores detalhes.  
31 -// *  
32 -// * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 -// * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 -// * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 -// * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 -// */  
37 -//package br.gov.frameworkdemoiselle.internal.proxy;  
38 -//  
39 -//import org.junit.runner.RunWith;  
40 -//import org.powermock.modules.junit4.PowerMockRunner;  
41 -//  
42 -//@RunWith(PowerMockRunner.class)  
43 -//public class HttpServletRequestProxyTest {  
44 -//  
45 -//}  
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletFilterTest.java
@@ -1,113 +0,0 @@ @@ -1,113 +0,0 @@
1 -///*  
2 -// * Demoiselle Framework  
3 -// * Copyright (C) 2010 SERPRO  
4 -// * ----------------------------------------------------------------------------  
5 -// * This file is part of Demoiselle Framework.  
6 -// *  
7 -// * Demoiselle Framework is free software; you can redistribute it and/or  
8 -// * modify it under the terms of the GNU Lesser General Public License version 3  
9 -// * as published by the Free Software Foundation.  
10 -// *  
11 -// * This program is distributed in the hope that it will be useful,  
12 -// * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 -// * GNU General Public License for more details.  
15 -// *  
16 -// * You should have received a copy of the GNU Lesser General Public License version 3  
17 -// * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 -// * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 -// * Fifth Floor, Boston, MA 02110-1301, USA.  
20 -// * ----------------------------------------------------------------------------  
21 -// * Este arquivo é parte do Framework Demoiselle.  
22 -// *  
23 -// * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 -// * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 -// * do Software Livre (FSF).  
26 -// *  
27 -// * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 -// * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 -// * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 -// * para maiores detalhes.  
31 -// *  
32 -// * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 -// * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 -// * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 -// * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 -// */  
37 -//package br.gov.frameworkdemoiselle.util;  
38 -//  
39 -//import static org.easymock.EasyMock.expect;  
40 -//import static org.powermock.api.easymock.PowerMock.createMock;  
41 -//import static org.powermock.api.easymock.PowerMock.mockStatic;  
42 -//import static org.powermock.api.easymock.PowerMock.replay;  
43 -//import static org.powermock.api.easymock.PowerMock.verifyAll;  
44 -//  
45 -//import java.io.IOException;  
46 -//  
47 -//import javax.servlet.FilterChain;  
48 -//import javax.servlet.FilterConfig;  
49 -//import javax.servlet.ServletException;  
50 -//import javax.servlet.http.HttpServletRequest;  
51 -//import javax.servlet.http.HttpServletResponse;  
52 -//  
53 -//import org.junit.Ignore;  
54 -//import org.junit.Test;  
55 -//import org.junit.runner.RunWith;  
56 -//import org.powermock.api.easymock.PowerMock;  
57 -//import org.powermock.core.classloader.annotations.PrepareForTest;  
58 -//import org.powermock.modules.junit4.PowerMockRunner;  
59 -//  
60 -//import br.gov.frameworkdemoiselle.internal.producer.HttpServletRequestProducer;  
61 -//import br.gov.frameworkdemoiselle.internal.producer.HttpServletResponseProducer;  
62 -//  
63 -//@RunWith(PowerMockRunner.class)  
64 -//@PrepareForTest(Beans.class)  
65 -//public class ServletFilterTest {  
66 -//  
67 -// private ServletFilter filter;  
68 -//  
69 -// @Test  
70 -// public void testInit() throws ServletException {  
71 -// FilterConfig config = createMock(FilterConfig.class);  
72 -// replay(config);  
73 -//  
74 -// filter = new ServletFilter();  
75 -// filter.init(config);  
76 -//  
77 -// verifyAll();  
78 -// }  
79 -//  
80 -// @Test  
81 -// public void testDoFilter() throws IOException, ServletException {  
82 -// HttpServletRequest request = createMock(HttpServletRequest.class);  
83 -// HttpServletResponse response = createMock(HttpServletResponse.class);  
84 -//  
85 -// FilterChain chain = createMock(FilterChain.class);  
86 -// HttpServletRequestProducer requestProducer = createMock(HttpServletRequestProducer.class);  
87 -// HttpServletResponseProducer responseProducer = createMock(HttpServletResponseProducer.class);  
88 -//  
89 -// mockStatic(Beans.class);  
90 -// expect(Beans.getReference(HttpServletRequestProducer.class)).andReturn(requestProducer);  
91 -// expect(Beans.getReference(HttpServletResponseProducer.class)).andReturn(responseProducer);  
92 -// requestProducer.setDelegate(request);  
93 -// PowerMock.expectLastCall().times(1);  
94 -// responseProducer.setDelegate(response);  
95 -// PowerMock.expectLastCall().times(1);  
96 -// chain.doFilter(request, response);  
97 -// PowerMock.expectLastCall().times(1);  
98 -//  
99 -// replay(Beans.class, request, response, chain, requestProducer, responseProducer);  
100 -//  
101 -// filter = new ServletFilter();  
102 -// filter.doFilter(request, response, chain);  
103 -//  
104 -// verifyAll();  
105 -// }  
106 -//  
107 -// @Test  
108 -// public void testDestroy() {  
109 -// filter = new ServletFilter();  
110 -// filter.destroy();  
111 -// verifyAll();  
112 -// }  
113 -//}  
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletListenerTest.java
@@ -1,100 +0,0 @@ @@ -1,100 +0,0 @@
1 -///*  
2 -// * Demoiselle Framework  
3 -// * Copyright (C) 2010 SERPRO  
4 -// * ----------------------------------------------------------------------------  
5 -// * This file is part of Demoiselle Framework.  
6 -// *  
7 -// * Demoiselle Framework is free software; you can redistribute it and/or  
8 -// * modify it under the terms of the GNU Lesser General Public License version 3  
9 -// * as published by the Free Software Foundation.  
10 -// *  
11 -// * This program is distributed in the hope that it will be useful,  
12 -// * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 -// * GNU General Public License for more details.  
15 -// *  
16 -// * You should have received a copy of the GNU Lesser General Public License version 3  
17 -// * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 -// * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 -// * Fifth Floor, Boston, MA 02110-1301, USA.  
20 -// * ----------------------------------------------------------------------------  
21 -// * Este arquivo é parte do Framework Demoiselle.  
22 -// *  
23 -// * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 -// * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 -// * do Software Livre (FSF).  
26 -// *  
27 -// * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 -// * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 -// * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 -// * para maiores detalhes.  
31 -// *  
32 -// * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 -// * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 -// * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 -// * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 -// */  
37 -//package br.gov.frameworkdemoiselle.util;  
38 -//  
39 -//import static org.easymock.EasyMock.createMock;  
40 -//import static org.easymock.EasyMock.expect;  
41 -//import static org.powermock.api.easymock.PowerMock.mockStatic;  
42 -//import static org.powermock.api.easymock.PowerMock.replayAll;  
43 -//import static org.powermock.api.easymock.PowerMock.verifyAll;  
44 -//  
45 -//import javax.enterprise.inject.spi.BeanManager;  
46 -//import javax.servlet.ServletContextEvent;  
47 -//  
48 -//import org.easymock.EasyMock;  
49 -//import org.junit.Test;  
50 -//import org.junit.runner.RunWith;  
51 -//import org.powermock.api.easymock.PowerMock;  
52 -//import org.powermock.core.classloader.annotations.PrepareForTest;  
53 -//import org.powermock.modules.junit4.PowerMockRunner;  
54 -//  
55 -//import br.gov.frameworkdemoiselle.internal.bootstrap.ShutdownBootstrap;  
56 -//import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess;  
57 -//  
58 -//@RunWith(PowerMockRunner.class)  
59 -//@PrepareForTest(Beans.class)  
60 -//public class ServletListenerTest {  
61 -//  
62 -// private ServletListener listener;  
63 -//  
64 -// @Test  
65 -// public void testContextInitialized() {  
66 -// ServletContextEvent event = createMock(ServletContextEvent.class);  
67 -// BeanManager beanManager = PowerMock.createMock(BeanManager.class);  
68 -//  
69 -// mockStatic(Beans.class);  
70 -// expect(Beans.getBeanManager()).andReturn(beanManager);  
71 -// beanManager.fireEvent(EasyMock.anyObject(AfterStartupProccess.class));  
72 -// PowerMock.expectLastCall().times(1);  
73 -//  
74 -// replayAll();  
75 -//  
76 -// listener = new ServletListener();  
77 -// listener.contextInitialized(event);  
78 -//  
79 -// verifyAll();  
80 -// }  
81 -//  
82 -// @Test  
83 -// public void testContextDestroyed() {  
84 -// ServletContextEvent event = createMock(ServletContextEvent.class);  
85 -// BeanManager beanManager = PowerMock.createMock(BeanManager.class);  
86 -//  
87 -// mockStatic(Beans.class);  
88 -// expect(Beans.getBeanManager()).andReturn(beanManager);  
89 -// beanManager.fireEvent(EasyMock.anyObject(ShutdownBootstrap.class));  
90 -// PowerMock.expectLastCall().times(1);  
91 -//  
92 -// replayAll();  
93 -//  
94 -// listener = new ServletListener();  
95 -// listener.contextDestroyed(event);  
96 -//  
97 -// verifyAll();  
98 -// }  
99 -//  
100 -//}  
impl/extension/servlet/src/test/java/test/Tests.java 0 → 100644
@@ -0,0 +1,99 @@ @@ -0,0 +1,99 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package test;
  38 +
  39 +import java.io.File;
  40 +
  41 +import org.jboss.shrinkwrap.api.ShrinkWrap;
  42 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  43 +import org.jboss.shrinkwrap.api.spec.WebArchive;
  44 +import org.jboss.shrinkwrap.resolver.api.maven.Maven;
  45 +import org.junit.Ignore;
  46 +
  47 +import br.gov.frameworkdemoiselle.internal.implementation.BasicAuthenticationFilter;
  48 +import br.gov.frameworkdemoiselle.internal.implementation.HttpServletRequestProducerFilter;
  49 +import br.gov.frameworkdemoiselle.internal.implementation.HttpServletResponseProducerFilter;
  50 +import br.gov.frameworkdemoiselle.internal.implementation.InternalProcessorFilterImpl;
  51 +import br.gov.frameworkdemoiselle.internal.producer.HttpServletRequestProducer;
  52 +import br.gov.frameworkdemoiselle.internal.producer.HttpServletResponseProducer;
  53 +import br.gov.frameworkdemoiselle.internal.producer.HttpSessionProducer;
  54 +import br.gov.frameworkdemoiselle.internal.producer.ServletLocaleProducer;
  55 +import br.gov.frameworkdemoiselle.security.Credentials;
  56 +import br.gov.frameworkdemoiselle.security.ServletAuthenticator;
  57 +import br.gov.frameworkdemoiselle.security.ServletAuthorizer;
  58 +import br.gov.frameworkdemoiselle.util.ServletFilter;
  59 +import br.gov.frameworkdemoiselle.util.ServletListener;
  60 +
  61 +@Ignore
  62 +public final class Tests {
  63 +
  64 + private Tests() {
  65 + }
  66 +
  67 + public static WebArchive createDeployment(final Class<?> baseClass) {
  68 + return createDeployment().addPackages(true, baseClass.getPackage()).addClass(Tests.class);
  69 + }
  70 +
  71 + public static WebArchive createDeployment() {
  72 + File[] libs = Maven.resolver().offline().loadPomFromFile("pom.xml", "arquillian-test")
  73 + .importCompileAndRuntimeDependencies().resolve().withTransitivity().asFile();
  74 +
  75 + return ShrinkWrap
  76 + .create(WebArchive.class)
  77 + .addClass(Credentials.class)
  78 + .addClass(ServletAuthenticator.class)
  79 + .addClass(ServletAuthorizer.class)
  80 + .addClass(ServletFilter.class)
  81 + .addClass(ServletListener.class)
  82 + .addClass(HttpServletRequestProducer.class)
  83 + .addClass(HttpServletResponseProducer.class)
  84 + .addClass(HttpSessionProducer.class)
  85 + .addClass(ServletLocaleProducer.class)
  86 + .addClass(BasicAuthenticationFilter.class)
  87 + .addClass(HttpServletRequestProducerFilter.class)
  88 + .addClass(HttpServletResponseProducerFilter.class)
  89 + .addClass(InternalProcessorFilterImpl.class)
  90 + .addAsResource(createFileAsset("src/main/resources/demoiselle-servlet-bundle.properties"),
  91 + "demoiselle-servlet-bundle.properties")
  92 + .addAsWebInfResource(createFileAsset("src/test/resources/test/beans.xml"), "beans.xml")
  93 + .addAsLibraries(libs);
  94 + }
  95 +
  96 + public static FileAsset createFileAsset(final String pathname) {
  97 + return new FileAsset(new File(pathname));
  98 + }
  99 +}
impl/extension/servlet/src/test/java/xxxx/XServlet.java 0 → 100644
@@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
  1 +package xxxx;
  2 +
  3 +import java.io.IOException;
  4 +
  5 +import javax.inject.Inject;
  6 +import javax.servlet.ServletException;
  7 +import javax.servlet.annotation.WebServlet;
  8 +import javax.servlet.http.HttpServlet;
  9 +import javax.servlet.http.HttpServletRequest;
  10 +import javax.servlet.http.HttpServletResponse;
  11 +
  12 +import br.gov.frameworkdemoiselle.security.Credentials;
  13 +import br.gov.frameworkdemoiselle.security.SecurityContext;
  14 +
  15 +@WebServlet("/login")
  16 +public class XServlet extends HttpServlet {
  17 +
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + @Inject
  21 + private SecurityContext securityContext;
  22 +
  23 + @Inject
  24 + private Credentials credentials;
  25 +
  26 + @Override
  27 + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  28 + super.doGet(request, response);
  29 +
  30 + credentials.setUsername("admin");
  31 + credentials.setPassword("changeit");
  32 +
  33 + securityContext.login();
  34 + }
  35 +}
impl/extension/servlet/src/test/java/xxxx/XTest.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  1 +package xxxx;
  2 +
  3 +import java.net.URL;
  4 +
  5 +import org.jboss.arquillian.container.test.api.Deployment;
  6 +import org.jboss.arquillian.drone.api.annotation.Drone;
  7 +import org.jboss.arquillian.junit.Arquillian;
  8 +import org.jboss.arquillian.test.api.ArquillianResource;
  9 +import org.jboss.shrinkwrap.api.spec.WebArchive;
  10 +import org.junit.Test;
  11 +import org.junit.runner.RunWith;
  12 +
  13 +import test.Tests;
  14 +
  15 +import com.thoughtworks.selenium.DefaultSelenium;
  16 +
  17 +@RunWith(Arquillian.class)
  18 +public class XTest {
  19 +
  20 + private static final String PATH = "src/test/resources/xxx";
  21 +
  22 + @Drone
  23 + private DefaultSelenium browser;
  24 +
  25 + @ArquillianResource
  26 + private URL deploymentUrl;
  27 +
  28 + @Deployment(testable = false)
  29 + public static WebArchive createDeployment() {
  30 + return Tests.createDeployment().addAsWebInfResource(Tests.createFileAsset(PATH + "/web.xml"), "web.xml");
  31 + }
  32 +
  33 + @Test
  34 + public void xxxx() {
  35 + browser.open(deploymentUrl + "login");
  36 +
  37 + // browser.type("id=xxx-input", "demo");
  38 + // browser.waitForPageToLoad("15000");
  39 +
  40 + // assertTrue("User should be logged in!",
  41 + // browser.isElementPresent("xpath=//li[contains(text(), 'Welcome')]"));
  42 + // assertTrue("Username should be shown!",
  43 + // browser.isElementPresent("xpath=//p[contains(text(), 'You are signed in as demo.')]"));
  44 + }
  45 +}
impl/extension/servlet/src/test/resources/.drone.profile 0 → 100644
impl/extension/servlet/src/test/resources/.glassfish.profile 0 → 100644
impl/extension/servlet/src/test/resources/arquillian.xml 0 → 100644
@@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
  1 +<!--
  2 + Demoiselle Framework
  3 + Copyright (C) 2010 SERPRO
  4 + ============================================================================
  5 + This file is part of Demoiselle Framework.
  6 +
  7 + Demoiselle Framework is free software; you can redistribute it and/or
  8 + modify it under the terms of the GNU Lesser General Public License version 3
  9 + as published by the Free Software Foundation.
  10 +
  11 + This program is distributed in the hope that it will be useful,
  12 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + GNU General Public License for more details.
  15 +
  16 + You should have received a copy of the GNU Lesser General Public License version 3
  17 + along with this program; if not, see <http://www.gnu.org/licenses />
  18 + or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + Fifth Floor, Boston, MA 02110-1301, USA.
  20 + ============================================================================
  21 + Este arquivo é parte do Framework Demoiselle.
  22 +
  23 + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + do Software Livre (FSF).
  26 +
  27 + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + para maiores detalhes.
  31 +
  32 + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses />
  34 + ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 +-->
  37 +<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  38 + xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
  39 +
  40 + <!--
  41 + -->
  42 + <engine>
  43 + <property name="deploymentExportPath">target/deployments</property>
  44 + </engine>
  45 +
  46 + <!--
  47 + <extension qualifier="selenium">
  48 + <property name="browser">*googlechrome</property>
  49 + </extension>
  50 + -->
  51 +
  52 + <!--
  53 + <container qualifier="glassfish" default="true">
  54 + <configuration>
  55 + <property name="autoDelete">true</property>
  56 + </configuration>
  57 + </container>
  58 + -->
  59 +
  60 + <!--
  61 + <container qualifier="jbossas-managed" default="true">
  62 + <protocol type="Servlet 3.0" />
  63 + <configuration>
  64 + <property name="jbossHome">target/jboss-as-${jboss.as.version}</property>
  65 + </configuration>
  66 + </container>
  67 + -->
  68 +</arquillian>
impl/extension/servlet/src/test/resources/test/beans.xml 0 → 100644
@@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
  1 +<!--
  2 + Demoiselle Framework
  3 + Copyright (C) 2010 SERPRO
  4 + ============================================================================
  5 + This file is part of Demoiselle Framework.
  6 +
  7 + Demoiselle Framework is free software; you can redistribute it and/or
  8 + modify it under the terms of the GNU Lesser General Public License version 3
  9 + as published by the Free Software Foundation.
  10 +
  11 + This program is distributed in the hope that it will be useful,
  12 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + GNU General Public License for more details.
  15 +
  16 + You should have received a copy of the GNU Lesser General Public License version 3
  17 + along with this program; if not, see <http://www.gnu.org/licenses />
  18 + or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + Fifth Floor, Boston, MA 02110-1301, USA.
  20 + ============================================================================
  21 + Este arquivo é parte do Framework Demoiselle.
  22 +
  23 + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + do Software Livre (FSF).
  26 +
  27 + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + para maiores detalhes.
  31 +
  32 + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses />
  34 + ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 +-->
  37 +<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  38 + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
  39 +
  40 + <interceptors>
  41 + <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class>
  42 + <class>br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor</class>
  43 + <class>br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor</class>
  44 + <class>br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor</class>
  45 + </interceptors>
  46 +
  47 +</beans>
impl/extension/servlet/src/test/resources/xxx/web.xml 0 → 100644
@@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
  1 +<!--
  2 + Demoiselle Framework
  3 + Copyright (C) 2010 SERPRO
  4 + ============================================================================
  5 + This file is part of Demoiselle Framework.
  6 +
  7 + Demoiselle Framework is free software; you can redistribute it and/or
  8 + modify it under the terms of the GNU Lesser General Public License version 3
  9 + as published by the Free Software Foundation.
  10 +
  11 + This program is distributed in the hope that it will be useful,
  12 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + GNU General Public License for more details.
  15 +
  16 + You should have received a copy of the GNU Lesser General Public License version 3
  17 + along with this program; if not, see <http://www.gnu.org/licenses />
  18 + or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + Fifth Floor, Boston, MA 02110-1301, USA.
  20 + ============================================================================
  21 + Este arquivo é parte do Framework Demoiselle.
  22 +
  23 + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + do Software Livre (FSF).
  26 +
  27 + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + para maiores detalhes.
  31 +
  32 + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses />
  34 + ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 +-->
  37 +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  38 + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  39 +
  40 + <listener>
  41 + <listener-class>br.gov.frameworkdemoiselle.util.ServletListener</listener-class>
  42 + </listener>
  43 + <filter>
  44 + <filter-name>Demoiselle Servlet Filter</filter-name>
  45 + <filter-class>br.gov.frameworkdemoiselle.util.ServletFilter</filter-class>
  46 + </filter>
  47 + <filter-mapping>
  48 + <filter-name>Demoiselle Servlet Filter</filter-name>
  49 + <url-pattern>/*</url-pattern>
  50 + </filter-mapping>
  51 +
  52 +</web-app>
0 \ No newline at end of file 53 \ No newline at end of file
parent/extension/pom.xml
@@ -191,7 +191,7 @@ @@ -191,7 +191,7 @@
191 <id>arquillian-weld-se-embedded</id> 191 <id>arquillian-weld-se-embedded</id>
192 <activation> 192 <activation>
193 <file> 193 <file>
194 - <exists>.arquillian-weld-se-embedded</exists> 194 + <exists>src/test/resources/.weldse.profile</exists>
195 </file> 195 </file>
196 </activation> 196 </activation>
197 <dependencies> 197 <dependencies>
@@ -209,7 +209,12 @@ @@ -209,7 +209,12 @@
209 <profile> 209 <profile>
210 <id>arquillian-glassfish-embedded</id> 210 <id>arquillian-glassfish-embedded</id>
211 <activation> 211 <activation>
  212 + <file>
  213 + <exists>src/test/resources/.glassfish.profile</exists>
  214 + </file>
  215 + <!--
212 <activeByDefault>true</activeByDefault> 216 <activeByDefault>true</activeByDefault>
  217 + -->
213 </activation> 218 </activation>
214 <dependencies> 219 <dependencies>
215 <dependency> 220 <dependency>
@@ -230,7 +235,7 @@ @@ -230,7 +235,7 @@
230 <id>arquillian-jbossas7-managed</id> 235 <id>arquillian-jbossas7-managed</id>
231 <activation> 236 <activation>
232 <file> 237 <file>
233 - <exists>.arquillian-jbossas7-managed</exists> 238 + <exists>src/test/resources/.jbossas7.profile</exists>
234 </file> 239 </file>
235 </activation> 240 </activation>
236 <build> 241 <build>
@@ -312,6 +317,58 @@ @@ -312,6 +317,58 @@
312 </dependency> 317 </dependency>
313 </dependencies> 318 </dependencies>
314 </profile> 319 </profile>
  320 + <profile>
  321 + <id>arquillian-drone</id>
  322 + <activation>
  323 + <file>
  324 + <exists>src/test/resources/.drone.profile</exists>
  325 + </file>
  326 + </activation>
  327 + <dependencyManagement>
  328 + <dependencies>
  329 + <dependency>
  330 + <groupId>org.jboss.arquillian.extension</groupId>
  331 + <artifactId>arquillian-drone-bom</artifactId>
  332 + <version>${arquillian.bom.version}</version>
  333 + <type>pom</type>
  334 + <scope>import</scope>
  335 + </dependency>
  336 + </dependencies>
  337 + </dependencyManagement>
  338 + <dependencies>
  339 + <dependency>
  340 + <groupId>org.jboss.arquillian.extension</groupId>
  341 + <artifactId>arquillian-drone-impl</artifactId>
  342 + <scope>test</scope>
  343 + </dependency>
  344 + <dependency>
  345 + <groupId>org.jboss.arquillian.extension</groupId>
  346 + <artifactId>arquillian-drone-selenium</artifactId>
  347 + <scope>test</scope>
  348 + </dependency>
  349 + <dependency>
  350 + <groupId>org.jboss.arquillian.extension</groupId>
  351 + <artifactId>arquillian-drone-selenium-server</artifactId>
  352 + <scope>test</scope>
  353 + </dependency>
  354 + <dependency>
  355 + <groupId>org.seleniumhq.selenium</groupId>
  356 + <artifactId>selenium-java</artifactId>
  357 + <scope>test</scope>
  358 + </dependency>
  359 + <dependency>
  360 + <groupId>org.seleniumhq.selenium</groupId>
  361 + <artifactId>selenium-server</artifactId>
  362 + <scope>test</scope>
  363 + <exclusions>
  364 + <exclusion>
  365 + <groupId>org.mortbay.jetty</groupId>
  366 + <artifactId>servlet-api-2.5</artifactId>
  367 + </exclusion>
  368 + </exclusions>
  369 + </dependency>
  370 + </dependencies>
  371 + </profile>
315 </profiles> 372 </profiles>
316 373
317 <properties> 374 <properties>
@@ -101,8 +101,8 @@ @@ -101,8 +101,8 @@
101 <connection>scm:git:git@github.com:demoiselle/${project.alias}.git</connection> 101 <connection>scm:git:git@github.com:demoiselle/${project.alias}.git</connection>
102 <developerConnection>scm:git:git@github.com:demoiselle/${project.alias}.git</developerConnection> 102 <developerConnection>scm:git:git@github.com:demoiselle/${project.alias}.git</developerConnection>
103 <url>http://github.com/demoiselle/${project.alias}</url> 103 <url>http://github.com/demoiselle/${project.alias}</url>
104 - <tag>HEAD</tag>  
105 - </scm> 104 + <tag>HEAD</tag>
  105 + </scm>
106 106
107 <repositories> 107 <repositories>
108 <repository> 108 <repository>