Commit 6b7fced590e0fb2f728233857f648d6f8e79bc7d

Authored by Cleverson Sacramento
1 parent c410689e
Exists in master

Ambiente de teste integrado com o Glassfish integrado

impl/extension/jdbc/pom.xml
... ... @@ -34,8 +34,7 @@
34 34 ou escreva para a Fundação do Software Livre (FSF) Inc.,
35 35 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36 36 -->
37   -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
38   - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  37 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
39 38  
40 39 <modelVersion>4.0.0</modelVersion>
41 40  
... ... @@ -89,78 +88,23 @@
89 88 <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
90 89 <scope>test</scope>
91 90 </dependency>
  91 + <dependency>
  92 + <groupId>org.jboss.arquillian.container</groupId>
  93 + <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
  94 + <scope>test</scope>
  95 + </dependency>
  96 + <dependency>
  97 + <groupId>org.glassfish.main.extras</groupId>
  98 + <artifactId>glassfish-embedded-all</artifactId>
  99 + <scope>test</scope>
  100 + </dependency>
  101 + <dependency>
  102 + <groupId>hsqldb</groupId>
  103 + <artifactId>hsqldb</artifactId>
  104 + <scope>test</scope>
  105 + </dependency>
92 106 </dependencies>
93 107  
94   - <build>
95   - <testResources>
96   - <testResource>
97   - <directory>src/test/resources</directory>
98   - <filtering>true</filtering>
99   - </testResource>
100   - </testResources>
101   - <plugins>
102   - <plugin>
103   - <artifactId>maven-dependency-plugin</artifactId>
104   - <executions>
105   - <execution>
106   - <id>unpack</id>
107   - <phase>process-test-classes</phase>
108   - <goals>
109   - <goal>unpack</goal>
110   - </goals>
111   - <configuration>
112   - <artifactItems>
113   - <artifactItem>
114   - <groupId>org.jboss.as</groupId>
115   - <artifactId>jboss-as-dist</artifactId>
116   - <version>${jbossas.version}</version>
117   - <type>zip</type>
118   - <overWrite>false</overWrite>
119   - <outputDirectory>target</outputDirectory>
120   - </artifactItem>
121   - </artifactItems>
122   - </configuration>
123   - </execution>
124   - </executions>
125   - </plugin>
126   -
127   - <plugin>
128   - <groupId>org.apache.maven.plugins</groupId>
129   - <artifactId>maven-surefire-plugin</artifactId>
130   - <version>2.16</version>
131   - </plugin>
132   - </plugins>
133   - <pluginManagement>
134   - <plugins>
135   - <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
136   - <plugin>
137   - <groupId>org.eclipse.m2e</groupId>
138   - <artifactId>lifecycle-mapping</artifactId>
139   - <version>1.0.0</version>
140   - <configuration>
141   - <lifecycleMappingMetadata>
142   - <pluginExecutions>
143   - <pluginExecution>
144   - <pluginExecutionFilter>
145   - <groupId>org.apache.maven.plugins</groupId>
146   - <artifactId>maven-dependency-plugin</artifactId>
147   - <versionRange>[2.1,)</versionRange>
148   - <goals>
149   - <goal>unpack</goal>
150   - </goals>
151   - </pluginExecutionFilter>
152   - <action>
153   - <ignore></ignore>
154   - </action>
155   - </pluginExecution>
156   - </pluginExecutions>
157   - </lifecycleMappingMetadata>
158   - </configuration>
159   - </plugin>
160   - </plugins>
161   - </pluginManagement>
162   - </build>
163   -
164 108 <repositories>
165 109 <repository>
166 110 <id>sonatype-nexus-snapshots</id>
... ... @@ -185,11 +129,10 @@
185 129 </releases>
186 130 </repository>
187 131 </repositories>
188   -
  132 +
189 133 <profiles>
190 134 <profile>
191 135 <id>arquillian-test</id>
192   -
193 136 <dependencies>
194 137 <dependency>
195 138 <groupId>br.gov.frameworkdemoiselle</groupId>
... ... @@ -207,24 +150,13 @@
207 150 <groupId>org.slf4j</groupId>
208 151 <artifactId>slf4j-api</artifactId>
209 152 </exclusion>
210   - <!--
211   - -->
212 153 <exclusion>
213 154 <groupId>org.javassist</groupId>
214 155 <artifactId>javassist</artifactId>
215 156 </exclusion>
216 157 </exclusions>
217 158 </dependency>
218   - <dependency>
219   - <groupId>org.eclipse.persistence</groupId>
220   - <artifactId>javax.persistence</artifactId>
221   - <scope>provided</scope>
222   - </dependency>
223 159 </dependencies>
224 160 </profile>
225 161 </profiles>
226   -
227   - <properties>
228   - <jbossas.version>7.1.1.Final</jbossas.version>
229   - </properties>
230 162 </project>
... ...
impl/extension/jdbc/src/test/java/test/Tests.java
... ... @@ -65,7 +65,7 @@ public final class Tests {
65 65 return createDeployment().addPackages(true, baseClass.getPackage());
66 66 }
67 67  
68   - public static WebArchive createDeployment() {
  68 + private static WebArchive createDeployment() {
69 69 File[] libs = Maven.resolver().offline().loadPomFromFile("pom.xml", "arquillian-test")
70 70 .importCompileAndRuntimeDependencies().resolve().withTransitivity().asFile();
71 71  
... ... @@ -80,8 +80,7 @@ public final class Tests {
80 80 .addClass(JDBCTransaction.class)
81 81 .addAsResource(createFileAsset("src/main/resources/demoiselle-jdbc-bundle.properties"),
82 82 "demoiselle-jdbc-bundle.properties")
83   -// .addAsResource(createFileAsset("src/test/resources/logging.properties"), "logging.properties")
84   - .addAsWebInfResource(createFileAsset("src/test/resources/META-INF/beans.xml"), "beans.xml")
  83 + .addAsWebInfResource(createFileAsset("src/test/resources/test/beans.xml"), "beans.xml")
85 84 .addAsLibraries(libs);
86 85 }
87 86  
... ...
impl/extension/jdbc/src/test/java/xxx/XTest.java 0 → 100644
... ... @@ -0,0 +1,38 @@
  1 +package xxx;
  2 +
  3 +import static junit.framework.Assert.assertNotNull;
  4 +
  5 +import java.sql.Connection;
  6 +
  7 +import javax.inject.Inject;
  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 +
  17 +@RunWith(Arquillian.class)
  18 +public class XTest {
  19 +
  20 + private static final String PATH = "src/test/resources/xxx";
  21 +
  22 + @Inject
  23 + private Connection conn;
  24 +
  25 + @Deployment
  26 + public static WebArchive createDeployment() {
  27 + WebArchive deployment = Tests.createDeployment(XTest.class);
  28 + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"),
  29 + "demoiselle.properties");
  30 +
  31 + return deployment;
  32 + }
  33 +
  34 + @Test
  35 + public void x() {
  36 + assertNotNull(conn);
  37 + }
  38 +}
... ...
impl/extension/jdbc/src/test/resources/META-INF/beans.xml
... ... @@ -1,40 +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"
38   - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
39   -
40   -</beans>
41 0 \ No newline at end of file
impl/extension/jdbc/src/test/resources/arquillian.xml
... ... @@ -43,58 +43,11 @@
43 43 <property name="deploymentExportPath">target/deployments</property>
44 44 </engine>
45 45  
46   - <container qualifier="jbossas-managed" default="true">
47   - <protocol type="Servlet 3.0" />
48   -
49   - <configuration>
50   - <property name="jbossHome">target/jboss-as-7.1.1.Final</property>
51   - <property name="javaHome">/usr/lib/jvm/java-6-sun/</property>
52   - <!--
53   - <property name="serverConfig">../../../../src/test/resources/standalone.xml</property>
54   - -->
55   - </configuration>
56   - </container>
57   - <!--
58   - <container qualifier="jbossas-managed" default="true">
59   - <configuration>
60   - <property name="jbossHome">target/jboss-as-${jbossas.version}</property>
61   - <property name="javaVmArguments">-Djboss.socket.binding.port-offset=10000 -Xmx512m -XX:MaxPermSize=128m</property>
62   - </configuration>
63   - </container>
64   - -->
65   - <!--
66   - <container qualifier="jbossas-managed" default="true">
67   - <configuration>
68   - <property name="javaHome">/usr/lib/jvm/java-6-serpro/</property>
69   - <property name="jbossHome">/opt/demoiselle/server/jboss-7.1/</property>
70   - </configuration>
71   - </container>
72   - -->
73   -
74   - <!--
75 46 <container qualifier="glassfish-embedded" default="true">
76 47 <configuration>
77 48 <property name="resourcesXml">src/test/resources/glassfish-resources.xml</property>
  49 +<!-- <property name="resourcesXml">${project.testResources}/glassfish-resources.xml</property> -->
78 50 </configuration>
79 51 </container>
80   - -->
81   -
82   - <!--
83   - <container qualifier="tomee" default="true">
84   - <configuration>
85   - <property name="httpPort">-1</property>
86   - <property name="stopPort">-1</property>
87   - </configuration>
88   - </container>
89   - -->
90   -
91   - <!--
92   - <container qualifier="jbossas-embedded" default="true">
93   - <configuration>
94   - <property name="bindaddress">127.0.0.1</property>
95   - <property name="httpport">8081</property>
96   - </configuration>
97   - </container>
98   - -->
99 52  
100 53 </arquillian>
101 54 \ No newline at end of file
... ...
impl/extension/jdbc/src/test/resources/demoiselle.properties
impl/extension/jdbc/src/test/resources/glassfish-resources.xml 0 → 100644
... ... @@ -0,0 +1,48 @@
  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 +<!DOCTYPE resources PUBLIC
  38 + "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN"
  39 + "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
  40 +<resources>
  41 + <jdbc-resource pool-name="ArquillianEmbeddedDerbyPool" jndi-name="jdbc/arquillian" />
  42 +
  43 + <jdbc-connection-pool name="ArquillianEmbeddedDerbyPool" res-type="javax.sql.DataSource" datasource-classname="org.apache.derby.jdbc.EmbeddedDataSource"
  44 + is-isolation-level-guaranteed="false">
  45 + <property name="databaseName" value="target/databases/derby" />
  46 + <property name="createDatabase" value="create" />
  47 + </jdbc-connection-pool>
  48 +</resources>
0 49 \ No newline at end of file
... ...
impl/extension/jdbc/src/test/resources/test/beans.xml 0 → 100644
... ... @@ -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/jdbc/src/test/resources/xxx/demoiselle.properties 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +# Demoiselle Framework
  2 +# Copyright (C) 2010 SERPRO
  3 +# ----------------------------------------------------------------------------
  4 +# This file is part of Demoiselle Framework.
  5 +#
  6 +# Demoiselle Framework is free software; you can redistribute it and/or
  7 +# modify it under the terms of the GNU Lesser General Public License version 3
  8 +# as published by the Free Software Foundation.
  9 +#
  10 +# This program is distributed in the hope that it will be useful,
  11 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13 +# GNU General Public License for more details.
  14 +#
  15 +# You should have received a copy of the GNU Lesser General Public License version 3
  16 +# along with this program; if not, see <http://www.gnu.org/licenses/>
  17 +# or write to the Free Software Foundation, Inc., 51 Franklin Street,
  18 +# Fifth Floor, Boston, MA 02110-1301, USA.
  19 +# ----------------------------------------------------------------------------
  20 +# Este arquivo é parte do Framework Demoiselle.
  21 +#
  22 +# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  23 +# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  24 +# do Software Livre (FSF).
  25 +#
  26 +# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  27 +# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  28 +# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  29 +# para maiores detalhes.
  30 +#
  31 +# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  32 +# "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  33 +# ou escreva para a Fundação do Software Livre (FSF) Inc.,
  34 +# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  35 +
  36 +frameworkdemoiselle.persistence.driver.class=org.hsqldb.jdbcDriver
  37 +frameworkdemoiselle.persistence.url=jdbc:hsqldb:mem:xxx
  38 +frameworkdemoiselle.persistence.username=sa
  39 +frameworkdemoiselle.persistence.password=
... ...
parent/bom/pom.xml
... ... @@ -311,7 +311,7 @@
311 311 <!-- embedded containners -->
312 312 <dependency>
313 313 <groupId>org.glassfish.main.extras</groupId>
314   - <artifactId>glassfish-embedded-web</artifactId>
  314 + <artifactId>glassfish-embedded-all</artifactId>
315 315 <version>${glassfish.embedded.version}</version>
316 316 </dependency>
317 317  
... ... @@ -379,6 +379,13 @@
379 379 <artifactId>easymock</artifactId>
380 380 <version>${easymock.version}</version>
381 381 </dependency>
  382 +
  383 + <!-- Plug-ins -->
  384 + <dependency>
  385 + <groupId>org.apache.maven.plugins</groupId>
  386 + <artifactId>maven-surefire-plugin</artifactId>
  387 + <version>${maven.surefire.plugin.version}</version>
  388 + </dependency>
382 389 </dependencies>
383 390 </dependencyManagement>
384 391  
... ... @@ -422,7 +429,7 @@
422 429  
423 430 <junit.version>4.8.1</junit.version>
424 431 <easymock.version>3.0</easymock.version>
425   -
  432 +
426 433 <arquillian.version>1.1.1.Final</arquillian.version>
427 434 <!--
428 435 <arquillian.version>1.0.4.Final</arquillian.version>
... ... @@ -430,8 +437,10 @@
430 437 <arquillian.weld.se.embedded.version>1.0.0.CR7</arquillian.weld.se.embedded.version>
431 438 <arquillian.persistence.version>1.0.0.Alpha6</arquillian.persistence.version>
432 439 <arquillian.glassfish.embedded.version>1.0.0.CR4</arquillian.glassfish.embedded.version>
433   -
434   - <glassfish.embedded.version>3.1.2</glassfish.embedded.version>
  440 +
  441 + <glassfish.embedded.version>3.1.2.2</glassfish.embedded.version>
  442 +
  443 + <maven.surefire.plugin.version>2.16</maven.surefire.plugin.version>
435 444  
436 445 <powermock.version>1.4.6</powermock.version>
437 446 <primefaces.version>3.4</primefaces.version>
... ...
parent/extension/pom.xml
... ... @@ -79,6 +79,12 @@
79 79 </dependencyManagement>
80 80  
81 81 <build>
  82 + <testResources>
  83 + <testResource>
  84 + <directory>src/test/resources</directory>
  85 + <filtering>true</filtering>
  86 + </testResource>
  87 + </testResources>
82 88 <plugins>
83 89 <plugin>
84 90 <groupId>org.apache.maven.plugins</groupId>
... ... @@ -96,6 +102,10 @@
96 102 <groupId>org.codehaus.mojo</groupId>
97 103 <artifactId>cobertura-maven-plugin</artifactId>
98 104 </plugin>
  105 + <plugin>
  106 + <groupId>org.apache.maven.plugins</groupId>
  107 + <artifactId>maven-surefire-plugin</artifactId>
  108 + </plugin>
99 109 </plugins>
100 110 </build>
101 111  
... ...