Commit 7fc129450bf7211592a213144ce6570ce97741b8
1 parent
d4b85982
Exists in
master
Adição das configurações para realização de testes funcionais com
Arquillian
Showing
2 changed files
with
228 additions
and
1 deletions
Show diff stats
impl/extension/jdbc/pom.xml
... | ... | @@ -34,7 +34,8 @@ |
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" 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" | |
38 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
38 | 39 | |
39 | 40 | <modelVersion>4.0.0</modelVersion> |
40 | 41 | |
... | ... | @@ -71,8 +72,95 @@ |
71 | 72 | <groupId>commons-dbcp</groupId> |
72 | 73 | <artifactId>commons-dbcp</artifactId> |
73 | 74 | </dependency> |
75 | + | |
76 | + <!-- for tests --> | |
77 | + <dependency> | |
78 | + <groupId>junit</groupId> | |
79 | + <artifactId>junit</artifactId> | |
80 | + <scope>test</scope> | |
81 | + </dependency> | |
82 | + <dependency> | |
83 | + <groupId>org.jboss.arquillian.junit</groupId> | |
84 | + <artifactId>arquillian-junit-container</artifactId> | |
85 | + <scope>test</scope> | |
86 | + </dependency> | |
87 | + <dependency> | |
88 | + <groupId>org.jboss.shrinkwrap.resolver</groupId> | |
89 | + <artifactId>shrinkwrap-resolver-impl-maven</artifactId> | |
90 | + <scope>test</scope> | |
91 | + </dependency> | |
74 | 92 | </dependencies> |
75 | 93 | |
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 | + | |
76 | 164 | <repositories> |
77 | 165 | <repository> |
78 | 166 | <id>sonatype-nexus-snapshots</id> |
... | ... | @@ -97,4 +185,46 @@ |
97 | 185 | </releases> |
98 | 186 | </repository> |
99 | 187 | </repositories> |
188 | + | |
189 | + <profiles> | |
190 | + <profile> | |
191 | + <id>arquillian-test</id> | |
192 | + | |
193 | + <dependencies> | |
194 | + <dependency> | |
195 | + <groupId>br.gov.frameworkdemoiselle</groupId> | |
196 | + <artifactId>demoiselle-core</artifactId> | |
197 | + <exclusions> | |
198 | + <exclusion> | |
199 | + <groupId>javax.enterprise</groupId> | |
200 | + <artifactId>cdi-api</artifactId> | |
201 | + </exclusion> | |
202 | + <exclusion> | |
203 | + <artifactId>validation-api</artifactId> | |
204 | + <groupId>javax.validation</groupId> | |
205 | + </exclusion> | |
206 | + <exclusion> | |
207 | + <groupId>org.slf4j</groupId> | |
208 | + <artifactId>slf4j-api</artifactId> | |
209 | + </exclusion> | |
210 | + <!-- | |
211 | + --> | |
212 | + <exclusion> | |
213 | + <groupId>org.javassist</groupId> | |
214 | + <artifactId>javassist</artifactId> | |
215 | + </exclusion> | |
216 | + </exclusions> | |
217 | + </dependency> | |
218 | + <dependency> | |
219 | + <groupId>org.eclipse.persistence</groupId> | |
220 | + <artifactId>javax.persistence</artifactId> | |
221 | + <scope>provided</scope> | |
222 | + </dependency> | |
223 | + </dependencies> | |
224 | + </profile> | |
225 | + </profiles> | |
226 | + | |
227 | + <properties> | |
228 | + <jbossas.version>7.1.1.Final</jbossas.version> | |
229 | + </properties> | |
100 | 230 | </project> | ... | ... |
... | ... | @@ -0,0 +1,97 @@ |
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 | +import java.util.Locale; | |
41 | + | |
42 | +import javax.enterprise.inject.Default; | |
43 | +import javax.enterprise.inject.Produces; | |
44 | + | |
45 | +import org.jboss.shrinkwrap.api.ShrinkWrap; | |
46 | +import org.jboss.shrinkwrap.api.asset.FileAsset; | |
47 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | |
48 | +import org.jboss.shrinkwrap.resolver.api.maven.Maven; | |
49 | +import org.junit.Ignore; | |
50 | + | |
51 | +import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig; | |
52 | +import br.gov.frameworkdemoiselle.internal.producer.ConnectionProducer; | |
53 | +import br.gov.frameworkdemoiselle.internal.producer.DataSourceProducer; | |
54 | +import br.gov.frameworkdemoiselle.internal.proxy.BasicDataSourceProxy; | |
55 | +import br.gov.frameworkdemoiselle.internal.proxy.ConnectionProxy; | |
56 | +import br.gov.frameworkdemoiselle.transaction.JDBCTransaction; | |
57 | + | |
58 | +@Ignore | |
59 | +public final class Tests { | |
60 | + | |
61 | + private Tests() { | |
62 | + } | |
63 | + | |
64 | + public static WebArchive createDeployment(final Class<?> baseClass) { | |
65 | + return createDeployment().addPackages(true, baseClass.getPackage()); | |
66 | + } | |
67 | + | |
68 | + public static WebArchive createDeployment() { | |
69 | + File[] libs = Maven.resolver().offline().loadPomFromFile("pom.xml", "arquillian-test") | |
70 | + .importCompileAndRuntimeDependencies().resolve().withTransitivity().asFile(); | |
71 | + | |
72 | + return ShrinkWrap | |
73 | + .create(WebArchive.class) | |
74 | + .addClass(Tests.class) | |
75 | + .addClass(JDBCConfig.class) | |
76 | + .addClass(ConnectionProducer.class) | |
77 | + .addClass(DataSourceProducer.class) | |
78 | + .addClass(BasicDataSourceProxy.class) | |
79 | + .addClass(ConnectionProxy.class) | |
80 | + .addClass(JDBCTransaction.class) | |
81 | + .addAsResource(createFileAsset("src/main/resources/demoiselle-jdbc-bundle.properties"), | |
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") | |
85 | + .addAsLibraries(libs); | |
86 | + } | |
87 | + | |
88 | + public static FileAsset createFileAsset(final String pathname) { | |
89 | + return new FileAsset(new File(pathname)); | |
90 | + } | |
91 | + | |
92 | + @Default | |
93 | + @Produces | |
94 | + public Locale create() { | |
95 | + return Locale.getDefault(); | |
96 | + } | |
97 | +} | ... | ... |