Commit 857c913f174993ddbad7fffc141ca4901d6aa688

Authored by Cleverson Sacramento
1 parent 69f80244
Exists in master

Ajuste no build dos projetos

Showing 40 changed files with 798 additions and 743 deletions   Show diff stats
impl/extension/jdbc/src/main/java/br/gov/frameworkdemoiselle/internal/producer/ConnectionProducer.java
... ... @@ -22,6 +22,8 @@ import br.gov.frameworkdemoiselle.DemoiselleException;
22 22 import br.gov.frameworkdemoiselle.annotation.Name;
23 23 import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig;
24 24 import br.gov.frameworkdemoiselle.internal.proxy.ConnectionProxy;
  25 +import br.gov.frameworkdemoiselle.util.Beans;
  26 +import br.gov.frameworkdemoiselle.util.NameQualifier;
25 27 import br.gov.frameworkdemoiselle.util.ResourceBundle;
26 28  
27 29 @RequestScoped
... ... @@ -29,15 +31,29 @@ public class ConnectionProducer implements Serializable {
29 31  
30 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 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 58 @Inject
43 59 private DataSourceProducer producer;
... ... @@ -81,10 +97,10 @@ public class ConnectionProducer implements Serializable {
81 97  
82 98 cache.put(name, connection);
83 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 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 112 connection.setAutoCommit(false);
97 113  
98 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 120 String result = config.getDefaultDataSourceName();
105 121  
106 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 126 return result;
... ... @@ -115,7 +131,7 @@ public class ConnectionProducer implements Serializable {
115 131 Set<String> names = producer.getCache().keySet();
116 132  
117 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 135 Name.class.getSimpleName()));
120 136 } else {
121 137 result = names.iterator().next();
... ... @@ -133,16 +149,16 @@ public class ConnectionProducer implements Serializable {
133 149  
134 150 try {
135 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 154 } else {
139 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 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 168 public Map<String, Connection> getCache() {
153 169 return cache;
154 170 }
155   -
  171 +
156 172 public Status getStatus(Connection connection) {
157 173 return statusCache.get(connection);
158 174 }
159   -
  175 +
160 176 public static class Status implements Serializable {
161 177  
162 178 private static final long serialVersionUID = 1L;
... ... @@ -181,5 +197,4 @@ public class ConnectionProducer implements Serializable {
181 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 10 import javax.annotation.PostConstruct;
11 11 import javax.annotation.PreDestroy;
12 12 import javax.enterprise.context.ApplicationScoped;
13   -import javax.inject.Inject;
14 13 import javax.naming.Context;
15 14 import javax.naming.InitialContext;
16 15 import javax.naming.NamingException;
... ... @@ -19,10 +18,10 @@ import javax.sql.DataSource;
19 18 import org.slf4j.Logger;
20 19  
21 20 import br.gov.frameworkdemoiselle.DemoiselleException;
22   -import br.gov.frameworkdemoiselle.annotation.Name;
23 21 import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig;
24 22 import br.gov.frameworkdemoiselle.internal.proxy.BasicDataSourceProxy;
25 23 import br.gov.frameworkdemoiselle.util.Beans;
  24 +import br.gov.frameworkdemoiselle.util.NameQualifier;
26 25 import br.gov.frameworkdemoiselle.util.ResourceBundle;
27 26  
28 27 @ApplicationScoped
... ... @@ -30,12 +29,25 @@ public class DataSourceProducer implements Serializable {
30 29  
31 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 52 private final Map<ClassLoader, Map<String, DataSource>> cache = Collections
41 53 .synchronizedMap(new HashMap<ClassLoader, Map<String, DataSource>>());
... ... @@ -52,7 +64,7 @@ public class DataSourceProducer implements Serializable {
52 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 82 }
71 83  
72 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 88 return result;
... ... @@ -117,10 +129,10 @@ public class DataSourceProducer implements Serializable {
117 129 result = initJNDIDataSource(dataSourceName, jndi);
118 130  
119 131 } else if (url != null) {
120   - result = new BasicDataSourceProxy(dataSourceName, config, bundle);
121   -
  132 + result = new BasicDataSourceProxy(dataSourceName, config, getBundle());
  133 +
122 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 138 return result;
... ... @@ -134,10 +146,11 @@ public class DataSourceProducer implements Serializable {
134 146 result = (DataSource) context.lookup(jndi);
135 147  
136 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 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 156 return result;
... ... @@ -153,7 +166,7 @@ public class DataSourceProducer implements Serializable {
153 166 Map<String, DataSource> result = cache.get(classLoader);
154 167  
155 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 171 for (String name : getDataSourceNames(classLoader)) {
159 172 create(name);
... ...
impl/extension/jdbc/src/test/java/test/Tests.java
... ... @@ -67,7 +67,7 @@ public final class Tests {
67 67  
68 68 private static WebArchive createDeployment() {
69 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 72 return ShrinkWrap
73 73 .create(WebArchive.class)
... ...
impl/extension/jdbc/src/test/resources/.glassfish.profile 0 → 100644
impl/extension/jpa/src/test/java/producer/MyEntity.java 0 → 100644
... ... @@ -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 @@
  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/transaction/interceptor/JPATransactionTest.java
1 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 8 import javax.inject.Inject;
4 9 import javax.persistence.EntityManager;
5 10  
6   -import junit.framework.Assert;
7   -
8 11 import org.jboss.arquillian.container.test.api.Deployment;
9 12 import org.jboss.arquillian.junit.Arquillian;
10 13 import org.jboss.shrinkwrap.api.spec.WebArchive;
... ... @@ -20,10 +23,10 @@ import br.gov.frameworkdemoiselle.transaction.TransactionContext;
20 23 public class JPATransactionTest {
21 24  
22 25 private static final String PATH = "src/test/resources/transaction/interceptor";
23   -
  26 +
24 27 @Inject
25 28 private TransactionalBusiness tb;
26   -
  29 +
27 30 @Inject
28 31 @Name("pu1")
29 32 private EntityManager em1;
... ... @@ -31,7 +34,7 @@ public class JPATransactionTest {
31 34 @Inject
32 35 @Name("pu2")
33 36 private EntityManager em2;
34   -
  37 +
35 38 @Inject
36 39 private TransactionContext transactionContext;
37 40  
... ... @@ -42,52 +45,51 @@ public class JPATransactionTest {
42 45  
43 46 return deployment;
44 47 }
45   -
  48 +
46 49 @Before
47   - public void eraseDatabases(){
  50 + public void eraseDatabases() {
48 51 transactionContext.getCurrentTransaction().begin();
49 52 em1.createQuery("DELETE FROM MyEntity1").executeUpdate();
50 53 em2.createQuery("DELETE FROM MyEntity2").executeUpdate();
51 54 transactionContext.getCurrentTransaction().commit();
52 55 }
53   -
  56 +
54 57 @Test
55   - public void isTransactionActiveWithInterceptor(){
56   - Assert.assertTrue(tb.isTransactionActiveWithInterceptor());
  58 + public void isTransactionActiveWithInterceptor() {
  59 + assertTrue(tb.isTransactionActiveWithInterceptor());
57 60 }
58   -
  61 +
59 62 @Test
60   - public void isTransactionActiveWithoutInterceptor(){
61   - Assert.assertFalse(tb.isTransactionActiveWithoutInterceptor());
  63 + public void isTransactionActiveWithoutInterceptor() {
  64 + assertFalse(tb.isTransactionActiveWithoutInterceptor());
62 65 }
63 66  
64 67 @Test
65 68 public void commitWithSuccess() {
66   -
  69 +
67 70 tb.commitWithSuccess();
68 71  
69 72 MyEntity1 entity1 = em1.find(MyEntity1.class, tb.createId("id-1"));
70 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 79 @Test
77 80 public void rollbackWithSuccess() {
78   -
79   - try{
  81 +
  82 + try {
80 83 tb.rollbackWithSuccess();
81 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 87 MyEntity1 entity1 = em1.find(MyEntity1.class, tb.createId("id-3"));
86 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 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/persistence.xml 0 → 100644
... ... @@ -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 77 \ No newline at end of file
... ...
impl/extension/jpa/src/test/resources/template/persistence.xml
... ... @@ -37,9 +37,8 @@
37 37 <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
38 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 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 43 <class>template.MyEntity</class>
45 44  
... ... @@ -47,21 +46,12 @@
47 46 <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
48 47 <property name="eclipselink.logging.level.sql" value="FINE" />
49 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 51 <property name="hibernate.show_sql" value="true" />
63 52 <property name="hibernate.format_sql" value="false" />
64 53 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  54 + -->
65 55 </properties>
66 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 39 <interceptors>
5 40 <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class>
... ...
impl/extension/jpa/src/test/resources/transaction/interceptor/persistence.xml
... ... @@ -37,36 +37,6 @@
37 37 <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
38 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 40 <persistence-unit name="pu1" transaction-type="RESOURCE_LOCAL">
71 41 <non-jta-data-source>jdbc/__default</non-jta-data-source>
72 42  
... ... @@ -74,9 +44,15 @@
74 44 <class>transaction.interceptor.MyEntity2</class>
75 45  
76 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 52 <property name="hibernate.show_sql" value="true" />
78 53 <property name="hibernate.format_sql" value="false" />
79 54 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  55 + -->
80 56 </properties>
81 57 </persistence-unit>
82 58  
... ... @@ -87,10 +63,16 @@
87 63 <class>transaction.interceptor.MyEntity2</class>
88 64  
89 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 71 <property name="hibernate.show_sql" value="true" />
91 72 <property name="hibernate.format_sql" value="false" />
92 73 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  74 + -->
93 75 </properties>
94 76 </persistence-unit>
95   -
  77 +
96 78 </persistence>
97 79 \ No newline at end of file
... ...
impl/extension/jpa/src/test/resources/transaction/manual/persistence.xml
... ... @@ -37,22 +37,8 @@
37 37 <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
38 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 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 43 <class>transaction.manual.MyEntity1</class>
58 44 <class>transaction.manual.MyEntity2</class>
... ... @@ -61,22 +47,12 @@
61 47 <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
62 48 <property name="eclipselink.logging.level.sql" value="FINE" />
63 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 52 <property name="hibernate.show_sql" value="true" />
78 53 <property name="hibernate.format_sql" value="false" />
79 54 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  55 + -->
80 56 </properties>
81 57 </persistence-unit>
82 58  
... ... @@ -87,12 +63,18 @@
87 63 <class>transaction.manual.MyEntity2</class>
88 64  
89 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 71 <property name="hibernate.show_sql" value="true" />
91 72 <property name="hibernate.format_sql" value="false" />
92 73 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  74 + -->
93 75 </properties>
94 76 </persistence-unit>
95   -
  77 +
96 78 <persistence-unit name="pu3" transaction-type="RESOURCE_LOCAL">
97 79 <non-jta-data-source>jdbc/__default</non-jta-data-source>
98 80  
... ... @@ -100,9 +82,15 @@
100 82 <class>transaction.manual.MyEntity2</class>
101 83  
102 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 90 <property name="hibernate.show_sql" value="true" />
104 91 <property name="hibernate.format_sql" value="false" />
105 92 <property name="hibernate.hbm2ddl.auto" value="create-drop" />
  93 + -->
106 94 </properties>
107 95 </persistence-unit>
108 96  
... ...
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 71 .addClass(JTATransaction.class)
72 72 .addAsResource(createFileAsset("src/main/resources/demoiselle-jta-bundle.properties") , "demoiselle-jta-bundle.properties" )
73 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 75 .addAsLibraries(libs);
76 76 }
77 77  
... ...
impl/extension/jta/src/test/resources/.glassfish.profile 0 → 100644
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 77 <version>1.4</version>
78 78 </dependency>
79 79  
  80 + <!--
80 81 <dependency>
81 82 <groupId>javax.el</groupId>
82 83 <artifactId>el-api</artifactId>
83 84 <scope>test</scope>
84 85 </dependency>
  86 + -->
85 87 </dependencies>
86 88  
87 89 <repositories>
... ... @@ -108,4 +110,17 @@
108 110 </releases>
109 111 </repository>
110 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 126 </project>
... ...
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/ServletAuthenticator.java
... ... @@ -49,11 +49,10 @@ import br.gov.frameworkdemoiselle.util.NameQualifier;
49 49 import br.gov.frameworkdemoiselle.util.ResourceBundle;
50 50  
51 51 /**
52   - * Implements the {@link Authenticator} interface, offering a way to implement
53   - * offering a manner to use the authenticator's functionalities.
  52 + * Implements the {@link Authenticator} interface, offering a way to implement offering a manner to use the
  53 + * authenticator's functionalities.
54 54 *
55 55 * @author SERPRO
56   - *
57 56 */
58 57  
59 58 @Priority(L2_PRIORITY)
... ... @@ -90,30 +89,30 @@ public class ServletAuthenticator implements Authenticator {
90 89 @Override
91 90 public User getUser() {
92 91 final Principal principal = getRequest().getUserPrincipal();
93   -
  92 +
94 93 User user = null;
95   -
96   - if (principal!=null) {
97   - user = new User() {
98   -
  94 +
  95 + if (principal != null) {
  96 + user = new User() {
  97 +
99 98 private static final long serialVersionUID = 1L;
100   -
  99 +
101 100 @Override
102 101 public String getId() {
103 102 return principal.getName();
104 103 }
105   -
  104 +
106 105 @Override
107 106 public void setAttribute(Object key, Object value) {
108 107 }
109   -
  108 +
110 109 @Override
111 110 public Object getAttribute(Object key) {
112 111 return null;
113 112 }
114 113 };
115 114 }
116   -
  115 +
117 116 return user;
118 117 }
119 118  
... ...
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/ServletAuthorizer.java
... ... @@ -42,16 +42,15 @@ import javax.servlet.http.HttpServletRequest;
42 42  
43 43 import br.gov.frameworkdemoiselle.DemoiselleException;
44 44 import br.gov.frameworkdemoiselle.annotation.Priority;
45   -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;
46 45 import br.gov.frameworkdemoiselle.util.Beans;
  46 +import br.gov.frameworkdemoiselle.util.NameQualifier;
47 47 import br.gov.frameworkdemoiselle.util.ResourceBundle;
48 48  
49 49 /**
50   - * Implements the {@link Authorizer} interface, offering a way to implement
51   - * offering a manner to use the authorizer's functionalities.
  50 + * Implements the {@link Authorizer} interface, offering a way to implement offering a manner to use the authorizer's
  51 + * functionalities.
52 52 *
53 53 * @author SERPRO
54   - *
55 54 */
56 55  
57 56 @Priority(L2_PRIORITY)
... ... @@ -59,7 +58,7 @@ public class ServletAuthorizer implements Authorizer {
59 58  
60 59 private static final long serialVersionUID = 1L;
61 60  
62   - private static ResourceBundle bundle;
  61 + private transient ResourceBundle bundle;
63 62  
64 63 @Override
65 64 public boolean hasRole(String role) {
... ... @@ -76,9 +75,9 @@ public class ServletAuthorizer implements Authorizer {
76 75 return Beans.getReference(HttpServletRequest.class);
77 76 }
78 77  
79   - private static ResourceBundle getBundle() {
  78 + private ResourceBundle getBundle() {
80 79 if (bundle == null) {
81   - bundle = new ResourceBundleProducer().create("demoiselle-servlet-bundle");
  80 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-servlet-bundle"));
82 81 }
83 82  
84 83 return bundle;
... ...
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/internal/producer/HttpServletRequestProducerTest.java
... ... @@ -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   -///*
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   -///*
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   -///*
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   -///*
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   -///*
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   -///*
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 @@
  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 @@
  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 @@
  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 @@
  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 @@
  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 @@
  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 53 \ No newline at end of file
... ...
parent/extension/pom.xml
... ... @@ -191,7 +191,7 @@
191 191 <id>arquillian-weld-se-embedded</id>
192 192 <activation>
193 193 <file>
194   - <exists>.arquillian-weld-se-embedded</exists>
  194 + <exists>src/test/resources/.weldse.profile</exists>
195 195 </file>
196 196 </activation>
197 197 <dependencies>
... ... @@ -209,7 +209,12 @@
209 209 <profile>
210 210 <id>arquillian-glassfish-embedded</id>
211 211 <activation>
  212 + <file>
  213 + <exists>src/test/resources/.glassfish.profile</exists>
  214 + </file>
  215 + <!--
212 216 <activeByDefault>true</activeByDefault>
  217 + -->
213 218 </activation>
214 219 <dependencies>
215 220 <dependency>
... ... @@ -230,7 +235,7 @@
230 235 <id>arquillian-jbossas7-managed</id>
231 236 <activation>
232 237 <file>
233   - <exists>.arquillian-jbossas7-managed</exists>
  238 + <exists>src/test/resources/.jbossas7.profile</exists>
234 239 </file>
235 240 </activation>
236 241 <build>
... ... @@ -312,6 +317,58 @@
312 317 </dependency>
313 318 </dependencies>
314 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 372 </profiles>
316 373  
317 374 <properties>
... ...
parent/framework/pom.xml
... ... @@ -56,6 +56,16 @@
56 56 </description>
57 57 <url>http://www.frameworkdemoiselle.gov.br</url>
58 58  
  59 + <build>
  60 + <plugins>
  61 + <plugin>
  62 + <groupId>org.apache.maven.plugins</groupId>
  63 + <artifactId>maven-eclipse-plugin</artifactId>
  64 + <version>2.9</version>
  65 + </plugin>
  66 + </plugins>
  67 + </build>
  68 +
59 69 <licenses>
60 70 <license>
61 71 <name>GNU Lesser General Public License, Version 3</name>
... ...
pom.xml
... ... @@ -94,6 +94,11 @@
94 94 <skip>true</skip>
95 95 </configuration>
96 96 </plugin>
  97 + <plugin>
  98 + <groupId>org.apache.maven.plugins</groupId>
  99 + <artifactId>maven-eclipse-plugin</artifactId>
  100 + <version>2.9</version>
  101 + </plugin>
97 102 </plugins>
98 103 </build>
99 104  
... ...