Commit 6a9ae948cd4f16d314d40ab4c6a9142408af6afc
1 parent
4e4888ac
Exists in
master
Refatoração do pacote dos testes de valor padrão das configurações
Showing
10 changed files
with
279 additions
and
279 deletions
Show diff stats
impl/core/src/test/java/configuration/defaultvalue/AbstractDefaultValueConfig.java
... | ... | @@ -1,60 +0,0 @@ |
1 | -/* | |
2 | - * Demoiselle Framework | |
3 | - * Copyright (C) 2010 SERPRO | |
4 | - * ---------------------------------------------------------------------------- | |
5 | - * This file is part of Demoiselle Framework. | |
6 | - * | |
7 | - * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | - * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | - * as published by the Free Software Foundation. | |
10 | - * | |
11 | - * This program is distributed in the hope that it will be useful, | |
12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | - * GNU General Public License for more details. | |
15 | - * | |
16 | - * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | - * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | - * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | - * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | - * ---------------------------------------------------------------------------- | |
21 | - * Este arquivo é parte do Framework Demoiselle. | |
22 | - * | |
23 | - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | - * do Software Livre (FSF). | |
26 | - * | |
27 | - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | - * para maiores detalhes. | |
31 | - * | |
32 | - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | - * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | - */ | |
37 | -package configuration.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
... | ... | @@ -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 configuration.defaultvalue; | |
38 | - | |
39 | -import static junit.framework.Assert.assertEquals; | |
40 | - | |
41 | -import javax.inject.Inject; | |
42 | - | |
43 | -import org.jboss.arquillian.container.test.api.Deployment; | |
44 | -import org.jboss.arquillian.junit.Arquillian; | |
45 | -import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
46 | -import org.junit.Test; | |
47 | -import org.junit.runner.RunWith; | |
48 | - | |
49 | -import test.Tests; | |
50 | - | |
51 | -@RunWith(Arquillian.class) | |
52 | -public class ConfigurationDefaultValueTest { | |
53 | - | |
54 | - private static final String PATH = "src/test/resources/configuration/field/default"; | |
55 | - | |
56 | - @Inject | |
57 | - private FilledDefaultValueConfig filledFieldConfig; | |
58 | - | |
59 | - @Inject | |
60 | - private EmptyDefaultValueConfig emptyFieldsConfig; | |
61 | - | |
62 | - @Inject | |
63 | - private PropertyWithInexistenceFileConfig noFileConfig; | |
64 | - | |
65 | - @Deployment | |
66 | - public static JavaArchive createDeployment() { | |
67 | - JavaArchive deployment = Tests.createDeployment(ConfigurationDefaultValueTest.class); | |
68 | - deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
69 | - deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
70 | - return deployment; | |
71 | - } | |
72 | - | |
73 | - @Test | |
74 | - public void loadDefaultValueWithoutKey() { | |
75 | - String expected = "Initialized value and without key in the property file"; | |
76 | - | |
77 | - assertEquals(expected, filledFieldConfig.getStringDefaultWithoutKey()); | |
78 | - assertEquals(expected, emptyFieldsConfig.getStringDefaultWithoutKey()); | |
79 | - assertEquals(expected, noFileConfig.getStringDefaultWithoutKey()); | |
80 | - } | |
81 | - | |
82 | - @Test | |
83 | - public void loadDefaultValueWithKey() { | |
84 | - assertEquals("Initialized value of the property file", filledFieldConfig.getStringDefaultWithKey()); | |
85 | - assertEquals("Initialized value and key in the property file", noFileConfig.getStringDefaultWithKey()); | |
86 | - assertEquals("", emptyFieldsConfig.getStringDefaultWithKey()); | |
87 | - } | |
88 | -} |
impl/core/src/test/java/configuration/defaultvalue/EmptyDefaultValueConfig.java
... | ... | @@ -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 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
... | ... | @@ -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 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
... | ... | @@ -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 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/defaultvalue/AbstractDefaultValueConfig.java
0 → 100644
... | ... | @@ -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.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/field/defaultvalue/ConfigurationDefaultValueTest.java
0 → 100644
... | ... | @@ -0,0 +1,88 @@ |
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.defaultvalue; | |
38 | + | |
39 | +import static junit.framework.Assert.assertEquals; | |
40 | + | |
41 | +import javax.inject.Inject; | |
42 | + | |
43 | +import org.jboss.arquillian.container.test.api.Deployment; | |
44 | +import org.jboss.arquillian.junit.Arquillian; | |
45 | +import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
46 | +import org.junit.Test; | |
47 | +import org.junit.runner.RunWith; | |
48 | + | |
49 | +import test.Tests; | |
50 | + | |
51 | +@RunWith(Arquillian.class) | |
52 | +public class ConfigurationDefaultValueTest { | |
53 | + | |
54 | + private static final String PATH = "src/test/resources/configuration/field/default"; | |
55 | + | |
56 | + @Inject | |
57 | + private FilledDefaultValueConfig filledFieldConfig; | |
58 | + | |
59 | + @Inject | |
60 | + private EmptyDefaultValueConfig emptyFieldsConfig; | |
61 | + | |
62 | + @Inject | |
63 | + private PropertyWithInexistenceFileConfig noFileConfig; | |
64 | + | |
65 | + @Deployment | |
66 | + public static JavaArchive createDeployment() { | |
67 | + JavaArchive deployment = Tests.createDeployment(ConfigurationDefaultValueTest.class); | |
68 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
69 | + deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); | |
70 | + return deployment; | |
71 | + } | |
72 | + | |
73 | + @Test | |
74 | + public void loadDefaultValueWithoutKey() { | |
75 | + String expected = "Initialized value and without key in the property file"; | |
76 | + | |
77 | + assertEquals(expected, filledFieldConfig.getStringDefaultWithoutKey()); | |
78 | + assertEquals(expected, emptyFieldsConfig.getStringDefaultWithoutKey()); | |
79 | + assertEquals(expected, noFileConfig.getStringDefaultWithoutKey()); | |
80 | + } | |
81 | + | |
82 | + @Test | |
83 | + public void loadDefaultValueWithKey() { | |
84 | + assertEquals("Initialized value of the property file", filledFieldConfig.getStringDefaultWithKey()); | |
85 | + assertEquals("Initialized value and key in the property file", noFileConfig.getStringDefaultWithKey()); | |
86 | + assertEquals("", emptyFieldsConfig.getStringDefaultWithKey()); | |
87 | + } | |
88 | +} | ... | ... |
impl/core/src/test/java/configuration/field/defaultvalue/EmptyDefaultValueConfig.java
0 → 100644
... | ... | @@ -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.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/field/defaultvalue/FilledDefaultValueConfig.java
0 → 100644
... | ... | @@ -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.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/field/defaultvalue/PropertyWithInexistenceFileConfig.java
0 → 100644
... | ... | @@ -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.defaultvalue; | |
38 | + | |
39 | +import br.gov.frameworkdemoiselle.configuration.Configuration; | |
40 | + | |
41 | +@Configuration(resource = "nofile") | |
42 | +public class PropertyWithInexistenceFileConfig extends AbstractDefaultValueConfig { | |
43 | +} | ... | ... |