Commit a21ee331cf01aa04f368590870f73bc9ab8fe06b
Exists in
master
Resolulão de conflitos
Showing
16 changed files
with
199 additions
and
209 deletions
Show diff stats
impl/core/src/test/java/configuration/AbstractConfigurationTest.java
0 → 100644
... | ... | @@ -0,0 +1,56 @@ |
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 configuration; | |
38 | + | |
39 | +import static junit.framework.Assert.assertEquals; | |
40 | +import static junit.framework.Assert.fail; | |
41 | + | |
42 | +import javax.inject.Inject; | |
43 | + | |
44 | +import junit.framework.Assert; | |
45 | + | |
46 | +import org.jboss.arquillian.container.test.api.Deployment; | |
47 | +import org.jboss.arquillian.junit.Arquillian; | |
48 | +import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
49 | +import org.junit.Test; | |
50 | +import org.junit.runner.RunWith; | |
51 | + | |
52 | +import util.Tests; | |
53 | +import br.gov.frameworkdemoiselle.configuration.ConfigurationException; | |
54 | + | |
55 | +public class AbstractConfigurationTest { | |
56 | +} | ... | ... |
impl/core/src/test/java/configuration/ConfigurationTests.java
... | ... | @@ -1,60 +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 configuration; | |
38 | - | |
39 | -import java.io.File; | |
40 | - | |
41 | -import org.jboss.shrinkwrap.api.ShrinkWrap; | |
42 | -import org.jboss.shrinkwrap.api.asset.EmptyAsset; | |
43 | -import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
44 | - | |
45 | -public final class ConfigurationTests { | |
46 | - | |
47 | - private ConfigurationTests() { | |
48 | - } | |
49 | - | |
50 | - public static JavaArchive createDeployment(Class<?> baseClass) { | |
51 | - return ShrinkWrap | |
52 | - .create(JavaArchive.class) | |
53 | - .addPackages(true, "br") | |
54 | - .addPackages(true, baseClass.getPackage()) | |
55 | - .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") | |
56 | - .addAsManifestResource( | |
57 | - new File("src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension"), | |
58 | - "services/javax.enterprise.inject.spi.Extension"); | |
59 | - } | |
60 | -} |
impl/core/src/test/java/configuration/defaultvalue/ConfigurationDefaultValueTest.java
... | ... | @@ -38,22 +38,21 @@ package configuration.defaultvalue; |
38 | 38 | |
39 | 39 | import static junit.framework.Assert.assertEquals; |
40 | 40 | |
41 | -import java.io.File; | |
42 | - | |
43 | 41 | import javax.inject.Inject; |
44 | 42 | |
45 | 43 | import org.jboss.arquillian.container.test.api.Deployment; |
46 | 44 | import org.jboss.arquillian.junit.Arquillian; |
47 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
48 | 45 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
49 | 46 | import org.junit.Test; |
50 | 47 | import org.junit.runner.RunWith; |
51 | 48 | |
52 | -import configuration.ConfigurationTests; | |
49 | +import util.Tests; | |
53 | 50 | |
54 | 51 | @RunWith(Arquillian.class) |
55 | 52 | public class ConfigurationDefaultValueTest { |
56 | 53 | |
54 | + private static final String PATH = "src/test/resources/configuration/field/default"; | |
55 | + | |
57 | 56 | @Inject |
58 | 57 | private FilledDefaultValueConfig filledFieldConfig; |
59 | 58 | |
... | ... | @@ -65,14 +64,9 @@ public class ConfigurationDefaultValueTest { |
65 | 64 | |
66 | 65 | @Deployment |
67 | 66 | public static JavaArchive createDeployment() { |
68 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationDefaultValueTest.class); | |
69 | - | |
70 | - deployment.addAsResource( | |
71 | - new FileAsset(new File("src/test/resources/configuration/field/default/demoiselle.properties")), | |
72 | - "demoiselle.properties").addAsResource( | |
73 | - new FileAsset(new File("src/test/resources/configuration/field/default/demoiselle.xml")), | |
74 | - "demoiselle.xml"); | |
75 | - | |
67 | + JavaArchive deployment = Tests.createDeployment(ConfigurationDefaultValueTest.class); | |
68 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
69 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
76 | 70 | return deployment; |
77 | 71 | } |
78 | 72 | ... | ... |
impl/core/src/test/java/configuration/field/array/ConfigurationArrayFieldTest.java
... | ... | @@ -39,8 +39,6 @@ package configuration.field.array; |
39 | 39 | import static junit.framework.Assert.assertEquals; |
40 | 40 | import static org.junit.Assert.assertArrayEquals; |
41 | 41 | |
42 | -import java.io.File; | |
43 | - | |
44 | 42 | import javax.inject.Inject; |
45 | 43 | |
46 | 44 | import junit.framework.Assert; |
... | ... | @@ -48,17 +46,18 @@ import junit.framework.Assert; |
48 | 46 | import org.apache.commons.configuration.ConversionException; |
49 | 47 | import org.jboss.arquillian.container.test.api.Deployment; |
50 | 48 | import org.jboss.arquillian.junit.Arquillian; |
51 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
52 | 49 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
53 | 50 | import org.junit.Test; |
54 | 51 | import org.junit.runner.RunWith; |
55 | 52 | |
53 | +import util.Tests; | |
56 | 54 | import br.gov.frameworkdemoiselle.configuration.ConfigurationException; |
57 | -import configuration.ConfigurationTests; | |
58 | 55 | |
59 | 56 | @RunWith(Arquillian.class) |
60 | 57 | public class ConfigurationArrayFieldTest { |
61 | 58 | |
59 | + private static final String PATH = "src/test/resources/configuration/field/array"; | |
60 | + | |
62 | 61 | @Inject |
63 | 62 | private PropertiesArrayFieldConfig propertiesConfig; |
64 | 63 | |
... | ... | @@ -70,13 +69,9 @@ public class ConfigurationArrayFieldTest { |
70 | 69 | |
71 | 70 | @Deployment |
72 | 71 | public static JavaArchive createDeployment() { |
73 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationArrayFieldTest.class); | |
74 | - deployment.addAsResource( | |
75 | - new FileAsset(new File("src/test/resources/configuration/field/array/demoiselle.properties")), | |
76 | - "demoiselle.properties").addAsResource( | |
77 | - new FileAsset(new File("src/test/resources/configuration/field/array/demoiselle.xml")), | |
78 | - "demoiselle.xml"); | |
79 | - | |
72 | + JavaArchive deployment = Tests.createDeployment(ConfigurationArrayFieldTest.class); | |
73 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
74 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
80 | 75 | return deployment; |
81 | 76 | } |
82 | 77 | ... | ... |
impl/core/src/test/java/configuration/field/clazz/ConfigurationClassFieldTest.java
... | ... | @@ -39,23 +39,22 @@ package configuration.field.clazz; |
39 | 39 | import static junit.framework.Assert.assertEquals; |
40 | 40 | import static junit.framework.Assert.fail; |
41 | 41 | |
42 | -import java.io.File; | |
43 | - | |
44 | 42 | import javax.inject.Inject; |
45 | 43 | |
46 | 44 | import org.jboss.arquillian.container.test.api.Deployment; |
47 | 45 | import org.jboss.arquillian.junit.Arquillian; |
48 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
49 | 46 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
50 | 47 | import org.junit.Test; |
51 | 48 | import org.junit.runner.RunWith; |
52 | 49 | |
50 | +import util.Tests; | |
53 | 51 | import br.gov.frameworkdemoiselle.configuration.ConfigurationException; |
54 | -import configuration.ConfigurationTests; | |
55 | 52 | |
56 | 53 | @RunWith(Arquillian.class) |
57 | 54 | public class ConfigurationClassFieldTest { |
58 | 55 | |
56 | + private static final String PATH = "src/test/resources/configuration/field/class"; | |
57 | + | |
59 | 58 | @Inject |
60 | 59 | private PropertiesExistentClassFieldConfig propertiesExistentConfig; |
61 | 60 | |
... | ... | @@ -67,10 +66,8 @@ public class ConfigurationClassFieldTest { |
67 | 66 | |
68 | 67 | @Deployment |
69 | 68 | public static JavaArchive createDeployment() { |
70 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationClassFieldTest.class); | |
71 | - deployment.addAsResource(new FileAsset(new File( | |
72 | - "src/test/resources/configuration/field/class/demoiselle.properties")), "demoiselle.properties"); | |
73 | - | |
69 | + JavaArchive deployment = Tests.createDeployment(ConfigurationClassFieldTest.class); | |
70 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
74 | 71 | return deployment; |
75 | 72 | } |
76 | 73 | ... | ... |
impl/core/src/test/java/configuration/field/custom/ConfigurationCustomFieldTest.java
... | ... | @@ -40,23 +40,22 @@ import static junit.framework.Assert.assertEquals; |
40 | 40 | import static junit.framework.Assert.assertNotNull; |
41 | 41 | import static junit.framework.Assert.fail; |
42 | 42 | |
43 | -import java.io.File; | |
44 | - | |
45 | 43 | import javax.inject.Inject; |
46 | 44 | |
47 | 45 | import org.jboss.arquillian.container.test.api.Deployment; |
48 | 46 | import org.jboss.arquillian.junit.Arquillian; |
49 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
50 | 47 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
51 | 48 | import org.junit.Test; |
52 | 49 | import org.junit.runner.RunWith; |
53 | 50 | |
51 | +import util.Tests; | |
54 | 52 | import br.gov.frameworkdemoiselle.configuration.ConfigurationException; |
55 | -import configuration.ConfigurationTests; | |
56 | 53 | |
57 | 54 | @RunWith(Arquillian.class) |
58 | 55 | public class ConfigurationCustomFieldTest { |
59 | 56 | |
57 | + private static final String PATH = "src/test/resources/configuration/field/custom"; | |
58 | + | |
60 | 59 | @Inject |
61 | 60 | private CustomMappedFieldConfig mappedField; |
62 | 61 | |
... | ... | @@ -65,10 +64,8 @@ public class ConfigurationCustomFieldTest { |
65 | 64 | |
66 | 65 | @Deployment |
67 | 66 | public static JavaArchive createDeployment() { |
68 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationCustomFieldTest.class); | |
69 | - deployment.addAsResource(new FileAsset(new File( | |
70 | - "src/test/resources/configuration/field/custom/demoiselle.properties")), "demoiselle.properties"); | |
71 | - | |
67 | + JavaArchive deployment = Tests.createDeployment(ConfigurationCustomFieldTest.class); | |
68 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
72 | 69 | return deployment; |
73 | 70 | } |
74 | 71 | ... | ... |
impl/core/src/test/java/configuration/field/ignored/ConfigurationIgnoredFieldTest.java
... | ... | @@ -38,22 +38,21 @@ package configuration.field.ignored; |
38 | 38 | |
39 | 39 | import static junit.framework.Assert.assertEquals; |
40 | 40 | |
41 | -import java.io.File; | |
42 | - | |
43 | 41 | import javax.inject.Inject; |
44 | 42 | |
45 | 43 | import org.jboss.arquillian.container.test.api.Deployment; |
46 | 44 | import org.jboss.arquillian.junit.Arquillian; |
47 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
48 | 45 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
49 | 46 | import org.junit.Test; |
50 | 47 | import org.junit.runner.RunWith; |
51 | 48 | |
52 | -import configuration.ConfigurationTests; | |
49 | +import util.Tests; | |
53 | 50 | |
54 | 51 | @RunWith(Arquillian.class) |
55 | 52 | public class ConfigurationIgnoredFieldTest { |
56 | 53 | |
54 | + private static final String PATH = "src/test/resources/configuration/field/ignored"; | |
55 | + | |
57 | 56 | @Inject |
58 | 57 | private FilledIgnoredFieldConfig filledFieldConfig; |
59 | 58 | |
... | ... | @@ -65,13 +64,9 @@ public class ConfigurationIgnoredFieldTest { |
65 | 64 | |
66 | 65 | @Deployment |
67 | 66 | public static JavaArchive createDeployment() { |
68 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationIgnoredFieldTest.class); | |
69 | - deployment.addAsResource( | |
70 | - new FileAsset(new File("src/test/resources/configuration/field/ignored/demoiselle.properties")), | |
71 | - "demoiselle.properties").addAsResource( | |
72 | - new FileAsset(new File("src/test/resources/configuration/field/ignored/demoiselle.xml")), | |
73 | - "demoiselle.xml"); | |
74 | - | |
67 | + JavaArchive deployment = Tests.createDeployment(ConfigurationIgnoredFieldTest.class); | |
68 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
69 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
75 | 70 | return deployment; |
76 | 71 | } |
77 | 72 | ... | ... |
impl/core/src/test/java/configuration/field/map/ConfigurationMapFieldTest.java
... | ... | @@ -38,7 +38,6 @@ package configuration.field.map; |
38 | 38 | |
39 | 39 | import static junit.framework.Assert.assertEquals; |
40 | 40 | |
41 | -import java.io.File; | |
42 | 41 | import java.util.HashMap; |
43 | 42 | import java.util.Map; |
44 | 43 | |
... | ... | @@ -46,16 +45,17 @@ import javax.inject.Inject; |
46 | 45 | |
47 | 46 | import org.jboss.arquillian.container.test.api.Deployment; |
48 | 47 | import org.jboss.arquillian.junit.Arquillian; |
49 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
50 | 48 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
51 | 49 | import org.junit.Test; |
52 | 50 | import org.junit.runner.RunWith; |
53 | 51 | |
54 | -import configuration.ConfigurationTests; | |
52 | +import util.Tests; | |
55 | 53 | |
56 | 54 | @RunWith(Arquillian.class) |
57 | 55 | public class ConfigurationMapFieldTest { |
58 | 56 | |
57 | + private static final String PATH = "src/test/resources/configuration/field/map"; | |
58 | + | |
59 | 59 | @Inject |
60 | 60 | private PropertiesMapFieldConfig propertiesConfig; |
61 | 61 | |
... | ... | @@ -64,12 +64,9 @@ public class ConfigurationMapFieldTest { |
64 | 64 | |
65 | 65 | @Deployment |
66 | 66 | public static JavaArchive createDeployment() { |
67 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationMapFieldTest.class); | |
68 | - deployment.addAsResource( | |
69 | - new FileAsset(new File("src/test/resources/configuration/field/map/demoiselle.properties")), | |
70 | - "demoiselle.properties").addAsResource( | |
71 | - new FileAsset(new File("src/test/resources/configuration/field/map/demoiselle.xml")), "demoiselle.xml"); | |
72 | - | |
67 | + JavaArchive deployment = Tests.createDeployment(ConfigurationMapFieldTest.class); | |
68 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
69 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
73 | 70 | return deployment; |
74 | 71 | } |
75 | 72 | ... | ... |
impl/core/src/test/java/configuration/field/named/ConfigurationNamedFieldTest.java
... | ... | @@ -39,23 +39,22 @@ package configuration.field.named; |
39 | 39 | import static junit.framework.Assert.assertEquals; |
40 | 40 | import static junit.framework.Assert.fail; |
41 | 41 | |
42 | -import java.io.File; | |
43 | - | |
44 | 42 | import javax.inject.Inject; |
45 | 43 | |
46 | 44 | import org.jboss.arquillian.container.test.api.Deployment; |
47 | 45 | import org.jboss.arquillian.junit.Arquillian; |
48 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
49 | 46 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
50 | 47 | import org.junit.Test; |
51 | 48 | import org.junit.runner.RunWith; |
52 | 49 | |
50 | +import util.Tests; | |
53 | 51 | import br.gov.frameworkdemoiselle.configuration.ConfigurationException; |
54 | -import configuration.ConfigurationTests; | |
55 | 52 | |
56 | 53 | @RunWith(Arquillian.class) |
57 | 54 | public class ConfigurationNamedFieldTest { |
58 | 55 | |
56 | + private static final String PATH = "src/test/resources/configuration/field/named"; | |
57 | + | |
59 | 58 | @Inject |
60 | 59 | private PropertyNamed propertyNamed; |
61 | 60 | |
... | ... | @@ -70,13 +69,9 @@ public class ConfigurationNamedFieldTest { |
70 | 69 | |
71 | 70 | @Deployment |
72 | 71 | public static JavaArchive createDeployment() { |
73 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationNamedFieldTest.class); | |
74 | - deployment.addAsResource( | |
75 | - new FileAsset(new File("src/test/resources/configuration/field/named/demoiselle.properties")), | |
76 | - "demoiselle.properties").addAsResource( | |
77 | - new FileAsset(new File("src/test/resources/configuration/field/named/demoiselle.xml")), | |
78 | - "demoiselle.xml"); | |
79 | - | |
72 | + JavaArchive deployment = Tests.createDeployment(ConfigurationNamedFieldTest.class); | |
73 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
74 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
80 | 75 | return deployment; |
81 | 76 | } |
82 | 77 | ... | ... |
impl/core/src/test/java/configuration/field/notnull/ConfigurationNotNullFieldTest.java
... | ... | @@ -39,25 +39,24 @@ package configuration.field.notnull; |
39 | 39 | import static junit.framework.Assert.assertEquals; |
40 | 40 | import static junit.framework.Assert.fail; |
41 | 41 | |
42 | -import java.io.File; | |
43 | - | |
44 | 42 | import javax.inject.Inject; |
45 | 43 | |
46 | 44 | import junit.framework.Assert; |
47 | 45 | |
48 | 46 | import org.jboss.arquillian.container.test.api.Deployment; |
49 | 47 | import org.jboss.arquillian.junit.Arquillian; |
50 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
51 | 48 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
52 | 49 | import org.junit.Test; |
53 | 50 | import org.junit.runner.RunWith; |
54 | 51 | |
52 | +import util.Tests; | |
55 | 53 | import br.gov.frameworkdemoiselle.configuration.ConfigurationException; |
56 | -import configuration.ConfigurationTests; | |
57 | 54 | |
58 | 55 | @RunWith(Arquillian.class) |
59 | 56 | public class ConfigurationNotNullFieldTest { |
60 | 57 | |
58 | + private static final String PATH = "src/test/resources/configuration/field/notnull"; | |
59 | + | |
61 | 60 | @Inject |
62 | 61 | private PropertyWithFilledFieldConfig propertyFilledFieldConfig; |
63 | 62 | |
... | ... | @@ -84,28 +83,13 @@ public class ConfigurationNotNullFieldTest { |
84 | 83 | |
85 | 84 | @Deployment |
86 | 85 | public static JavaArchive createDeployment() { |
87 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationNotNullFieldTest.class); | |
88 | - deployment | |
89 | - .addAsResource( | |
90 | - new FileAsset(new File("src/test/resources/configuration/field/notnull/demoiselle.properties")), | |
91 | - "demoiselle.properties") | |
92 | - .addAsResource( | |
93 | - new FileAsset(new File("src/test/resources/configuration/field/notnull/empty-field.properties")), | |
94 | - "empty-field.properties") | |
95 | - .addAsResource( | |
96 | - new FileAsset(new File( | |
97 | - "src/test/resources/configuration/field/notnull/without-field.properties")), | |
98 | - "without-field.properties") | |
99 | - .addAsResource( | |
100 | - new FileAsset(new File("src/test/resources/configuration/field/notnull/demoiselle.xml")), | |
101 | - "demoiselle.xml") | |
102 | - .addAsResource( | |
103 | - new FileAsset(new File("src/test/resources/configuration/field/notnull/empty-field.xml")), | |
104 | - "empty-field.xml") | |
105 | - .addAsResource( | |
106 | - new FileAsset(new File("src/test/resources/configuration/field/notnull/without-field.xml")), | |
107 | - "without-field.xml"); | |
108 | - | |
86 | + JavaArchive deployment = Tests.createDeployment(ConfigurationNotNullFieldTest.class); | |
87 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
88 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/empty-field.properties"), "empty-field.properties"); | |
89 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/without-field.properties"), "without-field.properties"); | |
90 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
91 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/empty-field.xml"), "empty-field.xml"); | |
92 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/without-field.xml"), "without-field.xml"); | |
109 | 93 | return deployment; |
110 | 94 | } |
111 | 95 | ... | ... |
impl/core/src/test/java/configuration/field/primitiveorwrapper/ConfigurationPrimitiveOrWrapperFieldTest.java
... | ... | @@ -39,25 +39,24 @@ package configuration.field.primitiveorwrapper; |
39 | 39 | import static junit.framework.Assert.assertEquals; |
40 | 40 | import static junit.framework.Assert.fail; |
41 | 41 | |
42 | -import java.io.File; | |
43 | - | |
44 | 42 | import javax.inject.Inject; |
45 | 43 | |
46 | 44 | import org.apache.commons.configuration.ConversionException; |
47 | 45 | import org.jboss.arquillian.container.test.api.Deployment; |
48 | 46 | import org.jboss.arquillian.junit.Arquillian; |
49 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
50 | 47 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
51 | 48 | import org.junit.BeforeClass; |
52 | 49 | import org.junit.Test; |
53 | 50 | import org.junit.runner.RunWith; |
54 | 51 | |
52 | +import util.Tests; | |
55 | 53 | import br.gov.frameworkdemoiselle.configuration.ConfigurationException; |
56 | -import configuration.ConfigurationTests; | |
57 | 54 | |
58 | 55 | @RunWith(Arquillian.class) |
59 | 56 | public class ConfigurationPrimitiveOrWrapperFieldTest { |
60 | 57 | |
58 | + private static final String PATH = "src/test/resources/configuration/field/primitiveorwrapper"; | |
59 | + | |
61 | 60 | @Inject |
62 | 61 | private PropertiesPrimitiveOrWrapperFieldConfig propertiesConfig; |
63 | 62 | |
... | ... | @@ -78,14 +77,9 @@ public class ConfigurationPrimitiveOrWrapperFieldTest { |
78 | 77 | |
79 | 78 | @Deployment |
80 | 79 | public static JavaArchive createDeployment() { |
81 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationPrimitiveOrWrapperFieldTest.class); | |
82 | - deployment.addAsResource( | |
83 | - new FileAsset(new File( | |
84 | - "src/test/resources/configuration/field/primitiveorwrapper/demoiselle.properties")), | |
85 | - "demoiselle.properties").addAsResource( | |
86 | - new FileAsset(new File("src/test/resources/configuration/field/primitiveorwrapper/demoiselle.xml")), | |
87 | - "demoiselle.xml"); | |
88 | - | |
80 | + JavaArchive deployment = Tests.createDeployment(ConfigurationPrimitiveOrWrapperFieldTest.class); | |
81 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
82 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
89 | 83 | return deployment; |
90 | 84 | } |
91 | 85 | ... | ... |
impl/core/src/test/java/configuration/field/string/ConfigurationStringFieldTest.java
... | ... | @@ -38,23 +38,22 @@ package configuration.field.string; |
38 | 38 | |
39 | 39 | import static junit.framework.Assert.assertEquals; |
40 | 40 | |
41 | -import java.io.File; | |
42 | - | |
43 | 41 | import javax.inject.Inject; |
44 | 42 | |
45 | 43 | import org.jboss.arquillian.container.test.api.Deployment; |
46 | 44 | import org.jboss.arquillian.junit.Arquillian; |
47 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
48 | 45 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
49 | 46 | import org.junit.BeforeClass; |
50 | 47 | import org.junit.Test; |
51 | 48 | import org.junit.runner.RunWith; |
52 | 49 | |
53 | -import configuration.ConfigurationTests; | |
50 | +import util.Tests; | |
54 | 51 | |
55 | 52 | @RunWith(Arquillian.class) |
56 | 53 | public class ConfigurationStringFieldTest { |
57 | 54 | |
55 | + private static final String PATH = "src/test/resources/configuration/field/string"; | |
56 | + | |
58 | 57 | @Inject |
59 | 58 | private PropertiesStringFieldConfig propertiesConfig; |
60 | 59 | |
... | ... | @@ -66,13 +65,9 @@ public class ConfigurationStringFieldTest { |
66 | 65 | |
67 | 66 | @Deployment |
68 | 67 | public static JavaArchive createDeployment() { |
69 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationStringFieldTest.class); | |
70 | - deployment.addAsResource( | |
71 | - new FileAsset(new File("src/test/resources/configuration/field/string/demoiselle.properties")), | |
72 | - "demoiselle.properties").addAsResource( | |
73 | - new FileAsset(new File("src/test/resources/configuration/field/string/demoiselle.xml")), | |
74 | - "demoiselle.xml"); | |
75 | - | |
68 | + JavaArchive deployment = Tests.createDeployment(ConfigurationStringFieldTest.class); | |
69 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
70 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
76 | 71 | return deployment; |
77 | 72 | } |
78 | 73 | ... | ... |
impl/core/src/test/java/configuration/prefix/ConfigurationPrefixTest.java
... | ... | @@ -39,22 +39,21 @@ package configuration.prefix; |
39 | 39 | import static junit.framework.Assert.assertNull; |
40 | 40 | import static org.junit.Assert.assertEquals; |
41 | 41 | |
42 | -import java.io.File; | |
43 | - | |
44 | 42 | import javax.inject.Inject; |
45 | 43 | |
46 | 44 | import org.jboss.arquillian.container.test.api.Deployment; |
47 | 45 | import org.jboss.arquillian.junit.Arquillian; |
48 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
49 | 46 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
50 | 47 | import org.junit.Test; |
51 | 48 | import org.junit.runner.RunWith; |
52 | 49 | |
53 | -import configuration.ConfigurationTests; | |
50 | +import util.Tests; | |
54 | 51 | |
55 | 52 | @RunWith(Arquillian.class) |
56 | 53 | public class ConfigurationPrefixTest { |
57 | 54 | |
55 | + private static final String PATH = "src/test/resources/configuration/prefix"; | |
56 | + | |
58 | 57 | @Inject |
59 | 58 | private PropertyPrefixEndingWithoutDot propertyEndingWithoutDotPrefix; |
60 | 59 | |
... | ... | @@ -75,12 +74,9 @@ public class ConfigurationPrefixTest { |
75 | 74 | |
76 | 75 | @Deployment |
77 | 76 | public static JavaArchive createDeployment() { |
78 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationPrefixTest.class); | |
79 | - deployment.addAsResource( | |
80 | - new FileAsset(new File("src/test/resources/configuration/prefix/demoiselle.properties")), | |
81 | - "demoiselle.properties").addAsResource( | |
82 | - new FileAsset(new File("src/test/resources/configuration/prefix/demoiselle.xml")), "demoiselle.xml"); | |
83 | - | |
77 | + JavaArchive deployment = Tests.createDeployment(ConfigurationPrefixTest.class); | |
78 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
79 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
84 | 80 | return deployment; |
85 | 81 | } |
86 | 82 | ... | ... |
impl/core/src/test/java/configuration/resource/ConfigurationResourceTest.java
... | ... | @@ -38,22 +38,21 @@ package configuration.resource; |
38 | 38 | |
39 | 39 | import static junit.framework.Assert.assertEquals; |
40 | 40 | |
41 | -import java.io.File; | |
42 | - | |
43 | 41 | import javax.inject.Inject; |
44 | 42 | |
45 | 43 | import org.jboss.arquillian.container.test.api.Deployment; |
46 | 44 | import org.jboss.arquillian.junit.Arquillian; |
47 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
48 | 45 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
49 | 46 | import org.junit.Test; |
50 | 47 | import org.junit.runner.RunWith; |
51 | 48 | |
52 | -import configuration.ConfigurationTests; | |
49 | +import util.Tests; | |
53 | 50 | |
54 | 51 | @RunWith(Arquillian.class) |
55 | 52 | public class ConfigurationResourceTest { |
56 | 53 | |
54 | + private static final String PATH = "src/test/resources/configuration/resource"; | |
55 | + | |
57 | 56 | @Inject |
58 | 57 | private PropertiesDefaultFileConfig propDefault; |
59 | 58 | |
... | ... | @@ -80,19 +79,11 @@ public class ConfigurationResourceTest { |
80 | 79 | |
81 | 80 | @Deployment |
82 | 81 | public static JavaArchive createDeployment() { |
83 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationResourceTest.class); | |
84 | - deployment | |
85 | - .addAsResource( | |
86 | - new FileAsset(new File("src/test/resources/configuration/resource/demoiselle.properties")), | |
87 | - "demoiselle.properties") | |
88 | - .addAsResource(new FileAsset(new File("src/test/resources/configuration/resource/demoiselle.xml")), | |
89 | - "demoiselle.xml") | |
90 | - .addAsResource( | |
91 | - new FileAsset(new File("src/test/resources/configuration/resource/resource.properties")), | |
92 | - "resource.properties") | |
93 | - .addAsResource(new FileAsset(new File("src/test/resources/configuration/resource/resource.xml")), | |
94 | - "resource.xml"); | |
95 | - | |
82 | + JavaArchive deployment = Tests.createDeployment(ConfigurationResourceTest.class); | |
83 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
84 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
85 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/resource.properties"), "resource.properties"); | |
86 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/resource.xml"), "resource.xml"); | |
96 | 87 | return deployment; |
97 | 88 | } |
98 | 89 | ... | ... |
impl/core/src/test/java/configuration/scope/ConfigurationScopeTest.java
... | ... | @@ -45,16 +45,15 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive; |
45 | 45 | import org.junit.Test; |
46 | 46 | import org.junit.runner.RunWith; |
47 | 47 | |
48 | +import util.Tests; | |
48 | 49 | import br.gov.frameworkdemoiselle.util.Beans; |
49 | -import configuration.ConfigurationTests; | |
50 | 50 | |
51 | 51 | @RunWith(Arquillian.class) |
52 | 52 | public class ConfigurationScopeTest { |
53 | 53 | |
54 | 54 | @Deployment |
55 | 55 | public static JavaArchive createDeployment() { |
56 | - JavaArchive deployment = ConfigurationTests.createDeployment(ConfigurationScopeTest.class); | |
57 | - return deployment; | |
56 | + return Tests.createDeployment(ConfigurationScopeTest.class); | |
58 | 57 | } |
59 | 58 | |
60 | 59 | @Test | ... | ... |
... | ... | @@ -0,0 +1,65 @@ |
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 util; | |
38 | + | |
39 | +import java.io.File; | |
40 | + | |
41 | +import org.jboss.shrinkwrap.api.ShrinkWrap; | |
42 | +import org.jboss.shrinkwrap.api.asset.EmptyAsset; | |
43 | +import org.jboss.shrinkwrap.api.asset.FileAsset; | |
44 | +import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
45 | + | |
46 | +public final class Tests { | |
47 | + | |
48 | + private Tests() { | |
49 | + } | |
50 | + | |
51 | + public static JavaArchive createDeployment(Class<?> baseClass) { | |
52 | + return ShrinkWrap | |
53 | + .create(JavaArchive.class) | |
54 | + .addPackages(true, "br") | |
55 | + .addPackages(true, baseClass.getPackage()) | |
56 | + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") | |
57 | + .addAsManifestResource( | |
58 | + new File("src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension"), | |
59 | + "services/javax.enterprise.inject.spi.Extension"); | |
60 | + } | |
61 | + | |
62 | + public static FileAsset createFileAsset(String pathname) { | |
63 | + return new FileAsset(new File(pathname)); | |
64 | + } | |
65 | +} | ... | ... |