Commit 29296286ce4894db5b948124a374e4a6f8a6367d
1 parent
18697138
Exists in
master
Experimentos com o Arquillian na extensão JPA
Showing
13 changed files
with
762 additions
and
2 deletions
Show diff stats
impl/extension/jpa/pom.xml
... | ... | @@ -115,7 +115,8 @@ |
115 | 115 | </dependency> |
116 | 116 | --> |
117 | 117 | |
118 | - | |
118 | + <!-- | |
119 | + --> | |
119 | 120 | <dependency> |
120 | 121 | <groupId>org.jboss.arquillian.container</groupId> |
121 | 122 | <artifactId>arquillian-glassfish-embedded-3.1</artifactId> |
... | ... | @@ -128,7 +129,6 @@ |
128 | 129 | <scope>test</scope> |
129 | 130 | </dependency> |
130 | 131 | --> |
131 | - | |
132 | 132 | <dependency> |
133 | 133 | <groupId>org.glassfish.main.extras</groupId> |
134 | 134 | <artifactId>glassfish-embedded-all</artifactId> |
... | ... | @@ -136,16 +136,33 @@ |
136 | 136 | <scope>test</scope> |
137 | 137 | </dependency> |
138 | 138 | |
139 | + <!-- | |
140 | + <dependency> | |
141 | + <groupId>org.jboss.as</groupId> | |
142 | + <artifactId>jboss-as-arquillian-container-managed</artifactId> | |
143 | + <version>7.1.1.Final</version> | |
144 | + <scope>test</scope> | |
145 | + </dependency> | |
146 | + <dependency> | |
147 | + <groupId>org.jboss.arquillian.protocol</groupId> | |
148 | + <artifactId>arquillian-protocol-servlet</artifactId> | |
149 | + <scope>test</scope> | |
150 | + </dependency> | |
151 | + --> | |
152 | + | |
139 | 153 | <dependency> |
140 | 154 | <groupId>org.jboss.shrinkwrap.resolver</groupId> |
141 | 155 | <artifactId>shrinkwrap-resolver-impl-maven</artifactId> |
142 | 156 | <scope>test</scope> |
143 | 157 | </dependency> |
158 | + <!-- | |
144 | 159 | <dependency> |
145 | 160 | <groupId>org.jboss.shrinkwrap.resolver</groupId> |
146 | 161 | <artifactId>shrinkwrap-resolver-depchain</artifactId> |
147 | 162 | <type>pom</type> |
163 | + <scope>test</scope> | |
148 | 164 | </dependency> |
165 | + --> | |
149 | 166 | |
150 | 167 | <!-- |
151 | 168 | <dependency> |
... | ... | @@ -229,4 +246,40 @@ |
229 | 246 | </releases> |
230 | 247 | </repository> |
231 | 248 | </repositories> |
249 | + | |
250 | + <profiles> | |
251 | + <profile> | |
252 | + <id>arquillian-test</id> | |
253 | + | |
254 | + <dependencies> | |
255 | + <dependency> | |
256 | + <groupId>br.gov.frameworkdemoiselle</groupId> | |
257 | + <artifactId>demoiselle-core</artifactId> | |
258 | + <exclusions> | |
259 | + <exclusion> | |
260 | + <groupId>javax.enterprise</groupId> | |
261 | + <artifactId>cdi-api</artifactId> | |
262 | + </exclusion> | |
263 | + <exclusion> | |
264 | + <artifactId>validation-api</artifactId> | |
265 | + <groupId>javax.validation</groupId> | |
266 | + </exclusion> | |
267 | + <exclusion> | |
268 | + <groupId>org.slf4j</groupId> | |
269 | + <artifactId>slf4j-api</artifactId> | |
270 | + </exclusion> | |
271 | + <exclusion> | |
272 | + <groupId>org.javassist</groupId> | |
273 | + <artifactId>javassist</artifactId> | |
274 | + </exclusion> | |
275 | + </exclusions> | |
276 | + </dependency> | |
277 | + <dependency> | |
278 | + <groupId>org.eclipse.persistence</groupId> | |
279 | + <artifactId>javax.persistence</artifactId> | |
280 | + <scope>provided</scope> | |
281 | + </dependency> | |
282 | + </dependencies> | |
283 | + </profile> | |
284 | + </profiles> | |
232 | 285 | </project> | ... | ... |
impl/extension/jpa/src/test/java/template/JPACrudTest.java
0 → 100644
... | ... | @@ -0,0 +1,84 @@ |
1 | +package template; | |
2 | + | |
3 | +import static junit.framework.Assert.assertEquals; | |
4 | +import static junit.framework.Assert.assertNotNull; | |
5 | +import static junit.framework.Assert.assertNull; | |
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 JPACrudTest { | |
19 | + | |
20 | + private static final String PATH = "src/test/resources/template"; | |
21 | + | |
22 | + @Inject | |
23 | + private MyCrud crud; | |
24 | + | |
25 | + @Deployment | |
26 | + public static WebArchive createDeployment() { | |
27 | + WebArchive deployment = Tests.createDeployment(JPACrudTest.class); | |
28 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/persistence.xml"), "META-INF/persistence.xml"); | |
29 | + | |
30 | + return deployment; | |
31 | + } | |
32 | + | |
33 | + @Test | |
34 | + public void x() { | |
35 | + | |
36 | + } | |
37 | + | |
38 | + @Test | |
39 | + public void successfullyInserted() { | |
40 | + populate(1, 0); | |
41 | + | |
42 | + MyEntity persisted = crud.load(createId("id-1")); | |
43 | + assertNotNull(persisted); | |
44 | + } | |
45 | + | |
46 | + @Test | |
47 | + public void successfullyDeleted() { | |
48 | + populate(1, 10); | |
49 | + | |
50 | + crud.delete(createId("id-11")); | |
51 | + MyEntity persisted = crud.load(createId("id-11")); | |
52 | + assertNull(persisted); | |
53 | + } | |
54 | + | |
55 | + @Test | |
56 | + public void successfullyUpdated() { | |
57 | + populate(1, 20); | |
58 | + | |
59 | + MyEntity persisted; | |
60 | + persisted = crud.load(createId("id-21")); | |
61 | + persisted.setDescription("update example"); | |
62 | + | |
63 | + crud.update(persisted); | |
64 | + persisted = crud.load(createId("id-21")); | |
65 | + | |
66 | + assertEquals("update example", persisted.getDescription()); | |
67 | + } | |
68 | + | |
69 | + private void populate(int size, int offset) { | |
70 | + MyEntity entity; | |
71 | + | |
72 | + for (int i = 0; i < size; i++) { | |
73 | + entity = new MyEntity(); | |
74 | + entity.setId(createId("id-" + (i + 1 + offset))); | |
75 | + entity.setDescription("desc-" + (i + 1 + offset)); | |
76 | + | |
77 | + crud.insert(entity); | |
78 | + } | |
79 | + } | |
80 | + | |
81 | + private String createId(String id) { | |
82 | + return this.getClass().getName() + "_" + id; | |
83 | + } | |
84 | +} | ... | ... |
... | ... | @@ -0,0 +1,29 @@ |
1 | +package template; | |
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 | +} | ... | ... |
... | ... | @@ -0,0 +1,102 @@ |
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.EntityManagerConfig; | |
52 | +import br.gov.frameworkdemoiselle.internal.producer.EntityManagerFactoryProducer; | |
53 | +import br.gov.frameworkdemoiselle.internal.producer.EntityManagerProducer; | |
54 | +import br.gov.frameworkdemoiselle.internal.proxy.EntityManagerProxy; | |
55 | +import br.gov.frameworkdemoiselle.internal.proxy.QueryProxy; | |
56 | +import br.gov.frameworkdemoiselle.internal.proxy.TypedQueryProxy; | |
57 | +import br.gov.frameworkdemoiselle.template.JPACrud; | |
58 | +import br.gov.frameworkdemoiselle.transaction.JPATransaction; | |
59 | + | |
60 | +@Ignore | |
61 | +public final class Tests { | |
62 | + | |
63 | + private Tests() { | |
64 | + } | |
65 | + | |
66 | + public static WebArchive createDeployment(final Class<?> baseClass) { | |
67 | + return createDeployment().addPackages(true, baseClass.getPackage()); | |
68 | + } | |
69 | + | |
70 | + public static WebArchive createDeployment() { | |
71 | + File[] libs = Maven.resolver().offline().loadPomFromFile("pom.xml", "arquillian-test") | |
72 | + .importCompileAndRuntimeDependencies().resolve().withTransitivity().asFile(); | |
73 | + | |
74 | + return ShrinkWrap | |
75 | + .create(WebArchive.class) | |
76 | + .addClass(Tests.class) | |
77 | + .addClass(EntityManagerConfig.class) | |
78 | + .addClass(EntityManagerFactoryProducer.class) | |
79 | + .addClass(EntityManagerProducer.class) | |
80 | + .addClass(EntityManagerProxy.class) | |
81 | + .addClass(QueryProxy.class) | |
82 | + .addClass(TypedQueryProxy.class) | |
83 | + .addClass(JPACrud.class) | |
84 | + .addClass(JPATransaction.class) | |
85 | + .addAsResource(createFileAsset("src/main/resources/demoiselle-jpa-bundle.properties"), | |
86 | + "demoiselle-jpa-bundle.properties") | |
87 | + .addAsResource(createFileAsset("src/test/resources/logging.properties"), "logging.properties") | |
88 | + .addAsLibraries(libs) | |
89 | + .addAsWebInfResource(createFileAsset("src/test/resources/test/beans.xml"), "beans.xml") | |
90 | + .addAsLibraries(libs); | |
91 | + } | |
92 | + | |
93 | + public static FileAsset createFileAsset(final String pathname) { | |
94 | + return new FileAsset(new File(pathname)); | |
95 | + } | |
96 | + | |
97 | + @Default | |
98 | + @Produces | |
99 | + public Locale create() { | |
100 | + return Locale.getDefault(); | |
101 | + } | |
102 | +} | ... | ... |
impl/extension/jpa/src/test/java/transaction/manual/JPATransactionTest.java
0 → 100644
... | ... | @@ -0,0 +1,120 @@ |
1 | +package transaction.manual; | |
2 | + | |
3 | +import static junit.framework.Assert.assertEquals; | |
4 | +import static junit.framework.Assert.assertFalse; | |
5 | +import static junit.framework.Assert.assertTrue; | |
6 | + | |
7 | +import javax.inject.Inject; | |
8 | +import javax.persistence.EntityManager; | |
9 | +import javax.persistence.TransactionRequiredException; | |
10 | + | |
11 | +import org.jboss.arquillian.container.test.api.Deployment; | |
12 | +import org.jboss.arquillian.junit.Arquillian; | |
13 | +import org.jboss.shrinkwrap.api.spec.WebArchive; | |
14 | +import org.junit.Test; | |
15 | +import org.junit.runner.RunWith; | |
16 | + | |
17 | +import test.Tests; | |
18 | +import br.gov.frameworkdemoiselle.annotation.Name; | |
19 | +import br.gov.frameworkdemoiselle.transaction.JPATransaction; | |
20 | +import br.gov.frameworkdemoiselle.transaction.Transaction; | |
21 | +import br.gov.frameworkdemoiselle.transaction.TransactionContext; | |
22 | + | |
23 | +@RunWith(Arquillian.class) | |
24 | +public class JPATransactionTest { | |
25 | + | |
26 | + private static final String PATH = "src/test/resources/transaction/manual"; | |
27 | + | |
28 | + @Inject | |
29 | + private TransactionContext transactionContext; | |
30 | + | |
31 | + @Inject | |
32 | + @Name("pu1") | |
33 | + private EntityManager em1; | |
34 | + | |
35 | + @Inject | |
36 | + @Name("pu2") | |
37 | + private EntityManager em2; | |
38 | + | |
39 | + @Deployment(testable = true) | |
40 | + public static WebArchive createDeployment() { | |
41 | + WebArchive deployment = Tests.createDeployment(JPATransactionTest.class); | |
42 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/persistence.xml"), "META-INF/persistence.xml"); | |
43 | + | |
44 | + return deployment; | |
45 | + } | |
46 | + | |
47 | + @Test | |
48 | + public void checkJPATransactionType() { | |
49 | + assertEquals(JPATransaction.class, transactionContext.getCurrentTransaction().getClass()); | |
50 | + } | |
51 | + | |
52 | + @Test | |
53 | + public void commitWithSuccess() { | |
54 | + Transaction transaction = transactionContext.getCurrentTransaction(); | |
55 | + | |
56 | + MyEntity entity = new MyEntity(); | |
57 | + entity.setId(createId("id-1")); | |
58 | + entity.setDescription("desc-1"); | |
59 | + | |
60 | + assertFalse(transaction.isActive()); | |
61 | + transaction.begin(); | |
62 | + assertTrue(transaction.isActive()); | |
63 | + | |
64 | + em1.persist(entity); | |
65 | + em2.persist(entity); | |
66 | + transaction.commit(); | |
67 | + em1.clear(); | |
68 | + em2.clear(); | |
69 | + | |
70 | + MyEntity persisted1 = em1.find(MyEntity.class, createId("id-1")); | |
71 | + MyEntity persisted2 = em2.find(MyEntity.class, createId("id-1")); | |
72 | + | |
73 | + assertEquals("desc-1", persisted1.getDescription()); | |
74 | + assertEquals("desc-1", persisted2.getDescription()); | |
75 | + } | |
76 | + | |
77 | + @Test(expected = TransactionRequiredException.class) | |
78 | + public void checkNoTransactionAutomaticallyLoaded() { | |
79 | + MyEntity entity = new MyEntity(); | |
80 | + entity.setId(createId("id-2")); | |
81 | + | |
82 | + em1.persist(entity); | |
83 | + em1.flush(); | |
84 | + } | |
85 | + | |
86 | + // | |
87 | + // @Test | |
88 | + // public void rollbackWithSuccess() { | |
89 | + // Transaction transaction = transactionContext.getCurrentTransaction(); | |
90 | + // | |
91 | + // MyEntity entity = new MyEntity(); | |
92 | + // entity.setId(createId("id-3")); | |
93 | + // | |
94 | + // assertFalse(transaction.isMarkedRollback()); | |
95 | + // transaction.begin(); | |
96 | + // assertTrue(transaction.isActive()); | |
97 | + // | |
98 | + // em1.persist(entity); | |
99 | + // em2.persist(entity); | |
100 | + // em1.flush(); | |
101 | + // em2.flush(); | |
102 | + // transaction.setRollbackOnly(); | |
103 | + // | |
104 | + // if (transaction.isMarkedRollback()) { | |
105 | + // transaction.rollback(); | |
106 | + // } | |
107 | + // | |
108 | + // em1.clear(); | |
109 | + // em2.clear(); | |
110 | + // | |
111 | + // MyEntity persisted1 = em1.find(MyEntity.class, createId("id-3")); | |
112 | + // MyEntity persisted2 = em2.find(MyEntity.class, createId("id-3")); | |
113 | + // assertNull(persisted1); | |
114 | + // assertNull(persisted2); | |
115 | + // } | |
116 | + | |
117 | + private String createId(String id) { | |
118 | + return this.getClass().getName() + "_" + id; | |
119 | + } | |
120 | +} | ... | ... |
impl/extension/jpa/src/test/java/transaction/manual/MyEntity.java
0 → 100644
... | ... | @@ -0,0 +1,29 @@ |
1 | +package transaction.manual; | |
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 | +} | ... | ... |
... | ... | @@ -0,0 +1,71 @@ |
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 | + <container qualifier="jbossas-managed" default="true"> | |
48 | + <configuration> | |
49 | + <property name="javaHome">/usr/lib/jvm/java-6-serpro/</property> | |
50 | + <property name="jbossHome">/opt/demoiselle/server/jboss-7.1/</property> | |
51 | + </configuration> | |
52 | + </container> | |
53 | + --> | |
54 | + | |
55 | + <!-- | |
56 | + --> | |
57 | + <container qualifier="glassfish-embedded" default="true"> | |
58 | + <configuration> | |
59 | + <property name="resourcesXml">src/test/resources/glassfish-resources.xml</property> | |
60 | + </configuration> | |
61 | + </container> | |
62 | + | |
63 | + <!-- | |
64 | + <container qualifier="jbossas-embedded" default="true"> | |
65 | + <configuration> | |
66 | + <property name="jbossHome">/opt/demoiselle/server/jboss-7.1/</property> | |
67 | + </configuration> | |
68 | + </container> | |
69 | + --> | |
70 | + | |
71 | +</arquillian> | |
0 | 72 | \ No newline at end of file | ... | ... |
impl/extension/jpa/src/test/resources/glassfish-resources.xml
0 → 100644
... | ... | @@ -0,0 +1,57 @@ |
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="ArquillianEmbeddedDerbyPool1" jndi-name="jdbc/arquillian1" /> | |
42 | + <jdbc-resource pool-name="ArquillianEmbeddedDerbyPool2" jndi-name="jdbc/arquillian2" /> | |
43 | + | |
44 | + <jdbc-connection-pool name="ArquillianEmbeddedDerbyPool1" res-type="javax.sql.DataSource" datasource-classname="org.apache.derby.jdbc.EmbeddedDataSource" | |
45 | + is-isolation-level-guaranteed="false"> | |
46 | + | |
47 | + <property name="databaseName" value="target/databases/derby1" /> | |
48 | + <property name="createDatabase" value="create" /> | |
49 | + </jdbc-connection-pool> | |
50 | + | |
51 | + <jdbc-connection-pool name="ArquillianEmbeddedDerbyPool2" res-type="javax.sql.DataSource" datasource-classname="org.apache.derby.jdbc.EmbeddedDataSource" | |
52 | + is-isolation-level-guaranteed="false"> | |
53 | + | |
54 | + <property name="databaseName" value="target/databases/derby2" /> | |
55 | + <property name="createDatabase" value="create" /> | |
56 | + </jdbc-connection-pool> | |
57 | +</resources> | |
0 | 58 | \ No newline at end of file | ... | ... |
impl/extension/jpa/src/test/resources/logging.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 | +handlers=java.util.logging.ConsoleHandler | |
37 | +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter | |
38 | +java.util.logging.SimpleFormatter.format=%4$s: %5$s%n | |
39 | +java.util.logging.ConsoleHandler.level=FINEST | |
0 | 40 | \ No newline at end of file | ... | ... |
impl/extension/jpa/src/test/resources/template/persistence.xml
0 → 100644
... | ... | @@ -0,0 +1,66 @@ |
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/arquillian1</non-jta-data-source> | |
42 | + | |
43 | + <class>template.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 | + </properties> | |
50 | + </persistence-unit> | |
51 | + | |
52 | + <!-- | |
53 | + <persistence-unit name="pu" transaction-type="RESOURCE_LOCAL"> | |
54 | + <non-jta-data-source>java:jboss/datasources/ExampleDS</non-jta-data-source> | |
55 | + | |
56 | + <class>template.MyEntity</class> | |
57 | + | |
58 | + <properties> | |
59 | + <property name="hibernate.show_sql" value="true" /> | |
60 | + <property name="hibernate.format_sql" value="false" /> | |
61 | + <property name="hibernate.hbm2ddl.auto" value="create-drop" /> | |
62 | + </properties> | |
63 | + </persistence-unit> | |
64 | + --> | |
65 | + | |
66 | +</persistence> | |
0 | 67 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,11 @@ |
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"> | |
3 | + | |
4 | + <interceptors> | |
5 | + <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class> | |
6 | + <class>br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor</class> | |
7 | + <class>br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor</class> | |
8 | + <class>br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor</class> | |
9 | + </interceptors> | |
10 | + | |
11 | +</beans> | ... | ... |
impl/extension/jpa/src/test/resources/transaction/manual/persistence.xml
0 → 100644
... | ... | @@ -0,0 +1,90 @@ |
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="pu1" transaction-type="RESOURCE_LOCAL"> | |
41 | + <non-jta-data-source>jdbc/arquillian1</non-jta-data-source> | |
42 | + | |
43 | + <class>transaction.manual.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 | + </properties> | |
50 | + </persistence-unit> | |
51 | + | |
52 | + <persistence-unit name="pu2" transaction-type="RESOURCE_LOCAL"> | |
53 | + <non-jta-data-source>jdbc/arquillian2</non-jta-data-source> | |
54 | + | |
55 | + <class>transaction.manual.MyEntity</class> | |
56 | + | |
57 | + <properties> | |
58 | + <property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> | |
59 | + <property name="eclipselink.logging.level.sql" value="FINE" /> | |
60 | + <property name="eclipselink.logging.parameters" value="true" /> | |
61 | + </properties> | |
62 | + </persistence-unit> | |
63 | + | |
64 | + <!-- | |
65 | + <persistence-unit name="pu1" transaction-type="RESOURCE_LOCAL"> | |
66 | + <non-jta-data-source>java:jboss/datasources/ExampleDS</non-jta-data-source> | |
67 | + | |
68 | + <class>transaction.manual.MyEntity</class> | |
69 | + | |
70 | + <properties> | |
71 | + <property name="hibernate.show_sql" value="true" /> | |
72 | + <property name="hibernate.format_sql" value="false" /> | |
73 | + <property name="hibernate.hbm2ddl.auto" value="create-drop" /> | |
74 | + </properties> | |
75 | + </persistence-unit> | |
76 | + | |
77 | + <persistence-unit name="pu2" transaction-type="RESOURCE_LOCAL"> | |
78 | + <non-jta-data-source>java:jboss/datasources/ExampleDS2</non-jta-data-source> | |
79 | + | |
80 | + <class>transaction.manual.MyEntity</class> | |
81 | + | |
82 | + <properties> | |
83 | + <property name="hibernate.show_sql" value="true" /> | |
84 | + <property name="hibernate.format_sql" value="false" /> | |
85 | + <property name="hibernate.hbm2ddl.auto" value="create-drop" /> | |
86 | + </properties> | |
87 | + </persistence-unit> | |
88 | + --> | |
89 | + | |
90 | +</persistence> | |
0 | 91 | \ No newline at end of file | ... | ... |