Commit 63481c19b1f3f8cfeb18559ffe3a63361cd3a3b8

Authored by Cleverson Sacramento
1 parent 054ab370
Exists in master

Movendo as classes de teste

Showing 188 changed files with 5181 additions and 5145 deletions   Show diff stats
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/AbstractConfigurationTest.java
@@ -1,96 +0,0 @@ @@ -1,96 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration;  
38 -  
39 -import java.io.File;  
40 -import java.util.ArrayList;  
41 -import java.util.List;  
42 -  
43 -import org.jboss.shrinkwrap.api.ShrinkWrap;  
44 -import org.jboss.shrinkwrap.api.asset.EmptyAsset;  
45 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
46 -  
47 -import br.gov.frameworkdemoiselle.annotation.Ignore;  
48 -import br.gov.frameworkdemoiselle.annotation.Name;  
49 -import br.gov.frameworkdemoiselle.internal.bootstrap.ConfigurationBootstrap;  
50 -import br.gov.frameworkdemoiselle.internal.bootstrap.CoreBootstrap;  
51 -import br.gov.frameworkdemoiselle.internal.implementation.ConfigurationArrayValueExtractor;  
52 -import br.gov.frameworkdemoiselle.internal.implementation.ConfigurationClassValueExtractor;  
53 -import br.gov.frameworkdemoiselle.internal.implementation.ConfigurationLoader;  
54 -import br.gov.frameworkdemoiselle.internal.implementation.ConfigurationMapValueExtractor;  
55 -import br.gov.frameworkdemoiselle.internal.implementation.ConfigurationPrimitiveOrWrapperValueExtractor;  
56 -import br.gov.frameworkdemoiselle.internal.implementation.ConfigurationStringValueExtractor;  
57 -import br.gov.frameworkdemoiselle.internal.producer.LocaleProducer;  
58 -import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer;  
59 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
60 -import br.gov.frameworkdemoiselle.util.Beans;  
61 -  
62 -public abstract class AbstractConfigurationTest {  
63 -  
64 - protected static Class<?>[] getConfigurationClasses() {  
65 - List<Class<?>> result = new ArrayList<Class<?>>();  
66 -  
67 - result.add(Ignore.class);  
68 - result.add(Name.class);  
69 - result.add(Configuration.class);  
70 - result.add(CoreBootstrap.class);  
71 - result.add(ConfigurationBootstrap.class);  
72 - result.add(ConfigurationLoader.class);  
73 - result.add(ConfigurationValueExtractor.class);  
74 - result.add(ConfigurationArrayValueExtractor.class);  
75 - result.add(ConfigurationMapValueExtractor.class);  
76 - result.add(ConfigurationClassValueExtractor.class);  
77 - result.add(ConfigurationStringValueExtractor.class);  
78 - result.add(ConfigurationPrimitiveOrWrapperValueExtractor.class);  
79 - result.add(Beans.class);  
80 - result.add(ResourceBundleProducer.class);  
81 - result.add(LoggerProducer.class);  
82 - result.add(LocaleProducer.class);  
83 -  
84 - return result.toArray(new Class<?>[0]);  
85 - }  
86 -  
87 - public static JavaArchive createConfigurationDeployment() {  
88 - return ShrinkWrap  
89 - .create(JavaArchive.class)  
90 - .addClasses(getConfigurationClasses())  
91 - .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")  
92 - .addAsManifestResource(  
93 - new File("src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension"),  
94 - "services/javax.enterprise.inject.spi.Extension");  
95 - }  
96 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/AbstractDefaultValueConfig.java
@@ -1,60 +0,0 @@ @@ -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 br.gov.frameworkdemoiselle.configuration.defaultvalue;  
38 -  
39 -public abstract class AbstractDefaultValueConfig {  
40 -  
41 - private String stringDefaultWithoutKey = "Initialized value and without key in the property file";  
42 -  
43 - private String stringDefaultWithKey = "Initialized value and key in the property file";  
44 -  
45 - public String getStringDefaultWithoutKey() {  
46 - return stringDefaultWithoutKey;  
47 - }  
48 -  
49 - public String getStringDefaultWithKey() {  
50 - return stringDefaultWithKey;  
51 - }  
52 -  
53 - public void setStringDefaultWithoutKey(String stringDefaultWithoutKey) {  
54 - this.stringDefaultWithoutKey = stringDefaultWithoutKey;  
55 - }  
56 -  
57 - public void setStringDefaultWithKey(String stringDefaultWithKey) {  
58 - this.stringDefaultWithKey = stringDefaultWithKey;  
59 - }  
60 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/ConfigurationDefaultValueTest.java
@@ -1,95 +0,0 @@ @@ -1,95 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.defaultvalue;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -  
41 -import java.io.File;  
42 -  
43 -import javax.inject.Inject;  
44 -  
45 -import org.jboss.arquillian.container.test.api.Deployment;  
46 -import org.jboss.arquillian.junit.Arquillian;  
47 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
48 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
49 -import org.junit.Test;  
50 -import org.junit.runner.RunWith;  
51 -  
52 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
53 -  
54 -@RunWith(Arquillian.class)  
55 -public class ConfigurationDefaultValueTest extends AbstractConfigurationTest {  
56 -  
57 - @Inject  
58 - private FilledDefaultValueConfig filledFieldConfig;  
59 -  
60 - @Inject  
61 - private EmptyDefaultValueConfig emptyFieldsConfig;  
62 -  
63 - @Inject  
64 - private PropertyWithInexistenceFileConfig noFileConfig;  
65 -  
66 - @Deployment  
67 - public static JavaArchive createDeployment() {  
68 - JavaArchive deployment = createConfigurationDeployment();  
69 -  
70 - deployment.addPackages(true, ConfigurationDefaultValueTest.class.getPackage());  
71 - deployment.addAsResource(  
72 - new FileAsset(new File("src/test/resources/configuration/field/default/demoiselle.properties")),  
73 - "demoiselle.properties").addAsResource(  
74 - new FileAsset(new File("src/test/resources/configuration/field/default/demoiselle.xml")),  
75 - "demoiselle.xml");  
76 -  
77 - return deployment;  
78 - }  
79 -  
80 - @Test  
81 - public void loadDefaultValueWithoutKey() {  
82 - String expected = "Initialized value and without key in the property file";  
83 -  
84 - assertEquals(expected, filledFieldConfig.getStringDefaultWithoutKey());  
85 - assertEquals(expected, emptyFieldsConfig.getStringDefaultWithoutKey());  
86 - assertEquals(expected, noFileConfig.getStringDefaultWithoutKey());  
87 - }  
88 -  
89 - @Test  
90 - public void loadDefaultValueWithKey() {  
91 - assertEquals("Initialized value of the property file", filledFieldConfig.getStringDefaultWithKey());  
92 - assertEquals("Initialized value and key in the property file", noFileConfig.getStringDefaultWithKey());  
93 - assertEquals("", emptyFieldsConfig.getStringDefaultWithKey());  
94 - }  
95 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/EmptyDefaultValueConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.defaultvalue;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "demoiselle", type = XML)  
43 -public class EmptyDefaultValueConfig extends AbstractDefaultValueConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/FilledDefaultValueConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.defaultvalue;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "demoiselle", type = PROPERTIES)  
43 -public class FilledDefaultValueConfig extends AbstractDefaultValueConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/PropertyWithInexistenceFileConfig.java
@@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.defaultvalue;  
38 -  
39 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
40 -  
41 -@Configuration(resource = "nofile")  
42 -public class PropertyWithInexistenceFileConfig extends AbstractDefaultValueConfig {  
43 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/array/AbstractArrayEmptyFieldConfig.java
@@ -1,58 +0,0 @@ @@ -1,58 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.array;  
38 -  
39 -public abstract class AbstractArrayEmptyFieldConfig {  
40 -  
41 - private int[] emptyPrimitiveIntegers;  
42 -  
43 - private Integer[] emptyWrapperIntegers;  
44 -  
45 - private Integer[] errorTypeWrapperIntegers;  
46 -  
47 - public Integer[] getEmptyWrapperIntegers() {  
48 - return emptyWrapperIntegers;  
49 - }  
50 -  
51 - public int[] getEmptyPrimitiveIntegers() {  
52 - return emptyPrimitiveIntegers;  
53 - }  
54 -  
55 - public Integer[] getErrorTypeWrapperIntegers() {  
56 - return errorTypeWrapperIntegers;  
57 - }  
58 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/array/AbstractArrayFieldConfig.java
@@ -1,76 +0,0 @@ @@ -1,76 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.array;  
38 -  
39 -public abstract class AbstractArrayFieldConfig {  
40 -  
41 - private int[] primitiveIntegers;  
42 -  
43 - private Integer[] wrappedIntegers;  
44 -  
45 - private String[] strings;  
46 -  
47 - private double[] primitiveDoubles;  
48 -  
49 - private Double[] wrappedDoubles;  
50 -  
51 - private String[] emptyStrings;  
52 -  
53 - public int[] getPrimitiveIntegers() {  
54 - return primitiveIntegers;  
55 - }  
56 -  
57 - public Integer[] getWrappedIntegers() {  
58 - return wrappedIntegers;  
59 - }  
60 -  
61 - public String[] getStrings() {  
62 - return strings;  
63 - }  
64 -  
65 - public double[] getPrimitiveDoubles() {  
66 - return primitiveDoubles;  
67 - }  
68 -  
69 - public Double[] getWrappedDoubles() {  
70 - return wrappedDoubles;  
71 - }  
72 -  
73 - public String[] getEmptyStrings() {  
74 - return emptyStrings;  
75 - }  
76 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/array/ConfigurationArrayFieldTest.java
@@ -1,160 +0,0 @@ @@ -1,160 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.array;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -import static org.junit.Assert.assertArrayEquals;  
41 -  
42 -import java.io.File;  
43 -  
44 -import javax.inject.Inject;  
45 -  
46 -import junit.framework.Assert;  
47 -  
48 -import org.apache.commons.configuration.ConversionException;  
49 -import org.jboss.arquillian.container.test.api.Deployment;  
50 -import org.jboss.arquillian.junit.Arquillian;  
51 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
52 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
53 -import org.junit.Test;  
54 -import org.junit.runner.RunWith;  
55 -  
56 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
57 -import br.gov.frameworkdemoiselle.configuration.ConfigurationException;  
58 -  
59 -@RunWith(Arquillian.class)  
60 -public class ConfigurationArrayFieldTest extends AbstractConfigurationTest {  
61 -  
62 - @Inject  
63 - private PropertiesArrayFieldConfig propertiesConfig;  
64 -  
65 - @Inject  
66 - private PropertiesArrayEmptyFieldConfig propertiesNullConfig;  
67 -  
68 - @Inject  
69 - private XMLArrayFieldConfig xmlConfig;  
70 -  
71 - @Deployment  
72 - public static JavaArchive createDeployment() {  
73 - JavaArchive deployment = createConfigurationDeployment();  
74 -  
75 - deployment.addPackages(true, ConfigurationArrayFieldTest.class.getPackage());  
76 - deployment.addAsResource(  
77 - new FileAsset(new File("src/test/resources/configuration/field/array/demoiselle.properties")),  
78 - "demoiselle.properties").addAsResource(  
79 - new FileAsset(new File("src/test/resources/configuration/field/array/demoiselle.xml")),  
80 - "demoiselle.xml");  
81 -  
82 - return deployment;  
83 - }  
84 -  
85 - @Test  
86 - public void loadPrimitiveInteger() {  
87 - int[] expected = { 1, 20, 0 };  
88 -  
89 - assertArrayEquals(expected, propertiesConfig.getPrimitiveIntegers());  
90 - assertArrayEquals(expected, xmlConfig.getPrimitiveIntegers());  
91 - }  
92 -  
93 - @Test  
94 - public void loadWrappedIntegers() {  
95 - Integer[] expected = { -99, 0, 1 };  
96 -  
97 - assertArrayEquals(expected, propertiesConfig.getWrappedIntegers());  
98 - assertArrayEquals(expected, xmlConfig.getWrappedIntegers());  
99 - }  
100 -  
101 - @Test  
102 - public void loadString() {  
103 - String[] expected = { "demoisele", "demoiselle framework", "demoiselle,framework", "demoiselle, framework" };  
104 -  
105 - assertArrayEquals(expected, propertiesConfig.getStrings());  
106 - assertArrayEquals(expected, xmlConfig.getStrings());  
107 - }  
108 -  
109 - @Test  
110 - public void loadPrimitiveDoubles() {  
111 - double[] expected = { -10, 200000.99999, 0 };  
112 -  
113 - assertArrayEquals(expected, propertiesConfig.getPrimitiveDoubles(), 0);  
114 - assertArrayEquals(expected, xmlConfig.getPrimitiveDoubles(), 0);  
115 - }  
116 -  
117 - @Test  
118 - public void loadWrappedDoubles() {  
119 - Double[] expected = { -456.123456789, 0.0, 52.2 };  
120 -  
121 - assertArrayEquals(expected, propertiesConfig.getWrappedDoubles());  
122 - assertArrayEquals(expected, xmlConfig.getWrappedDoubles());  
123 - }  
124 -  
125 - @Test  
126 - public void loadEmptyString() {  
127 - String[] expected = { "demoisele", "" };  
128 - assertArrayEquals(expected, propertiesConfig.getEmptyStrings());  
129 - }  
130 -  
131 - @Test  
132 - public void loadEmptyPrimitive() {  
133 - try {  
134 - propertiesNullConfig.getEmptyPrimitiveIntegers();  
135 - Assert.fail();  
136 - } catch (ConfigurationException cause) {  
137 - assertEquals(ConversionException.class, cause.getCause().getClass());  
138 - }  
139 - }  
140 -  
141 - @Test  
142 - public void loadEmptyWrapper() {  
143 - try {  
144 - propertiesNullConfig.getEmptyWrapperIntegers();  
145 - Assert.fail();  
146 - } catch (ConfigurationException cause) {  
147 - assertEquals(ConversionException.class, cause.getCause().getClass());  
148 - }  
149 - }  
150 -  
151 - @Test  
152 - public void loadErrorTypeWrapper() {  
153 - try {  
154 - propertiesNullConfig.getErrorTypeWrapperIntegers();  
155 - Assert.fail();  
156 - } catch (ConfigurationException cause) {  
157 - assertEquals(ConversionException.class, cause.getCause().getClass());  
158 - }  
159 - }  
160 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/array/PropertiesArrayEmptyFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.array;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = PROPERTIES)  
43 -public class PropertiesArrayEmptyFieldConfig extends AbstractArrayEmptyFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/array/PropertiesArrayFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.array;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = PROPERTIES)  
43 -public class PropertiesArrayFieldConfig extends AbstractArrayFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/array/XMLArrayFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.array;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "demoiselle", type = XML)  
43 -public class XMLArrayFieldConfig extends AbstractArrayFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/AbstractClassNotFoundFieldConfig.java
@@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.clazz;  
38 -  
39 -public abstract class AbstractClassNotFoundFieldConfig {  
40 -  
41 - private Class<MyClass> nonExistentTypedClass;  
42 -  
43 - private Class<?> nonExistentUntypedClass;  
44 -  
45 - public Class<MyClass> getNonExistentTypedClass() {  
46 - return nonExistentTypedClass;  
47 - }  
48 -  
49 - public Class<?> getNonExistentUntypedClass() {  
50 - return nonExistentUntypedClass;  
51 - }  
52 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/AbstractExistentClassFieldConfig.java
@@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.clazz;  
38 -  
39 -public abstract class AbstractExistentClassFieldConfig {  
40 -  
41 - private Class<MyClass> existentTypedClass;  
42 -  
43 - private Class<?> existentUntypedClass;  
44 -  
45 - public Class<MyClass> getExistentTypedClass() {  
46 - return existentTypedClass;  
47 - }  
48 -  
49 - public Class<?> getExistentUntypedClass() {  
50 - return existentUntypedClass;  
51 - }  
52 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/AbstractNullClassFieldConfig.java
@@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.clazz;  
38 -  
39 -public abstract class AbstractNullClassFieldConfig {  
40 -  
41 - private Class<MyClass> nullTypedClass;  
42 -  
43 - private Class<?> nullUntypedClass;  
44 -  
45 - public Class<MyClass> getNullTypedClass() {  
46 - return nullTypedClass;  
47 - }  
48 -  
49 - public Class<?> getNullUntypedClass() {  
50 - return nullUntypedClass;  
51 - }  
52 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/ConfigurationClassFieldTest.java
@@ -1,131 +0,0 @@ @@ -1,131 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.clazz;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -import static junit.framework.Assert.fail;  
41 -  
42 -import java.io.File;  
43 -  
44 -import javax.inject.Inject;  
45 -  
46 -import org.jboss.arquillian.container.test.api.Deployment;  
47 -import org.jboss.arquillian.junit.Arquillian;  
48 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
49 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
50 -import org.junit.Test;  
51 -import org.junit.runner.RunWith;  
52 -  
53 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
54 -import br.gov.frameworkdemoiselle.configuration.ConfigurationException;  
55 -  
56 -@RunWith(Arquillian.class)  
57 -public class ConfigurationClassFieldTest extends AbstractConfigurationTest {  
58 -  
59 - @Inject  
60 - private PropertiesExistentClassFieldConfig propertiesExistentConfig;  
61 -  
62 - @Inject  
63 - private PropertiesClassNotFoundFieldConfig propertiesNotFoundConfig;  
64 -  
65 - @Inject  
66 - private PropertiesNullClassFieldConfig propertiesNullFieldConfig;  
67 -  
68 - @Deployment  
69 - public static JavaArchive createDeployment() {  
70 - JavaArchive deployment = createConfigurationDeployment();  
71 -  
72 - deployment.addPackages(true, ConfigurationClassFieldTest.class.getPackage());  
73 - deployment.addAsResource(new FileAsset(new File(  
74 - "src/test/resources/configuration/field/class/demoiselle.properties")), "demoiselle.properties");  
75 -  
76 - return deployment;  
77 - }  
78 -  
79 - @Test  
80 - public void loadExistentTypedClass() {  
81 - assertEquals(MyClass.class, propertiesExistentConfig.getExistentTypedClass());  
82 - }  
83 -  
84 - @Test  
85 - public void loadExistentUntypedClass() {  
86 - assertEquals(MyClass.class, propertiesExistentConfig.getExistentUntypedClass());  
87 - }  
88 -  
89 - @Test  
90 - public void loadNonExistentTypedClass() {  
91 - try {  
92 - propertiesNotFoundConfig.getNonExistentTypedClass();  
93 - fail();  
94 - } catch (ConfigurationException cause) {  
95 - cause.printStackTrace();  
96 - assertEquals(ClassNotFoundException.class, cause.getCause().getClass());  
97 - }  
98 - }  
99 -  
100 - @Test  
101 - public void loadNonExistentUntypedClass() {  
102 - try {  
103 - propertiesNotFoundConfig.getNonExistentUntypedClass();  
104 - fail();  
105 - } catch (ConfigurationException cause) {  
106 - assertEquals(ClassNotFoundException.class, cause.getCause().getClass());  
107 - }  
108 - }  
109 -  
110 - @Test  
111 - public void loadNullTypedClass() {  
112 - try {  
113 - propertiesNullFieldConfig.getNullTypedClass();  
114 - fail();  
115 - } catch (ConfigurationException cause) {  
116 - cause.printStackTrace();  
117 - assertEquals(ClassNotFoundException.class, cause.getCause().getClass());  
118 - }  
119 - }  
120 -  
121 - @Test  
122 - public void loadNullUntypedClass() {  
123 - try {  
124 - propertiesNullFieldConfig.getNullUntypedClass();  
125 - fail();  
126 - } catch (ConfigurationException cause) {  
127 - assertEquals(ClassNotFoundException.class, cause.getCause().getClass());  
128 - }  
129 - }  
130 -  
131 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/MyClass.java
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.field.clazz;  
2 -  
3 -public class MyClass {  
4 -  
5 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/PropertiesClassNotFoundFieldConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.clazz;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = PROPERTIES)  
43 -public class PropertiesClassNotFoundFieldConfig extends AbstractClassNotFoundFieldConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/PropertiesExistentClassFieldConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.clazz;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = PROPERTIES)  
43 -public class PropertiesExistentClassFieldConfig extends AbstractExistentClassFieldConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/PropertiesNullClassFieldConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.clazz;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = PROPERTIES)  
43 -public class PropertiesNullClassFieldConfig extends AbstractNullClassFieldConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/custom/ConfigurationCustomFieldTest.java
@@ -1,91 +0,0 @@ @@ -1,91 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.custom;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -import static junit.framework.Assert.assertNotNull;  
41 -import static junit.framework.Assert.fail;  
42 -  
43 -import java.io.File;  
44 -  
45 -import javax.inject.Inject;  
46 -  
47 -import org.jboss.arquillian.container.test.api.Deployment;  
48 -import org.jboss.arquillian.junit.Arquillian;  
49 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
50 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
51 -import org.junit.Test;  
52 -import org.junit.runner.RunWith;  
53 -  
54 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
55 -import br.gov.frameworkdemoiselle.configuration.ConfigurationException;  
56 -  
57 -@RunWith(Arquillian.class)  
58 -public class ConfigurationCustomFieldTest extends AbstractConfigurationTest {  
59 -  
60 - @Inject  
61 - private CustomMappedFieldConfig mappedField;  
62 -  
63 - @Inject  
64 - private CustomUnmappedFieldConfig unmappedField;  
65 -  
66 - @Deployment  
67 - public static JavaArchive createDeployment() {  
68 - JavaArchive deployment = createConfigurationDeployment();  
69 -  
70 - deployment.addPackages(true, ConfigurationCustomFieldTest.class.getPackage());  
71 - deployment.addAsResource(new FileAsset(new File(  
72 - "src/test/resources/configuration/field/custom/demoiselle.properties")), "demoiselle.properties");  
73 -  
74 - return deployment;  
75 - }  
76 -  
77 - @Test  
78 - public void loadMappedClass() {  
79 - assertNotNull(mappedField.getMappedClass());  
80 - }  
81 -  
82 - @Test  
83 - public void loadUnmappedClass() {  
84 - try {  
85 - unmappedField.getUnmappedClass();  
86 - fail();  
87 - } catch (ConfigurationException cause) {  
88 - assertEquals(ClassNotFoundException.class, cause.getCause().getClass());  
89 - }  
90 - }  
91 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/custom/CustomMappedFieldConfig.java
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.custom;  
38 -  
39 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
40 -  
41 -@Configuration  
42 -public class CustomMappedFieldConfig {  
43 -  
44 - private MappedClass mappedClass;  
45 -  
46 - public MappedClass getMappedClass() {  
47 - return mappedClass;  
48 - }  
49 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/custom/CustomUnmappedFieldConfig.java
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.custom;  
38 -  
39 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
40 -  
41 -@Configuration  
42 -public class CustomUnmappedFieldConfig {  
43 -  
44 - private UnmappedClass unmappedClass;  
45 -  
46 - public UnmappedClass getUnmappedClass() {  
47 - return unmappedClass;  
48 - }  
49 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/custom/MappedClass.java
@@ -1,41 +0,0 @@ @@ -1,41 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.custom;  
38 -  
39 -public class MappedClass {  
40 -  
41 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/custom/MyValueExtractor.java
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.field.custom;  
2 -  
3 -import java.lang.reflect.Field;  
4 -  
5 -import org.apache.commons.configuration.Configuration;  
6 -  
7 -import br.gov.frameworkdemoiselle.configuration.ConfigurationValueExtractor;  
8 -  
9 -public class MyValueExtractor implements ConfigurationValueExtractor {  
10 -  
11 - @Override  
12 - public Object getValue(String prefix, String key, Field field, Configuration configuration) throws Exception {  
13 - return new MappedClass();  
14 - }  
15 -  
16 - @Override  
17 - public boolean isSupported(Field field) {  
18 - return field.getType() == MappedClass.class;  
19 - }  
20 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/custom/UnmappedClass.java
@@ -1,41 +0,0 @@ @@ -1,41 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.custom;  
38 -  
39 -public class UnmappedClass {  
40 -  
41 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/ignored/AbstractIgnoredFieldConfig.java
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.ignored;  
38 -  
39 -import br.gov.frameworkdemoiselle.annotation.Ignore;  
40 -  
41 -public abstract class AbstractIgnoredFieldConfig {  
42 -  
43 - @Ignore  
44 - private int ignoredAttribute;  
45 -  
46 - public int getIgnoredAttribute() {  
47 - return ignoredAttribute;  
48 - }  
49 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/ignored/ConfigurationIgnoredFieldTest.java
@@ -1,88 +0,0 @@ @@ -1,88 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.ignored;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -  
41 -import java.io.File;  
42 -  
43 -import javax.inject.Inject;  
44 -  
45 -import org.jboss.arquillian.container.test.api.Deployment;  
46 -import org.jboss.arquillian.junit.Arquillian;  
47 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
48 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
49 -import org.junit.Test;  
50 -import org.junit.runner.RunWith;  
51 -  
52 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
53 -  
54 -@RunWith(Arquillian.class)  
55 -public class ConfigurationIgnoredFieldTest extends AbstractConfigurationTest {  
56 -  
57 - @Inject  
58 - private FilledIgnoredFieldConfig filledFieldConfig;  
59 -  
60 - @Inject  
61 - private EmptyIgnoredFieldConfig emptyFieldsConfig;  
62 -  
63 - @Inject  
64 - private PropertyWithoutFileConfig noFileConfig;  
65 -  
66 - @Deployment  
67 - public static JavaArchive createDeployment() {  
68 - JavaArchive deployment = createConfigurationDeployment();  
69 -  
70 - deployment.addPackages(true, ConfigurationIgnoredFieldTest.class.getPackage());  
71 - deployment.addAsResource(  
72 - new FileAsset(new File("src/test/resources/configuration/field/ignored/demoiselle.properties")),  
73 - "demoiselle.properties").addAsResource(  
74 - new FileAsset(new File("src/test/resources/configuration/field/ignored/demoiselle.xml")),  
75 - "demoiselle.xml");  
76 -  
77 - return deployment;  
78 - }  
79 -  
80 - @Test  
81 - public void loadIgnoredAttribute() {  
82 - int expected = 0;  
83 -  
84 - assertEquals(expected, filledFieldConfig.getIgnoredAttribute());  
85 - assertEquals(expected, noFileConfig.getIgnoredAttribute());  
86 - assertEquals(expected, emptyFieldsConfig.getIgnoredAttribute());  
87 - }  
88 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/ignored/EmptyIgnoredFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.ignored;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "demoiselle", type = XML)  
43 -public class EmptyIgnoredFieldConfig extends AbstractIgnoredFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/ignored/FilledIgnoredFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.ignored;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "demoiselle", type = PROPERTIES)  
43 -public class FilledIgnoredFieldConfig extends AbstractIgnoredFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/ignored/PropertyWithoutFileConfig.java
@@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.ignored;  
38 -  
39 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
40 -  
41 -@Configuration(resource = "nofile")  
42 -public class PropertyWithoutFileConfig extends AbstractIgnoredFieldConfig {  
43 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/map/AbstractMapFieldConfig.java
@@ -1,60 +0,0 @@ @@ -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 br.gov.frameworkdemoiselle.configuration.field.map;  
38 -  
39 -import java.util.Map;  
40 -  
41 -public abstract class AbstractMapFieldConfig {  
42 -  
43 - private Map<String, String> stringWithDefinedKeyMap;  
44 -  
45 - private Map<String, String> stringWithUndefinedKeyMap;  
46 -  
47 - private Map<String, String> emptyValueMap;  
48 -  
49 - public Map<String, String> getStringWithUndefinedKeyMap() {  
50 - return stringWithUndefinedKeyMap;  
51 - }  
52 -  
53 - public Map<String, String> getStringWithDefinedKeyMap() {  
54 - return stringWithDefinedKeyMap;  
55 - }  
56 -  
57 - public Map<String, String> getEmptyValueMap() {  
58 - return emptyValueMap;  
59 - }  
60 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/map/ConfigurationMapFieldTest.java
@@ -1,107 +0,0 @@ @@ -1,107 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.map;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -  
41 -import java.io.File;  
42 -import java.util.HashMap;  
43 -import java.util.Map;  
44 -  
45 -import javax.inject.Inject;  
46 -import javax.validation.constraints.Size;  
47 -  
48 -import org.jboss.arquillian.container.test.api.Deployment;  
49 -import org.jboss.arquillian.junit.Arquillian;  
50 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
51 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
52 -import org.junit.Test;  
53 -import org.junit.runner.RunWith;  
54 -  
55 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
56 -  
57 -@RunWith(Arquillian.class)  
58 -public class ConfigurationMapFieldTest extends AbstractConfigurationTest {  
59 -  
60 - @Inject  
61 - private PropertiesMapFieldConfig propertiesConfig;  
62 -  
63 - @Inject  
64 - private XMLMapFieldConfig xmlConfig;  
65 -  
66 - @Deployment  
67 - public static JavaArchive createDeployment() {  
68 - JavaArchive deployment = createConfigurationDeployment();  
69 -  
70 - deployment.addPackages(true, ConfigurationMapFieldTest.class.getPackage());  
71 - deployment.addAsResource(  
72 - new FileAsset(new File("src/test/resources/configuration/field/map/demoiselle.properties")),  
73 - "demoiselle.properties").addAsResource(  
74 - new FileAsset(new File("src/test/resources/configuration/field/map/demoiselle.xml")), "demoiselle.xml");  
75 -  
76 - return deployment;  
77 - }  
78 -  
79 - @Test  
80 - public void loadStringWithDefinedKeyMap() {  
81 - Map<String, String> expected = new HashMap<String, String>();  
82 - expected.put("item1", "demoiselle");  
83 - expected.put("item2", "framework");  
84 -  
85 - assertEquals(expected, propertiesConfig.getStringWithDefinedKeyMap());  
86 - assertEquals(expected, xmlConfig.getStringWithDefinedKeyMap());  
87 - }  
88 -  
89 - @Test  
90 - public void loadStringWithUndefinedKeyMap() {  
91 - Map<String, String> expected = new HashMap<String, String>();  
92 - expected.put("default", "undefined");  
93 -  
94 - assertEquals(expected, propertiesConfig.getStringWithUndefinedKeyMap());  
95 - assertEquals(expected, xmlConfig.getStringWithUndefinedKeyMap());  
96 - }  
97 -  
98 - @Test  
99 - public void loadEmptyKeyMapString() {  
100 - Map<String, String> expected = new HashMap<String, String>();  
101 - expected.put("item1", "");  
102 - expected.put("item2", "");  
103 -  
104 - assertEquals(expected, propertiesConfig.getEmptyValueMap());  
105 - assertEquals(expected, xmlConfig.getEmptyValueMap());  
106 - }  
107 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/map/PropertiesMapFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.map;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = PROPERTIES)  
43 -public class PropertiesMapFieldConfig extends AbstractMapFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/map/XMLMapFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.map;  
38 -  
39 -import br.gov.frameworkdemoiselle.configuration.ConfigType;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = ConfigType.XML)  
43 -public class XMLMapFieldConfig extends AbstractMapFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/named/AbstractEmptyNamedFieldConfig.java
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.named;  
38 -  
39 -import br.gov.frameworkdemoiselle.annotation.Name;  
40 -  
41 -public abstract class AbstractEmptyNamedFieldConfig {  
42 -  
43 - @Name("")  
44 - private int noNameAttribute;  
45 -  
46 - public int getNoNameAttribute() {  
47 - return noNameAttribute;  
48 - }  
49 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/named/AbstractNamedFieldConfig.java
@@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.named;  
38 -  
39 -import br.gov.frameworkdemoiselle.annotation.Name;  
40 -  
41 -public abstract class AbstractNamedFieldConfig {  
42 -  
43 - @Name("main.int")  
44 - private int uniqueNameAttribute;  
45 -  
46 - @Name("nonexistent.property")  
47 - private int notPresentAttribute;  
48 -  
49 - @Name("attribute.without.file")  
50 - private int namedWithoutFileAttribute;  
51 -  
52 - public int getUniqueNameAttribute() {  
53 - return uniqueNameAttribute;  
54 - }  
55 -  
56 - public int getNotPresentAttribute() {  
57 - return notPresentAttribute;  
58 - }  
59 -  
60 - public int getNamedWithoutFileAttribute() {  
61 - return namedWithoutFileAttribute;  
62 - }  
63 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/named/ConfigurationNamedFieldTest.java
@@ -1,122 +0,0 @@ @@ -1,122 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.named;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -import static junit.framework.Assert.fail;  
41 -  
42 -import java.io.File;  
43 -  
44 -import javax.inject.Inject;  
45 -  
46 -import junit.framework.Assert;  
47 -  
48 -import org.jboss.arquillian.container.test.api.Deployment;  
49 -import org.jboss.arquillian.junit.Arquillian;  
50 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
51 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
52 -import org.junit.Test;  
53 -import org.junit.runner.RunWith;  
54 -  
55 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
56 -import br.gov.frameworkdemoiselle.configuration.ConfigurationException;  
57 -  
58 -@RunWith(Arquillian.class)  
59 -public class ConfigurationNamedFieldTest extends AbstractConfigurationTest {  
60 -  
61 - @Inject  
62 - private PropertyNamed propertyNamed;  
63 -  
64 - @Inject  
65 - private XMLNamed xmlNamed;  
66 -  
67 - @Inject  
68 - private PropertyEmptyNamed propertyEmptyNamed;  
69 -  
70 - @Inject  
71 - private XMLEmptyNamed xmlEmptyNamed;  
72 -  
73 - @Deployment  
74 - public static JavaArchive createDeployment() {  
75 - JavaArchive deployment = createConfigurationDeployment();  
76 -  
77 - deployment.addPackages(true, ConfigurationNamedFieldTest.class.getPackage());  
78 - deployment.addAsResource(  
79 - new FileAsset(new File("src/test/resources/configuration/field/named/demoiselle.properties")),  
80 - "demoiselle.properties").addAsResource(  
81 - new FileAsset(new File("src/test/resources/configuration/field/named/demoiselle.xml")),  
82 - "demoiselle.xml");  
83 -  
84 - return deployment;  
85 - }  
86 -  
87 - @Test  
88 - public void loadNamedConfigFromPropertyWithName() {  
89 - assertEquals(1, propertyNamed.getUniqueNameAttribute());  
90 - assertEquals(1, xmlNamed.getUniqueNameAttribute());  
91 - }  
92 -  
93 - @Test  
94 - public void loadNamedConfigFromNonexistentProperty() {  
95 - assertEquals(0, propertyNamed.getNotPresentAttribute());  
96 - assertEquals(0, xmlNamed.getNotPresentAttribute());  
97 - }  
98 -  
99 - @Test  
100 - public void loadNamedConfigFromPropertyWithoutField() {  
101 - assertEquals(0, propertyNamed.getNamedWithoutFileAttribute());  
102 - assertEquals(0, xmlNamed.getNamedWithoutFileAttribute());  
103 - }  
104 -  
105 - @Test  
106 - public void loadEmptyNameConfig() {  
107 - try {  
108 - xmlEmptyNamed.getNoNameAttribute();  
109 - fail();  
110 - } catch (ConfigurationException cause) {  
111 - assertEquals(IllegalArgumentException.class, cause.getCause().getClass());  
112 - }  
113 -  
114 - try {  
115 - propertyEmptyNamed.getNoNameAttribute();  
116 - fail();  
117 - } catch (ConfigurationException cause) {  
118 - assertEquals(IllegalArgumentException.class, cause.getCause().getClass());  
119 - }  
120 -  
121 - }  
122 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/named/PropertyEmptyNamed.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.field.named;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(type = PROPERTIES)  
7 -public class PropertyEmptyNamed extends AbstractEmptyNamedFieldConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/named/PropertyNamed.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.field.named;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(type = PROPERTIES)  
7 -public class PropertyNamed extends AbstractNamedFieldConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/named/XMLEmptyNamed.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.field.named;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(type = XML)  
7 -public class XMLEmptyNamed extends AbstractEmptyNamedFieldConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/named/XMLNamed.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.field.named;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(type = XML)  
7 -public class XMLNamed extends AbstractNamedFieldConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/AbstractNotNullFieldConfig.java
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.notnull;  
38 -  
39 -import javax.validation.constraints.NotNull;  
40 -  
41 -public abstract class AbstractNotNullFieldConfig {  
42 -  
43 - @NotNull  
44 - private Integer attibuteNotNull;  
45 -  
46 - public Integer getAttributeNotNull() {  
47 - return attibuteNotNull;  
48 - }  
49 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/ConfigurationNotNullFieldTest.java
@@ -1,173 +0,0 @@ @@ -1,173 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.notnull;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -import static junit.framework.Assert.fail;  
41 -  
42 -import java.io.File;  
43 -  
44 -import javax.inject.Inject;  
45 -  
46 -import junit.framework.Assert;  
47 -  
48 -import org.jboss.arquillian.container.test.api.Deployment;  
49 -import org.jboss.arquillian.junit.Arquillian;  
50 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
51 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
52 -import org.junit.Test;  
53 -import org.junit.runner.RunWith;  
54 -  
55 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
56 -import br.gov.frameworkdemoiselle.configuration.ConfigurationException;  
57 -  
58 -@RunWith(Arquillian.class)  
59 -public class ConfigurationNotNullFieldTest extends AbstractConfigurationTest {  
60 -  
61 - @Inject  
62 - private PropertyWithFilledFieldConfig propertyFilledFieldConfig;  
63 -  
64 - @Inject  
65 - private PropertyWithEmptyFieldConfig propertyEmptyFieldsConfig;  
66 -  
67 - @Inject  
68 - private PropertyWithoutNotNullField propertyWithoutNotNullField;  
69 -  
70 - @Inject  
71 - private PropertyWithoutFileConfig propertyNoFileConfig;  
72 -  
73 - @Inject  
74 - private XMLWithFilledFieldConfig xmlFilledFieldConfig;  
75 -  
76 - @Inject  
77 - private XMLWithEmptyFieldConfig xmlEmptyFieldsConfig;  
78 -  
79 - @Inject  
80 - private XMLWithoutNotNullField xmlWithoutNotNullField;  
81 -  
82 - @Inject  
83 - private XMLWithoutFileConfig xmlNoFileConfig;  
84 -  
85 - @Deployment  
86 - public static JavaArchive createDeployment() {  
87 - JavaArchive deployment = createConfigurationDeployment();  
88 -  
89 - deployment.addPackages(true, ConfigurationNotNullFieldTest.class.getPackage());  
90 - deployment  
91 - .addAsResource(  
92 - new FileAsset(new File("src/test/resources/configuration/field/notnull/demoiselle.properties")),  
93 - "demoiselle.properties")  
94 - .addAsResource(  
95 - new FileAsset(new File("src/test/resources/configuration/field/notnull/empty-field.properties")),  
96 - "empty-field.properties")  
97 - .addAsResource(  
98 - new FileAsset(new File(  
99 - "src/test/resources/configuration/field/notnull/without-field.properties")),  
100 - "without-field.properties")  
101 - .addAsResource(  
102 - new FileAsset(new File("src/test/resources/configuration/field/notnull/demoiselle.xml")),  
103 - "demoiselle.xml")  
104 - .addAsResource(  
105 - new FileAsset(new File("src/test/resources/configuration/field/notnull/empty-field.xml")),  
106 - "empty-field.xml")  
107 - .addAsResource(  
108 - new FileAsset(new File(  
109 - "src/test/resources/configuration/field/notnull/without-field.xml")),  
110 - "without-field.xml");  
111 -  
112 - return deployment;  
113 - }  
114 -  
115 - @Test  
116 - public void loadFieldNotNullFromFilledFile() {  
117 - Integer expected = 1;  
118 -  
119 - assertEquals(expected, propertyFilledFieldConfig.getAttributeNotNull());  
120 - assertEquals(expected, xmlFilledFieldConfig.getAttributeNotNull());  
121 - }  
122 -  
123 - @Test  
124 - public void loadFieldNotNullFromEmptyProperty() {  
125 - try {  
126 - propertyEmptyFieldsConfig.getAttributeNotNull();  
127 - fail();  
128 - } catch (ConfigurationException cause) {  
129 - Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());  
130 - }  
131 -  
132 - try {  
133 - xmlEmptyFieldsConfig.getAttributeNotNull();  
134 - fail();  
135 - } catch (ConfigurationException cause) {  
136 - Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());  
137 - }  
138 - }  
139 -  
140 - @Test  
141 - public void loadFieldFromPropertyFileWithoutNotNullField() {  
142 - try {  
143 - propertyWithoutNotNullField.getAttributeNotNull();  
144 - fail();  
145 - } catch (ConfigurationException cause) {  
146 - Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());  
147 - }  
148 -  
149 - try {  
150 - xmlWithoutNotNullField.getAttributeNotNull();  
151 - fail();  
152 - } catch (ConfigurationException cause) {  
153 - Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());  
154 - }  
155 - }  
156 -  
157 - @Test  
158 - public void loadFieldNotNullFromInexistentPropertyFile() {  
159 - try {  
160 - propertyNoFileConfig.getAttributeNotNull();  
161 - fail();  
162 - } catch (ConfigurationException cause) {  
163 - Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());  
164 - }  
165 -  
166 - try {  
167 - xmlNoFileConfig.getAttributeNotNull();  
168 - fail();  
169 - } catch (ConfigurationException cause) {  
170 - Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());  
171 - }  
172 - }  
173 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/PropertyWithEmptyFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.notnull;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "empty-field", type = PROPERTIES)  
43 -public class PropertyWithEmptyFieldConfig extends AbstractNotNullFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/PropertyWithFilledFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.notnull;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "demoiselle", type = PROPERTIES)  
43 -public class PropertyWithFilledFieldConfig extends AbstractNotNullFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/PropertyWithoutFileConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.notnull;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "nofile", type = PROPERTIES)  
43 -public class PropertyWithoutFileConfig extends AbstractNotNullFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/PropertyWithoutNotNullField.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.field.notnull;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(resource = "without-field", type = PROPERTIES)  
7 -public class PropertyWithoutNotNullField extends AbstractNotNullFieldConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/XMLWithEmptyFieldConfig.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.field.notnull;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(resource = "empty-field", type = XML)  
7 -public class XMLWithEmptyFieldConfig extends AbstractNotNullFieldConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/XMLWithFilledFieldConfig.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.field.notnull;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(resource = "demoiselle", type = XML)  
7 -public class XMLWithFilledFieldConfig extends AbstractNotNullFieldConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/XMLWithoutFileConfig.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.field.notnull;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(resource = "nofile", type = XML)  
7 -public class XMLWithoutFileConfig extends AbstractNotNullFieldConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/XMLWithoutNotNullField.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.field.notnull;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(resource = "without-field", type = XML)  
7 -public class XMLWithoutNotNullField extends AbstractNotNullFieldConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/AbstractPrimitiveOrWrapperEmptyFieldConfig.java
@@ -1,76 +0,0 @@ @@ -1,76 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.primitiveorwrapper;  
38 -  
39 -public abstract class AbstractPrimitiveOrWrapperEmptyFieldConfig {  
40 -  
41 - private int primitiveInteger;  
42 -  
43 - private int nullPrimitiveInteger;  
44 -  
45 - private int errorPrimitiveInteger;  
46 -  
47 - private Integer wrappedInteger;  
48 -  
49 - private Integer nullWrappedInteger;  
50 -  
51 - private Integer errorWrappedInteger;  
52 -  
53 - public Integer getWrappedInteger() {  
54 - return wrappedInteger;  
55 - }  
56 -  
57 - public int getPrimitiveInteger() {  
58 - return primitiveInteger;  
59 - }  
60 -  
61 - public int getNullPrimitiveInteger() {  
62 - return nullPrimitiveInteger;  
63 - }  
64 -  
65 - public Integer getNullWrappedInteger() {  
66 - return nullWrappedInteger;  
67 - }  
68 -  
69 - public int getErrorPrimitiveInteger() {  
70 - return errorPrimitiveInteger;  
71 - }  
72 -  
73 - public Integer getErrorWrappedInteger() {  
74 - return errorWrappedInteger;  
75 - }  
76 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/AbstractPrimitiveOrWrapperErrorFieldConfig.java
@@ -1,64 +0,0 @@ @@ -1,64 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.primitiveorwrapper;  
38 -  
39 -public abstract class AbstractPrimitiveOrWrapperErrorFieldConfig {  
40 -  
41 - private int emptyPrimitiveInteger;  
42 -  
43 - private int errorPrimitiveInteger;  
44 -  
45 - private Integer emptyWrappedInteger;  
46 -  
47 - private Integer errorWrappedInteger;  
48 -  
49 - public int getEmptyPrimitiveInteger() {  
50 - return emptyPrimitiveInteger;  
51 - }  
52 -  
53 - public Integer getEmptyWrappedInteger() {  
54 - return emptyWrappedInteger;  
55 - }  
56 -  
57 - public int getErrorPrimitiveInteger() {  
58 - return errorPrimitiveInteger;  
59 - }  
60 -  
61 - public Integer getErrorWrappedInteger() {  
62 - return errorWrappedInteger;  
63 - }  
64 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/AbstractPrimitiveOrWrapperFieldConfig.java
@@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.primitiveorwrapper;  
38 -  
39 -public abstract class AbstractPrimitiveOrWrapperFieldConfig {  
40 -  
41 - private int primitiveInteger;  
42 -  
43 - private Integer wrappedInteger;  
44 -  
45 - public Integer getWrappedInteger() {  
46 - return wrappedInteger;  
47 - }  
48 -  
49 - public int getPrimitiveInteger() {  
50 - return primitiveInteger;  
51 - }  
52 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/ConfigurationPrimitiveOrWrapperFieldTest.java
@@ -1,211 +0,0 @@ @@ -1,211 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.primitiveorwrapper;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -import static junit.framework.Assert.fail;  
41 -  
42 -import java.io.File;  
43 -  
44 -import javax.inject.Inject;  
45 -  
46 -import org.apache.commons.configuration.ConversionException;  
47 -import org.jboss.arquillian.container.test.api.Deployment;  
48 -import org.jboss.arquillian.junit.Arquillian;  
49 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
50 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
51 -import org.junit.BeforeClass;  
52 -import org.junit.Test;  
53 -import org.junit.runner.RunWith;  
54 -  
55 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
56 -import br.gov.frameworkdemoiselle.configuration.ConfigurationException;  
57 -  
58 -@RunWith(Arquillian.class)  
59 -public class ConfigurationPrimitiveOrWrapperFieldTest extends AbstractConfigurationTest {  
60 -  
61 - @Inject  
62 - private PropertiesPrimitiveOrWrapperFieldConfig propertiesConfig;  
63 -  
64 - @Inject  
65 - private XMLPrimitiveOrWrapperFieldConfig xmlConfig;  
66 -  
67 - @Inject  
68 - private SystemPrimitiveOrWrapperFieldConfig systemConfig;  
69 -  
70 - @Inject  
71 - private PropertiesPrimitiveOrWrapperErrorFieldConfig propertiesErrorConfig;  
72 -  
73 - @Inject  
74 - private XMLPrimitiveOrWrapperErrorFieldConfig xmlErrorConfig;  
75 -  
76 - @Inject  
77 - private SystemPrimitiveOrWrapperErrorFieldConfig systemErrorConfig;  
78 -  
79 - @Deployment  
80 - public static JavaArchive createDeployment() {  
81 - JavaArchive deployment = createConfigurationDeployment();  
82 -  
83 - deployment.addPackages(true, ConfigurationPrimitiveOrWrapperFieldTest.class.getPackage());  
84 - deployment.addAsResource(  
85 - new FileAsset(new File(  
86 - "src/test/resources/configuration/field/primitiveorwrapper/demoiselle.properties")),  
87 - "demoiselle.properties").addAsResource(  
88 - new FileAsset(new File("src/test/resources/configuration/field/primitiveorwrapper/demoiselle.xml")),  
89 - "demoiselle.xml");  
90 -  
91 - return deployment;  
92 - }  
93 -  
94 - @BeforeClass  
95 - public static void afterClass() {  
96 - System.setProperty("primitiveInteger", String.valueOf(1));  
97 - System.setProperty("emptyPrimitiveInteger", String.valueOf(""));  
98 - System.setProperty("errorPrimitiveInteger", String.valueOf("a"));  
99 - System.setProperty("wrappedInteger", String.valueOf(2));  
100 - System.setProperty("emptyWrappedInteger", String.valueOf(""));  
101 - System.setProperty("errorWrappedInteger", String.valueOf("a"));  
102 - }  
103 -  
104 - @Test  
105 - public void loadPrimitiveInteger() {  
106 - int expected = 1;  
107 -  
108 - assertEquals(expected, systemConfig.getPrimitiveInteger());  
109 - assertEquals(expected, propertiesConfig.getPrimitiveInteger());  
110 - assertEquals(expected, xmlConfig.getPrimitiveInteger());  
111 - }  
112 -  
113 - @Test  
114 - public void loadWrappedInteger() {  
115 - Integer expected = 2;  
116 -  
117 - assertEquals(expected, systemConfig.getWrappedInteger());  
118 - assertEquals(expected, propertiesConfig.getWrappedInteger());  
119 - assertEquals(expected, xmlConfig.getWrappedInteger());  
120 - }  
121 -  
122 - @Test  
123 - public void loadEmptyPrimitiveInteger() {  
124 - try {  
125 - systemErrorConfig.getEmptyPrimitiveInteger();  
126 - } catch (ConfigurationException cause) {  
127 - assertEquals(ConversionException.class, cause.getCause().getClass());  
128 - }  
129 -  
130 - try {  
131 - propertiesErrorConfig.getEmptyPrimitiveInteger();  
132 - } catch (ConfigurationException cause) {  
133 - assertEquals(ConversionException.class, cause.getCause().getClass());  
134 - }  
135 -  
136 - try {  
137 - propertiesErrorConfig.getEmptyPrimitiveInteger();  
138 - } catch (ConfigurationException cause) {  
139 - assertEquals(ConversionException.class, cause.getCause().getClass());  
140 - }  
141 - }  
142 -  
143 - @Test  
144 - public void loadNullWrappedInteger() {  
145 - try {  
146 - systemErrorConfig.getEmptyWrappedInteger();  
147 - } catch (ConfigurationException cause) {  
148 - assertEquals(ConversionException.class, cause.getCause().getClass());  
149 - }  
150 -  
151 - try {  
152 - propertiesErrorConfig.getEmptyWrappedInteger();  
153 - } catch (ConfigurationException cause) {  
154 - assertEquals(ConversionException.class, cause.getCause().getClass());  
155 - }  
156 -  
157 - try {  
158 - propertiesErrorConfig.getEmptyWrappedInteger();  
159 - } catch (ConfigurationException cause) {  
160 - assertEquals(ConversionException.class, cause.getCause().getClass());  
161 - }  
162 - }  
163 -  
164 - @Test  
165 - public void loadErrorPrimitiveInteger() {  
166 - try {  
167 - propertiesErrorConfig.getErrorPrimitiveInteger();  
168 - fail();  
169 - } catch (ConfigurationException cause) {  
170 - assertEquals(ConversionException.class, cause.getCause().getClass());  
171 - }  
172 -  
173 - try {  
174 - propertiesErrorConfig.getErrorPrimitiveInteger();  
175 - fail();  
176 - } catch (ConfigurationException cause) {  
177 - assertEquals(ConversionException.class, cause.getCause().getClass());  
178 - }  
179 -  
180 - try {  
181 - xmlErrorConfig.getErrorPrimitiveInteger();  
182 - fail();  
183 - } catch (ConfigurationException cause) {  
184 - assertEquals(ConversionException.class, cause.getCause().getClass());  
185 - }  
186 - }  
187 -  
188 - @Test  
189 - public void loadErrorWrappedInteger() {  
190 - try {  
191 - propertiesErrorConfig.getErrorWrappedInteger();  
192 - fail();  
193 - } catch (ConfigurationException cause) {  
194 - assertEquals(ConversionException.class, cause.getCause().getClass());  
195 - }  
196 -  
197 - try {  
198 - propertiesErrorConfig.getErrorWrappedInteger();  
199 - fail();  
200 - } catch (ConfigurationException cause) {  
201 - assertEquals(ConversionException.class, cause.getCause().getClass());  
202 - }  
203 -  
204 - try {  
205 - xmlErrorConfig.getErrorWrappedInteger();  
206 - fail();  
207 - } catch (ConfigurationException cause) {  
208 - assertEquals(ConversionException.class, cause.getCause().getClass());  
209 - }  
210 - }  
211 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/PropertiesPrimitiveOrWrapperErrorFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.primitiveorwrapper;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = PROPERTIES)  
43 -public class PropertiesPrimitiveOrWrapperErrorFieldConfig extends AbstractPrimitiveOrWrapperErrorFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/PropertiesPrimitiveOrWrapperFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.primitiveorwrapper;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = PROPERTIES)  
43 -public class PropertiesPrimitiveOrWrapperFieldConfig extends AbstractPrimitiveOrWrapperFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/SystemPrimitiveOrWrapperErrorFieldConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.primitiveorwrapper;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.SYSTEM;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = SYSTEM)  
43 -public class SystemPrimitiveOrWrapperErrorFieldConfig extends AbstractPrimitiveOrWrapperErrorFieldConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/SystemPrimitiveOrWrapperFieldConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.primitiveorwrapper;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.SYSTEM;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = SYSTEM)  
43 -public class SystemPrimitiveOrWrapperFieldConfig extends AbstractPrimitiveOrWrapperFieldConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/XMLPrimitiveOrWrapperErrorFieldConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.primitiveorwrapper;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = XML)  
43 -public class XMLPrimitiveOrWrapperErrorFieldConfig extends AbstractPrimitiveOrWrapperErrorFieldConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/XMLPrimitiveOrWrapperFieldConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.primitiveorwrapper;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = XML)  
43 -public class XMLPrimitiveOrWrapperFieldConfig extends AbstractPrimitiveOrWrapperFieldConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/string/AbstractStringFieldConfig.java
@@ -1,58 +0,0 @@ @@ -1,58 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.string;  
38 -  
39 -public abstract class AbstractStringFieldConfig {  
40 -  
41 - private String stringWithSpace;  
42 -  
43 - private String stringWithComma;  
44 -  
45 - private String emptyString;  
46 -  
47 - public String getStringWithSpace() {  
48 - return stringWithSpace;  
49 - }  
50 -  
51 - public String getStringWithComma() {  
52 - return stringWithComma;  
53 - }  
54 -  
55 - public String getEmptyString() {  
56 - return emptyString;  
57 - }  
58 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/string/ConfigurationStringFieldTest.java
@@ -1,113 +0,0 @@ @@ -1,113 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.string;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -  
41 -import java.io.File;  
42 -  
43 -import javax.inject.Inject;  
44 -  
45 -import org.jboss.arquillian.container.test.api.Deployment;  
46 -import org.jboss.arquillian.junit.Arquillian;  
47 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
48 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
49 -import org.junit.BeforeClass;  
50 -import org.junit.Test;  
51 -import org.junit.runner.RunWith;  
52 -  
53 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
54 -  
55 -@RunWith(Arquillian.class)  
56 -public class ConfigurationStringFieldTest extends AbstractConfigurationTest {  
57 -  
58 - @Inject  
59 - private PropertiesStringFieldConfig propertiesConfig;  
60 -  
61 - @Inject  
62 - private XMLStringFieldConfig xmlConfig;  
63 -  
64 - @Inject  
65 - private SystemBasicFieldConfig systemConfig;  
66 -  
67 - @Deployment  
68 - public static JavaArchive createDeployment() {  
69 - JavaArchive deployment = createConfigurationDeployment();  
70 -  
71 - deployment.addPackages(true, ConfigurationStringFieldTest.class.getPackage());  
72 - deployment.addAsResource(  
73 - new FileAsset(new File("src/test/resources/configuration/field/string/demoiselle.properties")),  
74 - "demoiselle.properties").addAsResource(  
75 - new FileAsset(new File("src/test/resources/configuration/field/string/demoiselle.xml")),  
76 - "demoiselle.xml");  
77 -  
78 - return deployment;  
79 - }  
80 -  
81 - @BeforeClass  
82 - public static void afterClass() {  
83 - System.setProperty("stringWithSpace", String.valueOf("demoiselle framework"));  
84 - System.setProperty("stringWithComma", String.valueOf("demoiselle, framework"));  
85 - System.setProperty("emptyString", String.valueOf(""));  
86 - }  
87 -  
88 - @Test  
89 - public void loadStringWithSpace() {  
90 - String expected = "demoiselle framework";  
91 -  
92 - assertEquals(expected, systemConfig.getStringWithSpace());  
93 - assertEquals(expected, propertiesConfig.getStringWithSpace());  
94 - assertEquals(expected, xmlConfig.getStringWithSpace());  
95 - }  
96 -  
97 - @Test  
98 - public void loadStringWithComma() {  
99 - String expected = "demoiselle, framework";  
100 -  
101 - assertEquals(expected, systemConfig.getStringWithComma());  
102 - assertEquals(expected, propertiesConfig.getStringWithComma());  
103 - assertEquals(expected, xmlConfig.getStringWithComma());  
104 - }  
105 -  
106 - @Test  
107 - public void loadEmptyString() {  
108 - String expected = "";  
109 - assertEquals(expected, systemConfig.getEmptyString());  
110 - assertEquals(expected, propertiesConfig.getEmptyString());  
111 - assertEquals(expected, xmlConfig.getEmptyString());  
112 - }  
113 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/string/PropertiesStringFieldConfig.java
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.string;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = PROPERTIES)  
43 -public class PropertiesStringFieldConfig extends AbstractStringFieldConfig {  
44 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/string/SystemBasicFieldConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.string;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.SYSTEM;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = SYSTEM)  
43 -public class SystemBasicFieldConfig extends AbstractStringFieldConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/string/XMLStringFieldConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.field.string;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = XML)  
43 -public class XMLStringFieldConfig extends AbstractStringFieldConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/AbstractPrefixConfig.java
@@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.prefix;  
38 -  
39 -public abstract class AbstractPrefixConfig {  
40 -  
41 - private String prefixedAttribute;  
42 -  
43 - public String getPrefixedAttribute() {  
44 - return prefixedAttribute;  
45 - }  
46 -  
47 - public void setPrefixedAttribute(String prefixedAttribute) {  
48 - this.prefixedAttribute = prefixedAttribute;  
49 - }  
50 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/ConfigurationPrefixTest.java
@@ -1,112 +0,0 @@ @@ -1,112 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.prefix;  
38 -  
39 -import static junit.framework.Assert.assertNull;  
40 -import static org.junit.Assert.assertEquals;  
41 -  
42 -import java.io.File;  
43 -  
44 -import javax.inject.Inject;  
45 -  
46 -import org.jboss.arquillian.container.test.api.Deployment;  
47 -import org.jboss.arquillian.junit.Arquillian;  
48 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
49 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
50 -import org.junit.Test;  
51 -import org.junit.runner.RunWith;  
52 -  
53 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
54 -  
55 -@RunWith(Arquillian.class)  
56 -public class ConfigurationPrefixTest extends AbstractConfigurationTest {  
57 -  
58 - @Inject  
59 - private PropertyPrefixEndingWithoutDot propertyEndingWithoutDotPrefix;  
60 -  
61 - @Inject  
62 - private PropertyMissingPrefix propertyMissingPrefix;  
63 -  
64 - @Inject  
65 - private PropertyPrefixEndingWithDot propertyEndingWithDotPrefix;  
66 -  
67 -  
68 - @Inject  
69 - private XMLPrefixEndingWithoutDot xmlEndingWithoutDotPrefix;  
70 -  
71 - @Inject  
72 - private XMLMissingPrefix xmlMissingPrefix;  
73 -  
74 - @Inject  
75 - private XMLPrefixEndingWithDot xmlEndingWithDotPrefix;  
76 -  
77 - @Deployment  
78 - public static JavaArchive createDeployment() {  
79 - JavaArchive deployment = createConfigurationDeployment();  
80 -  
81 - deployment.addPackages(true, ConfigurationPrefixTest.class.getPackage());  
82 - deployment.addAsResource(  
83 - new FileAsset(new File("src/test/resources/configuration/prefix/demoiselle.properties")),  
84 - "demoiselle.properties").addAsResource(  
85 - new FileAsset(new File("src/test/resources/configuration/prefix/demoiselle.xml")),  
86 - "demoiselle.xml");  
87 -  
88 - return deployment;  
89 - }  
90 -  
91 - @Test  
92 - public void loadFromPrefixedExistentProperty() {  
93 - String expected = "prefix ending without dot";  
94 -  
95 - assertEquals(expected, propertyEndingWithoutDotPrefix.getPrefixedAttribute());  
96 - assertEquals(expected, xmlEndingWithoutDotPrefix.getPrefixedAttribute());  
97 - }  
98 -  
99 - @Test  
100 - public void loadFromPrefixedWithouPrefixOnProperty() {  
101 - assertNull(propertyMissingPrefix.getPrefixedAttribute());  
102 - assertNull(xmlMissingPrefix.getPrefixedAttribute());  
103 - }  
104 -  
105 - @Test  
106 - public void loadPrefixEndingWithDot() {  
107 - String expected = "prefix ending with dot";  
108 -  
109 - assertEquals(expected, propertyEndingWithDotPrefix.getPrefixedAttribute());  
110 - assertEquals(expected, propertyEndingWithDotPrefix.getPrefixedAttribute());  
111 - }  
112 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/PropertyMissingPrefix.java
@@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.prefix;  
2 -  
3 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
4 -  
5 -@Configuration(prefix = "missing.prefix")  
6 -public class PropertyMissingPrefix extends AbstractPrefixConfig {  
7 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/PropertyPrefixEndingWithDot.java
@@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.prefix;  
2 -  
3 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
4 -  
5 -@Configuration(prefix = "endingWithDot.")  
6 -public class PropertyPrefixEndingWithDot extends AbstractPrefixConfig {  
7 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/PropertyPrefixEndingWithoutDot.java
@@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.prefix;  
2 -  
3 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
4 -  
5 -@Configuration(prefix = "prefix")  
6 -public class PropertyPrefixEndingWithoutDot extends AbstractPrefixConfig {  
7 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/XMLMissingPrefix.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.prefix;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(type = XML, prefix = "missing.prefix")  
7 -public class XMLMissingPrefix extends AbstractPrefixConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/XMLPrefixEndingWithDot.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.prefix;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(type = XML, prefix = "endingWithDot.")  
7 -public class XMLPrefixEndingWithDot extends AbstractPrefixConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/XMLPrefixEndingWithoutDot.java
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package br.gov.frameworkdemoiselle.configuration.prefix;  
2 -  
3 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
4 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
5 -  
6 -@Configuration(type = XML, prefix = "prefix")  
7 -public class XMLPrefixEndingWithoutDot extends AbstractPrefixConfig {  
8 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/resource/AbstractResourceConfig.java
@@ -1,46 +0,0 @@ @@ -1,46 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.resource;  
38 -  
39 -public abstract class AbstractResourceConfig {  
40 -  
41 - private String string;  
42 -  
43 - public String getStringWithComma() {  
44 - return string;  
45 - }  
46 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/resource/ConfigurationResourceTest.java
@@ -1,132 +0,0 @@ @@ -1,132 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.resource;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -  
41 -import java.io.File;  
42 -  
43 -import javax.inject.Inject;  
44 -  
45 -import org.jboss.arquillian.container.test.api.Deployment;  
46 -import org.jboss.arquillian.junit.Arquillian;  
47 -import org.jboss.shrinkwrap.api.asset.FileAsset;  
48 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
49 -import org.junit.Test;  
50 -import org.junit.runner.RunWith;  
51 -  
52 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
53 -  
54 -@RunWith(Arquillian.class)  
55 -public class ConfigurationResourceTest extends AbstractConfigurationTest {  
56 -  
57 - @Inject  
58 - private PropertiesDefaultFileConfig propDefault;  
59 -  
60 - @Inject  
61 - private PropertiesNamedDefaultFileConfig propNamedDefault;  
62 -  
63 - @Inject  
64 - private PropertiesNotDefaultFileConfig propNotDefault;  
65 -  
66 - @Inject  
67 - private PropertiesWithoutFileConfig propWithoutFile;  
68 -  
69 - @Inject  
70 - private XMLDefaultFileConfig xmlDefault;  
71 -  
72 - @Inject  
73 - private XMLNamedDefaultFileConfig xmlNamedDefault;  
74 -  
75 - @Inject  
76 - private XMLNotDefaultFileConfig xmlNotDefault;  
77 -  
78 - @Inject  
79 - private XMLWithoutFileConfig xmlWithoutFile;  
80 -  
81 - @Deployment  
82 - public static JavaArchive createDeployment() {  
83 - JavaArchive deployment = createConfigurationDeployment();  
84 -  
85 - deployment.addPackages(true, ConfigurationResourceTest.class.getPackage());  
86 - deployment  
87 - .addAsResource(  
88 - new FileAsset(new File("src/test/resources/configuration/resource/demoiselle.properties")),  
89 - "demoiselle.properties")  
90 - .addAsResource(new FileAsset(new File("src/test/resources/configuration/resource/demoiselle.xml")),  
91 - "demoiselle.xml")  
92 - .addAsResource(  
93 - new FileAsset(new File("src/test/resources/configuration/resource/resource.properties")),  
94 - "resource.properties")  
95 - .addAsResource(new FileAsset(new File("src/test/resources/configuration/resource/resource.xml")),  
96 - "resource.xml");  
97 -  
98 - return deployment;  
99 - }  
100 -  
101 - @Test  
102 - public void loadFromDefaultFile() {  
103 - String expected = "demoiselle";  
104 -  
105 - assertEquals(expected, propDefault.getStringWithComma());  
106 - assertEquals(expected, xmlDefault.getStringWithComma());  
107 - }  
108 -  
109 - @Test  
110 - public void loadFromNamedDefaultFile() {  
111 - String expected = "demoiselle";  
112 -  
113 - assertEquals(expected, propNamedDefault.getStringWithComma());  
114 - assertEquals(expected, xmlNamedDefault.getStringWithComma());  
115 - }  
116 -  
117 - @Test  
118 - public void loadFromNotDefaultFile() {  
119 - String expected = "demoiselle";  
120 -  
121 - assertEquals(expected, propNotDefault.getStringWithComma());  
122 - assertEquals(expected, xmlNotDefault.getStringWithComma());  
123 - }  
124 -  
125 - @Test  
126 - public void loadFromNonexistentFile() {  
127 - String expected = null;  
128 -  
129 - assertEquals(expected, propWithoutFile.getStringWithComma());  
130 - assertEquals(expected, xmlWithoutFile.getStringWithComma());  
131 - }  
132 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/resource/PropertiesDefaultFileConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.resource;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = PROPERTIES)  
43 -public class PropertiesDefaultFileConfig extends AbstractResourceConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/resource/PropertiesNamedDefaultFileConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.resource;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "demoiselle", type = PROPERTIES)  
43 -public class PropertiesNamedDefaultFileConfig extends AbstractResourceConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/resource/PropertiesNotDefaultFileConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.resource;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "resource", type = PROPERTIES)  
43 -public class PropertiesNotDefaultFileConfig extends AbstractResourceConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/resource/PropertiesWithoutFileConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.resource;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "nofile", type = PROPERTIES)  
43 -public class PropertiesWithoutFileConfig extends AbstractResourceConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/resource/XMLDefaultFileConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.resource;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(type = XML)  
43 -public class XMLDefaultFileConfig extends AbstractResourceConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/resource/XMLNamedDefaultFileConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.resource;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "demoiselle", type = XML)  
43 -public class XMLNamedDefaultFileConfig extends AbstractResourceConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/resource/XMLNotDefaultFileConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.resource;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "resource", type = XML)  
43 -public class XMLNotDefaultFileConfig extends AbstractResourceConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/resource/XMLWithoutFileConfig.java
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.resource;  
38 -  
39 -import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;  
40 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
41 -  
42 -@Configuration(resource = "nofile", type = XML)  
43 -public class XMLWithoutFileConfig extends AbstractResourceConfig {  
44 -  
45 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/scope/AbstractScopedConfig.java
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.scope;  
38 -  
39 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
40 -  
41 -@Configuration  
42 -public abstract class AbstractScopedConfig {  
43 -  
44 - private String string;  
45 -  
46 - public String getStringWithComma() {  
47 - return string;  
48 - }  
49 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/scope/ConfigurationScopeTest.java
@@ -1,76 +0,0 @@ @@ -1,76 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.scope;  
38 -  
39 -import static junit.framework.Assert.assertNotSame;  
40 -import static junit.framework.Assert.assertSame;  
41 -  
42 -import org.jboss.arquillian.container.test.api.Deployment;  
43 -import org.jboss.arquillian.junit.Arquillian;  
44 -import org.jboss.shrinkwrap.api.spec.JavaArchive;  
45 -import org.junit.Test;  
46 -import org.junit.runner.RunWith;  
47 -  
48 -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;  
49 -import br.gov.frameworkdemoiselle.util.Beans;  
50 -  
51 -@RunWith(Arquillian.class)  
52 -public class ConfigurationScopeTest extends AbstractConfigurationTest {  
53 -  
54 - @Deployment  
55 - public static JavaArchive createDeployment() {  
56 - JavaArchive deployment = createConfigurationDeployment();  
57 - deployment.addPackages(true, ConfigurationScopeTest.class.getPackage());  
58 - return deployment;  
59 - }  
60 -  
61 - @Test  
62 - public void twoInvocationsSameInstance() {  
63 - DefaultScopeWithoutSuperClassConfig config1 = Beans.getReference(DefaultScopeWithoutSuperClassConfig.class);  
64 - DefaultScopeWithoutSuperClassConfig config2 = Beans.getReference(DefaultScopeWithoutSuperClassConfig.class);  
65 -  
66 - assertSame(config1, config2);  
67 - }  
68 -  
69 - @Test  
70 - public void twoInvocationsDifferentInstances() {  
71 - DependentScopeWithoutSuperClassConfig config1 = Beans.getReference(DependentScopeWithoutSuperClassConfig.class);  
72 - DependentScopeWithoutSuperClassConfig config2 = Beans.getReference(DependentScopeWithoutSuperClassConfig.class);  
73 -  
74 - assertNotSame(config1, config2);  
75 - }  
76 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/scope/DefaultScopeWithoutSuperClassConfig.java
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.scope;  
38 -  
39 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
40 -  
41 -@Configuration  
42 -public class DefaultScopeWithoutSuperClassConfig {  
43 -  
44 - private String string;  
45 -  
46 - public String getString() {  
47 - return string;  
48 - }  
49 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/scope/DependentScopeWithoutSuperClassConfig.java
@@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.configuration.scope;  
38 -  
39 -import javax.enterprise.context.Dependent;  
40 -  
41 -import br.gov.frameworkdemoiselle.configuration.Configuration;  
42 -  
43 -@Dependent  
44 -@Configuration  
45 -public class DependentScopeWithoutSuperClassConfig {  
46 -  
47 - private String string;  
48 -  
49 - public String getString() {  
50 - return string;  
51 - }  
52 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/util/ExceptionsTest.java
@@ -1,89 +0,0 @@ @@ -1,89 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.util;  
38 -  
39 -import static org.junit.Assert.assertFalse;  
40 -import static org.junit.Assert.assertTrue;  
41 -import static org.junit.Assert.fail;  
42 -  
43 -import org.junit.Test;  
44 -  
45 -import br.gov.frameworkdemoiselle.exception.ApplicationException;  
46 -  
47 -public class ExceptionsTest {  
48 -  
49 - @Test  
50 - public void testIsApplicationException() {  
51 - assertTrue(Exceptions.isApplicationException(new MyException()));  
52 - assertFalse(Exceptions.isApplicationException(new Exception()));  
53 - }  
54 -  
55 - @Test  
56 - public void testHandleRuntimeException() {  
57 - try {  
58 - Exceptions.handleToRuntimeException(new SomeRuntimeException());  
59 - fail();  
60 - } catch (Throwable t) {  
61 - if (!RuntimeException.class.isInstance(t)) {  
62 - fail();  
63 - }  
64 - }  
65 -  
66 - try {  
67 - Exceptions.handleToRuntimeException(new Exception());  
68 - fail();  
69 - } catch (Throwable t) {  
70 - if (!RuntimeException.class.isInstance(t)) {  
71 - fail();  
72 - }  
73 - }  
74 -  
75 - }  
76 -  
77 -}  
78 -  
79 -@ApplicationException  
80 -class MyException extends Exception {  
81 -  
82 - private static final long serialVersionUID = 1L;  
83 -}  
84 -  
85 -class SomeRuntimeException extends RuntimeException {  
86 -  
87 - private static final long serialVersionUID = 1L;  
88 -  
89 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/util/ReflectionsTest.java
@@ -1,73 +0,0 @@ @@ -1,73 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.util;  
38 -  
39 -import static org.junit.Assert.assertEquals;  
40 -  
41 -import java.lang.reflect.Member;  
42 -  
43 -import org.junit.Test;  
44 -  
45 -public class ReflectionsTest {  
46 -  
47 - @Test  
48 - public void testGetGenericTypeArgumentClass() {  
49 - assertEquals(Long.class, Reflections.getGenericTypeArgument(OtherClass.class, 0));  
50 - assertEquals(String.class, Reflections.getGenericTypeArgument(OtherClass.class, 1));  
51 - }  
52 -  
53 - @Test  
54 - public void testGetGenericTypeArgumentMember() throws SecurityException, NoSuchFieldException {  
55 - Member[] members = OtherClass.class.getFields();  
56 - assertEquals(Long.class, Reflections.getGenericTypeArgument(members[0], 0));  
57 - assertEquals(String.class, Reflections.getGenericTypeArgument(members[1], 0));  
58 - }  
59 -}  
60 -  
61 -class SomeClass<T, I> {  
62 -  
63 - public void setNumber(T t) {  
64 -  
65 - }  
66 -}  
67 -  
68 -class OtherClass extends SomeClass<Long, String> {  
69 -  
70 - public Class<Long> number;  
71 -  
72 - public Class<String> text;  
73 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/util/ResourceBundleTest.java
@@ -1,124 +0,0 @@ @@ -1,124 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.util;  
38 -  
39 -import static org.junit.Assert.assertEquals;  
40 -import static org.junit.Assert.assertFalse;  
41 -import static org.junit.Assert.assertTrue;  
42 -  
43 -import java.util.Enumeration;  
44 -import java.util.Locale;  
45 -  
46 -import org.junit.Before;  
47 -import org.junit.Ignore;  
48 -import org.junit.Test;  
49 -  
50 -@Ignore  
51 -public class ResourceBundleTest {  
52 -  
53 - /**  
54 - * This is a workaround to mock java.util.ResourceBundle. Since getString(key) method is defined as final, there is  
55 - * no way to extend and override it. For that reason, setting expectations (i.e. expect(...)) won't work.  
56 - */  
57 - private ResourceBundle resourceBundle;  
58 -  
59 - @Before  
60 - public void setUp() throws Exception {  
61 - resourceBundle = new ResourceBundle("resource-bundle", new Locale("pt"));  
62 - }  
63 -  
64 - @Test  
65 - public void containsKey() {  
66 - assertTrue(resourceBundle.containsKey("msgWithoutParams"));  
67 -  
68 - assertFalse(resourceBundle.containsKey("inexistentKey"));  
69 - }  
70 -  
71 - @Test  
72 - public void getKeys() {  
73 - int keyCount = 0;  
74 -  
75 - Enumeration<String> e = resourceBundle.getKeys();  
76 -  
77 - while (e.hasMoreElements()) {  
78 - keyCount++;  
79 - e.nextElement();  
80 - }  
81 -  
82 - assertEquals(resourceBundle.keySet().size(), keyCount);  
83 - }  
84 -  
85 - @Test  
86 - public void testGetLocale() {  
87 - assertEquals(resourceBundle.getLocale(), new Locale("pt"));  
88 - }  
89 -  
90 - @Test  
91 - public void testKeySet() {  
92 - assertEquals(2, resourceBundle.keySet().size());  
93 - }  
94 -  
95 - @Test  
96 - public void getString() {  
97 - assertEquals("no params", resourceBundle.getString("msgWithoutParams"));  
98 -  
99 - assertEquals("params: a, b", resourceBundle.getString("msgWithParams", "a", "b"));  
100 -  
101 - assertEquals("params: {0}, {1}", resourceBundle.getString("msgWithParams"));  
102 - }  
103 -  
104 - /**  
105 - * For this test, java.util.ResourceBundle is mocked to force an exception. Since the getString method is called  
106 - * from the actual ResourceBundle, not from the mock, it tries to find a handleGetObject method that doesn't exist.  
107 - *  
108 - * @throws Exception  
109 - */  
110 - // @Test(expected = RuntimeException.class)  
111 - // public void getStringWhenHandleGetObjectThrowsException() {  
112 - // mockResourceBundle = createMock(java.util.ResourceBundle.class);  
113 - // resourceBundle = new ResourceBundle(mockResourceBundle);  
114 - //  
115 - // replay(mockResourceBundle);  
116 - //  
117 - // resourceBundle.getString("msgWithParams");  
118 - //  
119 - // verify(mockResourceBundle);  
120 - //  
121 - // Assert.fail();  
122 - // }  
123 -  
124 -}  
impl/core/src/test/java/br/gov/frameworkdemoiselle/util/StringsTest.java
@@ -1,201 +0,0 @@ @@ -1,201 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.util;  
38 -  
39 -import static org.junit.Assert.assertEquals;  
40 -import static org.junit.Assert.assertFalse;  
41 -import static org.junit.Assert.assertNull;  
42 -import static org.junit.Assert.assertTrue;  
43 -  
44 -import org.junit.Test;  
45 -  
46 -import br.gov.frameworkdemoiselle.annotation.Ignore;  
47 -  
48 -public class StringsTest {  
49 -  
50 - @Test  
51 - public void getString() {  
52 - testEqualsGetString("teste", "teste");  
53 - testEqualsGetString("", "");  
54 - testEqualsGetString(null, null);  
55 - testEqualsGetString(null, null, "teste");  
56 - testEqualsGetString("{0}", "teste", "teste");  
57 - testEqualsGetString("teste", "teste", (Object[]) null);  
58 - testEqualsGetString("teste {0}", "teste 1", "1");  
59 - testEqualsGetString("{0} teste", "Um teste", "Um");  
60 - testEqualsGetString("{1} testando {0}", "Apenas testando novamente", "novamente", "Apenas");  
61 - testEqualsGetString("{0} testando {1}", "Apenas testando {1}", "Apenas", null);  
62 - testEqualsGetString("testando {1} novamente", "testando isto novamente", "aquilo", "isto");  
63 - testEqualsGetString("teste", "teste", "1", "2");  
64 - testEqualsGetString("teste {0}.", "teste \\.", "\\");  
65 - }  
66 -  
67 - @Test  
68 - public void isEmpty() {  
69 - assertTrue(Strings.isEmpty(null));  
70 - assertTrue(Strings.isEmpty(""));  
71 - assertTrue(Strings.isEmpty(" "));  
72 - assertTrue(Strings.isEmpty(" "));  
73 -  
74 - assertFalse(Strings.isEmpty(" _ "));  
75 - assertFalse(Strings.isEmpty("."));  
76 - assertFalse(Strings.isEmpty("null"));  
77 - }  
78 -  
79 - @Test  
80 - public void isResourceBundleKeyFormat() {  
81 - assertTrue(Strings.isResourceBundleKeyFormat("{x}"));  
82 - assertTrue(Strings.isResourceBundleKeyFormat("{.}"));  
83 - assertTrue(Strings.isResourceBundleKeyFormat("{*}"));  
84 - assertTrue(Strings.isResourceBundleKeyFormat("{$}"));  
85 - assertFalse(Strings.isResourceBundleKeyFormat("{}"));  
86 - assertFalse(Strings.isResourceBundleKeyFormat(""));  
87 - assertFalse(Strings.isResourceBundleKeyFormat(" "));  
88 - assertFalse(Strings.isResourceBundleKeyFormat(null));  
89 - assertFalse(Strings.isResourceBundleKeyFormat("a{a}a"));  
90 - assertFalse(Strings.isResourceBundleKeyFormat("a{a}"));  
91 - assertFalse(Strings.isResourceBundleKeyFormat("{a}a"));  
92 - assertFalse(Strings.isResourceBundleKeyFormat(" {a} "));  
93 - assertFalse(Strings.isResourceBundleKeyFormat("{a"));  
94 - assertFalse(Strings.isResourceBundleKeyFormat("a}"));  
95 - }  
96 -  
97 - @Test  
98 - public void camelCaseToSymbolSeparated() {  
99 - assertEquals(null, Strings.camelCaseToSymbolSeparated(null, null));  
100 - assertEquals(null, Strings.camelCaseToSymbolSeparated(null, "."));  
101 - assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", null));  
102 - assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", ""));  
103 - assertEquals("my.var", Strings.camelCaseToSymbolSeparated("myVar", "."));  
104 - assertEquals("my-var", Strings.camelCaseToSymbolSeparated("MyVar", "-"));  
105 - assertEquals("my?var?name", Strings.camelCaseToSymbolSeparated("myVarName", "?"));  
106 - assertEquals("my___var___name", Strings.camelCaseToSymbolSeparated("myVarName", "___"));  
107 - }  
108 -  
109 - @Test  
110 - public void firstToUpper() {  
111 - assertNull(Strings.firstToUpper(null));  
112 - assertEquals("", Strings.firstToUpper(""));  
113 - assertEquals("A", Strings.firstToUpper("a"));  
114 - assertEquals("A", Strings.firstToUpper("A"));  
115 - assertEquals("Ab", Strings.firstToUpper("Ab"));  
116 - assertEquals("AB", Strings.firstToUpper("AB"));  
117 - assertEquals("Ab", Strings.firstToUpper("ab"));  
118 - assertEquals("AB", Strings.firstToUpper("aB"));  
119 - }  
120 -  
121 - @Test  
122 - public void toStringWhenObjectIsNull() {  
123 - assertEquals("", Strings.toString(null));  
124 - }  
125 -  
126 - @Test  
127 - public void classToString() throws SecurityException, NoSuchFieldException {  
128 - @SuppressWarnings("unused")  
129 - class Test {  
130 -  
131 - private String name = "myName";  
132 -  
133 - private String lastname = "myLastname";  
134 -  
135 - private String nullField = null;  
136 -  
137 - @Ignore  
138 - private String ignore = "ignoreMe";  
139 -  
140 - }  
141 -  
142 - String result = Strings.toString(new Test());  
143 - assertTrue(result.contains("Test [name=myName, lastname=myLastname, nullField=null, this"));  
144 - }  
145 -  
146 - private void testEqualsGetString(String in, String expected, Object... params) {  
147 - String out = Strings.getString(in, params);  
148 - assertEquals(expected, out);  
149 - }  
150 -  
151 - @Test  
152 - public void removeBraces() {  
153 - assertNull(Strings.removeBraces(null));  
154 - assertEquals("", Strings.removeBraces(""));  
155 - assertEquals(" ", Strings.removeBraces(" "));  
156 - assertEquals(" {x} ", Strings.removeBraces(" {x} "));  
157 - assertEquals("{x} ", Strings.removeBraces("{x} "));  
158 - assertEquals(" {x}", Strings.removeBraces(" {x}"));  
159 - assertEquals("x", Strings.removeBraces("{x}"));  
160 - assertEquals("a b c", Strings.removeBraces("{a b c}"));  
161 - assertEquals("{}", Strings.removeBraces("{}"));  
162 - assertEquals("{}", Strings.removeBraces("{{}}"));  
163 - assertEquals("?", Strings.removeBraces("{?}"));  
164 - assertEquals("*", Strings.removeBraces("{*}"));  
165 - }  
166 -  
167 - @Test  
168 - public void insertBraces() {  
169 - assertNull(Strings.insertBraces(null));  
170 - assertEquals("", Strings.insertBraces(""));  
171 - assertEquals(" ", Strings.insertBraces(" "));  
172 - assertEquals("{ x }", Strings.insertBraces(" x "));  
173 - assertEquals("{ {x} }", Strings.insertBraces(" {x} "));  
174 - assertEquals("{{x}", Strings.insertBraces("{x"));  
175 - assertEquals("{*}", Strings.insertBraces("*"));  
176 - assertEquals("{?}", Strings.insertBraces("?"));  
177 - }  
178 -  
179 - @Test  
180 - public void removeCharsWhenStringIsNull() {  
181 - assertEquals(null, Strings.removeChars(null, 'a'));  
182 - }  
183 -  
184 - @Test  
185 - public void removeCharsWhenStringIsNotNull() {  
186 - String string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus lobortis.";  
187 - string = Strings.removeChars(string, 'L', 'l');  
188 - assertEquals(-1, string.indexOf('L'));  
189 - assertEquals(-1, string.indexOf('l'));  
190 - }  
191 -  
192 - @Test  
193 - public void insertZeros() {  
194 - String string = "Lorem ipsum";  
195 - assertEquals("00000", Strings.insertZeros(null, 5));  
196 - assertEquals(string, Strings.insertZeros(string, string.length() - 1));  
197 - assertEquals(string, Strings.insertZeros(string, string.length()));  
198 - assertEquals("0" + string, Strings.insertZeros(string, string.length() + 1));  
199 - assertEquals("00" + string, Strings.insertZeros(string, string.length() + 2));  
200 - }  
201 -}  
impl/core/src/test/java/configuration/AbstractConfigurationTest.java 0 → 100644
@@ -0,0 +1,56 @@ @@ -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 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 abstract class AbstractConfigurationTest {
  46 +
  47 + public static JavaArchive createConfigurationDeployment() {
  48 + return ShrinkWrap
  49 + .create(JavaArchive.class)
  50 + .addPackages(true, "br")
  51 + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
  52 + .addAsManifestResource(
  53 + new File("src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension"),
  54 + "services/javax.enterprise.inject.spi.Extension");
  55 + }
  56 +}
impl/core/src/test/java/configuration/defaultvalue/AbstractDefaultValueConfig.java 0 → 100644
@@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
  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.defaultvalue;
  38 +
  39 +public abstract class AbstractDefaultValueConfig {
  40 +
  41 + private String stringDefaultWithoutKey = "Initialized value and without key in the property file";
  42 +
  43 + private String stringDefaultWithKey = "Initialized value and key in the property file";
  44 +
  45 + public String getStringDefaultWithoutKey() {
  46 + return stringDefaultWithoutKey;
  47 + }
  48 +
  49 + public String getStringDefaultWithKey() {
  50 + return stringDefaultWithKey;
  51 + }
  52 +
  53 + public void setStringDefaultWithoutKey(String stringDefaultWithoutKey) {
  54 + this.stringDefaultWithoutKey = stringDefaultWithoutKey;
  55 + }
  56 +
  57 + public void setStringDefaultWithKey(String stringDefaultWithKey) {
  58 + this.stringDefaultWithKey = stringDefaultWithKey;
  59 + }
  60 +}
impl/core/src/test/java/configuration/defaultvalue/ConfigurationDefaultValueTest.java 0 → 100644
@@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
  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.defaultvalue;
  38 +
  39 +import static junit.framework.Assert.assertEquals;
  40 +
  41 +import java.io.File;
  42 +
  43 +import javax.inject.Inject;
  44 +
  45 +import org.jboss.arquillian.container.test.api.Deployment;
  46 +import org.jboss.arquillian.junit.Arquillian;
  47 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  48 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  49 +import org.junit.Test;
  50 +import org.junit.runner.RunWith;
  51 +
  52 +import configuration.AbstractConfigurationTest;
  53 +
  54 +
  55 +@RunWith(Arquillian.class)
  56 +public class ConfigurationDefaultValueTest extends AbstractConfigurationTest {
  57 +
  58 + @Inject
  59 + private FilledDefaultValueConfig filledFieldConfig;
  60 +
  61 + @Inject
  62 + private EmptyDefaultValueConfig emptyFieldsConfig;
  63 +
  64 + @Inject
  65 + private PropertyWithInexistenceFileConfig noFileConfig;
  66 +
  67 + @Deployment
  68 + public static JavaArchive createDeployment() {
  69 + JavaArchive deployment = createConfigurationDeployment();
  70 +
  71 + deployment.addPackages(true, ConfigurationDefaultValueTest.class.getPackage());
  72 + deployment.addAsResource(
  73 + new FileAsset(new File("src/test/resources/configuration/field/default/demoiselle.properties")),
  74 + "demoiselle.properties").addAsResource(
  75 + new FileAsset(new File("src/test/resources/configuration/field/default/demoiselle.xml")),
  76 + "demoiselle.xml");
  77 +
  78 + return deployment;
  79 + }
  80 +
  81 + @Test
  82 + public void loadDefaultValueWithoutKey() {
  83 + String expected = "Initialized value and without key in the property file";
  84 +
  85 + assertEquals(expected, filledFieldConfig.getStringDefaultWithoutKey());
  86 + assertEquals(expected, emptyFieldsConfig.getStringDefaultWithoutKey());
  87 + assertEquals(expected, noFileConfig.getStringDefaultWithoutKey());
  88 + }
  89 +
  90 + @Test
  91 + public void loadDefaultValueWithKey() {
  92 + assertEquals("Initialized value of the property file", filledFieldConfig.getStringDefaultWithKey());
  93 + assertEquals("Initialized value and key in the property file", noFileConfig.getStringDefaultWithKey());
  94 + assertEquals("", emptyFieldsConfig.getStringDefaultWithKey());
  95 + }
  96 +}
impl/core/src/test/java/configuration/defaultvalue/EmptyDefaultValueConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.defaultvalue;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "demoiselle", type = XML)
  43 +public class EmptyDefaultValueConfig extends AbstractDefaultValueConfig {
  44 +}
impl/core/src/test/java/configuration/defaultvalue/FilledDefaultValueConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.defaultvalue;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "demoiselle", type = PROPERTIES)
  43 +public class FilledDefaultValueConfig extends AbstractDefaultValueConfig {
  44 +}
impl/core/src/test/java/configuration/defaultvalue/PropertyWithInexistenceFileConfig.java 0 → 100644
@@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
  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.defaultvalue;
  38 +
  39 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  40 +
  41 +@Configuration(resource = "nofile")
  42 +public class PropertyWithInexistenceFileConfig extends AbstractDefaultValueConfig {
  43 +}
impl/core/src/test/java/configuration/field/array/AbstractArrayEmptyFieldConfig.java 0 → 100644
@@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
  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.field.array;
  38 +
  39 +public abstract class AbstractArrayEmptyFieldConfig {
  40 +
  41 + private int[] emptyPrimitiveIntegers;
  42 +
  43 + private Integer[] emptyWrapperIntegers;
  44 +
  45 + private Integer[] errorTypeWrapperIntegers;
  46 +
  47 + public Integer[] getEmptyWrapperIntegers() {
  48 + return emptyWrapperIntegers;
  49 + }
  50 +
  51 + public int[] getEmptyPrimitiveIntegers() {
  52 + return emptyPrimitiveIntegers;
  53 + }
  54 +
  55 + public Integer[] getErrorTypeWrapperIntegers() {
  56 + return errorTypeWrapperIntegers;
  57 + }
  58 +}
impl/core/src/test/java/configuration/field/array/AbstractArrayFieldConfig.java 0 → 100644
@@ -0,0 +1,76 @@ @@ -0,0 +1,76 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package configuration.field.array;
  38 +
  39 +public abstract class AbstractArrayFieldConfig {
  40 +
  41 + private int[] primitiveIntegers;
  42 +
  43 + private Integer[] wrappedIntegers;
  44 +
  45 + private String[] strings;
  46 +
  47 + private double[] primitiveDoubles;
  48 +
  49 + private Double[] wrappedDoubles;
  50 +
  51 + private String[] emptyStrings;
  52 +
  53 + public int[] getPrimitiveIntegers() {
  54 + return primitiveIntegers;
  55 + }
  56 +
  57 + public Integer[] getWrappedIntegers() {
  58 + return wrappedIntegers;
  59 + }
  60 +
  61 + public String[] getStrings() {
  62 + return strings;
  63 + }
  64 +
  65 + public double[] getPrimitiveDoubles() {
  66 + return primitiveDoubles;
  67 + }
  68 +
  69 + public Double[] getWrappedDoubles() {
  70 + return wrappedDoubles;
  71 + }
  72 +
  73 + public String[] getEmptyStrings() {
  74 + return emptyStrings;
  75 + }
  76 +}
impl/core/src/test/java/configuration/field/array/ConfigurationArrayFieldTest.java 0 → 100644
@@ -0,0 +1,161 @@ @@ -0,0 +1,161 @@
  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.field.array;
  38 +
  39 +import static junit.framework.Assert.assertEquals;
  40 +import static org.junit.Assert.assertArrayEquals;
  41 +
  42 +import java.io.File;
  43 +
  44 +import javax.inject.Inject;
  45 +
  46 +import junit.framework.Assert;
  47 +
  48 +import org.apache.commons.configuration.ConversionException;
  49 +import org.jboss.arquillian.container.test.api.Deployment;
  50 +import org.jboss.arquillian.junit.Arquillian;
  51 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  52 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  53 +import org.junit.Test;
  54 +import org.junit.runner.RunWith;
  55 +
  56 +import configuration.AbstractConfigurationTest;
  57 +
  58 +import br.gov.frameworkdemoiselle.configuration.ConfigurationException;
  59 +
  60 +@RunWith(Arquillian.class)
  61 +public class ConfigurationArrayFieldTest extends AbstractConfigurationTest {
  62 +
  63 + @Inject
  64 + private PropertiesArrayFieldConfig propertiesConfig;
  65 +
  66 + @Inject
  67 + private PropertiesArrayEmptyFieldConfig propertiesNullConfig;
  68 +
  69 + @Inject
  70 + private XMLArrayFieldConfig xmlConfig;
  71 +
  72 + @Deployment
  73 + public static JavaArchive createDeployment() {
  74 + JavaArchive deployment = createConfigurationDeployment();
  75 +
  76 + deployment.addPackages(true, ConfigurationArrayFieldTest.class.getPackage());
  77 + deployment.addAsResource(
  78 + new FileAsset(new File("src/test/resources/configuration/field/array/demoiselle.properties")),
  79 + "demoiselle.properties").addAsResource(
  80 + new FileAsset(new File("src/test/resources/configuration/field/array/demoiselle.xml")),
  81 + "demoiselle.xml");
  82 +
  83 + return deployment;
  84 + }
  85 +
  86 + @Test
  87 + public void loadPrimitiveInteger() {
  88 + int[] expected = { 1, 20, 0 };
  89 +
  90 + assertArrayEquals(expected, propertiesConfig.getPrimitiveIntegers());
  91 + assertArrayEquals(expected, xmlConfig.getPrimitiveIntegers());
  92 + }
  93 +
  94 + @Test
  95 + public void loadWrappedIntegers() {
  96 + Integer[] expected = { -99, 0, 1 };
  97 +
  98 + assertArrayEquals(expected, propertiesConfig.getWrappedIntegers());
  99 + assertArrayEquals(expected, xmlConfig.getWrappedIntegers());
  100 + }
  101 +
  102 + @Test
  103 + public void loadString() {
  104 + String[] expected = { "demoisele", "demoiselle framework", "demoiselle,framework", "demoiselle, framework" };
  105 +
  106 + assertArrayEquals(expected, propertiesConfig.getStrings());
  107 + assertArrayEquals(expected, xmlConfig.getStrings());
  108 + }
  109 +
  110 + @Test
  111 + public void loadPrimitiveDoubles() {
  112 + double[] expected = { -10, 200000.99999, 0 };
  113 +
  114 + assertArrayEquals(expected, propertiesConfig.getPrimitiveDoubles(), 0);
  115 + assertArrayEquals(expected, xmlConfig.getPrimitiveDoubles(), 0);
  116 + }
  117 +
  118 + @Test
  119 + public void loadWrappedDoubles() {
  120 + Double[] expected = { -456.123456789, 0.0, 52.2 };
  121 +
  122 + assertArrayEquals(expected, propertiesConfig.getWrappedDoubles());
  123 + assertArrayEquals(expected, xmlConfig.getWrappedDoubles());
  124 + }
  125 +
  126 + @Test
  127 + public void loadEmptyString() {
  128 + String[] expected = { "demoisele", "" };
  129 + assertArrayEquals(expected, propertiesConfig.getEmptyStrings());
  130 + }
  131 +
  132 + @Test
  133 + public void loadEmptyPrimitive() {
  134 + try {
  135 + propertiesNullConfig.getEmptyPrimitiveIntegers();
  136 + Assert.fail();
  137 + } catch (ConfigurationException cause) {
  138 + assertEquals(ConversionException.class, cause.getCause().getClass());
  139 + }
  140 + }
  141 +
  142 + @Test
  143 + public void loadEmptyWrapper() {
  144 + try {
  145 + propertiesNullConfig.getEmptyWrapperIntegers();
  146 + Assert.fail();
  147 + } catch (ConfigurationException cause) {
  148 + assertEquals(ConversionException.class, cause.getCause().getClass());
  149 + }
  150 + }
  151 +
  152 + @Test
  153 + public void loadErrorTypeWrapper() {
  154 + try {
  155 + propertiesNullConfig.getErrorTypeWrapperIntegers();
  156 + Assert.fail();
  157 + } catch (ConfigurationException cause) {
  158 + assertEquals(ConversionException.class, cause.getCause().getClass());
  159 + }
  160 + }
  161 +}
impl/core/src/test/java/configuration/field/array/PropertiesArrayEmptyFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.array;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = PROPERTIES)
  43 +public class PropertiesArrayEmptyFieldConfig extends AbstractArrayEmptyFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/array/PropertiesArrayFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.array;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = PROPERTIES)
  43 +public class PropertiesArrayFieldConfig extends AbstractArrayFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/array/XMLArrayFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.array;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "demoiselle", type = XML)
  43 +public class XMLArrayFieldConfig extends AbstractArrayFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/clazz/AbstractClassNotFoundFieldConfig.java 0 → 100644
@@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package configuration.field.clazz;
  38 +
  39 +public abstract class AbstractClassNotFoundFieldConfig {
  40 +
  41 + private Class<MyClass> nonExistentTypedClass;
  42 +
  43 + private Class<?> nonExistentUntypedClass;
  44 +
  45 + public Class<MyClass> getNonExistentTypedClass() {
  46 + return nonExistentTypedClass;
  47 + }
  48 +
  49 + public Class<?> getNonExistentUntypedClass() {
  50 + return nonExistentUntypedClass;
  51 + }
  52 +}
impl/core/src/test/java/configuration/field/clazz/AbstractExistentClassFieldConfig.java 0 → 100644
@@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package configuration.field.clazz;
  38 +
  39 +public abstract class AbstractExistentClassFieldConfig {
  40 +
  41 + private Class<MyClass> existentTypedClass;
  42 +
  43 + private Class<?> existentUntypedClass;
  44 +
  45 + public Class<MyClass> getExistentTypedClass() {
  46 + return existentTypedClass;
  47 + }
  48 +
  49 + public Class<?> getExistentUntypedClass() {
  50 + return existentUntypedClass;
  51 + }
  52 +}
impl/core/src/test/java/configuration/field/clazz/AbstractNullClassFieldConfig.java 0 → 100644
@@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package configuration.field.clazz;
  38 +
  39 +public abstract class AbstractNullClassFieldConfig {
  40 +
  41 + private Class<MyClass> nullTypedClass;
  42 +
  43 + private Class<?> nullUntypedClass;
  44 +
  45 + public Class<MyClass> getNullTypedClass() {
  46 + return nullTypedClass;
  47 + }
  48 +
  49 + public Class<?> getNullUntypedClass() {
  50 + return nullUntypedClass;
  51 + }
  52 +}
impl/core/src/test/java/configuration/field/clazz/ConfigurationClassFieldTest.java 0 → 100644
@@ -0,0 +1,132 @@ @@ -0,0 +1,132 @@
  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.field.clazz;
  38 +
  39 +import static junit.framework.Assert.assertEquals;
  40 +import static junit.framework.Assert.fail;
  41 +
  42 +import java.io.File;
  43 +
  44 +import javax.inject.Inject;
  45 +
  46 +import org.jboss.arquillian.container.test.api.Deployment;
  47 +import org.jboss.arquillian.junit.Arquillian;
  48 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  49 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  50 +import org.junit.Test;
  51 +import org.junit.runner.RunWith;
  52 +
  53 +import configuration.AbstractConfigurationTest;
  54 +
  55 +import br.gov.frameworkdemoiselle.configuration.ConfigurationException;
  56 +
  57 +@RunWith(Arquillian.class)
  58 +public class ConfigurationClassFieldTest extends AbstractConfigurationTest {
  59 +
  60 + @Inject
  61 + private PropertiesExistentClassFieldConfig propertiesExistentConfig;
  62 +
  63 + @Inject
  64 + private PropertiesClassNotFoundFieldConfig propertiesNotFoundConfig;
  65 +
  66 + @Inject
  67 + private PropertiesNullClassFieldConfig propertiesNullFieldConfig;
  68 +
  69 + @Deployment
  70 + public static JavaArchive createDeployment() {
  71 + JavaArchive deployment = createConfigurationDeployment();
  72 +
  73 + deployment.addPackages(true, ConfigurationClassFieldTest.class.getPackage());
  74 + deployment.addAsResource(new FileAsset(new File(
  75 + "src/test/resources/configuration/field/class/demoiselle.properties")), "demoiselle.properties");
  76 +
  77 + return deployment;
  78 + }
  79 +
  80 + @Test
  81 + public void loadExistentTypedClass() {
  82 + assertEquals(MyClass.class, propertiesExistentConfig.getExistentTypedClass());
  83 + }
  84 +
  85 + @Test
  86 + public void loadExistentUntypedClass() {
  87 + assertEquals(MyClass.class, propertiesExistentConfig.getExistentUntypedClass());
  88 + }
  89 +
  90 + @Test
  91 + public void loadNonExistentTypedClass() {
  92 + try {
  93 + propertiesNotFoundConfig.getNonExistentTypedClass();
  94 + fail();
  95 + } catch (ConfigurationException cause) {
  96 + cause.printStackTrace();
  97 + assertEquals(ClassNotFoundException.class, cause.getCause().getClass());
  98 + }
  99 + }
  100 +
  101 + @Test
  102 + public void loadNonExistentUntypedClass() {
  103 + try {
  104 + propertiesNotFoundConfig.getNonExistentUntypedClass();
  105 + fail();
  106 + } catch (ConfigurationException cause) {
  107 + assertEquals(ClassNotFoundException.class, cause.getCause().getClass());
  108 + }
  109 + }
  110 +
  111 + @Test
  112 + public void loadNullTypedClass() {
  113 + try {
  114 + propertiesNullFieldConfig.getNullTypedClass();
  115 + fail();
  116 + } catch (ConfigurationException cause) {
  117 + cause.printStackTrace();
  118 + assertEquals(ClassNotFoundException.class, cause.getCause().getClass());
  119 + }
  120 + }
  121 +
  122 + @Test
  123 + public void loadNullUntypedClass() {
  124 + try {
  125 + propertiesNullFieldConfig.getNullUntypedClass();
  126 + fail();
  127 + } catch (ConfigurationException cause) {
  128 + assertEquals(ClassNotFoundException.class, cause.getCause().getClass());
  129 + }
  130 + }
  131 +
  132 +}
impl/core/src/test/java/configuration/field/clazz/MyClass.java 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +package configuration.field.clazz;
  2 +
  3 +public class MyClass {
  4 +
  5 +}
impl/core/src/test/java/configuration/field/clazz/PropertiesClassNotFoundFieldConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.field.clazz;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = PROPERTIES)
  43 +public class PropertiesClassNotFoundFieldConfig extends AbstractClassNotFoundFieldConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/field/clazz/PropertiesExistentClassFieldConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.field.clazz;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = PROPERTIES)
  43 +public class PropertiesExistentClassFieldConfig extends AbstractExistentClassFieldConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/field/clazz/PropertiesNullClassFieldConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.field.clazz;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = PROPERTIES)
  43 +public class PropertiesNullClassFieldConfig extends AbstractNullClassFieldConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/field/custom/ConfigurationCustomFieldTest.java 0 → 100644
@@ -0,0 +1,92 @@ @@ -0,0 +1,92 @@
  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.field.custom;
  38 +
  39 +import static junit.framework.Assert.assertEquals;
  40 +import static junit.framework.Assert.assertNotNull;
  41 +import static junit.framework.Assert.fail;
  42 +
  43 +import java.io.File;
  44 +
  45 +import javax.inject.Inject;
  46 +
  47 +import org.jboss.arquillian.container.test.api.Deployment;
  48 +import org.jboss.arquillian.junit.Arquillian;
  49 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  50 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  51 +import org.junit.Test;
  52 +import org.junit.runner.RunWith;
  53 +
  54 +import configuration.AbstractConfigurationTest;
  55 +
  56 +import br.gov.frameworkdemoiselle.configuration.ConfigurationException;
  57 +
  58 +@RunWith(Arquillian.class)
  59 +public class ConfigurationCustomFieldTest extends AbstractConfigurationTest {
  60 +
  61 + @Inject
  62 + private CustomMappedFieldConfig mappedField;
  63 +
  64 + @Inject
  65 + private CustomUnmappedFieldConfig unmappedField;
  66 +
  67 + @Deployment
  68 + public static JavaArchive createDeployment() {
  69 + JavaArchive deployment = createConfigurationDeployment();
  70 +
  71 + deployment.addPackages(true, ConfigurationCustomFieldTest.class.getPackage());
  72 + deployment.addAsResource(new FileAsset(new File(
  73 + "src/test/resources/configuration/field/custom/demoiselle.properties")), "demoiselle.properties");
  74 +
  75 + return deployment;
  76 + }
  77 +
  78 + @Test
  79 + public void loadMappedClass() {
  80 + assertNotNull(mappedField.getMappedClass());
  81 + }
  82 +
  83 + @Test
  84 + public void loadUnmappedClass() {
  85 + try {
  86 + unmappedField.getUnmappedClass();
  87 + fail();
  88 + } catch (ConfigurationException cause) {
  89 + assertEquals(ClassNotFoundException.class, cause.getCause().getClass());
  90 + }
  91 + }
  92 +}
impl/core/src/test/java/configuration/field/custom/CustomMappedFieldConfig.java 0 → 100644
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
  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.field.custom;
  38 +
  39 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  40 +
  41 +@Configuration
  42 +public class CustomMappedFieldConfig {
  43 +
  44 + private MappedClass mappedClass;
  45 +
  46 + public MappedClass getMappedClass() {
  47 + return mappedClass;
  48 + }
  49 +}
impl/core/src/test/java/configuration/field/custom/CustomUnmappedFieldConfig.java 0 → 100644
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
  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.field.custom;
  38 +
  39 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  40 +
  41 +@Configuration
  42 +public class CustomUnmappedFieldConfig {
  43 +
  44 + private UnmappedClass unmappedClass;
  45 +
  46 + public UnmappedClass getUnmappedClass() {
  47 + return unmappedClass;
  48 + }
  49 +}
impl/core/src/test/java/configuration/field/custom/MappedClass.java 0 → 100644
@@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
  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.field.custom;
  38 +
  39 +public class MappedClass {
  40 +
  41 +}
impl/core/src/test/java/configuration/field/custom/MyValueExtractor.java 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +package configuration.field.custom;
  2 +
  3 +import java.lang.reflect.Field;
  4 +
  5 +import org.apache.commons.configuration.Configuration;
  6 +
  7 +import br.gov.frameworkdemoiselle.configuration.ConfigurationValueExtractor;
  8 +
  9 +public class MyValueExtractor implements ConfigurationValueExtractor {
  10 +
  11 + @Override
  12 + public Object getValue(String prefix, String key, Field field, Configuration configuration) throws Exception {
  13 + return new MappedClass();
  14 + }
  15 +
  16 + @Override
  17 + public boolean isSupported(Field field) {
  18 + return field.getType() == MappedClass.class;
  19 + }
  20 +}
impl/core/src/test/java/configuration/field/custom/UnmappedClass.java 0 → 100644
@@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
  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.field.custom;
  38 +
  39 +public class UnmappedClass {
  40 +
  41 +}
impl/core/src/test/java/configuration/field/ignored/AbstractIgnoredFieldConfig.java 0 → 100644
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
  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.field.ignored;
  38 +
  39 +import br.gov.frameworkdemoiselle.annotation.Ignore;
  40 +
  41 +public abstract class AbstractIgnoredFieldConfig {
  42 +
  43 + @Ignore
  44 + private int ignoredAttribute;
  45 +
  46 + public int getIgnoredAttribute() {
  47 + return ignoredAttribute;
  48 + }
  49 +}
impl/core/src/test/java/configuration/field/ignored/ConfigurationIgnoredFieldTest.java 0 → 100644
@@ -0,0 +1,90 @@ @@ -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 +package configuration.field.ignored;
  38 +
  39 +import static junit.framework.Assert.assertEquals;
  40 +
  41 +import java.io.File;
  42 +
  43 +import javax.inject.Inject;
  44 +
  45 +import org.jboss.arquillian.container.test.api.Deployment;
  46 +import org.jboss.arquillian.junit.Arquillian;
  47 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  48 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  49 +import org.junit.Test;
  50 +import org.junit.runner.RunWith;
  51 +
  52 +import configuration.AbstractConfigurationTest;
  53 +
  54 +
  55 +@RunWith(Arquillian.class)
  56 +public class ConfigurationIgnoredFieldTest extends AbstractConfigurationTest {
  57 +
  58 + @Inject
  59 + private FilledIgnoredFieldConfig filledFieldConfig;
  60 +
  61 + @Inject
  62 + private EmptyIgnoredFieldConfig emptyFieldsConfig;
  63 +
  64 + @Inject
  65 + private PropertyWithoutFileConfig noFileConfig;
  66 +
  67 + @Deployment
  68 + public static JavaArchive createDeployment() {
  69 + JavaArchive deployment = createConfigurationDeployment();
  70 +
  71 + deployment.addPackages(true, "br");
  72 + deployment.addPackages(true, ConfigurationIgnoredFieldTest.class.getPackage());
  73 + deployment.addAsResource(
  74 + new FileAsset(new File("src/test/resources/configuration/field/ignored/demoiselle.properties")),
  75 + "demoiselle.properties").addAsResource(
  76 + new FileAsset(new File("src/test/resources/configuration/field/ignored/demoiselle.xml")),
  77 + "demoiselle.xml");
  78 +
  79 + return deployment;
  80 + }
  81 +
  82 + @Test
  83 + public void loadIgnoredAttribute() {
  84 + int expected = 0;
  85 +
  86 + assertEquals(expected, filledFieldConfig.getIgnoredAttribute());
  87 + assertEquals(expected, noFileConfig.getIgnoredAttribute());
  88 + assertEquals(expected, emptyFieldsConfig.getIgnoredAttribute());
  89 + }
  90 +}
impl/core/src/test/java/configuration/field/ignored/EmptyIgnoredFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.ignored;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "demoiselle", type = XML)
  43 +public class EmptyIgnoredFieldConfig extends AbstractIgnoredFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/ignored/FilledIgnoredFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.ignored;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "demoiselle", type = PROPERTIES)
  43 +public class FilledIgnoredFieldConfig extends AbstractIgnoredFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/ignored/PropertyWithoutFileConfig.java 0 → 100644
@@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
  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.field.ignored;
  38 +
  39 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  40 +
  41 +@Configuration(resource = "nofile")
  42 +public class PropertyWithoutFileConfig extends AbstractIgnoredFieldConfig {
  43 +}
impl/core/src/test/java/configuration/field/map/AbstractMapFieldConfig.java 0 → 100644
@@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
  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.field.map;
  38 +
  39 +import java.util.Map;
  40 +
  41 +public abstract class AbstractMapFieldConfig {
  42 +
  43 + private Map<String, String> stringWithDefinedKeyMap;
  44 +
  45 + private Map<String, String> stringWithUndefinedKeyMap;
  46 +
  47 + private Map<String, String> emptyValueMap;
  48 +
  49 + public Map<String, String> getStringWithUndefinedKeyMap() {
  50 + return stringWithUndefinedKeyMap;
  51 + }
  52 +
  53 + public Map<String, String> getStringWithDefinedKeyMap() {
  54 + return stringWithDefinedKeyMap;
  55 + }
  56 +
  57 + public Map<String, String> getEmptyValueMap() {
  58 + return emptyValueMap;
  59 + }
  60 +}
impl/core/src/test/java/configuration/field/map/ConfigurationMapFieldTest.java 0 → 100644
@@ -0,0 +1,108 @@ @@ -0,0 +1,108 @@
  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.field.map;
  38 +
  39 +import static junit.framework.Assert.assertEquals;
  40 +
  41 +import java.io.File;
  42 +import java.util.HashMap;
  43 +import java.util.Map;
  44 +
  45 +import javax.inject.Inject;
  46 +import javax.validation.constraints.Size;
  47 +
  48 +import org.jboss.arquillian.container.test.api.Deployment;
  49 +import org.jboss.arquillian.junit.Arquillian;
  50 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  51 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  52 +import org.junit.Test;
  53 +import org.junit.runner.RunWith;
  54 +
  55 +import configuration.AbstractConfigurationTest;
  56 +
  57 +
  58 +@RunWith(Arquillian.class)
  59 +public class ConfigurationMapFieldTest extends AbstractConfigurationTest {
  60 +
  61 + @Inject
  62 + private PropertiesMapFieldConfig propertiesConfig;
  63 +
  64 + @Inject
  65 + private XMLMapFieldConfig xmlConfig;
  66 +
  67 + @Deployment
  68 + public static JavaArchive createDeployment() {
  69 + JavaArchive deployment = createConfigurationDeployment();
  70 +
  71 + deployment.addPackages(true, ConfigurationMapFieldTest.class.getPackage());
  72 + deployment.addAsResource(
  73 + new FileAsset(new File("src/test/resources/configuration/field/map/demoiselle.properties")),
  74 + "demoiselle.properties").addAsResource(
  75 + new FileAsset(new File("src/test/resources/configuration/field/map/demoiselle.xml")), "demoiselle.xml");
  76 +
  77 + return deployment;
  78 + }
  79 +
  80 + @Test
  81 + public void loadStringWithDefinedKeyMap() {
  82 + Map<String, String> expected = new HashMap<String, String>();
  83 + expected.put("item1", "demoiselle");
  84 + expected.put("item2", "framework");
  85 +
  86 + assertEquals(expected, propertiesConfig.getStringWithDefinedKeyMap());
  87 + assertEquals(expected, xmlConfig.getStringWithDefinedKeyMap());
  88 + }
  89 +
  90 + @Test
  91 + public void loadStringWithUndefinedKeyMap() {
  92 + Map<String, String> expected = new HashMap<String, String>();
  93 + expected.put("default", "undefined");
  94 +
  95 + assertEquals(expected, propertiesConfig.getStringWithUndefinedKeyMap());
  96 + assertEquals(expected, xmlConfig.getStringWithUndefinedKeyMap());
  97 + }
  98 +
  99 + @Test
  100 + public void loadEmptyKeyMapString() {
  101 + Map<String, String> expected = new HashMap<String, String>();
  102 + expected.put("item1", "");
  103 + expected.put("item2", "");
  104 +
  105 + assertEquals(expected, propertiesConfig.getEmptyValueMap());
  106 + assertEquals(expected, xmlConfig.getEmptyValueMap());
  107 + }
  108 +}
impl/core/src/test/java/configuration/field/map/PropertiesMapFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.map;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = PROPERTIES)
  43 +public class PropertiesMapFieldConfig extends AbstractMapFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/map/XMLMapFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.map;
  38 +
  39 +import br.gov.frameworkdemoiselle.configuration.ConfigType;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = ConfigType.XML)
  43 +public class XMLMapFieldConfig extends AbstractMapFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/named/AbstractEmptyNamedFieldConfig.java 0 → 100644
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
  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.field.named;
  38 +
  39 +import br.gov.frameworkdemoiselle.annotation.Name;
  40 +
  41 +public abstract class AbstractEmptyNamedFieldConfig {
  42 +
  43 + @Name("")
  44 + private int noNameAttribute;
  45 +
  46 + public int getNoNameAttribute() {
  47 + return noNameAttribute;
  48 + }
  49 +}
impl/core/src/test/java/configuration/field/named/AbstractNamedFieldConfig.java 0 → 100644
@@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
  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.field.named;
  38 +
  39 +import br.gov.frameworkdemoiselle.annotation.Name;
  40 +
  41 +public abstract class AbstractNamedFieldConfig {
  42 +
  43 + @Name("main.int")
  44 + private int uniqueNameAttribute;
  45 +
  46 + @Name("nonexistent.property")
  47 + private int notPresentAttribute;
  48 +
  49 + @Name("attribute.without.file")
  50 + private int namedWithoutFileAttribute;
  51 +
  52 + public int getUniqueNameAttribute() {
  53 + return uniqueNameAttribute;
  54 + }
  55 +
  56 + public int getNotPresentAttribute() {
  57 + return notPresentAttribute;
  58 + }
  59 +
  60 + public int getNamedWithoutFileAttribute() {
  61 + return namedWithoutFileAttribute;
  62 + }
  63 +}
impl/core/src/test/java/configuration/field/named/ConfigurationNamedFieldTest.java 0 → 100644
@@ -0,0 +1,123 @@ @@ -0,0 +1,123 @@
  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.field.named;
  38 +
  39 +import static junit.framework.Assert.assertEquals;
  40 +import static junit.framework.Assert.fail;
  41 +
  42 +import java.io.File;
  43 +
  44 +import javax.inject.Inject;
  45 +
  46 +import junit.framework.Assert;
  47 +
  48 +import org.jboss.arquillian.container.test.api.Deployment;
  49 +import org.jboss.arquillian.junit.Arquillian;
  50 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  51 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  52 +import org.junit.Test;
  53 +import org.junit.runner.RunWith;
  54 +
  55 +import configuration.AbstractConfigurationTest;
  56 +
  57 +import br.gov.frameworkdemoiselle.configuration.ConfigurationException;
  58 +
  59 +@RunWith(Arquillian.class)
  60 +public class ConfigurationNamedFieldTest extends AbstractConfigurationTest {
  61 +
  62 + @Inject
  63 + private PropertyNamed propertyNamed;
  64 +
  65 + @Inject
  66 + private XMLNamed xmlNamed;
  67 +
  68 + @Inject
  69 + private PropertyEmptyNamed propertyEmptyNamed;
  70 +
  71 + @Inject
  72 + private XMLEmptyNamed xmlEmptyNamed;
  73 +
  74 + @Deployment
  75 + public static JavaArchive createDeployment() {
  76 + JavaArchive deployment = createConfigurationDeployment();
  77 +
  78 + deployment.addPackages(true, ConfigurationNamedFieldTest.class.getPackage());
  79 + deployment.addAsResource(
  80 + new FileAsset(new File("src/test/resources/configuration/field/named/demoiselle.properties")),
  81 + "demoiselle.properties").addAsResource(
  82 + new FileAsset(new File("src/test/resources/configuration/field/named/demoiselle.xml")),
  83 + "demoiselle.xml");
  84 +
  85 + return deployment;
  86 + }
  87 +
  88 + @Test
  89 + public void loadNamedConfigFromPropertyWithName() {
  90 + assertEquals(1, propertyNamed.getUniqueNameAttribute());
  91 + assertEquals(1, xmlNamed.getUniqueNameAttribute());
  92 + }
  93 +
  94 + @Test
  95 + public void loadNamedConfigFromNonexistentProperty() {
  96 + assertEquals(0, propertyNamed.getNotPresentAttribute());
  97 + assertEquals(0, xmlNamed.getNotPresentAttribute());
  98 + }
  99 +
  100 + @Test
  101 + public void loadNamedConfigFromPropertyWithoutField() {
  102 + assertEquals(0, propertyNamed.getNamedWithoutFileAttribute());
  103 + assertEquals(0, xmlNamed.getNamedWithoutFileAttribute());
  104 + }
  105 +
  106 + @Test
  107 + public void loadEmptyNameConfig() {
  108 + try {
  109 + xmlEmptyNamed.getNoNameAttribute();
  110 + fail();
  111 + } catch (ConfigurationException cause) {
  112 + assertEquals(IllegalArgumentException.class, cause.getCause().getClass());
  113 + }
  114 +
  115 + try {
  116 + propertyEmptyNamed.getNoNameAttribute();
  117 + fail();
  118 + } catch (ConfigurationException cause) {
  119 + assertEquals(IllegalArgumentException.class, cause.getCause().getClass());
  120 + }
  121 +
  122 + }
  123 +}
impl/core/src/test/java/configuration/field/named/PropertyEmptyNamed.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.field.named;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(type = PROPERTIES)
  7 +public class PropertyEmptyNamed extends AbstractEmptyNamedFieldConfig {
  8 +}
impl/core/src/test/java/configuration/field/named/PropertyNamed.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.field.named;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(type = PROPERTIES)
  7 +public class PropertyNamed extends AbstractNamedFieldConfig {
  8 +}
impl/core/src/test/java/configuration/field/named/XMLEmptyNamed.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.field.named;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(type = XML)
  7 +public class XMLEmptyNamed extends AbstractEmptyNamedFieldConfig {
  8 +}
impl/core/src/test/java/configuration/field/named/XMLNamed.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.field.named;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(type = XML)
  7 +public class XMLNamed extends AbstractNamedFieldConfig {
  8 +}
impl/core/src/test/java/configuration/field/notnull/AbstractNotNullFieldConfig.java 0 → 100644
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
  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.field.notnull;
  38 +
  39 +import javax.validation.constraints.NotNull;
  40 +
  41 +public abstract class AbstractNotNullFieldConfig {
  42 +
  43 + @NotNull
  44 + private Integer attibuteNotNull;
  45 +
  46 + public Integer getAttributeNotNull() {
  47 + return attibuteNotNull;
  48 + }
  49 +}
impl/core/src/test/java/configuration/field/notnull/ConfigurationNotNullFieldTest.java 0 → 100644
@@ -0,0 +1,174 @@ @@ -0,0 +1,174 @@
  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.field.notnull;
  38 +
  39 +import static junit.framework.Assert.assertEquals;
  40 +import static junit.framework.Assert.fail;
  41 +
  42 +import java.io.File;
  43 +
  44 +import javax.inject.Inject;
  45 +
  46 +import junit.framework.Assert;
  47 +
  48 +import org.jboss.arquillian.container.test.api.Deployment;
  49 +import org.jboss.arquillian.junit.Arquillian;
  50 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  51 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  52 +import org.junit.Test;
  53 +import org.junit.runner.RunWith;
  54 +
  55 +import configuration.AbstractConfigurationTest;
  56 +
  57 +import br.gov.frameworkdemoiselle.configuration.ConfigurationException;
  58 +
  59 +@RunWith(Arquillian.class)
  60 +public class ConfigurationNotNullFieldTest extends AbstractConfigurationTest {
  61 +
  62 + @Inject
  63 + private PropertyWithFilledFieldConfig propertyFilledFieldConfig;
  64 +
  65 + @Inject
  66 + private PropertyWithEmptyFieldConfig propertyEmptyFieldsConfig;
  67 +
  68 + @Inject
  69 + private PropertyWithoutNotNullField propertyWithoutNotNullField;
  70 +
  71 + @Inject
  72 + private PropertyWithoutFileConfig propertyNoFileConfig;
  73 +
  74 + @Inject
  75 + private XMLWithFilledFieldConfig xmlFilledFieldConfig;
  76 +
  77 + @Inject
  78 + private XMLWithEmptyFieldConfig xmlEmptyFieldsConfig;
  79 +
  80 + @Inject
  81 + private XMLWithoutNotNullField xmlWithoutNotNullField;
  82 +
  83 + @Inject
  84 + private XMLWithoutFileConfig xmlNoFileConfig;
  85 +
  86 + @Deployment
  87 + public static JavaArchive createDeployment() {
  88 + JavaArchive deployment = createConfigurationDeployment();
  89 +
  90 + deployment.addPackages(true, ConfigurationNotNullFieldTest.class.getPackage());
  91 + deployment
  92 + .addAsResource(
  93 + new FileAsset(new File("src/test/resources/configuration/field/notnull/demoiselle.properties")),
  94 + "demoiselle.properties")
  95 + .addAsResource(
  96 + new FileAsset(new File("src/test/resources/configuration/field/notnull/empty-field.properties")),
  97 + "empty-field.properties")
  98 + .addAsResource(
  99 + new FileAsset(new File(
  100 + "src/test/resources/configuration/field/notnull/without-field.properties")),
  101 + "without-field.properties")
  102 + .addAsResource(
  103 + new FileAsset(new File("src/test/resources/configuration/field/notnull/demoiselle.xml")),
  104 + "demoiselle.xml")
  105 + .addAsResource(
  106 + new FileAsset(new File("src/test/resources/configuration/field/notnull/empty-field.xml")),
  107 + "empty-field.xml")
  108 + .addAsResource(
  109 + new FileAsset(new File(
  110 + "src/test/resources/configuration/field/notnull/without-field.xml")),
  111 + "without-field.xml");
  112 +
  113 + return deployment;
  114 + }
  115 +
  116 + @Test
  117 + public void loadFieldNotNullFromFilledFile() {
  118 + Integer expected = 1;
  119 +
  120 + assertEquals(expected, propertyFilledFieldConfig.getAttributeNotNull());
  121 + assertEquals(expected, xmlFilledFieldConfig.getAttributeNotNull());
  122 + }
  123 +
  124 + @Test
  125 + public void loadFieldNotNullFromEmptyProperty() {
  126 + try {
  127 + propertyEmptyFieldsConfig.getAttributeNotNull();
  128 + fail();
  129 + } catch (ConfigurationException cause) {
  130 + Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());
  131 + }
  132 +
  133 + try {
  134 + xmlEmptyFieldsConfig.getAttributeNotNull();
  135 + fail();
  136 + } catch (ConfigurationException cause) {
  137 + Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());
  138 + }
  139 + }
  140 +
  141 + @Test
  142 + public void loadFieldFromPropertyFileWithoutNotNullField() {
  143 + try {
  144 + propertyWithoutNotNullField.getAttributeNotNull();
  145 + fail();
  146 + } catch (ConfigurationException cause) {
  147 + Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());
  148 + }
  149 +
  150 + try {
  151 + xmlWithoutNotNullField.getAttributeNotNull();
  152 + fail();
  153 + } catch (ConfigurationException cause) {
  154 + Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());
  155 + }
  156 + }
  157 +
  158 + @Test
  159 + public void loadFieldNotNullFromInexistentPropertyFile() {
  160 + try {
  161 + propertyNoFileConfig.getAttributeNotNull();
  162 + fail();
  163 + } catch (ConfigurationException cause) {
  164 + Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());
  165 + }
  166 +
  167 + try {
  168 + xmlNoFileConfig.getAttributeNotNull();
  169 + fail();
  170 + } catch (ConfigurationException cause) {
  171 + Assert.assertEquals(NullPointerException.class, cause.getCause().getClass());
  172 + }
  173 + }
  174 +}
impl/core/src/test/java/configuration/field/notnull/PropertyWithEmptyFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.notnull;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "empty-field", type = PROPERTIES)
  43 +public class PropertyWithEmptyFieldConfig extends AbstractNotNullFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/notnull/PropertyWithFilledFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.notnull;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "demoiselle", type = PROPERTIES)
  43 +public class PropertyWithFilledFieldConfig extends AbstractNotNullFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/notnull/PropertyWithoutFileConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.notnull;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "nofile", type = PROPERTIES)
  43 +public class PropertyWithoutFileConfig extends AbstractNotNullFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/notnull/PropertyWithoutNotNullField.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.field.notnull;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(resource = "without-field", type = PROPERTIES)
  7 +public class PropertyWithoutNotNullField extends AbstractNotNullFieldConfig {
  8 +}
impl/core/src/test/java/configuration/field/notnull/XMLWithEmptyFieldConfig.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.field.notnull;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(resource = "empty-field", type = XML)
  7 +public class XMLWithEmptyFieldConfig extends AbstractNotNullFieldConfig {
  8 +}
impl/core/src/test/java/configuration/field/notnull/XMLWithFilledFieldConfig.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.field.notnull;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(resource = "demoiselle", type = XML)
  7 +public class XMLWithFilledFieldConfig extends AbstractNotNullFieldConfig {
  8 +}
impl/core/src/test/java/configuration/field/notnull/XMLWithoutFileConfig.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.field.notnull;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(resource = "nofile", type = XML)
  7 +public class XMLWithoutFileConfig extends AbstractNotNullFieldConfig {
  8 +}
impl/core/src/test/java/configuration/field/notnull/XMLWithoutNotNullField.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.field.notnull;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(resource = "without-field", type = XML)
  7 +public class XMLWithoutNotNullField extends AbstractNotNullFieldConfig {
  8 +}
impl/core/src/test/java/configuration/field/primitiveorwrapper/AbstractPrimitiveOrWrapperEmptyFieldConfig.java 0 → 100644
@@ -0,0 +1,76 @@ @@ -0,0 +1,76 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package configuration.field.primitiveorwrapper;
  38 +
  39 +public abstract class AbstractPrimitiveOrWrapperEmptyFieldConfig {
  40 +
  41 + private int primitiveInteger;
  42 +
  43 + private int nullPrimitiveInteger;
  44 +
  45 + private int errorPrimitiveInteger;
  46 +
  47 + private Integer wrappedInteger;
  48 +
  49 + private Integer nullWrappedInteger;
  50 +
  51 + private Integer errorWrappedInteger;
  52 +
  53 + public Integer getWrappedInteger() {
  54 + return wrappedInteger;
  55 + }
  56 +
  57 + public int getPrimitiveInteger() {
  58 + return primitiveInteger;
  59 + }
  60 +
  61 + public int getNullPrimitiveInteger() {
  62 + return nullPrimitiveInteger;
  63 + }
  64 +
  65 + public Integer getNullWrappedInteger() {
  66 + return nullWrappedInteger;
  67 + }
  68 +
  69 + public int getErrorPrimitiveInteger() {
  70 + return errorPrimitiveInteger;
  71 + }
  72 +
  73 + public Integer getErrorWrappedInteger() {
  74 + return errorWrappedInteger;
  75 + }
  76 +}
impl/core/src/test/java/configuration/field/primitiveorwrapper/AbstractPrimitiveOrWrapperErrorFieldConfig.java 0 → 100644
@@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
  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.field.primitiveorwrapper;
  38 +
  39 +public abstract class AbstractPrimitiveOrWrapperErrorFieldConfig {
  40 +
  41 + private int emptyPrimitiveInteger;
  42 +
  43 + private int errorPrimitiveInteger;
  44 +
  45 + private Integer emptyWrappedInteger;
  46 +
  47 + private Integer errorWrappedInteger;
  48 +
  49 + public int getEmptyPrimitiveInteger() {
  50 + return emptyPrimitiveInteger;
  51 + }
  52 +
  53 + public Integer getEmptyWrappedInteger() {
  54 + return emptyWrappedInteger;
  55 + }
  56 +
  57 + public int getErrorPrimitiveInteger() {
  58 + return errorPrimitiveInteger;
  59 + }
  60 +
  61 + public Integer getErrorWrappedInteger() {
  62 + return errorWrappedInteger;
  63 + }
  64 +}
impl/core/src/test/java/configuration/field/primitiveorwrapper/AbstractPrimitiveOrWrapperFieldConfig.java 0 → 100644
@@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package configuration.field.primitiveorwrapper;
  38 +
  39 +public abstract class AbstractPrimitiveOrWrapperFieldConfig {
  40 +
  41 + private int primitiveInteger;
  42 +
  43 + private Integer wrappedInteger;
  44 +
  45 + public Integer getWrappedInteger() {
  46 + return wrappedInteger;
  47 + }
  48 +
  49 + public int getPrimitiveInteger() {
  50 + return primitiveInteger;
  51 + }
  52 +}
impl/core/src/test/java/configuration/field/primitiveorwrapper/ConfigurationPrimitiveOrWrapperFieldTest.java 0 → 100644
@@ -0,0 +1,212 @@ @@ -0,0 +1,212 @@
  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.field.primitiveorwrapper;
  38 +
  39 +import static junit.framework.Assert.assertEquals;
  40 +import static junit.framework.Assert.fail;
  41 +
  42 +import java.io.File;
  43 +
  44 +import javax.inject.Inject;
  45 +
  46 +import org.apache.commons.configuration.ConversionException;
  47 +import org.jboss.arquillian.container.test.api.Deployment;
  48 +import org.jboss.arquillian.junit.Arquillian;
  49 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  50 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  51 +import org.junit.BeforeClass;
  52 +import org.junit.Test;
  53 +import org.junit.runner.RunWith;
  54 +
  55 +import configuration.AbstractConfigurationTest;
  56 +
  57 +import br.gov.frameworkdemoiselle.configuration.ConfigurationException;
  58 +
  59 +@RunWith(Arquillian.class)
  60 +public class ConfigurationPrimitiveOrWrapperFieldTest extends AbstractConfigurationTest {
  61 +
  62 + @Inject
  63 + private PropertiesPrimitiveOrWrapperFieldConfig propertiesConfig;
  64 +
  65 + @Inject
  66 + private XMLPrimitiveOrWrapperFieldConfig xmlConfig;
  67 +
  68 + @Inject
  69 + private SystemPrimitiveOrWrapperFieldConfig systemConfig;
  70 +
  71 + @Inject
  72 + private PropertiesPrimitiveOrWrapperErrorFieldConfig propertiesErrorConfig;
  73 +
  74 + @Inject
  75 + private XMLPrimitiveOrWrapperErrorFieldConfig xmlErrorConfig;
  76 +
  77 + @Inject
  78 + private SystemPrimitiveOrWrapperErrorFieldConfig systemErrorConfig;
  79 +
  80 + @Deployment
  81 + public static JavaArchive createDeployment() {
  82 + JavaArchive deployment = createConfigurationDeployment();
  83 +
  84 + deployment.addPackages(true, ConfigurationPrimitiveOrWrapperFieldTest.class.getPackage());
  85 + deployment.addAsResource(
  86 + new FileAsset(new File(
  87 + "src/test/resources/configuration/field/primitiveorwrapper/demoiselle.properties")),
  88 + "demoiselle.properties").addAsResource(
  89 + new FileAsset(new File("src/test/resources/configuration/field/primitiveorwrapper/demoiselle.xml")),
  90 + "demoiselle.xml");
  91 +
  92 + return deployment;
  93 + }
  94 +
  95 + @BeforeClass
  96 + public static void afterClass() {
  97 + System.setProperty("primitiveInteger", String.valueOf(1));
  98 + System.setProperty("emptyPrimitiveInteger", String.valueOf(""));
  99 + System.setProperty("errorPrimitiveInteger", String.valueOf("a"));
  100 + System.setProperty("wrappedInteger", String.valueOf(2));
  101 + System.setProperty("emptyWrappedInteger", String.valueOf(""));
  102 + System.setProperty("errorWrappedInteger", String.valueOf("a"));
  103 + }
  104 +
  105 + @Test
  106 + public void loadPrimitiveInteger() {
  107 + int expected = 1;
  108 +
  109 + assertEquals(expected, systemConfig.getPrimitiveInteger());
  110 + assertEquals(expected, propertiesConfig.getPrimitiveInteger());
  111 + assertEquals(expected, xmlConfig.getPrimitiveInteger());
  112 + }
  113 +
  114 + @Test
  115 + public void loadWrappedInteger() {
  116 + Integer expected = 2;
  117 +
  118 + assertEquals(expected, systemConfig.getWrappedInteger());
  119 + assertEquals(expected, propertiesConfig.getWrappedInteger());
  120 + assertEquals(expected, xmlConfig.getWrappedInteger());
  121 + }
  122 +
  123 + @Test
  124 + public void loadEmptyPrimitiveInteger() {
  125 + try {
  126 + systemErrorConfig.getEmptyPrimitiveInteger();
  127 + } catch (ConfigurationException cause) {
  128 + assertEquals(ConversionException.class, cause.getCause().getClass());
  129 + }
  130 +
  131 + try {
  132 + propertiesErrorConfig.getEmptyPrimitiveInteger();
  133 + } catch (ConfigurationException cause) {
  134 + assertEquals(ConversionException.class, cause.getCause().getClass());
  135 + }
  136 +
  137 + try {
  138 + propertiesErrorConfig.getEmptyPrimitiveInteger();
  139 + } catch (ConfigurationException cause) {
  140 + assertEquals(ConversionException.class, cause.getCause().getClass());
  141 + }
  142 + }
  143 +
  144 + @Test
  145 + public void loadNullWrappedInteger() {
  146 + try {
  147 + systemErrorConfig.getEmptyWrappedInteger();
  148 + } catch (ConfigurationException cause) {
  149 + assertEquals(ConversionException.class, cause.getCause().getClass());
  150 + }
  151 +
  152 + try {
  153 + propertiesErrorConfig.getEmptyWrappedInteger();
  154 + } catch (ConfigurationException cause) {
  155 + assertEquals(ConversionException.class, cause.getCause().getClass());
  156 + }
  157 +
  158 + try {
  159 + propertiesErrorConfig.getEmptyWrappedInteger();
  160 + } catch (ConfigurationException cause) {
  161 + assertEquals(ConversionException.class, cause.getCause().getClass());
  162 + }
  163 + }
  164 +
  165 + @Test
  166 + public void loadErrorPrimitiveInteger() {
  167 + try {
  168 + propertiesErrorConfig.getErrorPrimitiveInteger();
  169 + fail();
  170 + } catch (ConfigurationException cause) {
  171 + assertEquals(ConversionException.class, cause.getCause().getClass());
  172 + }
  173 +
  174 + try {
  175 + propertiesErrorConfig.getErrorPrimitiveInteger();
  176 + fail();
  177 + } catch (ConfigurationException cause) {
  178 + assertEquals(ConversionException.class, cause.getCause().getClass());
  179 + }
  180 +
  181 + try {
  182 + xmlErrorConfig.getErrorPrimitiveInteger();
  183 + fail();
  184 + } catch (ConfigurationException cause) {
  185 + assertEquals(ConversionException.class, cause.getCause().getClass());
  186 + }
  187 + }
  188 +
  189 + @Test
  190 + public void loadErrorWrappedInteger() {
  191 + try {
  192 + propertiesErrorConfig.getErrorWrappedInteger();
  193 + fail();
  194 + } catch (ConfigurationException cause) {
  195 + assertEquals(ConversionException.class, cause.getCause().getClass());
  196 + }
  197 +
  198 + try {
  199 + propertiesErrorConfig.getErrorWrappedInteger();
  200 + fail();
  201 + } catch (ConfigurationException cause) {
  202 + assertEquals(ConversionException.class, cause.getCause().getClass());
  203 + }
  204 +
  205 + try {
  206 + xmlErrorConfig.getErrorWrappedInteger();
  207 + fail();
  208 + } catch (ConfigurationException cause) {
  209 + assertEquals(ConversionException.class, cause.getCause().getClass());
  210 + }
  211 + }
  212 +}
impl/core/src/test/java/configuration/field/primitiveorwrapper/PropertiesPrimitiveOrWrapperErrorFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.primitiveorwrapper;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = PROPERTIES)
  43 +public class PropertiesPrimitiveOrWrapperErrorFieldConfig extends AbstractPrimitiveOrWrapperErrorFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/primitiveorwrapper/PropertiesPrimitiveOrWrapperFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.primitiveorwrapper;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = PROPERTIES)
  43 +public class PropertiesPrimitiveOrWrapperFieldConfig extends AbstractPrimitiveOrWrapperFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/primitiveorwrapper/SystemPrimitiveOrWrapperErrorFieldConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.field.primitiveorwrapper;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.SYSTEM;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = SYSTEM)
  43 +public class SystemPrimitiveOrWrapperErrorFieldConfig extends AbstractPrimitiveOrWrapperErrorFieldConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/field/primitiveorwrapper/SystemPrimitiveOrWrapperFieldConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.field.primitiveorwrapper;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.SYSTEM;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = SYSTEM)
  43 +public class SystemPrimitiveOrWrapperFieldConfig extends AbstractPrimitiveOrWrapperFieldConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/field/primitiveorwrapper/XMLPrimitiveOrWrapperErrorFieldConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.field.primitiveorwrapper;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = XML)
  43 +public class XMLPrimitiveOrWrapperErrorFieldConfig extends AbstractPrimitiveOrWrapperErrorFieldConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/field/primitiveorwrapper/XMLPrimitiveOrWrapperFieldConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.field.primitiveorwrapper;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = XML)
  43 +public class XMLPrimitiveOrWrapperFieldConfig extends AbstractPrimitiveOrWrapperFieldConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/field/string/AbstractStringFieldConfig.java 0 → 100644
@@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
  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.field.string;
  38 +
  39 +public abstract class AbstractStringFieldConfig {
  40 +
  41 + private String stringWithSpace;
  42 +
  43 + private String stringWithComma;
  44 +
  45 + private String emptyString;
  46 +
  47 + public String getStringWithSpace() {
  48 + return stringWithSpace;
  49 + }
  50 +
  51 + public String getStringWithComma() {
  52 + return stringWithComma;
  53 + }
  54 +
  55 + public String getEmptyString() {
  56 + return emptyString;
  57 + }
  58 +}
impl/core/src/test/java/configuration/field/string/ConfigurationStringFieldTest.java 0 → 100644
@@ -0,0 +1,114 @@ @@ -0,0 +1,114 @@
  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.field.string;
  38 +
  39 +import static junit.framework.Assert.assertEquals;
  40 +
  41 +import java.io.File;
  42 +
  43 +import javax.inject.Inject;
  44 +
  45 +import org.jboss.arquillian.container.test.api.Deployment;
  46 +import org.jboss.arquillian.junit.Arquillian;
  47 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  48 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  49 +import org.junit.BeforeClass;
  50 +import org.junit.Test;
  51 +import org.junit.runner.RunWith;
  52 +
  53 +import configuration.AbstractConfigurationTest;
  54 +
  55 +
  56 +@RunWith(Arquillian.class)
  57 +public class ConfigurationStringFieldTest extends AbstractConfigurationTest {
  58 +
  59 + @Inject
  60 + private PropertiesStringFieldConfig propertiesConfig;
  61 +
  62 + @Inject
  63 + private XMLStringFieldConfig xmlConfig;
  64 +
  65 + @Inject
  66 + private SystemBasicFieldConfig systemConfig;
  67 +
  68 + @Deployment
  69 + public static JavaArchive createDeployment() {
  70 + JavaArchive deployment = createConfigurationDeployment();
  71 +
  72 + deployment.addPackages(true, ConfigurationStringFieldTest.class.getPackage());
  73 + deployment.addAsResource(
  74 + new FileAsset(new File("src/test/resources/configuration/field/string/demoiselle.properties")),
  75 + "demoiselle.properties").addAsResource(
  76 + new FileAsset(new File("src/test/resources/configuration/field/string/demoiselle.xml")),
  77 + "demoiselle.xml");
  78 +
  79 + return deployment;
  80 + }
  81 +
  82 + @BeforeClass
  83 + public static void afterClass() {
  84 + System.setProperty("stringWithSpace", String.valueOf("demoiselle framework"));
  85 + System.setProperty("stringWithComma", String.valueOf("demoiselle, framework"));
  86 + System.setProperty("emptyString", String.valueOf(""));
  87 + }
  88 +
  89 + @Test
  90 + public void loadStringWithSpace() {
  91 + String expected = "demoiselle framework";
  92 +
  93 + assertEquals(expected, systemConfig.getStringWithSpace());
  94 + assertEquals(expected, propertiesConfig.getStringWithSpace());
  95 + assertEquals(expected, xmlConfig.getStringWithSpace());
  96 + }
  97 +
  98 + @Test
  99 + public void loadStringWithComma() {
  100 + String expected = "demoiselle, framework";
  101 +
  102 + assertEquals(expected, systemConfig.getStringWithComma());
  103 + assertEquals(expected, propertiesConfig.getStringWithComma());
  104 + assertEquals(expected, xmlConfig.getStringWithComma());
  105 + }
  106 +
  107 + @Test
  108 + public void loadEmptyString() {
  109 + String expected = "";
  110 + assertEquals(expected, systemConfig.getEmptyString());
  111 + assertEquals(expected, propertiesConfig.getEmptyString());
  112 + assertEquals(expected, xmlConfig.getEmptyString());
  113 + }
  114 +}
impl/core/src/test/java/configuration/field/string/PropertiesStringFieldConfig.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  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.field.string;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = PROPERTIES)
  43 +public class PropertiesStringFieldConfig extends AbstractStringFieldConfig {
  44 +}
impl/core/src/test/java/configuration/field/string/SystemBasicFieldConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.field.string;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.SYSTEM;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = SYSTEM)
  43 +public class SystemBasicFieldConfig extends AbstractStringFieldConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/field/string/XMLStringFieldConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.field.string;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = XML)
  43 +public class XMLStringFieldConfig extends AbstractStringFieldConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/prefix/AbstractPrefixConfig.java 0 → 100644
@@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
  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.prefix;
  38 +
  39 +public abstract class AbstractPrefixConfig {
  40 +
  41 + private String prefixedAttribute;
  42 +
  43 + public String getPrefixedAttribute() {
  44 + return prefixedAttribute;
  45 + }
  46 +
  47 + public void setPrefixedAttribute(String prefixedAttribute) {
  48 + this.prefixedAttribute = prefixedAttribute;
  49 + }
  50 +}
impl/core/src/test/java/configuration/prefix/ConfigurationPrefixTest.java 0 → 100644
@@ -0,0 +1,113 @@ @@ -0,0 +1,113 @@
  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.prefix;
  38 +
  39 +import static junit.framework.Assert.assertNull;
  40 +import static org.junit.Assert.assertEquals;
  41 +
  42 +import java.io.File;
  43 +
  44 +import javax.inject.Inject;
  45 +
  46 +import org.jboss.arquillian.container.test.api.Deployment;
  47 +import org.jboss.arquillian.junit.Arquillian;
  48 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  49 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  50 +import org.junit.Test;
  51 +import org.junit.runner.RunWith;
  52 +
  53 +import configuration.AbstractConfigurationTest;
  54 +
  55 +
  56 +@RunWith(Arquillian.class)
  57 +public class ConfigurationPrefixTest extends AbstractConfigurationTest {
  58 +
  59 + @Inject
  60 + private PropertyPrefixEndingWithoutDot propertyEndingWithoutDotPrefix;
  61 +
  62 + @Inject
  63 + private PropertyMissingPrefix propertyMissingPrefix;
  64 +
  65 + @Inject
  66 + private PropertyPrefixEndingWithDot propertyEndingWithDotPrefix;
  67 +
  68 +
  69 + @Inject
  70 + private XMLPrefixEndingWithoutDot xmlEndingWithoutDotPrefix;
  71 +
  72 + @Inject
  73 + private XMLMissingPrefix xmlMissingPrefix;
  74 +
  75 + @Inject
  76 + private XMLPrefixEndingWithDot xmlEndingWithDotPrefix;
  77 +
  78 + @Deployment
  79 + public static JavaArchive createDeployment() {
  80 + JavaArchive deployment = createConfigurationDeployment();
  81 +
  82 + deployment.addPackages(true, ConfigurationPrefixTest.class.getPackage());
  83 + deployment.addAsResource(
  84 + new FileAsset(new File("src/test/resources/configuration/prefix/demoiselle.properties")),
  85 + "demoiselle.properties").addAsResource(
  86 + new FileAsset(new File("src/test/resources/configuration/prefix/demoiselle.xml")),
  87 + "demoiselle.xml");
  88 +
  89 + return deployment;
  90 + }
  91 +
  92 + @Test
  93 + public void loadFromPrefixedExistentProperty() {
  94 + String expected = "prefix ending without dot";
  95 +
  96 + assertEquals(expected, propertyEndingWithoutDotPrefix.getPrefixedAttribute());
  97 + assertEquals(expected, xmlEndingWithoutDotPrefix.getPrefixedAttribute());
  98 + }
  99 +
  100 + @Test
  101 + public void loadFromPrefixedWithouPrefixOnProperty() {
  102 + assertNull(propertyMissingPrefix.getPrefixedAttribute());
  103 + assertNull(xmlMissingPrefix.getPrefixedAttribute());
  104 + }
  105 +
  106 + @Test
  107 + public void loadPrefixEndingWithDot() {
  108 + String expected = "prefix ending with dot";
  109 +
  110 + assertEquals(expected, propertyEndingWithDotPrefix.getPrefixedAttribute());
  111 + assertEquals(expected, propertyEndingWithDotPrefix.getPrefixedAttribute());
  112 + }
  113 +}
impl/core/src/test/java/configuration/prefix/PropertyMissingPrefix.java 0 → 100644
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +package configuration.prefix;
  2 +
  3 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  4 +
  5 +@Configuration(prefix = "missing.prefix")
  6 +public class PropertyMissingPrefix extends AbstractPrefixConfig {
  7 +}
impl/core/src/test/java/configuration/prefix/PropertyPrefixEndingWithDot.java 0 → 100644
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +package configuration.prefix;
  2 +
  3 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  4 +
  5 +@Configuration(prefix = "endingWithDot.")
  6 +public class PropertyPrefixEndingWithDot extends AbstractPrefixConfig {
  7 +}
impl/core/src/test/java/configuration/prefix/PropertyPrefixEndingWithoutDot.java 0 → 100644
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +package configuration.prefix;
  2 +
  3 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  4 +
  5 +@Configuration(prefix = "prefix")
  6 +public class PropertyPrefixEndingWithoutDot extends AbstractPrefixConfig {
  7 +}
impl/core/src/test/java/configuration/prefix/XMLMissingPrefix.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.prefix;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(type = XML, prefix = "missing.prefix")
  7 +public class XMLMissingPrefix extends AbstractPrefixConfig {
  8 +}
impl/core/src/test/java/configuration/prefix/XMLPrefixEndingWithDot.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.prefix;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(type = XML, prefix = "endingWithDot.")
  7 +public class XMLPrefixEndingWithDot extends AbstractPrefixConfig {
  8 +}
impl/core/src/test/java/configuration/prefix/XMLPrefixEndingWithoutDot.java 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +package configuration.prefix;
  2 +
  3 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  4 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  5 +
  6 +@Configuration(type = XML, prefix = "prefix")
  7 +public class XMLPrefixEndingWithoutDot extends AbstractPrefixConfig {
  8 +}
impl/core/src/test/java/configuration/resource/AbstractResourceConfig.java 0 → 100644
@@ -0,0 +1,46 @@ @@ -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 +package configuration.resource;
  38 +
  39 +public abstract class AbstractResourceConfig {
  40 +
  41 + private String string;
  42 +
  43 + public String getStringWithComma() {
  44 + return string;
  45 + }
  46 +}
impl/core/src/test/java/configuration/resource/ConfigurationResourceTest.java 0 → 100644
@@ -0,0 +1,133 @@ @@ -0,0 +1,133 @@
  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.resource;
  38 +
  39 +import static junit.framework.Assert.assertEquals;
  40 +
  41 +import java.io.File;
  42 +
  43 +import javax.inject.Inject;
  44 +
  45 +import org.jboss.arquillian.container.test.api.Deployment;
  46 +import org.jboss.arquillian.junit.Arquillian;
  47 +import org.jboss.shrinkwrap.api.asset.FileAsset;
  48 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  49 +import org.junit.Test;
  50 +import org.junit.runner.RunWith;
  51 +
  52 +import configuration.AbstractConfigurationTest;
  53 +
  54 +
  55 +@RunWith(Arquillian.class)
  56 +public class ConfigurationResourceTest extends AbstractConfigurationTest {
  57 +
  58 + @Inject
  59 + private PropertiesDefaultFileConfig propDefault;
  60 +
  61 + @Inject
  62 + private PropertiesNamedDefaultFileConfig propNamedDefault;
  63 +
  64 + @Inject
  65 + private PropertiesNotDefaultFileConfig propNotDefault;
  66 +
  67 + @Inject
  68 + private PropertiesWithoutFileConfig propWithoutFile;
  69 +
  70 + @Inject
  71 + private XMLDefaultFileConfig xmlDefault;
  72 +
  73 + @Inject
  74 + private XMLNamedDefaultFileConfig xmlNamedDefault;
  75 +
  76 + @Inject
  77 + private XMLNotDefaultFileConfig xmlNotDefault;
  78 +
  79 + @Inject
  80 + private XMLWithoutFileConfig xmlWithoutFile;
  81 +
  82 + @Deployment
  83 + public static JavaArchive createDeployment() {
  84 + JavaArchive deployment = createConfigurationDeployment();
  85 +
  86 + deployment.addPackages(true, ConfigurationResourceTest.class.getPackage());
  87 + deployment
  88 + .addAsResource(
  89 + new FileAsset(new File("src/test/resources/configuration/resource/demoiselle.properties")),
  90 + "demoiselle.properties")
  91 + .addAsResource(new FileAsset(new File("src/test/resources/configuration/resource/demoiselle.xml")),
  92 + "demoiselle.xml")
  93 + .addAsResource(
  94 + new FileAsset(new File("src/test/resources/configuration/resource/resource.properties")),
  95 + "resource.properties")
  96 + .addAsResource(new FileAsset(new File("src/test/resources/configuration/resource/resource.xml")),
  97 + "resource.xml");
  98 +
  99 + return deployment;
  100 + }
  101 +
  102 + @Test
  103 + public void loadFromDefaultFile() {
  104 + String expected = "demoiselle";
  105 +
  106 + assertEquals(expected, propDefault.getStringWithComma());
  107 + assertEquals(expected, xmlDefault.getStringWithComma());
  108 + }
  109 +
  110 + @Test
  111 + public void loadFromNamedDefaultFile() {
  112 + String expected = "demoiselle";
  113 +
  114 + assertEquals(expected, propNamedDefault.getStringWithComma());
  115 + assertEquals(expected, xmlNamedDefault.getStringWithComma());
  116 + }
  117 +
  118 + @Test
  119 + public void loadFromNotDefaultFile() {
  120 + String expected = "demoiselle";
  121 +
  122 + assertEquals(expected, propNotDefault.getStringWithComma());
  123 + assertEquals(expected, xmlNotDefault.getStringWithComma());
  124 + }
  125 +
  126 + @Test
  127 + public void loadFromNonexistentFile() {
  128 + String expected = null;
  129 +
  130 + assertEquals(expected, propWithoutFile.getStringWithComma());
  131 + assertEquals(expected, xmlWithoutFile.getStringWithComma());
  132 + }
  133 +}
impl/core/src/test/java/configuration/resource/PropertiesDefaultFileConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.resource;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = PROPERTIES)
  43 +public class PropertiesDefaultFileConfig extends AbstractResourceConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/resource/PropertiesNamedDefaultFileConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.resource;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "demoiselle", type = PROPERTIES)
  43 +public class PropertiesNamedDefaultFileConfig extends AbstractResourceConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/resource/PropertiesNotDefaultFileConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.resource;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "resource", type = PROPERTIES)
  43 +public class PropertiesNotDefaultFileConfig extends AbstractResourceConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/resource/PropertiesWithoutFileConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.resource;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "nofile", type = PROPERTIES)
  43 +public class PropertiesWithoutFileConfig extends AbstractResourceConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/resource/XMLDefaultFileConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.resource;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(type = XML)
  43 +public class XMLDefaultFileConfig extends AbstractResourceConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/resource/XMLNamedDefaultFileConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.resource;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "demoiselle", type = XML)
  43 +public class XMLNamedDefaultFileConfig extends AbstractResourceConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/resource/XMLNotDefaultFileConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.resource;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "resource", type = XML)
  43 +public class XMLNotDefaultFileConfig extends AbstractResourceConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/resource/XMLWithoutFileConfig.java 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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.resource;
  38 +
  39 +import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML;
  40 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  41 +
  42 +@Configuration(resource = "nofile", type = XML)
  43 +public class XMLWithoutFileConfig extends AbstractResourceConfig {
  44 +
  45 +}
impl/core/src/test/java/configuration/scope/AbstractScopedConfig.java 0 → 100644
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
  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.scope;
  38 +
  39 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  40 +
  41 +@Configuration
  42 +public abstract class AbstractScopedConfig {
  43 +
  44 + private String string;
  45 +
  46 + public String getStringWithComma() {
  47 + return string;
  48 + }
  49 +}
impl/core/src/test/java/configuration/scope/ConfigurationScopeTest.java 0 → 100644
@@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
  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.scope;
  38 +
  39 +import static junit.framework.Assert.assertNotSame;
  40 +import static junit.framework.Assert.assertSame;
  41 +
  42 +import org.jboss.arquillian.container.test.api.Deployment;
  43 +import org.jboss.arquillian.junit.Arquillian;
  44 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  45 +import org.junit.Test;
  46 +import org.junit.runner.RunWith;
  47 +
  48 +import configuration.AbstractConfigurationTest;
  49 +
  50 +import br.gov.frameworkdemoiselle.util.Beans;
  51 +
  52 +@RunWith(Arquillian.class)
  53 +public class ConfigurationScopeTest extends AbstractConfigurationTest {
  54 +
  55 + @Deployment
  56 + public static JavaArchive createDeployment() {
  57 + JavaArchive deployment = createConfigurationDeployment();
  58 + deployment.addPackages(true, ConfigurationScopeTest.class.getPackage());
  59 + return deployment;
  60 + }
  61 +
  62 + @Test
  63 + public void twoInvocationsSameInstance() {
  64 + DefaultScopeWithoutSuperClassConfig config1 = Beans.getReference(DefaultScopeWithoutSuperClassConfig.class);
  65 + DefaultScopeWithoutSuperClassConfig config2 = Beans.getReference(DefaultScopeWithoutSuperClassConfig.class);
  66 +
  67 + assertSame(config1, config2);
  68 + }
  69 +
  70 + @Test
  71 + public void twoInvocationsDifferentInstances() {
  72 + DependentScopeWithoutSuperClassConfig config1 = Beans.getReference(DependentScopeWithoutSuperClassConfig.class);
  73 + DependentScopeWithoutSuperClassConfig config2 = Beans.getReference(DependentScopeWithoutSuperClassConfig.class);
  74 +
  75 + assertNotSame(config1, config2);
  76 + }
  77 +}
impl/core/src/test/java/configuration/scope/DefaultScopeWithoutSuperClassConfig.java 0 → 100644
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
  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.scope;
  38 +
  39 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  40 +
  41 +@Configuration
  42 +public class DefaultScopeWithoutSuperClassConfig {
  43 +
  44 + private String string;
  45 +
  46 + public String getString() {
  47 + return string;
  48 + }
  49 +}
impl/core/src/test/java/configuration/scope/DependentScopeWithoutSuperClassConfig.java 0 → 100644
@@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package configuration.scope;
  38 +
  39 +import javax.enterprise.context.Dependent;
  40 +
  41 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  42 +
  43 +@Dependent
  44 +@Configuration
  45 +public class DependentScopeWithoutSuperClassConfig {
  46 +
  47 + private String string;
  48 +
  49 + public String getString() {
  50 + return string;
  51 + }
  52 +}
impl/core/src/test/java/security/AbstractSecurityTest.java 0 → 100644
@@ -0,0 +1,56 @@ @@ -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 security;
  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 abstract class AbstractSecurityTest {
  46 +
  47 + public static JavaArchive createConfigurationDeployment() {
  48 + return ShrinkWrap
  49 + .create(JavaArchive.class)
  50 + .addPackages(true, "br")
  51 + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
  52 + .addAsManifestResource(
  53 + new File("src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension"),
  54 + "services/javax.enterprise.inject.spi.Extension");
  55 + }
  56 +}
impl/core/src/test/java/util/ExceptionsTest.java 0 → 100644
@@ -0,0 +1,90 @@ @@ -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 +package util;
  38 +
  39 +import static org.junit.Assert.assertFalse;
  40 +import static org.junit.Assert.assertTrue;
  41 +import static org.junit.Assert.fail;
  42 +
  43 +import org.junit.Test;
  44 +
  45 +import br.gov.frameworkdemoiselle.exception.ApplicationException;
  46 +import br.gov.frameworkdemoiselle.util.Exceptions;
  47 +
  48 +public class ExceptionsTest {
  49 +
  50 + @Test
  51 + public void testIsApplicationException() {
  52 + assertTrue(Exceptions.isApplicationException(new MyException()));
  53 + assertFalse(Exceptions.isApplicationException(new Exception()));
  54 + }
  55 +
  56 + @Test
  57 + public void testHandleRuntimeException() {
  58 + try {
  59 + Exceptions.handleToRuntimeException(new SomeRuntimeException());
  60 + fail();
  61 + } catch (Throwable t) {
  62 + if (!RuntimeException.class.isInstance(t)) {
  63 + fail();
  64 + }
  65 + }
  66 +
  67 + try {
  68 + Exceptions.handleToRuntimeException(new Exception());
  69 + fail();
  70 + } catch (Throwable t) {
  71 + if (!RuntimeException.class.isInstance(t)) {
  72 + fail();
  73 + }
  74 + }
  75 +
  76 + }
  77 +
  78 +}
  79 +
  80 +@ApplicationException
  81 +class MyException extends Exception {
  82 +
  83 + private static final long serialVersionUID = 1L;
  84 +}
  85 +
  86 +class SomeRuntimeException extends RuntimeException {
  87 +
  88 + private static final long serialVersionUID = 1L;
  89 +
  90 +}
impl/core/src/test/java/util/ReflectionsTest.java 0 → 100644
@@ -0,0 +1,75 @@ @@ -0,0 +1,75 @@
  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 static org.junit.Assert.assertEquals;
  40 +
  41 +import java.lang.reflect.Member;
  42 +
  43 +import org.junit.Test;
  44 +
  45 +import br.gov.frameworkdemoiselle.util.Reflections;
  46 +
  47 +public class ReflectionsTest {
  48 +
  49 + @Test
  50 + public void testGetGenericTypeArgumentClass() {
  51 + assertEquals(Long.class, Reflections.getGenericTypeArgument(OtherClass.class, 0));
  52 + assertEquals(String.class, Reflections.getGenericTypeArgument(OtherClass.class, 1));
  53 + }
  54 +
  55 + @Test
  56 + public void testGetGenericTypeArgumentMember() throws SecurityException, NoSuchFieldException {
  57 + Member[] members = OtherClass.class.getFields();
  58 + assertEquals(Long.class, Reflections.getGenericTypeArgument(members[0], 0));
  59 + assertEquals(String.class, Reflections.getGenericTypeArgument(members[1], 0));
  60 + }
  61 +}
  62 +
  63 +class SomeClass<T, I> {
  64 +
  65 + public void setNumber(T t) {
  66 +
  67 + }
  68 +}
  69 +
  70 +class OtherClass extends SomeClass<Long, String> {
  71 +
  72 + public Class<Long> number;
  73 +
  74 + public Class<String> text;
  75 +}
impl/core/src/test/java/util/ResourceBundleTest.java 0 → 100644
@@ -0,0 +1,126 @@ @@ -0,0 +1,126 @@
  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 static org.junit.Assert.assertEquals;
  40 +import static org.junit.Assert.assertFalse;
  41 +import static org.junit.Assert.assertTrue;
  42 +
  43 +import java.util.Enumeration;
  44 +import java.util.Locale;
  45 +
  46 +import org.junit.Before;
  47 +import org.junit.Ignore;
  48 +import org.junit.Test;
  49 +
  50 +import br.gov.frameworkdemoiselle.util.ResourceBundle;
  51 +
  52 +@Ignore
  53 +public class ResourceBundleTest {
  54 +
  55 + /**
  56 + * This is a workaround to mock java.util.ResourceBundle. Since getString(key) method is defined as final, there is
  57 + * no way to extend and override it. For that reason, setting expectations (i.e. expect(...)) won't work.
  58 + */
  59 + private ResourceBundle resourceBundle;
  60 +
  61 + @Before
  62 + public void setUp() throws Exception {
  63 + resourceBundle = new ResourceBundle("resource-bundle", new Locale("pt"));
  64 + }
  65 +
  66 + @Test
  67 + public void containsKey() {
  68 + assertTrue(resourceBundle.containsKey("msgWithoutParams"));
  69 +
  70 + assertFalse(resourceBundle.containsKey("inexistentKey"));
  71 + }
  72 +
  73 + @Test
  74 + public void getKeys() {
  75 + int keyCount = 0;
  76 +
  77 + Enumeration<String> e = resourceBundle.getKeys();
  78 +
  79 + while (e.hasMoreElements()) {
  80 + keyCount++;
  81 + e.nextElement();
  82 + }
  83 +
  84 + assertEquals(resourceBundle.keySet().size(), keyCount);
  85 + }
  86 +
  87 + @Test
  88 + public void testGetLocale() {
  89 + assertEquals(resourceBundle.getLocale(), new Locale("pt"));
  90 + }
  91 +
  92 + @Test
  93 + public void testKeySet() {
  94 + assertEquals(2, resourceBundle.keySet().size());
  95 + }
  96 +
  97 + @Test
  98 + public void getString() {
  99 + assertEquals("no params", resourceBundle.getString("msgWithoutParams"));
  100 +
  101 + assertEquals("params: a, b", resourceBundle.getString("msgWithParams", "a", "b"));
  102 +
  103 + assertEquals("params: {0}, {1}", resourceBundle.getString("msgWithParams"));
  104 + }
  105 +
  106 + /**
  107 + * For this test, java.util.ResourceBundle is mocked to force an exception. Since the getString method is called
  108 + * from the actual ResourceBundle, not from the mock, it tries to find a handleGetObject method that doesn't exist.
  109 + *
  110 + * @throws Exception
  111 + */
  112 + // @Test(expected = RuntimeException.class)
  113 + // public void getStringWhenHandleGetObjectThrowsException() {
  114 + // mockResourceBundle = createMock(java.util.ResourceBundle.class);
  115 + // resourceBundle = new ResourceBundle(mockResourceBundle);
  116 + //
  117 + // replay(mockResourceBundle);
  118 + //
  119 + // resourceBundle.getString("msgWithParams");
  120 + //
  121 + // verify(mockResourceBundle);
  122 + //
  123 + // Assert.fail();
  124 + // }
  125 +
  126 +}
impl/core/src/test/java/util/StringsTest.java 0 → 100644
@@ -0,0 +1,202 @@ @@ -0,0 +1,202 @@
  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 static org.junit.Assert.assertEquals;
  40 +import static org.junit.Assert.assertFalse;
  41 +import static org.junit.Assert.assertNull;
  42 +import static org.junit.Assert.assertTrue;
  43 +
  44 +import org.junit.Test;
  45 +
  46 +import br.gov.frameworkdemoiselle.annotation.Ignore;
  47 +import br.gov.frameworkdemoiselle.util.Strings;
  48 +
  49 +public class StringsTest {
  50 +
  51 + @Test
  52 + public void getString() {
  53 + testEqualsGetString("teste", "teste");
  54 + testEqualsGetString("", "");
  55 + testEqualsGetString(null, null);
  56 + testEqualsGetString(null, null, "teste");
  57 + testEqualsGetString("{0}", "teste", "teste");
  58 + testEqualsGetString("teste", "teste", (Object[]) null);
  59 + testEqualsGetString("teste {0}", "teste 1", "1");
  60 + testEqualsGetString("{0} teste", "Um teste", "Um");
  61 + testEqualsGetString("{1} testando {0}", "Apenas testando novamente", "novamente", "Apenas");
  62 + testEqualsGetString("{0} testando {1}", "Apenas testando {1}", "Apenas", null);
  63 + testEqualsGetString("testando {1} novamente", "testando isto novamente", "aquilo", "isto");
  64 + testEqualsGetString("teste", "teste", "1", "2");
  65 + testEqualsGetString("teste {0}.", "teste \\.", "\\");
  66 + }
  67 +
  68 + @Test
  69 + public void isEmpty() {
  70 + assertTrue(Strings.isEmpty(null));
  71 + assertTrue(Strings.isEmpty(""));
  72 + assertTrue(Strings.isEmpty(" "));
  73 + assertTrue(Strings.isEmpty(" "));
  74 +
  75 + assertFalse(Strings.isEmpty(" _ "));
  76 + assertFalse(Strings.isEmpty("."));
  77 + assertFalse(Strings.isEmpty("null"));
  78 + }
  79 +
  80 + @Test
  81 + public void isResourceBundleKeyFormat() {
  82 + assertTrue(Strings.isResourceBundleKeyFormat("{x}"));
  83 + assertTrue(Strings.isResourceBundleKeyFormat("{.}"));
  84 + assertTrue(Strings.isResourceBundleKeyFormat("{*}"));
  85 + assertTrue(Strings.isResourceBundleKeyFormat("{$}"));
  86 + assertFalse(Strings.isResourceBundleKeyFormat("{}"));
  87 + assertFalse(Strings.isResourceBundleKeyFormat(""));
  88 + assertFalse(Strings.isResourceBundleKeyFormat(" "));
  89 + assertFalse(Strings.isResourceBundleKeyFormat(null));
  90 + assertFalse(Strings.isResourceBundleKeyFormat("a{a}a"));
  91 + assertFalse(Strings.isResourceBundleKeyFormat("a{a}"));
  92 + assertFalse(Strings.isResourceBundleKeyFormat("{a}a"));
  93 + assertFalse(Strings.isResourceBundleKeyFormat(" {a} "));
  94 + assertFalse(Strings.isResourceBundleKeyFormat("{a"));
  95 + assertFalse(Strings.isResourceBundleKeyFormat("a}"));
  96 + }
  97 +
  98 + @Test
  99 + public void camelCaseToSymbolSeparated() {
  100 + assertEquals(null, Strings.camelCaseToSymbolSeparated(null, null));
  101 + assertEquals(null, Strings.camelCaseToSymbolSeparated(null, "."));
  102 + assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", null));
  103 + assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", ""));
  104 + assertEquals("my.var", Strings.camelCaseToSymbolSeparated("myVar", "."));
  105 + assertEquals("my-var", Strings.camelCaseToSymbolSeparated("MyVar", "-"));
  106 + assertEquals("my?var?name", Strings.camelCaseToSymbolSeparated("myVarName", "?"));
  107 + assertEquals("my___var___name", Strings.camelCaseToSymbolSeparated("myVarName", "___"));
  108 + }
  109 +
  110 + @Test
  111 + public void firstToUpper() {
  112 + assertNull(Strings.firstToUpper(null));
  113 + assertEquals("", Strings.firstToUpper(""));
  114 + assertEquals("A", Strings.firstToUpper("a"));
  115 + assertEquals("A", Strings.firstToUpper("A"));
  116 + assertEquals("Ab", Strings.firstToUpper("Ab"));
  117 + assertEquals("AB", Strings.firstToUpper("AB"));
  118 + assertEquals("Ab", Strings.firstToUpper("ab"));
  119 + assertEquals("AB", Strings.firstToUpper("aB"));
  120 + }
  121 +
  122 + @Test
  123 + public void toStringWhenObjectIsNull() {
  124 + assertEquals("", Strings.toString(null));
  125 + }
  126 +
  127 + @Test
  128 + public void classToString() throws SecurityException, NoSuchFieldException {
  129 + @SuppressWarnings("unused")
  130 + class Test {
  131 +
  132 + private String name = "myName";
  133 +
  134 + private String lastname = "myLastname";
  135 +
  136 + private String nullField = null;
  137 +
  138 + @Ignore
  139 + private String ignore = "ignoreMe";
  140 +
  141 + }
  142 +
  143 + String result = Strings.toString(new Test());
  144 + assertTrue(result.contains("Test [name=myName, lastname=myLastname, nullField=null, this"));
  145 + }
  146 +
  147 + private void testEqualsGetString(String in, String expected, Object... params) {
  148 + String out = Strings.getString(in, params);
  149 + assertEquals(expected, out);
  150 + }
  151 +
  152 + @Test
  153 + public void removeBraces() {
  154 + assertNull(Strings.removeBraces(null));
  155 + assertEquals("", Strings.removeBraces(""));
  156 + assertEquals(" ", Strings.removeBraces(" "));
  157 + assertEquals(" {x} ", Strings.removeBraces(" {x} "));
  158 + assertEquals("{x} ", Strings.removeBraces("{x} "));
  159 + assertEquals(" {x}", Strings.removeBraces(" {x}"));
  160 + assertEquals("x", Strings.removeBraces("{x}"));
  161 + assertEquals("a b c", Strings.removeBraces("{a b c}"));
  162 + assertEquals("{}", Strings.removeBraces("{}"));
  163 + assertEquals("{}", Strings.removeBraces("{{}}"));
  164 + assertEquals("?", Strings.removeBraces("{?}"));
  165 + assertEquals("*", Strings.removeBraces("{*}"));
  166 + }
  167 +
  168 + @Test
  169 + public void insertBraces() {
  170 + assertNull(Strings.insertBraces(null));
  171 + assertEquals("", Strings.insertBraces(""));
  172 + assertEquals(" ", Strings.insertBraces(" "));
  173 + assertEquals("{ x }", Strings.insertBraces(" x "));
  174 + assertEquals("{ {x} }", Strings.insertBraces(" {x} "));
  175 + assertEquals("{{x}", Strings.insertBraces("{x"));
  176 + assertEquals("{*}", Strings.insertBraces("*"));
  177 + assertEquals("{?}", Strings.insertBraces("?"));
  178 + }
  179 +
  180 + @Test
  181 + public void removeCharsWhenStringIsNull() {
  182 + assertEquals(null, Strings.removeChars(null, 'a'));
  183 + }
  184 +
  185 + @Test
  186 + public void removeCharsWhenStringIsNotNull() {
  187 + String string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus lobortis.";
  188 + string = Strings.removeChars(string, 'L', 'l');
  189 + assertEquals(-1, string.indexOf('L'));
  190 + assertEquals(-1, string.indexOf('l'));
  191 + }
  192 +
  193 + @Test
  194 + public void insertZeros() {
  195 + String string = "Lorem ipsum";
  196 + assertEquals("00000", Strings.insertZeros(null, 5));
  197 + assertEquals(string, Strings.insertZeros(string, string.length() - 1));
  198 + assertEquals(string, Strings.insertZeros(string, string.length()));
  199 + assertEquals("0" + string, Strings.insertZeros(string, string.length() + 1));
  200 + assertEquals("00" + string, Strings.insertZeros(string, string.length() + 2));
  201 + }
  202 +}
impl/core/src/test/resources/configuration/field/class/demoiselle.properties
@@ -33,8 +33,8 @@ @@ -33,8 +33,8 @@
33 # ou escreva para a Fundação do Software Livre (FSF) Inc., 33 # ou escreva para a Fundação do Software Livre (FSF) Inc.,
34 # 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. 34 # 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
35 35
36 -existentTypedClass=br.gov.frameworkdemoiselle.configuration.field.clazz.MyClass  
37 -existentUntypedClass=br.gov.frameworkdemoiselle.configuration.field.clazz.MyClass 36 +existentTypedClass=configuration.field.clazz.MyClass
  37 +existentUntypedClass=configuration.field.clazz.MyClass
38 nonExistentTypedClass=com.fake.NonExistentClass 38 nonExistentTypedClass=com.fake.NonExistentClass
39 nonExistentUntypedClass=com.fake.NonExistentClass 39 nonExistentUntypedClass=com.fake.NonExistentClass
40 nullTypedClass= 40 nullTypedClass=