Commit 13bc29d587b455bfc34eed86ffa93999ff27747a
1 parent
547baed0
Exists in
master
Acrescentados testes de carregamento a partir de arquivo xml nos testes
de prefixo
Showing
11 changed files
with
119 additions
and
29 deletions
Show diff stats
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/ConfigurationPrefixTest.java
... | ... | @@ -56,37 +56,57 @@ import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest; |
56 | 56 | public class ConfigurationPrefixTest extends AbstractConfigurationTest { |
57 | 57 | |
58 | 58 | @Inject |
59 | - private PrefixEndindWithoutDot endingWithoutDotPrefix; | |
59 | + private PropertyPrefixEndingWithoutDot propertyEndingWithoutDotPrefix; | |
60 | 60 | |
61 | 61 | @Inject |
62 | - private MissingPrefix missingPrefix; | |
62 | + private PropertyMissingPrefix propertyMissingPrefix; | |
63 | 63 | |
64 | 64 | @Inject |
65 | - private PrefixEndingWithDot endingWithDotPrefix; | |
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; | |
66 | 76 | |
67 | 77 | @Deployment |
68 | 78 | public static JavaArchive createDeployment() { |
69 | 79 | JavaArchive deployment = createConfigurationDeployment(); |
70 | 80 | |
71 | 81 | deployment.addPackages(true, ConfigurationPrefixTest.class.getPackage()); |
72 | - deployment.addAsResource(new FileAsset( | |
73 | - new File("src/test/resources/configuration/prefix/demoiselle.properties")), "demoiselle.properties"); | |
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"); | |
74 | 87 | |
75 | 88 | return deployment; |
76 | 89 | } |
77 | 90 | |
78 | 91 | @Test |
79 | 92 | public void loadFromPrefixedExistentProperty() { |
80 | - assertEquals("prefix ending without dot", endingWithoutDotPrefix.getPrefixedAttribute()); | |
93 | + String expected = "prefix ending without dot"; | |
94 | + | |
95 | + assertEquals(expected, propertyEndingWithoutDotPrefix.getPrefixedAttribute()); | |
96 | + assertEquals(expected, xmlEndingWithoutDotPrefix.getPrefixedAttribute()); | |
81 | 97 | } |
82 | 98 | |
83 | 99 | @Test |
84 | 100 | public void loadFromPrefixedWithouPrefixOnProperty() { |
85 | - assertNull(missingPrefix.getPrefixedAttribute()); | |
101 | + assertNull(propertyMissingPrefix.getPrefixedAttribute()); | |
102 | + assertNull(xmlMissingPrefix.getPrefixedAttribute()); | |
86 | 103 | } |
87 | 104 | |
88 | 105 | @Test |
89 | 106 | public void loadPrefixEndingWithDot() { |
90 | - assertEquals("prefix ending with dot", endingWithDotPrefix.getPrefixedAttribute()); | |
107 | + String expected = "prefix ending with dot"; | |
108 | + | |
109 | + assertEquals(expected, propertyEndingWithDotPrefix.getPrefixedAttribute()); | |
110 | + assertEquals(expected, propertyEndingWithDotPrefix.getPrefixedAttribute()); | |
91 | 111 | } |
92 | 112 | } | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/MissingPrefix.java
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/PrefixEndindWithoutDot.java
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/PrefixEndingWithDot.java
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/PropertyMissingPrefix.java
0 → 100644
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/PropertyPrefixEndingWithDot.java
0 → 100644
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/PropertyPrefixEndingWithoutDot.java
0 → 100644
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/XMLMissingPrefix.java
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
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
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
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
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
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/resources/configuration/prefix/demoiselle.xml
0 → 100644
... | ... | @@ -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 | + | |
38 | +<configuration> | |
39 | + <prefix> | |
40 | + <prefixedAttribute>prefix ending without dot</prefixedAttribute> | |
41 | + </prefix> | |
42 | + <prefixedAttribute>without prefix</prefixedAttribute> | |
43 | + <endingWithDot> | |
44 | + <prefixedAttribute>prefix ending with dot</prefixedAttribute> | |
45 | + </endingWithDot> | |
46 | +</configuration> | ... | ... |