Commit 35c7352556030a32c36d5abb4fc46ee1499d5007
Exists in
master
Merge branch '2.4.0' of git@github.com:demoiselle/framework.git into 2.4.0
Showing
10 changed files
with
242 additions
and
18 deletions
Show diff stats
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/AbstractPrimitiveOrWrapperErrorFieldConfig.java
0 → 100644
| ... | ... | @@ -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 br.gov.frameworkdemoiselle.configuration.field.primitiveorwrapper; | |
| 38 | + | |
| 39 | +public abstract class AbstractPrimitiveOrWrapperErrorFieldConfig { | |
| 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/AbstractPrimitiveOrWrapperFieldConfig.java
| ... | ... | @@ -42,14 +42,10 @@ public abstract class AbstractPrimitiveOrWrapperFieldConfig { |
| 42 | 42 | |
| 43 | 43 | private int nullPrimitiveInteger; |
| 44 | 44 | |
| 45 | - private int errorPrimitiveInteger; | |
| 46 | - | |
| 47 | 45 | private Integer wrappedInteger; |
| 48 | 46 | |
| 49 | 47 | private Integer nullWrappedInteger; |
| 50 | 48 | |
| 51 | - private Integer errorWrappedInteger; | |
| 52 | - | |
| 53 | 49 | public Integer getWrappedInteger() { |
| 54 | 50 | return wrappedInteger; |
| 55 | 51 | } |
| ... | ... | @@ -65,12 +61,4 @@ public abstract class AbstractPrimitiveOrWrapperFieldConfig { |
| 65 | 61 | public Integer getNullWrappedInteger() { |
| 66 | 62 | return nullWrappedInteger; |
| 67 | 63 | } |
| 68 | - | |
| 69 | - public int getErrorPrimitiveInteger() { | |
| 70 | - return errorPrimitiveInteger; | |
| 71 | - } | |
| 72 | - | |
| 73 | - public Integer getErrorWrappedInteger() { | |
| 74 | - return errorWrappedInteger; | |
| 75 | - } | |
| 76 | 64 | } | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/ConfigurationPrimitiveOrWrapperFieldTest.java
| ... | ... | @@ -69,6 +69,15 @@ public class ConfigurationPrimitiveOrWrapperFieldTest extends AbstractConfigurat |
| 69 | 69 | |
| 70 | 70 | @Inject |
| 71 | 71 | private SystemPrimitiveOrWrapperFieldConfig systemConfig; |
| 72 | + | |
| 73 | + @Inject | |
| 74 | + private PropertiesPrimitiveOrWrapperErrorFieldConfig propertiesErrorConfig; | |
| 75 | + | |
| 76 | + @Inject | |
| 77 | + private XMLPrimitiveOrWrapperErrorFieldConfig xmlErrorConfig; | |
| 78 | + | |
| 79 | + @Inject | |
| 80 | + private SystemPrimitiveOrWrapperErrorFieldConfig systemErrorConfig; | |
| 72 | 81 | |
| 73 | 82 | @Deployment |
| 74 | 83 | public static JavaArchive createDeployment() { |
| ... | ... | @@ -136,21 +145,21 @@ public class ConfigurationPrimitiveOrWrapperFieldTest extends AbstractConfigurat |
| 136 | 145 | int expected = 0; |
| 137 | 146 | |
| 138 | 147 | try { |
| 139 | - assertEquals(expected, propertiesConfig.getErrorPrimitiveInteger()); | |
| 148 | + assertEquals(expected, propertiesErrorConfig.getErrorPrimitiveInteger()); | |
| 140 | 149 | fail(); |
| 141 | 150 | } catch (ConversionException cause) { |
| 142 | 151 | Assert.assertEquals(ConversionException.class, cause.getCause().getClass()); |
| 143 | 152 | } |
| 144 | 153 | |
| 145 | 154 | try { |
| 146 | - assertEquals(expected, propertiesConfig.getErrorPrimitiveInteger()); | |
| 155 | + assertEquals(expected, propertiesErrorConfig.getErrorPrimitiveInteger()); | |
| 147 | 156 | fail(); |
| 148 | 157 | } catch (ConversionException cause) { |
| 149 | 158 | Assert.assertEquals(ConversionException.class, cause.getCause().getClass()); |
| 150 | 159 | } |
| 151 | 160 | |
| 152 | 161 | try { |
| 153 | - assertEquals(expected, xmlConfig.getErrorPrimitiveInteger()); | |
| 162 | + assertEquals(expected, xmlErrorConfig.getErrorPrimitiveInteger()); | |
| 154 | 163 | fail(); |
| 155 | 164 | } catch (ConversionException cause) { |
| 156 | 165 | Assert.assertEquals(ConversionException.class, cause.getCause().getClass()); |
| ... | ... | @@ -163,21 +172,21 @@ public class ConfigurationPrimitiveOrWrapperFieldTest extends AbstractConfigurat |
| 163 | 172 | Integer expected = 2; |
| 164 | 173 | |
| 165 | 174 | try { |
| 166 | - assertEquals(expected, propertiesConfig.getErrorWrappedInteger()); | |
| 175 | + assertEquals(expected, propertiesErrorConfig.getErrorWrappedInteger()); | |
| 167 | 176 | fail(); |
| 168 | 177 | } catch (ConversionException cause) { |
| 169 | 178 | Assert.assertEquals(ConversionException.class, cause.getCause().getClass()); |
| 170 | 179 | } |
| 171 | 180 | |
| 172 | 181 | try { |
| 173 | - assertEquals(expected, propertiesConfig.getErrorWrappedInteger()); | |
| 182 | + assertEquals(expected, propertiesErrorConfig.getErrorWrappedInteger()); | |
| 174 | 183 | fail(); |
| 175 | 184 | } catch (ConversionException cause) { |
| 176 | 185 | Assert.assertEquals(ConversionException.class, cause.getCause().getClass()); |
| 177 | 186 | } |
| 178 | 187 | |
| 179 | 188 | try { |
| 180 | - assertEquals(expected, xmlConfig.getErrorWrappedInteger()); | |
| 189 | + assertEquals(expected, xmlErrorConfig.getErrorWrappedInteger()); | |
| 181 | 190 | fail(); |
| 182 | 191 | } catch (ConversionException cause) { |
| 183 | 192 | Assert.assertEquals(ConversionException.class, cause.getCause().getClass()); | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/primitiveorwrapper/PropertiesPrimitiveOrWrapperErrorFieldConfig.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.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/SystemPrimitiveOrWrapperErrorFieldConfig.java
0 → 100644
| ... | ... | @@ -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 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/XMLPrimitiveOrWrapperErrorFieldConfig.java
0 → 100644
| ... | ... | @@ -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 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/string/AbstractStringFieldConfig.java
| ... | ... | @@ -42,6 +42,8 @@ public abstract class AbstractStringFieldConfig { |
| 42 | 42 | |
| 43 | 43 | private String stringWithComma; |
| 44 | 44 | |
| 45 | + private String emptyString; | |
| 46 | + | |
| 45 | 47 | public String getStringWithSpace() { |
| 46 | 48 | return stringWithSpace; |
| 47 | 49 | } |
| ... | ... | @@ -49,4 +51,8 @@ public abstract class AbstractStringFieldConfig { |
| 49 | 51 | public String getStringWithComma() { |
| 50 | 52 | return stringWithComma; |
| 51 | 53 | } |
| 54 | + | |
| 55 | + public String getEmptyString() { | |
| 56 | + return emptyString; | |
| 57 | + } | |
| 52 | 58 | } | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/string/ConfigurationStringFieldTest.java
| ... | ... | @@ -82,6 +82,7 @@ public class ConfigurationStringFieldTest extends AbstractConfigurationTest { |
| 82 | 82 | public static void afterClass() { |
| 83 | 83 | System.setProperty("stringWithSpace", String.valueOf("demoiselle framework")); |
| 84 | 84 | System.setProperty("stringWithComma", String.valueOf("demoiselle, framework")); |
| 85 | + System.setProperty("emptyString", String.valueOf("")); | |
| 85 | 86 | } |
| 86 | 87 | |
| 87 | 88 | @Test |
| ... | ... | @@ -101,4 +102,12 @@ public class ConfigurationStringFieldTest extends AbstractConfigurationTest { |
| 101 | 102 | assertEquals(expected, propertiesConfig.getStringWithComma()); |
| 102 | 103 | assertEquals(expected, xmlConfig.getStringWithComma()); |
| 103 | 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 | + } | |
| 104 | 113 | } | ... | ... |
impl/core/src/test/resources/configuration/field/string/demoiselle.properties
impl/core/src/test/resources/configuration/field/string/demoiselle.xml