Commit 6eb182ad0b20c2242902335ea38e1d1451299d3e
1 parent
6e4143e0
Exists in
master
Teste com arquivo XML
Showing
3 changed files
with
113 additions
and
6 deletions
Show diff stats
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/map/ConfigurationMapFieldTest.java
... | ... | @@ -60,13 +60,19 @@ public class ConfigurationMapFieldTest extends AbstractConfigurationTest { |
60 | 60 | @Inject |
61 | 61 | private PropertiesMapFieldConfig propertiesConfig; |
62 | 62 | |
63 | + @Inject | |
64 | + private XMLMapFieldConfig xmlConfig; | |
65 | + | |
63 | 66 | @Deployment |
64 | 67 | public static JavaArchive createDeployment() { |
65 | 68 | JavaArchive deployment = createConfigurationDeployment(); |
66 | 69 | |
67 | 70 | deployment.addPackages(true, ConfigurationMapFieldTest.class.getPackage()); |
68 | - deployment.addAsResource(new FileAsset(new File( | |
69 | - "src/test/resources/configuration/field/map/demoiselle.properties")), "demoiselle.properties"); | |
71 | + deployment | |
72 | + .addAsResource( | |
73 | + new FileAsset(new File("src/test/resources/configuration/field/map/demoiselle.properties")), "demoiselle.properties") | |
74 | + .addAsResource( | |
75 | + new FileAsset(new File("src/test/resources/configuration/field/map/demoiselle.xml")), "demoiselle.xml"); | |
70 | 76 | |
71 | 77 | return deployment; |
72 | 78 | } |
... | ... | @@ -78,6 +84,7 @@ public class ConfigurationMapFieldTest extends AbstractConfigurationTest { |
78 | 84 | expected.put("item2", "framework"); |
79 | 85 | |
80 | 86 | assertEquals(expected, propertiesConfig.getStringWithDefinedKeyMap()); |
87 | + assertEquals(expected, xmlConfig.getStringWithDefinedKeyMap()); | |
81 | 88 | } |
82 | 89 | |
83 | 90 | @Test |
... | ... | @@ -86,13 +93,15 @@ public class ConfigurationMapFieldTest extends AbstractConfigurationTest { |
86 | 93 | expected.put("default", "undefined"); |
87 | 94 | |
88 | 95 | assertEquals(expected, propertiesConfig.getStringWithUndefinedKeyMap()); |
96 | + assertEquals(expected, xmlConfig.getStringWithUndefinedKeyMap()); | |
89 | 97 | } |
90 | - | |
98 | + | |
91 | 99 | @Test |
92 | 100 | public void loadEmptyKeyMapString() { |
93 | 101 | Map<String, String> expected = new HashMap<String, String>(); |
94 | - | |
102 | + | |
95 | 103 | assertEquals(expected, propertiesConfig.getEmptyValueMap()); |
96 | - } | |
97 | - | |
104 | + assertEquals(expected, xmlConfig.getEmptyValueMap()); | |
105 | + } | |
106 | + | |
98 | 107 | } | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/map/XMLMapFieldConfig.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 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/resources/configuration/field/map/demoiselle.xml
0 → 100644
... | ... | @@ -0,0 +1,54 @@ |
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 | + <item1> | |
40 | + <stringWithDefinedKeyMap>demoiselle</stringWithDefinedKeyMap> | |
41 | + </item1> | |
42 | + <item2> | |
43 | + <stringWithDefinedKeyMap>framework</stringWithDefinedKeyMap> | |
44 | + </item2> | |
45 | + <stringWithUndefinedKeyMap>undefined</stringWithUndefinedKeyMap> | |
46 | + <item1> | |
47 | + <emptyValueMap></emptyValueMap> | |
48 | + </item1> | |
49 | + <item2> | |
50 | + <emptyValueMap></emptyValueMap> | |
51 | + </item2> | |
52 | + | |
53 | + | |
54 | +</configuration> | ... | ... |