Commit 092d105908c7ce7fa5a5d595647d763ad2bb71c6

Authored by Emerson Oliveira
1 parent 0546214a
Exists in master

Acrescentados testes com carregamento de configurações a partir de

arquivo xml
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/named/ConfigurationNamedFieldTest.java
... ... @@ -55,8 +55,11 @@ import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest;
55 55 public class ConfigurationNamedFieldTest extends AbstractConfigurationTest {
56 56  
57 57 @Inject
58   - private PropertyDefault propertyDefault;
59   -
  58 + private PropertyNamed propertyNamed;
  59 +
  60 + @Inject
  61 + private XMLNamed xmlNamed;
  62 +
60 63 @Deployment
61 64 public static JavaArchive createDeployment() {
62 65 JavaArchive deployment = createConfigurationDeployment();
... ... @@ -64,23 +67,28 @@ public class ConfigurationNamedFieldTest extends AbstractConfigurationTest {
64 67 deployment.addPackages(true, ConfigurationNamedFieldTest.class.getPackage());
65 68 deployment.addAsResource(
66 69 new FileAsset(new File("src/test/resources/configuration/field/named/demoiselle.properties")),
67   - "demoiselle.properties");
  70 + "demoiselle.properties").addAsResource(
  71 + new FileAsset(new File("src/test/resources/configuration/field/named/demoiselle.xml")),
  72 + "demoiselle.xml");
68 73  
69 74 return deployment;
70 75 }
71   -
  76 +
72 77 @Test
73   - public void loadNamedConfigFromPropertyWithName(){
74   - assertEquals(1, propertyDefault.getIntUniqueName());
  78 + public void loadNamedConfigFromPropertyWithName() {
  79 + assertEquals(1, propertyNamed.getIntUniqueName());
  80 + assertEquals(1, xmlNamed.getIntUniqueName());
75 81 }
76 82  
77 83 @Test
78   - public void loadNamedConfigFromNonexistentProperty(){
79   - assertEquals(0, propertyDefault.getIntNotPresent());
  84 + public void loadNamedConfigFromNonexistentProperty() {
  85 + assertEquals(0, propertyNamed.getIntNotPresent());
  86 + assertEquals(0, xmlNamed.getIntNotPresent());
80 87 }
81   -
  88 +
82 89 @Test
83   - public void loadNamedConfigFromPropertyWithoutField(){
84   - assertEquals(0, propertyDefault.getIntNamedWithoutFile());
  90 + public void loadNamedConfigFromPropertyWithoutField() {
  91 + assertEquals(0, propertyNamed.getIntNamedWithoutFile());
  92 + assertEquals(0, xmlNamed.getIntNamedWithoutFile());
85 93 }
86 94 }
... ...
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/named/PropertyDefault.java
... ... @@ -1,7 +0,0 @@
1   -package br.gov.frameworkdemoiselle.configuration.field.named;
2   -
3   -import br.gov.frameworkdemoiselle.configuration.Configuration;
4   -
5   -@Configuration
6   -public class PropertyDefault extends AbstractNamedFieldConfig {
7   -}
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/named/PropertyNamed.java 0 → 100644
... ... @@ -0,0 +1,8 @@
  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/XMLNamed.java 0 → 100644
... ... @@ -0,0 +1,8 @@
  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/resources/configuration/field/named/demoiselle.xml 0 → 100644
... ... @@ -0,0 +1,42 @@
  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 +<configurations>
  38 + <main>
  39 + <int>1</int>
  40 + </main>
  41 + <intNamedWithoutFile>1</intNamedWithoutFile>
  42 +</configurations>
... ...