Commit dea8f195169503431836896a3eb99830b6bd0c0b
1 parent
0d8a7a35
Exists in
master
Remoçãod e código desnecessário
Showing
3 changed files
with
9 additions
and
70 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationLoader.java
| @@ -173,10 +173,6 @@ public class ConfigurationLoader implements Serializable { | @@ -173,10 +173,6 @@ public class ConfigurationLoader implements Serializable { | ||
| 173 | AbstractConfiguration config; | 173 | AbstractConfiguration config; |
| 174 | 174 | ||
| 175 | switch (this.type) { | 175 | switch (this.type) { |
| 176 | - case PROPERTIES: | ||
| 177 | - config = new PropertiesConfiguration(); | ||
| 178 | - break; | ||
| 179 | - | ||
| 180 | case XML: | 176 | case XML: |
| 181 | config = new XMLConfiguration(); | 177 | config = new XMLConfiguration(); |
| 182 | break; | 178 | break; |
| @@ -186,8 +182,7 @@ public class ConfigurationLoader implements Serializable { | @@ -186,8 +182,7 @@ public class ConfigurationLoader implements Serializable { | ||
| 186 | break; | 182 | break; |
| 187 | 183 | ||
| 188 | default: | 184 | default: |
| 189 | - throw new ConfigurationException(getBundle().getString("configuration-type-not-implemented-yet", | ||
| 190 | - type.name()), new IllegalArgumentException()); | 185 | + config = new PropertiesConfiguration(); |
| 191 | } | 186 | } |
| 192 | 187 | ||
| 193 | config.setDelimiterParsingDisabled(true); | 188 | config.setDelimiterParsingDisabled(true); |
| @@ -238,14 +233,15 @@ public class ConfigurationLoader implements Serializable { | @@ -238,14 +233,15 @@ public class ConfigurationLoader implements Serializable { | ||
| 238 | try { | 233 | try { |
| 239 | ConfigurationValueExtractor extractor = getValueExtractor(field); | 234 | ConfigurationValueExtractor extractor = getValueExtractor(field); |
| 240 | value = extractor.getValue(this.prefix, key, field, this.configuration); | 235 | value = extractor.getValue(this.prefix, key, field, this.configuration); |
| 241 | - | 236 | + |
| 242 | } catch (ConfigurationException cause) { | 237 | } catch (ConfigurationException cause) { |
| 243 | throw cause; | 238 | throw cause; |
| 244 | 239 | ||
| 245 | } catch (ConversionException cause) { | 240 | } catch (ConversionException cause) { |
| 246 | - throw new ConfigurationException(getBundle().getString("configuration-not-conversion" , this.prefix + getKey(field), field.getType().toString()) , cause); | ||
| 247 | - } | ||
| 248 | - | 241 | + throw new ConfigurationException(getBundle().getString("configuration-not-conversion", |
| 242 | + this.prefix + getKey(field), field.getType().toString()), cause); | ||
| 243 | + } | ||
| 244 | + | ||
| 249 | catch (Exception cause) { | 245 | catch (Exception cause) { |
| 250 | // TODO Lançar mensagem informando que houve erro ao tentar extrair o valor com o extrator tal. | 246 | // TODO Lançar mensagem informando que houve erro ao tentar extrair o valor com o extrator tal. |
| 251 | throw new ConfigurationException("", cause); | 247 | throw new ConfigurationException("", cause); |
| @@ -305,15 +301,15 @@ public class ConfigurationLoader implements Serializable { | @@ -305,15 +301,15 @@ public class ConfigurationLoader implements Serializable { | ||
| 305 | Validator validator = dfv.getValidator(); | 301 | Validator validator = dfv.getValidator(); |
| 306 | 302 | ||
| 307 | Set violations = validator.validateProperty(this.object, field.getName()); | 303 | Set violations = validator.validateProperty(this.object, field.getName()); |
| 308 | - | 304 | + |
| 309 | StringBuffer message = new StringBuffer(); | 305 | StringBuffer message = new StringBuffer(); |
| 310 | 306 | ||
| 311 | if (!violations.isEmpty()) { | 307 | if (!violations.isEmpty()) { |
| 312 | for (Iterator iter = violations.iterator(); iter.hasNext();) { | 308 | for (Iterator iter = violations.iterator(); iter.hasNext();) { |
| 313 | - ConstraintViolation violation = (ConstraintViolation)iter.next(); | 309 | + ConstraintViolation violation = (ConstraintViolation) iter.next(); |
| 314 | message.append(field.toGenericString() + " " + violation.getMessage() + "\n"); | 310 | message.append(field.toGenericString() + " " + violation.getMessage() + "\n"); |
| 315 | } | 311 | } |
| 316 | - | 312 | + |
| 317 | throw new ConfigurationException(message.toString(), new ConstraintViolationException(violations)); | 313 | throw new ConfigurationException(message.toString(), new ConstraintViolationException(violations)); |
| 318 | } | 314 | } |
| 319 | } | 315 | } |
impl/core/src/main/resources/demoiselle-core-bundle.properties
| @@ -67,7 +67,6 @@ executing-all=Executando todos os \: {0} | @@ -67,7 +67,6 @@ executing-all=Executando todos os \: {0} | ||
| 67 | custom-context-was-registered=O contexto {0} foi registrado | 67 | custom-context-was-registered=O contexto {0} foi registrado |
| 68 | custom-context-was-unregistered=O contexto {0} foi removido | 68 | custom-context-was-unregistered=O contexto {0} foi removido |
| 69 | 69 | ||
| 70 | -configuration-type-not-implemented-yet=Configuration type "{0}" is not implemented yet | ||
| 71 | error-creating-new-instance-for=Error creating a new instance for "{0}" | 70 | error-creating-new-instance-for=Error creating a new instance for "{0}" |
| 72 | executed-successfully={0} execultado com sucesso | 71 | executed-successfully={0} execultado com sucesso |
| 73 | must-declare-one-single-parameter=Voc\u00EA deve declarar um par\u00E2metro \u00FAnico em {0} | 72 | must-declare-one-single-parameter=Voc\u00EA deve declarar um par\u00E2metro \u00FAnico em {0} |
impl/core/src/test/java/configuration/AbstractConfigurationTest.java
| @@ -1,56 +0,0 @@ | @@ -1,56 +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; | ||
| 38 | - | ||
| 39 | -import static junit.framework.Assert.assertEquals; | ||
| 40 | -import static junit.framework.Assert.fail; | ||
| 41 | - | ||
| 42 | -import javax.inject.Inject; | ||
| 43 | - | ||
| 44 | -import junit.framework.Assert; | ||
| 45 | - | ||
| 46 | -import org.jboss.arquillian.container.test.api.Deployment; | ||
| 47 | -import org.jboss.arquillian.junit.Arquillian; | ||
| 48 | -import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
| 49 | -import org.junit.Test; | ||
| 50 | -import org.junit.runner.RunWith; | ||
| 51 | - | ||
| 52 | -import util.Tests; | ||
| 53 | -import br.gov.frameworkdemoiselle.configuration.ConfigurationException; | ||
| 54 | - | ||
| 55 | -public class AbstractConfigurationTest { | ||
| 56 | -} |