From dea8f195169503431836896a3eb99830b6bd0c0b Mon Sep 17 00:00:00 2001 From: Cleverson Sacramento Date: Mon, 15 Apr 2013 14:09:17 -0300 Subject: [PATCH] Remoçãod e código desnecessário --- impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationLoader.java | 22 +++++++++------------- impl/core/src/main/resources/demoiselle-core-bundle.properties | 1 - impl/core/src/test/java/configuration/AbstractConfigurationTest.java | 56 -------------------------------------------------------- 3 files changed, 9 insertions(+), 70 deletions(-) delete mode 100644 impl/core/src/test/java/configuration/AbstractConfigurationTest.java diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationLoader.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationLoader.java index ca190e9..1a05f50 100644 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationLoader.java +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationLoader.java @@ -173,10 +173,6 @@ public class ConfigurationLoader implements Serializable { AbstractConfiguration config; switch (this.type) { - case PROPERTIES: - config = new PropertiesConfiguration(); - break; - case XML: config = new XMLConfiguration(); break; @@ -186,8 +182,7 @@ public class ConfigurationLoader implements Serializable { break; default: - throw new ConfigurationException(getBundle().getString("configuration-type-not-implemented-yet", - type.name()), new IllegalArgumentException()); + config = new PropertiesConfiguration(); } config.setDelimiterParsingDisabled(true); @@ -238,14 +233,15 @@ public class ConfigurationLoader implements Serializable { try { ConfigurationValueExtractor extractor = getValueExtractor(field); value = extractor.getValue(this.prefix, key, field, this.configuration); - + } catch (ConfigurationException cause) { throw cause; } catch (ConversionException cause) { - throw new ConfigurationException(getBundle().getString("configuration-not-conversion" , this.prefix + getKey(field), field.getType().toString()) , cause); - } - + throw new ConfigurationException(getBundle().getString("configuration-not-conversion", + this.prefix + getKey(field), field.getType().toString()), cause); + } + catch (Exception cause) { // TODO Lançar mensagem informando que houve erro ao tentar extrair o valor com o extrator tal. throw new ConfigurationException("", cause); @@ -305,15 +301,15 @@ public class ConfigurationLoader implements Serializable { Validator validator = dfv.getValidator(); Set violations = validator.validateProperty(this.object, field.getName()); - + StringBuffer message = new StringBuffer(); if (!violations.isEmpty()) { for (Iterator iter = violations.iterator(); iter.hasNext();) { - ConstraintViolation violation = (ConstraintViolation)iter.next(); + ConstraintViolation violation = (ConstraintViolation) iter.next(); message.append(field.toGenericString() + " " + violation.getMessage() + "\n"); } - + throw new ConfigurationException(message.toString(), new ConstraintViolationException(violations)); } } diff --git a/impl/core/src/main/resources/demoiselle-core-bundle.properties b/impl/core/src/main/resources/demoiselle-core-bundle.properties index 674bc00..096c9be 100644 --- a/impl/core/src/main/resources/demoiselle-core-bundle.properties +++ b/impl/core/src/main/resources/demoiselle-core-bundle.properties @@ -67,7 +67,6 @@ executing-all=Executando todos os \: {0} custom-context-was-registered=O contexto {0} foi registrado custom-context-was-unregistered=O contexto {0} foi removido -configuration-type-not-implemented-yet=Configuration type "{0}" is not implemented yet error-creating-new-instance-for=Error creating a new instance for "{0}" executed-successfully={0} execultado com sucesso must-declare-one-single-parameter=Voc\u00EA deve declarar um par\u00E2metro \u00FAnico em {0} diff --git a/impl/core/src/test/java/configuration/AbstractConfigurationTest.java b/impl/core/src/test/java/configuration/AbstractConfigurationTest.java deleted file mode 100644 index b525102..0000000 --- a/impl/core/src/test/java/configuration/AbstractConfigurationTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package configuration; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.fail; - -import javax.inject.Inject; - -import junit.framework.Assert; - -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.junit.Test; -import org.junit.runner.RunWith; - -import util.Tests; -import br.gov.frameworkdemoiselle.configuration.ConfigurationException; - -public class AbstractConfigurationTest { -} -- libgit2 0.21.2