Commit 93579178ba1896924aface6816e4a0d5f9880e69
1 parent
c602e2d9
Exists in
master
Merge
Showing
14 changed files
with
176 additions
and
128 deletions
Show diff stats
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/AbstractConfigurationTest.java
... | ... | @@ -6,7 +6,6 @@ import java.util.List; |
6 | 6 | |
7 | 7 | import org.jboss.shrinkwrap.api.ShrinkWrap; |
8 | 8 | import org.jboss.shrinkwrap.api.asset.EmptyAsset; |
9 | -import org.jboss.shrinkwrap.api.asset.FileAsset; | |
10 | 9 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
11 | 10 | |
12 | 11 | import br.gov.frameworkdemoiselle.annotation.Ignore; | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/basic/AbstractBasicFieldConfig.java
0 → 100644
... | ... | @@ -0,0 +1,44 @@ |
1 | +package br.gov.frameworkdemoiselle.configuration.field.basic; | |
2 | + | |
3 | +public abstract class AbstractBasicFieldConfig { | |
4 | + | |
5 | + private int primitiveInteger; | |
6 | + | |
7 | + private Integer wrappedInteger; | |
8 | + | |
9 | + private String stringWithSpace; | |
10 | + | |
11 | + private String stringWithComma; | |
12 | + | |
13 | + public Integer getWrappedInteger() { | |
14 | + return wrappedInteger; | |
15 | + } | |
16 | + | |
17 | + public void setWrappedInteger(Integer wrappedInteger) { | |
18 | + this.wrappedInteger = wrappedInteger; | |
19 | + } | |
20 | + | |
21 | + public int getPrimitiveInteger() { | |
22 | + return primitiveInteger; | |
23 | + } | |
24 | + | |
25 | + public void setPrimitiveInteger(int primitiveInteger) { | |
26 | + this.primitiveInteger = primitiveInteger; | |
27 | + } | |
28 | + | |
29 | + public String getStringWithSpace() { | |
30 | + return stringWithSpace; | |
31 | + } | |
32 | + | |
33 | + public void setStringWithSpace(String stringWithSpace) { | |
34 | + this.stringWithSpace = stringWithSpace; | |
35 | + } | |
36 | + | |
37 | + public String getStringWithComma() { | |
38 | + return stringWithComma; | |
39 | + } | |
40 | + | |
41 | + public void setStringWithComma(String stringWithComma) { | |
42 | + this.stringWithComma = stringWithComma; | |
43 | + } | |
44 | +} | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/basic/ConfigurationBasicFieldTest.java
0 → 100644
... | ... | @@ -0,0 +1,60 @@ |
1 | +package br.gov.frameworkdemoiselle.configuration.field.basic; | |
2 | + | |
3 | +import static junit.framework.Assert.assertEquals; | |
4 | + | |
5 | +import javax.inject.Inject; | |
6 | + | |
7 | +import org.jboss.arquillian.container.test.api.Deployment; | |
8 | +import org.jboss.arquillian.junit.Arquillian; | |
9 | +import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
10 | +import org.junit.Test; | |
11 | +import org.junit.runner.RunWith; | |
12 | + | |
13 | +import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest; | |
14 | + | |
15 | +@RunWith(Arquillian.class) | |
16 | +public class ConfigurationBasicFieldTest extends AbstractConfigurationTest { | |
17 | + | |
18 | + @Inject | |
19 | + private PropertiesBasicFieldConfig propertiesConfig; | |
20 | + | |
21 | + @Inject | |
22 | + private XMLBasicFieldConfig xmlConfig; | |
23 | + | |
24 | + @Deployment | |
25 | + public static JavaArchive createDeployment() { | |
26 | + return createConfigurationDeployment().addPackages(true, ConfigurationBasicFieldTest.class.getPackage()); | |
27 | + } | |
28 | + | |
29 | + @Test | |
30 | + public void loadPrimitiveInteger() { | |
31 | + int expected = 1; | |
32 | + | |
33 | + assertEquals(expected, propertiesConfig.getPrimitiveInteger()); | |
34 | + assertEquals(expected, xmlConfig.getPrimitiveInteger()); | |
35 | + } | |
36 | + | |
37 | + @Test | |
38 | + public void loadWrappedInteger() { | |
39 | + Integer expected = 2; | |
40 | + | |
41 | + assertEquals(expected, propertiesConfig.getWrappedInteger()); | |
42 | + assertEquals(expected, xmlConfig.getWrappedInteger()); | |
43 | + } | |
44 | + | |
45 | + @Test | |
46 | + public void loadStringWithSpace() { | |
47 | + String expected = "demoiselle framework"; | |
48 | + | |
49 | + assertEquals(expected, propertiesConfig.getStringWithSpace()); | |
50 | + assertEquals(expected, xmlConfig.getStringWithSpace()); | |
51 | + } | |
52 | + | |
53 | +// @Test | |
54 | + public void loadStringWithComma() { | |
55 | + String expected = "demoiselle,framework"; | |
56 | + | |
57 | + assertEquals(expected, propertiesConfig.getStringWithComma()); | |
58 | + assertEquals(expected, xmlConfig.getStringWithComma()); | |
59 | + } | |
60 | +} | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/basic/PropertiesBasicFieldConfig.java
0 → 100644
... | ... | @@ -0,0 +1,8 @@ |
1 | +package br.gov.frameworkdemoiselle.configuration.field.basic; | |
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 PropertiesBasicFieldConfig extends AbstractBasicFieldConfig { | |
8 | +} | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/basic/SystemBasicFieldConfig.java
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +package br.gov.frameworkdemoiselle.configuration.field.basic; | |
2 | + | |
3 | +import static br.gov.frameworkdemoiselle.configuration.ConfigType.SYSTEM; | |
4 | +import br.gov.frameworkdemoiselle.configuration.Configuration; | |
5 | + | |
6 | +@Configuration(type = SYSTEM) | |
7 | +public class SystemBasicFieldConfig extends AbstractBasicFieldConfig { | |
8 | + | |
9 | +} | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/basic/XMLBasicFieldConfig.java
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +package br.gov.frameworkdemoiselle.configuration.field.basic; | |
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 XMLBasicFieldConfig extends AbstractBasicFieldConfig { | |
8 | + | |
9 | +} | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/fields/basic/AbstractBasicFieldsConfig.java
... | ... | @@ -1,44 +0,0 @@ |
1 | -package br.gov.frameworkdemoiselle.configuration.fields.basic; | |
2 | - | |
3 | -public abstract class AbstractBasicFieldsConfig { | |
4 | - | |
5 | - private int primitiveInteger; | |
6 | - | |
7 | - private Integer wrappedInteger; | |
8 | - | |
9 | - private String stringWithSpace; | |
10 | - | |
11 | - private String stringWithComma; | |
12 | - | |
13 | - public Integer getWrappedInteger() { | |
14 | - return wrappedInteger; | |
15 | - } | |
16 | - | |
17 | - public void setWrappedInteger(Integer wrappedInteger) { | |
18 | - this.wrappedInteger = wrappedInteger; | |
19 | - } | |
20 | - | |
21 | - public int getPrimitiveInteger() { | |
22 | - return primitiveInteger; | |
23 | - } | |
24 | - | |
25 | - public void setPrimitiveInteger(int primitiveInteger) { | |
26 | - this.primitiveInteger = primitiveInteger; | |
27 | - } | |
28 | - | |
29 | - public String getStringWithSpace() { | |
30 | - return stringWithSpace; | |
31 | - } | |
32 | - | |
33 | - public void setStringWithSpace(String stringWithSpace) { | |
34 | - this.stringWithSpace = stringWithSpace; | |
35 | - } | |
36 | - | |
37 | - public String getStringWithComma() { | |
38 | - return stringWithComma; | |
39 | - } | |
40 | - | |
41 | - public void setStringWithComma(String stringWithComma) { | |
42 | - this.stringWithComma = stringWithComma; | |
43 | - } | |
44 | -} |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/fields/basic/ConfigurationBasicFieldsTest.java
... | ... | @@ -1,53 +0,0 @@ |
1 | -package br.gov.frameworkdemoiselle.configuration.fields.basic; | |
2 | - | |
3 | -import static junit.framework.Assert.assertEquals; | |
4 | - | |
5 | -import javax.inject.Inject; | |
6 | - | |
7 | -import org.jboss.arquillian.container.test.api.Deployment; | |
8 | -import org.jboss.arquillian.junit.Arquillian; | |
9 | -import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
10 | -import org.junit.Test; | |
11 | -import org.junit.runner.RunWith; | |
12 | - | |
13 | -import br.gov.frameworkdemoiselle.configuration.AbstractConfigurationTest; | |
14 | - | |
15 | -@RunWith(Arquillian.class) | |
16 | -public class ConfigurationBasicFieldsTest extends AbstractConfigurationTest { | |
17 | - | |
18 | - @Inject | |
19 | - private PropertiesBasicFieldsConfig propertiesConfig; | |
20 | - | |
21 | - @Deployment | |
22 | - public static JavaArchive createDeployment() { | |
23 | - return createConfigurationDeployment().addPackages(true, ConfigurationBasicFieldsTest.class.getPackage()); | |
24 | - } | |
25 | - | |
26 | - @Test | |
27 | - public void loadPrimitiveInteger() { | |
28 | - int expected = 1; | |
29 | - | |
30 | - assertEquals(expected, propertiesConfig.getPrimitiveInteger()); | |
31 | - } | |
32 | - | |
33 | - @Test | |
34 | - public void loadWrappedInteger() { | |
35 | - Integer expected = 2; | |
36 | - | |
37 | - assertEquals(expected, propertiesConfig.getWrappedInteger()); | |
38 | - } | |
39 | - | |
40 | - @Test | |
41 | - public void loadStringWithSpace() { | |
42 | - String expected = "demoiselle framework"; | |
43 | - | |
44 | - assertEquals(expected, propertiesConfig.getStringWithSpace()); | |
45 | - } | |
46 | - | |
47 | -// @Test | |
48 | - public void loadStringWithComma() { | |
49 | - String expected = "demoiselle,framework"; | |
50 | - | |
51 | - assertEquals(expected, propertiesConfig.getStringWithComma()); | |
52 | - } | |
53 | -} |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/fields/basic/PropertiesBasicFieldsConfig.java
... | ... | @@ -1,8 +0,0 @@ |
1 | -package br.gov.frameworkdemoiselle.configuration.fields.basic; | |
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 PropertiesBasicFieldsConfig extends AbstractBasicFieldsConfig { | |
8 | -} |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/fields/basic/SystemBasicFieldsConfig.java
... | ... | @@ -1,9 +0,0 @@ |
1 | -package br.gov.frameworkdemoiselle.configuration.fields.basic; | |
2 | - | |
3 | -import static br.gov.frameworkdemoiselle.configuration.ConfigType.SYSTEM; | |
4 | -import br.gov.frameworkdemoiselle.configuration.Configuration; | |
5 | - | |
6 | -@Configuration(type = SYSTEM) | |
7 | -public class SystemBasicFieldsConfig extends AbstractBasicFieldsConfig { | |
8 | - | |
9 | -} |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/fields/basic/XMLBasicFieldsConfig.java
... | ... | @@ -1,9 +0,0 @@ |
1 | -package br.gov.frameworkdemoiselle.configuration.fields.basic; | |
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 XMLBasicFieldsConfig extends AbstractBasicFieldsConfig { | |
8 | - | |
9 | -} |
impl/core/src/test/resources/configuration/field/basic/demoiselle.properties
0 → 100644
impl/core/src/test/resources/configuration/field/basic/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 | +<definitions> | |
38 | + <primitiveInteger>1</primitiveInteger> | |
39 | + <wrappedInteger>2</wrappedInteger> | |
40 | + <stringWithSpace>demoiselle framework</stringWithSpace> | |
41 | + <stringWithComma>demoiselle,framework</stringWithComma> | |
42 | +</definitions> | |
0 | 43 | \ No newline at end of file | ... | ... |
impl/core/src/test/resources/configuration/fields/basic/demoiselle.properties