Commit 1f211e0a72326e7f1923fe7774fbe07599a69e13
Exists in
master
Merge pull request #14 from clovisjunior/master
Com essas alterações é possível trabalhar nos arquivos Propeties e XML utilizando os tipos de List<?> e Array para Integer, Short, Byte, Boolean, Long, Float, Double, BigDecimal, BigInteger, Calendar, Date, Color, Locale, URL, String
Showing
8 changed files
with
1541 additions
and
7 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoader.java
... | ... | @@ -38,6 +38,8 @@ package br.gov.frameworkdemoiselle.internal.configuration; |
38 | 38 | |
39 | 39 | import java.lang.reflect.Field; |
40 | 40 | import java.lang.reflect.Method; |
41 | +import java.lang.reflect.ParameterizedType; | |
42 | +import java.lang.reflect.Type; | |
41 | 43 | import java.util.HashSet; |
42 | 44 | import java.util.Iterator; |
43 | 45 | import java.util.Properties; |
... | ... | @@ -46,6 +48,7 @@ import java.util.Set; |
46 | 48 | import javax.inject.Inject; |
47 | 49 | import javax.validation.constraints.NotNull; |
48 | 50 | |
51 | +import org.apache.commons.configuration.DataConfiguration; | |
49 | 52 | import org.apache.commons.configuration.PropertiesConfiguration; |
50 | 53 | import org.apache.commons.configuration.SystemConfiguration; |
51 | 54 | import org.apache.commons.configuration.XMLConfiguration; |
... | ... | @@ -105,7 +108,8 @@ public class ConfigurationLoader { |
105 | 108 | org.apache.commons.configuration.Configuration config = getConfiguration(resource, type); |
106 | 109 | |
107 | 110 | String key = getKey(field, clazz, config); |
108 | - Object value = getValue(key, field.getType(), config); | |
111 | + //Object value = getValue(key, field.getType(), config); | |
112 | + Object value = getValue(key, field, config); | |
109 | 113 | |
110 | 114 | validate(field, key, value, resource); |
111 | 115 | setValue(field, key, object, value); |
... | ... | @@ -211,11 +215,11 @@ public class ConfigurationLoader { |
211 | 215 | break; |
212 | 216 | |
213 | 217 | case PROPERTIES: |
214 | - config = new PropertiesConfiguration(resource + ".properties"); | |
218 | + config = new DataConfiguration(new PropertiesConfiguration(resource + ".properties")); | |
215 | 219 | break; |
216 | 220 | |
217 | 221 | case XML: |
218 | - config = new XMLConfiguration(resource + ".xml"); | |
222 | + config = new DataConfiguration(new XMLConfiguration(resource + ".xml")); | |
219 | 223 | break; |
220 | 224 | |
221 | 225 | default: |
... | ... | @@ -239,7 +243,7 @@ public class ConfigurationLoader { |
239 | 243 | * @param fieldClass |
240 | 244 | * @return the value |
241 | 245 | */ |
242 | - @SuppressWarnings("unchecked") | |
246 | + /*@SuppressWarnings("unchecked") | |
243 | 247 | private <T> T getValue(String key, Class<T> fieldClass, org.apache.commons.configuration.Configuration config) { |
244 | 248 | Object value; |
245 | 249 | |
... | ... | @@ -254,9 +258,27 @@ public class ConfigurationLoader { |
254 | 258 | } |
255 | 259 | |
256 | 260 | return (T) value; |
257 | - } | |
261 | + }*/ | |
262 | + | |
263 | + @SuppressWarnings("unchecked") | |
264 | + private <T> T getValue(String key, Field field, org.apache.commons.configuration.Configuration config) { | |
265 | + Object value; | |
266 | + | |
267 | + Class<?> fieldClass = (Class<?>) field.getType(); | |
268 | + | |
269 | + if (fieldClass.isArray()) { | |
270 | + value = getArray(key, field, config); | |
271 | + } else if (fieldClass.equals(Properties.class)) { | |
272 | + value = getProperty(key, config); | |
258 | 273 | |
259 | - private <T> Object getBasic(String key, Class<T> fieldClass, org.apache.commons.configuration.Configuration config) { | |
274 | + } else { | |
275 | + value = getBasic(key, field, config); | |
276 | + } | |
277 | + | |
278 | + return (T) value; | |
279 | + } | |
280 | + | |
281 | + /*private <T> Object getBasic(String key, Class<T> fieldClass, org.apache.commons.configuration.Configuration config) { | |
260 | 282 | Object value = null; |
261 | 283 | |
262 | 284 | try { |
... | ... | @@ -266,6 +288,7 @@ public class ConfigurationLoader { |
266 | 288 | if (!fieldClass.isPrimitive()) { |
267 | 289 | method = config.getClass().getMethod(methodName, String.class, fieldClass); |
268 | 290 | value = method.invoke(config, key, null); |
291 | + | |
269 | 292 | } else if (config.containsKey(key)) { |
270 | 293 | method = config.getClass().getMethod(methodName, String.class); |
271 | 294 | value = method.invoke(config, key); |
... | ... | @@ -276,8 +299,93 @@ public class ConfigurationLoader { |
276 | 299 | } |
277 | 300 | |
278 | 301 | return value; |
302 | + }*/ | |
303 | + | |
304 | + private <T> Object getArray(String key, Field field, org.apache.commons.configuration.Configuration config) { | |
305 | + Object value = null; | |
306 | + | |
307 | + Class<?> fieldClass = (Class<?>) field.getType(); | |
308 | + | |
309 | + try { | |
310 | + Method method; | |
311 | + | |
312 | + String methodName = "get"; | |
313 | + | |
314 | + methodName += Strings.firstToUpper(fieldClass.getSimpleName()); | |
315 | + methodName = Strings.removeChars(methodName, '[', ']'); | |
316 | + | |
317 | + methodName += "Array"; | |
318 | + | |
319 | + method = config.getClass().getMethod(methodName, String.class); | |
320 | + value = method.invoke(config, key); | |
321 | + | |
322 | + } catch (Throwable cause) { | |
323 | + throw new ConfigurationException(bundle.getString("error-converting-to-type", fieldClass.getName()), cause); | |
324 | + } | |
325 | + | |
326 | + return value; | |
279 | 327 | } |
280 | 328 | |
329 | + private <T> Object getBasic(String key, Field field, org.apache.commons.configuration.Configuration config) { | |
330 | + Object value = null; | |
331 | + | |
332 | + Class<?> fieldClass = (Class<?>) field.getType(); | |
333 | + | |
334 | + try { | |
335 | + Method method; | |
336 | + | |
337 | + String methodName = "get"; | |
338 | + | |
339 | + methodName += discoveryGenericType(field); | |
340 | + | |
341 | + methodName += Strings.firstToUpper(fieldClass.getSimpleName()); | |
342 | + | |
343 | + if (!fieldClass.isPrimitive()) { | |
344 | + method = config.getClass().getMethod(methodName, String.class, fieldClass); | |
345 | + value = method.invoke(config, key, null); | |
346 | + | |
347 | + } else if (config.containsKey(key)) { | |
348 | + method = config.getClass().getMethod(methodName, String.class); | |
349 | + value = method.invoke(config, key); | |
350 | + } | |
351 | + | |
352 | + } catch (Throwable cause) { | |
353 | + throw new ConfigurationException(bundle.getString("error-converting-to-type", fieldClass.getName()), cause); | |
354 | + } | |
355 | + | |
356 | + return value; | |
357 | + } | |
358 | + | |
359 | + /** | |
360 | + * Discovery the Generic's type. | |
361 | + * | |
362 | + * for example: the generic's type of List<Integer> list is an Integer type | |
363 | + * | |
364 | + * @param field | |
365 | + * @return | |
366 | + */ | |
367 | + private String discoveryGenericType(Field field) { | |
368 | + | |
369 | + Type genericFieldType = field.getGenericType(); | |
370 | + | |
371 | + if(genericFieldType instanceof ParameterizedType){ | |
372 | + ParameterizedType type = (ParameterizedType) genericFieldType; | |
373 | + Type[] fieldArgumentTypes = type.getActualTypeArguments(); | |
374 | + for(Type fieldArgumentType : fieldArgumentTypes){ | |
375 | + @SuppressWarnings("rawtypes") | |
376 | + Class fieldArgumentClass = (Class) fieldArgumentType; | |
377 | + | |
378 | + if("String".equals(fieldArgumentClass.getSimpleName())) { | |
379 | + return ""; | |
380 | + } | |
381 | + | |
382 | + return fieldArgumentClass.getSimpleName(); | |
383 | + } | |
384 | + } | |
385 | + | |
386 | + return ""; | |
387 | + } | |
388 | + | |
281 | 389 | private Object getProperty(String key, org.apache.commons.configuration.Configuration config) { |
282 | 390 | Object value = null; |
283 | 391 | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoaderTest.java
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoaderWithArrayTest.java
0 → 100644
... | ... | @@ -0,0 +1,520 @@ |
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.internal.configuration; | |
38 | + | |
39 | +import static org.easymock.EasyMock.expect; | |
40 | +import static org.junit.Assert.assertEquals; | |
41 | +import static org.powermock.api.easymock.PowerMock.mockStatic; | |
42 | + | |
43 | +import java.awt.Color; | |
44 | +import java.math.BigDecimal; | |
45 | +import java.math.BigInteger; | |
46 | +import java.net.URL; | |
47 | +import java.util.Calendar; | |
48 | +import java.util.Date; | |
49 | +import java.util.GregorianCalendar; | |
50 | +import java.util.Locale; | |
51 | + | |
52 | +import org.junit.After; | |
53 | +import org.junit.Before; | |
54 | +import org.junit.Test; | |
55 | +import org.junit.runner.RunWith; | |
56 | +import org.powermock.api.easymock.PowerMock; | |
57 | +import org.powermock.core.classloader.annotations.PrepareForTest; | |
58 | +import org.powermock.modules.junit4.PowerMockRunner; | |
59 | +import org.powermock.reflect.Whitebox; | |
60 | +import org.slf4j.Logger; | |
61 | + | |
62 | +import br.gov.frameworkdemoiselle.configuration.ConfigType; | |
63 | +import br.gov.frameworkdemoiselle.configuration.Configuration; | |
64 | +import br.gov.frameworkdemoiselle.internal.bootstrap.CoreBootstrap; | |
65 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
66 | + | |
67 | +@RunWith(PowerMockRunner.class) | |
68 | +@PrepareForTest(CoreBootstrap.class) | |
69 | +public class ConfigurationLoaderWithArrayTest { | |
70 | + | |
71 | + private ConfigurationLoader configurationLoader; | |
72 | + | |
73 | + @Configuration(type = ConfigType.PROPERTIES , resource = "configuration-with-array") | |
74 | + public class ConfigurationPropertiesWithArray { | |
75 | + | |
76 | + /* | |
77 | + * All methods supported by org.apache.commons.configuration.DataConfiguration class for array | |
78 | + */ | |
79 | + | |
80 | + protected BigDecimal[] bigDecimalArray; | |
81 | + protected BigInteger[] bigIntegerArray; | |
82 | + protected boolean[] booleanArray; | |
83 | + protected byte[] byteArray; | |
84 | + protected Calendar[] calendarArray; | |
85 | + protected Color[] colorArray; | |
86 | + protected Date[] dateArray; | |
87 | + protected double[] doubleArray; | |
88 | + protected float[] floatArray; | |
89 | + protected int[] integerArray; | |
90 | + protected Locale[] localeArray; | |
91 | + protected long[] longArray; | |
92 | + protected short[] shortArray; | |
93 | + protected URL[] urlArray; | |
94 | + protected String[] stringArray; | |
95 | + | |
96 | + } | |
97 | + | |
98 | + @Configuration(type = ConfigType.XML, resource = "configuration-with-array") | |
99 | + public class ConfigurationXMLWithArray { | |
100 | + | |
101 | + /* | |
102 | + * All methods supported by org.apache.commons.configuration.DataConfiguration class for array | |
103 | + */ | |
104 | + | |
105 | + protected BigDecimal[] bigDecimalArray; | |
106 | + protected BigInteger[] bigIntegerArray; | |
107 | + protected boolean[] booleanArray; | |
108 | + protected byte[] byteArray; | |
109 | + protected Calendar[] calendarArray; | |
110 | + protected Color[] colorArray; | |
111 | + protected Date[] dateArray; | |
112 | + protected double[] doubleArray; | |
113 | + protected float[] floatArray; | |
114 | + protected int[] integerArray; | |
115 | + protected Locale[] localeArray; | |
116 | + protected long[] longArray; | |
117 | + protected short[] shortArray; | |
118 | + protected URL[] urlArray; | |
119 | + protected String[] stringArray; | |
120 | + | |
121 | + } | |
122 | + | |
123 | + | |
124 | + @Before | |
125 | + public void setUp() throws Exception { | |
126 | + Logger logger; | |
127 | + ResourceBundle bundle; | |
128 | + logger = PowerMock.createMock(Logger.class); | |
129 | + bundle = new ResourceBundle(ResourceBundle.getBundle("demoiselle-core-bundle")); | |
130 | + configurationLoader = new ConfigurationLoader(); | |
131 | + Whitebox.setInternalState(this.configurationLoader, "bundle", bundle); | |
132 | + Whitebox.setInternalState(this.configurationLoader, "logger", logger); | |
133 | + } | |
134 | + | |
135 | + @After | |
136 | + public void tearDown() throws Exception { | |
137 | + } | |
138 | + | |
139 | + @Test | |
140 | + public void testConfigurationPropertiesWithIntegerArray() { | |
141 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
142 | + | |
143 | + Integer integerValue = config.integerArray[0]; | |
144 | + | |
145 | + assertEquals(Integer.class, integerValue.getClass()); | |
146 | + assertEquals(Integer.MAX_VALUE, integerValue.intValue()); | |
147 | + assertEquals(4, config.integerArray.length); | |
148 | + } | |
149 | + | |
150 | + | |
151 | + @Test | |
152 | + public void testConfigurationPropertiesWithShortArray() { | |
153 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
154 | + | |
155 | + Short shortValue = config.shortArray[0]; | |
156 | + | |
157 | + assertEquals(Short.class, shortValue.getClass()); | |
158 | + assertEquals(Short.MAX_VALUE, shortValue.shortValue()); | |
159 | + assertEquals(4, config.shortArray.length); | |
160 | + } | |
161 | + | |
162 | + @Test | |
163 | + public void testConfigurationPropertiesWithByteArray() { | |
164 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
165 | + | |
166 | + Byte byteValue = config.byteArray[0]; | |
167 | + | |
168 | + assertEquals(Byte.class, byteValue.getClass()); | |
169 | + assertEquals(Byte.MAX_VALUE, byteValue.byteValue()); | |
170 | + assertEquals(8, config.byteArray.length); | |
171 | + } | |
172 | + | |
173 | + @Test | |
174 | + public void testConfigurationPropertiesWithBooleanArray() { | |
175 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
176 | + | |
177 | + Boolean booleanValue = config.booleanArray[0]; | |
178 | + | |
179 | + assertEquals(Boolean.class, booleanValue.getClass()); | |
180 | + assertEquals(2, config.booleanArray.length); | |
181 | + } | |
182 | + | |
183 | + @Test | |
184 | + public void testConfigurationPropertiesWithLongArray() { | |
185 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
186 | + | |
187 | + Long longValue = config.longArray[0]; | |
188 | + | |
189 | + assertEquals(Long.class, longValue.getClass()); | |
190 | + assertEquals(Long.MAX_VALUE, longValue.longValue()); | |
191 | + assertEquals(5, config.longArray.length); | |
192 | + } | |
193 | + | |
194 | + @Test | |
195 | + public void testConfigurationPropertiesWithFloatArray() { | |
196 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
197 | + | |
198 | + Float floatValue = config.floatArray[0]; | |
199 | + | |
200 | + assertEquals(Float.class, floatValue.getClass()); | |
201 | + assertEquals(Float.MAX_VALUE, floatValue.floatValue(), 1); | |
202 | + assertEquals(5, config.floatArray.length); | |
203 | + } | |
204 | + | |
205 | + @Test | |
206 | + public void testConfigurationPropertiesWithDoubleArray() { | |
207 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
208 | + | |
209 | + Double doubleValue = config.doubleArray[0]; | |
210 | + | |
211 | + assertEquals(Double.class, doubleValue.getClass()); | |
212 | + assertEquals(Double.MAX_VALUE, doubleValue.doubleValue(), 1); | |
213 | + assertEquals(3, config.doubleArray.length); | |
214 | + } | |
215 | + | |
216 | + @Test | |
217 | + public void testConfigurationPropertiesWithBigDecimalArray() { | |
218 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
219 | + | |
220 | + BigDecimal bigDecimalValue = config.bigDecimalArray[0]; | |
221 | + | |
222 | + assertEquals(BigDecimal.class, bigDecimalValue.getClass()); | |
223 | + assertEquals(3, config.bigDecimalArray.length); | |
224 | + } | |
225 | + | |
226 | + @Test | |
227 | + public void testConfigurationPropertiesWithBigIntegerArray() { | |
228 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
229 | + | |
230 | + BigInteger bigIntegerValue = config.bigIntegerArray[0]; | |
231 | + | |
232 | + assertEquals(BigInteger.class, bigIntegerValue.getClass()); | |
233 | + assertEquals(3, config.bigIntegerArray.length); | |
234 | + } | |
235 | + | |
236 | + @Test | |
237 | + public void testConfigurationPropertiesWithCalendarArray() { | |
238 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
239 | + | |
240 | + Calendar calendarValue = config.calendarArray[0]; | |
241 | + | |
242 | + GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.JUNE, 14, 10, 10); | |
243 | + | |
244 | + assertEquals(Calendar.class, calendarValue.getClass().getSuperclass()); | |
245 | + assertEquals(calendar.getTimeInMillis(), calendarValue.getTimeInMillis()); | |
246 | + assertEquals(3, config.calendarArray.length); | |
247 | + } | |
248 | + | |
249 | + @Test | |
250 | + public void testConfigurationPropertiesWithDateArray() { | |
251 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
252 | + | |
253 | + Date dateValue = config.dateArray[0]; | |
254 | + | |
255 | + GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.AUGUST, 14, 18, 10, 50); | |
256 | + | |
257 | + Date date = new Date(calendar.getTimeInMillis()); | |
258 | + | |
259 | + assertEquals(Date.class, dateValue.getClass()); | |
260 | + assertEquals(date.getTime(), dateValue.getTime()); | |
261 | + assertEquals(3, config.dateArray.length); | |
262 | + } | |
263 | + | |
264 | + @Test | |
265 | + public void testConfigurationPropertiesWithColorArray() { | |
266 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
267 | + | |
268 | + Color colorValue = config.colorArray[0]; | |
269 | + | |
270 | + assertEquals(Color.class, colorValue.getClass()); | |
271 | + assertEquals(Color.gray, colorValue); | |
272 | + assertEquals(3, config.colorArray.length); | |
273 | + } | |
274 | + | |
275 | + @Test | |
276 | + public void testConfigurationPropertiesWithLocaleArray() { | |
277 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
278 | + | |
279 | + Locale localeValue = config.localeArray[0]; | |
280 | + Locale localeValue2 = config.localeArray[1]; | |
281 | + | |
282 | + assertEquals(Locale.class, localeValue.getClass()); | |
283 | + assertEquals(Locale.ENGLISH, localeValue); | |
284 | + assertEquals("BR", localeValue2.getCountry()); | |
285 | + assertEquals(3, config.localeArray.length); | |
286 | + } | |
287 | + | |
288 | + @Test | |
289 | + public void testConfigurationPropertiesWithURLArray() { | |
290 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
291 | + | |
292 | + URL urlValue = config.urlArray[0]; | |
293 | + | |
294 | + URL otherURL = null; | |
295 | + | |
296 | + try { | |
297 | + otherURL = new URL("http://www.test.com"); | |
298 | + } | |
299 | + catch(Exception e) { | |
300 | + | |
301 | + } | |
302 | + | |
303 | + assertEquals(URL.class, urlValue.getClass()); | |
304 | + assertEquals(otherURL, urlValue); | |
305 | + assertEquals(3, config.urlArray.length); | |
306 | + } | |
307 | + | |
308 | + @Test | |
309 | + public void testConfigurationPropertiesWithStringArray() { | |
310 | + ConfigurationPropertiesWithArray config = prepareConfigurationPropertiesWithArray(); | |
311 | + | |
312 | + String stringValue = config.stringArray[0]; | |
313 | + | |
314 | + assertEquals(String.class, stringValue.getClass()); | |
315 | + assertEquals("Test", stringValue); | |
316 | + assertEquals(3, config.stringArray.length); | |
317 | + } | |
318 | + | |
319 | + private ConfigurationPropertiesWithArray prepareConfigurationPropertiesWithArray() { | |
320 | + ConfigurationPropertiesWithArray config = new ConfigurationPropertiesWithArray(); | |
321 | + | |
322 | + mockStatic(CoreBootstrap.class); | |
323 | + expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true); | |
324 | + PowerMock.replay(CoreBootstrap.class); | |
325 | + | |
326 | + configurationLoader.load(config); | |
327 | + return config; | |
328 | + } | |
329 | + | |
330 | + @Test | |
331 | + public void testConfigurationXMLWithIntegerArray() { | |
332 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
333 | + | |
334 | + Integer integerValue = config.integerArray[0]; | |
335 | + | |
336 | + assertEquals(Integer.class, integerValue.getClass()); | |
337 | + assertEquals(Integer.MAX_VALUE, integerValue.intValue()); | |
338 | + assertEquals(4, config.integerArray.length); | |
339 | + } | |
340 | + | |
341 | + | |
342 | + @Test | |
343 | + public void testConfigurationXMLWithShortArray() { | |
344 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
345 | + | |
346 | + Short shortValue = config.shortArray[0]; | |
347 | + | |
348 | + assertEquals(Short.class, shortValue.getClass()); | |
349 | + assertEquals(Short.MAX_VALUE, shortValue.shortValue()); | |
350 | + assertEquals(4, config.shortArray.length); | |
351 | + } | |
352 | + | |
353 | + @Test | |
354 | + public void testConfigurationXMLWithByteArray() { | |
355 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
356 | + | |
357 | + Byte byteValue = config.byteArray[0]; | |
358 | + | |
359 | + assertEquals(Byte.class, byteValue.getClass()); | |
360 | + assertEquals(Byte.MAX_VALUE, byteValue.byteValue()); | |
361 | + assertEquals(8, config.byteArray.length); | |
362 | + } | |
363 | + | |
364 | + @Test | |
365 | + public void testConfigurationXMLWithBooleanArray() { | |
366 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
367 | + | |
368 | + Boolean booleanValue = config.booleanArray[0]; | |
369 | + | |
370 | + assertEquals(Boolean.class, booleanValue.getClass()); | |
371 | + assertEquals(2, config.booleanArray.length); | |
372 | + } | |
373 | + | |
374 | + @Test | |
375 | + public void testConfigurationXMLWithLongArray() { | |
376 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
377 | + | |
378 | + Long longValue = config.longArray[0]; | |
379 | + | |
380 | + assertEquals(Long.class, longValue.getClass()); | |
381 | + assertEquals(Long.MAX_VALUE, longValue.longValue()); | |
382 | + assertEquals(5, config.longArray.length); | |
383 | + } | |
384 | + | |
385 | + @Test | |
386 | + public void testConfigurationXMLWithFloatArray() { | |
387 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
388 | + | |
389 | + Float floatValue = config.floatArray[0]; | |
390 | + | |
391 | + assertEquals(Float.class, floatValue.getClass()); | |
392 | + assertEquals(Float.MAX_VALUE, floatValue.floatValue(), 1); | |
393 | + assertEquals(5, config.floatArray.length); | |
394 | + } | |
395 | + | |
396 | + @Test | |
397 | + public void testConfigurationXMLWithDoubleArray() { | |
398 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
399 | + | |
400 | + Double doubleValue = config.doubleArray[0]; | |
401 | + | |
402 | + assertEquals(Double.class, doubleValue.getClass()); | |
403 | + assertEquals(Double.MAX_VALUE, doubleValue.doubleValue(), 1); | |
404 | + assertEquals(3, config.doubleArray.length); | |
405 | + } | |
406 | + | |
407 | + @Test | |
408 | + public void testConfigurationXMLWithBigDecimalArray() { | |
409 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
410 | + | |
411 | + BigDecimal bigDecimalValue = config.bigDecimalArray[0]; | |
412 | + | |
413 | + assertEquals(BigDecimal.class, bigDecimalValue.getClass()); | |
414 | + assertEquals(3, config.bigDecimalArray.length); | |
415 | + } | |
416 | + | |
417 | + @Test | |
418 | + public void testConfigurationXMLWithBigIntegerArray() { | |
419 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
420 | + | |
421 | + BigInteger bigIntegerValue = config.bigIntegerArray[0]; | |
422 | + | |
423 | + assertEquals(BigInteger.class, bigIntegerValue.getClass()); | |
424 | + assertEquals(3, config.bigIntegerArray.length); | |
425 | + } | |
426 | + | |
427 | + @Test | |
428 | + public void testConfigurationXMLWithCalendarArray() { | |
429 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
430 | + | |
431 | + Calendar calendarValue = config.calendarArray[0]; | |
432 | + | |
433 | + GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.JUNE, 14, 10, 10); | |
434 | + | |
435 | + assertEquals(Calendar.class, calendarValue.getClass().getSuperclass()); | |
436 | + assertEquals(calendar.getTimeInMillis(), calendarValue.getTimeInMillis()); | |
437 | + assertEquals(3, config.calendarArray.length); | |
438 | + } | |
439 | + | |
440 | + @Test | |
441 | + public void testConfigurationXMLWithDateArray() { | |
442 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
443 | + | |
444 | + Date dateValue = config.dateArray[0]; | |
445 | + | |
446 | + GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.AUGUST, 14, 18, 10, 50); | |
447 | + | |
448 | + Date date = new Date(calendar.getTimeInMillis()); | |
449 | + | |
450 | + assertEquals(Date.class, dateValue.getClass()); | |
451 | + assertEquals(date.getTime(), dateValue.getTime()); | |
452 | + assertEquals(3, config.dateArray.length); | |
453 | + } | |
454 | + | |
455 | + @Test | |
456 | + public void testConfigurationXMLWithColorArray() { | |
457 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
458 | + | |
459 | + Color colorValue = config.colorArray[0]; | |
460 | + | |
461 | + assertEquals(Color.class, colorValue.getClass()); | |
462 | + assertEquals(Color.gray, colorValue); | |
463 | + assertEquals(3, config.colorArray.length); | |
464 | + } | |
465 | + | |
466 | + @Test | |
467 | + public void testConfigurationXMLWithLocaleArray() { | |
468 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
469 | + | |
470 | + Locale localeValue = config.localeArray[0]; | |
471 | + Locale localeValue2 = config.localeArray[1]; | |
472 | + | |
473 | + assertEquals(Locale.class, localeValue.getClass()); | |
474 | + assertEquals(Locale.ENGLISH, localeValue); | |
475 | + assertEquals("BR", localeValue2.getCountry()); | |
476 | + assertEquals(3, config.localeArray.length); | |
477 | + } | |
478 | + | |
479 | + @Test | |
480 | + public void testConfigurationXMLWithURLArray() { | |
481 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
482 | + | |
483 | + URL urlValue = config.urlArray[0]; | |
484 | + | |
485 | + URL otherURL = null; | |
486 | + | |
487 | + try { | |
488 | + otherURL = new URL("http://www.test.com"); | |
489 | + } | |
490 | + catch(Exception e) { | |
491 | + | |
492 | + } | |
493 | + | |
494 | + assertEquals(URL.class, urlValue.getClass()); | |
495 | + assertEquals(otherURL, urlValue); | |
496 | + assertEquals(3, config.urlArray.length); | |
497 | + } | |
498 | + | |
499 | + @Test | |
500 | + public void testConfigurationXMLWithStringArray() { | |
501 | + ConfigurationXMLWithArray config = prepareConfigurationXMLWithArray(); | |
502 | + | |
503 | + String stringValue = config.stringArray[0]; | |
504 | + | |
505 | + assertEquals(String.class, stringValue.getClass()); | |
506 | + assertEquals("Test", stringValue); | |
507 | + assertEquals(3, config.stringArray.length); | |
508 | + } | |
509 | + | |
510 | + private ConfigurationXMLWithArray prepareConfigurationXMLWithArray() { | |
511 | + ConfigurationXMLWithArray config = new ConfigurationXMLWithArray(); | |
512 | + | |
513 | + mockStatic(CoreBootstrap.class); | |
514 | + expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true); | |
515 | + PowerMock.replay(CoreBootstrap.class); | |
516 | + | |
517 | + configurationLoader.load(config); | |
518 | + return config; | |
519 | + } | |
520 | +} | ... | ... |
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoaderWithListTest.java
0 → 100644
... | ... | @@ -0,0 +1,516 @@ |
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.internal.configuration; | |
38 | + | |
39 | +import static org.easymock.EasyMock.expect; | |
40 | +import static org.junit.Assert.assertEquals; | |
41 | +import static org.powermock.api.easymock.PowerMock.mockStatic; | |
42 | + | |
43 | +import java.awt.Color; | |
44 | +import java.math.BigDecimal; | |
45 | +import java.math.BigInteger; | |
46 | +import java.net.URL; | |
47 | +import java.util.Calendar; | |
48 | +import java.util.Date; | |
49 | +import java.util.GregorianCalendar; | |
50 | +import java.util.List; | |
51 | +import java.util.Locale; | |
52 | + | |
53 | +import org.junit.After; | |
54 | +import org.junit.Before; | |
55 | +import org.junit.Test; | |
56 | +import org.junit.runner.RunWith; | |
57 | +import org.powermock.api.easymock.PowerMock; | |
58 | +import org.powermock.core.classloader.annotations.PrepareForTest; | |
59 | +import org.powermock.modules.junit4.PowerMockRunner; | |
60 | +import org.powermock.reflect.Whitebox; | |
61 | +import org.slf4j.Logger; | |
62 | + | |
63 | +import br.gov.frameworkdemoiselle.configuration.ConfigType; | |
64 | +import br.gov.frameworkdemoiselle.configuration.Configuration; | |
65 | +import br.gov.frameworkdemoiselle.internal.bootstrap.CoreBootstrap; | |
66 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
67 | + | |
68 | +@RunWith(PowerMockRunner.class) | |
69 | +@PrepareForTest(CoreBootstrap.class) | |
70 | +public class ConfigurationLoaderWithListTest { | |
71 | + | |
72 | + private ConfigurationLoader configurationLoader; | |
73 | + | |
74 | + @Configuration(type = ConfigType.PROPERTIES, resource = "configuration-with-list") | |
75 | + public class ConfigurationPropertiesWithList { | |
76 | + /* | |
77 | + * All methods supported by org.apache.commons.configuration.DataConfiguration class for List type | |
78 | + */ | |
79 | + | |
80 | + protected List<BigDecimal> bigDecimalList; | |
81 | + protected List<BigInteger> bigIntegerList; | |
82 | + protected List<Boolean> booleanList; | |
83 | + protected List<Byte> byteList; | |
84 | + protected List<Calendar> calendarList; | |
85 | + protected List<Color> colorList; | |
86 | + protected List<Date> dateList; | |
87 | + protected List<Double> doubleList; | |
88 | + protected List<Float> floatList; | |
89 | + protected List<Integer> integerList; | |
90 | + protected List<Locale> localeList; | |
91 | + protected List<Long> longList; | |
92 | + protected List<Short> shortList; | |
93 | + protected List<URL> urlList; | |
94 | + protected List<String> stringList; | |
95 | + } | |
96 | + | |
97 | + @Configuration(type = ConfigType.XML, resource = "configuration-with-list") | |
98 | + public class ConfigurationXMLWithList { | |
99 | + /* | |
100 | + * All methods supported by org.apache.commons.configuration.DataConfiguration class for List type | |
101 | + */ | |
102 | + | |
103 | + protected List<BigDecimal> bigDecimalList; | |
104 | + protected List<BigInteger> bigIntegerList; | |
105 | + protected List<Boolean> booleanList; | |
106 | + protected List<Byte> byteList; | |
107 | + protected List<Calendar> calendarList; | |
108 | + protected List<Color> colorList; | |
109 | + protected List<Date> dateList; | |
110 | + protected List<Double> doubleList; | |
111 | + protected List<Float> floatList; | |
112 | + protected List<Integer> integerList; | |
113 | + protected List<Locale> localeList; | |
114 | + protected List<Long> longList; | |
115 | + protected List<Short> shortList; | |
116 | + protected List<URL> urlList; | |
117 | + protected List<String> stringList; | |
118 | + } | |
119 | + | |
120 | + @Before | |
121 | + public void setUp() throws Exception { | |
122 | + Logger logger; | |
123 | + ResourceBundle bundle; | |
124 | + logger = PowerMock.createMock(Logger.class); | |
125 | + bundle = new ResourceBundle(ResourceBundle.getBundle("demoiselle-core-bundle")); | |
126 | + configurationLoader = new ConfigurationLoader(); | |
127 | + Whitebox.setInternalState(this.configurationLoader, "bundle", bundle); | |
128 | + Whitebox.setInternalState(this.configurationLoader, "logger", logger); | |
129 | + } | |
130 | + | |
131 | + @After | |
132 | + public void tearDown() throws Exception { | |
133 | + } | |
134 | + | |
135 | + @Test | |
136 | + public void testConfigurationPropertiesWithIntegerList() { | |
137 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
138 | + | |
139 | + Integer integerValue = config.integerList.get(0); | |
140 | + | |
141 | + assertEquals(Integer.class, integerValue.getClass()); | |
142 | + assertEquals(Integer.MAX_VALUE, integerValue.intValue()); | |
143 | + assertEquals(4, config.integerList.size()); | |
144 | + } | |
145 | + | |
146 | + @Test | |
147 | + public void testConfigurationPropertiesWithShortList() { | |
148 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
149 | + | |
150 | + Short shortValue = config.shortList.get(0); | |
151 | + | |
152 | + assertEquals(Short.class, shortValue.getClass()); | |
153 | + assertEquals(Short.MAX_VALUE, shortValue.shortValue()); | |
154 | + assertEquals(4, config.shortList.size()); | |
155 | + } | |
156 | + | |
157 | + @Test | |
158 | + public void testConfigurationPropertiesWithByteList() { | |
159 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
160 | + | |
161 | + Byte byteValue = config.byteList.get(0); | |
162 | + | |
163 | + assertEquals(Byte.class, byteValue.getClass()); | |
164 | + assertEquals(Byte.MAX_VALUE, byteValue.byteValue()); | |
165 | + assertEquals(8, config.byteList.size()); | |
166 | + } | |
167 | + | |
168 | + @Test | |
169 | + public void testConfigurationPropertiesWithBooleanList() { | |
170 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
171 | + | |
172 | + Boolean booleanValue = config.booleanList.get(0); | |
173 | + | |
174 | + assertEquals(Boolean.class, booleanValue.getClass()); | |
175 | + assertEquals(2, config.booleanList.size()); | |
176 | + } | |
177 | + | |
178 | + @Test | |
179 | + public void testConfigurationPropertiesWithLongList() { | |
180 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
181 | + | |
182 | + Long longValue = config.longList.get(0); | |
183 | + | |
184 | + assertEquals(Long.class, longValue.getClass()); | |
185 | + assertEquals(Long.MAX_VALUE, longValue.longValue()); | |
186 | + assertEquals(5, config.longList.size()); | |
187 | + } | |
188 | + | |
189 | + @Test | |
190 | + public void testConfigurationPropertiesWithFloatList() { | |
191 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
192 | + | |
193 | + Float floatValue = config.floatList.get(0); | |
194 | + | |
195 | + assertEquals(Float.class, floatValue.getClass()); | |
196 | + assertEquals(Float.MAX_VALUE, floatValue.floatValue(), 1); | |
197 | + assertEquals(5, config.floatList.size()); | |
198 | + } | |
199 | + | |
200 | + @Test | |
201 | + public void testConfigurationPropertiesWithDoubleList() { | |
202 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
203 | + | |
204 | + Double doubleValue = config.doubleList.get(0); | |
205 | + | |
206 | + assertEquals(Double.class, doubleValue.getClass()); | |
207 | + assertEquals(Double.MAX_VALUE, doubleValue.doubleValue(), 1); | |
208 | + assertEquals(3, config.doubleList.size()); | |
209 | + } | |
210 | + | |
211 | + @Test | |
212 | + public void testConfigurationPropertiesWithBigDecimalList() { | |
213 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
214 | + | |
215 | + BigDecimal bigDecimalValue = config.bigDecimalList.get(0); | |
216 | + | |
217 | + assertEquals(BigDecimal.class, bigDecimalValue.getClass()); | |
218 | + assertEquals(3, config.bigDecimalList.size()); | |
219 | + } | |
220 | + | |
221 | + @Test | |
222 | + public void testConfigurationPropertiesWithBigIntegerList() { | |
223 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
224 | + | |
225 | + BigInteger bigIntegerValue = config.bigIntegerList.get(0); | |
226 | + | |
227 | + assertEquals(BigInteger.class, bigIntegerValue.getClass()); | |
228 | + assertEquals(3, config.bigIntegerList.size()); | |
229 | + } | |
230 | + | |
231 | + @Test | |
232 | + public void testConfigurationPropertiesWithCalendarList() { | |
233 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
234 | + | |
235 | + Calendar calendarValue = config.calendarList.get(0); | |
236 | + | |
237 | + GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.JUNE, 14, 10, 10); | |
238 | + | |
239 | + assertEquals(Calendar.class, calendarValue.getClass().getSuperclass()); | |
240 | + assertEquals(calendar.getTimeInMillis(), calendarValue.getTimeInMillis()); | |
241 | + assertEquals(3, config.calendarList.size()); | |
242 | + } | |
243 | + | |
244 | + @Test | |
245 | + public void testConfigurationPropertiesWithDateList() { | |
246 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
247 | + | |
248 | + Date dateValue = config.dateList.get(0); | |
249 | + | |
250 | + GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.AUGUST, 14, 18, 10, 50); | |
251 | + | |
252 | + Date date = new Date(calendar.getTimeInMillis()); | |
253 | + | |
254 | + assertEquals(Date.class, dateValue.getClass()); | |
255 | + assertEquals(date.getTime(), dateValue.getTime()); | |
256 | + assertEquals(3, config.dateList.size()); | |
257 | + } | |
258 | + | |
259 | + @Test | |
260 | + public void testConfigurationPropertiesWithColorList() { | |
261 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
262 | + | |
263 | + Color colorValue = config.colorList.get(0); | |
264 | + | |
265 | + assertEquals(Color.class, colorValue.getClass()); | |
266 | + assertEquals(Color.gray, colorValue); | |
267 | + assertEquals(3, config.colorList.size()); | |
268 | + } | |
269 | + | |
270 | + @Test | |
271 | + public void testConfigurationPropertiesWithLocaleList() { | |
272 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
273 | + | |
274 | + Locale localeValue = config.localeList.get(0); | |
275 | + Locale localeValue2 = config.localeList.get(1); | |
276 | + | |
277 | + assertEquals(Locale.class, localeValue.getClass()); | |
278 | + assertEquals(Locale.ENGLISH, localeValue); | |
279 | + assertEquals("BR", localeValue2.getCountry()); | |
280 | + assertEquals(3, config.localeList.size()); | |
281 | + } | |
282 | + | |
283 | + @Test | |
284 | + public void testConfigurationPropertiesWithURLList() { | |
285 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
286 | + | |
287 | + URL urlValue = config.urlList.get(0); | |
288 | + | |
289 | + URL otherURL = null; | |
290 | + | |
291 | + try { | |
292 | + otherURL = new URL("http://www.test.com"); | |
293 | + } | |
294 | + catch(Exception e) { | |
295 | + | |
296 | + } | |
297 | + | |
298 | + assertEquals(URL.class, urlValue.getClass()); | |
299 | + assertEquals(otherURL, urlValue); | |
300 | + assertEquals(3, config.urlList.size()); | |
301 | + } | |
302 | + | |
303 | + @Test | |
304 | + public void testConfigurationPropertiesWithStringList() { | |
305 | + ConfigurationPropertiesWithList config = prepareConfigurationPropertiesWithList(); | |
306 | + | |
307 | + String stringValue = config.stringList.get(0); | |
308 | + | |
309 | + assertEquals(String.class, stringValue.getClass()); | |
310 | + assertEquals("Test", stringValue); | |
311 | + assertEquals(3, config.stringList.size()); | |
312 | + } | |
313 | + | |
314 | + private ConfigurationPropertiesWithList prepareConfigurationPropertiesWithList() { | |
315 | + ConfigurationPropertiesWithList config = new ConfigurationPropertiesWithList(); | |
316 | + | |
317 | + mockStatic(CoreBootstrap.class); | |
318 | + expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true); | |
319 | + PowerMock.replay(CoreBootstrap.class); | |
320 | + | |
321 | + configurationLoader.load(config); | |
322 | + return config; | |
323 | + } | |
324 | + | |
325 | + | |
326 | + @Test | |
327 | + public void testConfigurationXMLWithIntegerList() { | |
328 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
329 | + | |
330 | + Integer integerValue = config.integerList.get(0); | |
331 | + | |
332 | + assertEquals(Integer.class, integerValue.getClass()); | |
333 | + assertEquals(Integer.MAX_VALUE, integerValue.intValue()); | |
334 | + assertEquals(4, config.integerList.size()); | |
335 | + } | |
336 | + | |
337 | + @Test | |
338 | + public void testConfigurationXMLWithShortList() { | |
339 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
340 | + | |
341 | + Short shortValue = config.shortList.get(0); | |
342 | + | |
343 | + assertEquals(Short.class, shortValue.getClass()); | |
344 | + assertEquals(Short.MAX_VALUE, shortValue.shortValue()); | |
345 | + assertEquals(4, config.shortList.size()); | |
346 | + } | |
347 | + | |
348 | + @Test | |
349 | + public void testConfigurationXMLWithByteList() { | |
350 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
351 | + | |
352 | + Byte byteValue = config.byteList.get(0); | |
353 | + | |
354 | + assertEquals(Byte.class, byteValue.getClass()); | |
355 | + assertEquals(Byte.MAX_VALUE, byteValue.byteValue()); | |
356 | + assertEquals(8, config.byteList.size()); | |
357 | + } | |
358 | + | |
359 | + @Test | |
360 | + public void testConfigurationXMLWithBooleanList() { | |
361 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
362 | + | |
363 | + Boolean booleanValue = config.booleanList.get(0); | |
364 | + | |
365 | + assertEquals(Boolean.class, booleanValue.getClass()); | |
366 | + assertEquals(2, config.booleanList.size()); | |
367 | + } | |
368 | + | |
369 | + @Test | |
370 | + public void testConfigurationXMLWithLongList() { | |
371 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
372 | + | |
373 | + Long longValue = config.longList.get(0); | |
374 | + | |
375 | + assertEquals(Long.class, longValue.getClass()); | |
376 | + assertEquals(Long.MAX_VALUE, longValue.longValue()); | |
377 | + assertEquals(5, config.longList.size()); | |
378 | + } | |
379 | + | |
380 | + @Test | |
381 | + public void testConfigurationXMLWithFloatList() { | |
382 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
383 | + | |
384 | + Float floatValue = config.floatList.get(0); | |
385 | + | |
386 | + assertEquals(Float.class, floatValue.getClass()); | |
387 | + assertEquals(Float.MAX_VALUE, floatValue.floatValue(), 1); | |
388 | + assertEquals(5, config.floatList.size()); | |
389 | + } | |
390 | + | |
391 | + @Test | |
392 | + public void testConfigurationXMLWithDoubleList() { | |
393 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
394 | + | |
395 | + Double doubleValue = config.doubleList.get(0); | |
396 | + | |
397 | + assertEquals(Double.class, doubleValue.getClass()); | |
398 | + assertEquals(Double.MAX_VALUE, doubleValue.doubleValue(), 1); | |
399 | + assertEquals(3, config.doubleList.size()); | |
400 | + } | |
401 | + | |
402 | + @Test | |
403 | + public void testConfigurationXMLWithBigDecimalList() { | |
404 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
405 | + | |
406 | + BigDecimal bigDecimalValue = config.bigDecimalList.get(0); | |
407 | + | |
408 | + assertEquals(BigDecimal.class, bigDecimalValue.getClass()); | |
409 | + assertEquals(3, config.bigDecimalList.size()); | |
410 | + } | |
411 | + | |
412 | + @Test | |
413 | + public void testConfigurationXMLWithBigIntegerList() { | |
414 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
415 | + | |
416 | + BigInteger bigIntegerValue = config.bigIntegerList.get(0); | |
417 | + | |
418 | + assertEquals(BigInteger.class, bigIntegerValue.getClass()); | |
419 | + assertEquals(3, config.bigIntegerList.size()); | |
420 | + } | |
421 | + | |
422 | + @Test | |
423 | + public void testConfigurationXMLWithCalendarList() { | |
424 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
425 | + | |
426 | + Calendar calendarValue = config.calendarList.get(0); | |
427 | + | |
428 | + GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.JUNE, 14, 10, 10); | |
429 | + | |
430 | + assertEquals(Calendar.class, calendarValue.getClass().getSuperclass()); | |
431 | + assertEquals(calendar.getTimeInMillis(), calendarValue.getTimeInMillis()); | |
432 | + assertEquals(3, config.calendarList.size()); | |
433 | + } | |
434 | + | |
435 | + @Test | |
436 | + public void testConfigurationXMLWithDateList() { | |
437 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
438 | + | |
439 | + Date dateValue = config.dateList.get(0); | |
440 | + | |
441 | + GregorianCalendar calendar = new GregorianCalendar(2012, Calendar.AUGUST, 14, 18, 10, 50); | |
442 | + | |
443 | + Date date = new Date(calendar.getTimeInMillis()); | |
444 | + | |
445 | + assertEquals(Date.class, dateValue.getClass()); | |
446 | + assertEquals(date.getTime(), dateValue.getTime()); | |
447 | + assertEquals(3, config.dateList.size()); | |
448 | + } | |
449 | + | |
450 | + @Test | |
451 | + public void testConfigurationXMLWithColorList() { | |
452 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
453 | + | |
454 | + Color colorValue = config.colorList.get(0); | |
455 | + | |
456 | + assertEquals(Color.class, colorValue.getClass()); | |
457 | + assertEquals(Color.gray, colorValue); | |
458 | + assertEquals(3, config.colorList.size()); | |
459 | + } | |
460 | + | |
461 | + @Test | |
462 | + public void testConfigurationXMLWithLocaleList() { | |
463 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
464 | + | |
465 | + Locale localeValue = config.localeList.get(0); | |
466 | + Locale localeValue2 = config.localeList.get(1); | |
467 | + | |
468 | + assertEquals(Locale.class, localeValue.getClass()); | |
469 | + assertEquals(Locale.ENGLISH, localeValue); | |
470 | + assertEquals("BR", localeValue2.getCountry()); | |
471 | + assertEquals(3, config.localeList.size()); | |
472 | + } | |
473 | + | |
474 | + @Test | |
475 | + public void testConfigurationXMLWithURLList() { | |
476 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
477 | + | |
478 | + URL urlValue = config.urlList.get(0); | |
479 | + | |
480 | + URL otherURL = null; | |
481 | + | |
482 | + try { | |
483 | + otherURL = new URL("http://www.test.com"); | |
484 | + } | |
485 | + catch(Exception e) { | |
486 | + | |
487 | + } | |
488 | + | |
489 | + assertEquals(URL.class, urlValue.getClass()); | |
490 | + assertEquals(otherURL, urlValue); | |
491 | + assertEquals(3, config.urlList.size()); | |
492 | + } | |
493 | + | |
494 | + @Test | |
495 | + public void testConfigurationXMLWithStringList() { | |
496 | + ConfigurationXMLWithList config = prepareConfigurationXMLWithList(); | |
497 | + | |
498 | + String stringValue = config.stringList.get(0); | |
499 | + | |
500 | + assertEquals(String.class, stringValue.getClass()); | |
501 | + assertEquals("Test", stringValue); | |
502 | + assertEquals(3, config.stringList.size()); | |
503 | + } | |
504 | + | |
505 | + | |
506 | + private ConfigurationXMLWithList prepareConfigurationXMLWithList() { | |
507 | + ConfigurationXMLWithList config = new ConfigurationXMLWithList(); | |
508 | + | |
509 | + mockStatic(CoreBootstrap.class); | |
510 | + expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true); | |
511 | + PowerMock.replay(CoreBootstrap.class); | |
512 | + | |
513 | + configurationLoader.load(config); | |
514 | + return config; | |
515 | + } | |
516 | +} | ... | ... |
impl/core/src/test/resources/configuration-with-array.properties
0 → 100644
... | ... | @@ -0,0 +1,50 @@ |
1 | +# Demoiselle Framework | |
2 | +# Copyright (C) 2010 SERPRO | |
3 | +# ---------------------------------------------------------------------------- | |
4 | +# This file is part of Demoiselle Framework. | |
5 | +# | |
6 | +# Demoiselle Framework is free software; you can redistribute it and/or | |
7 | +# modify it under the terms of the GNU Lesser General Public License version 3 | |
8 | +# as published by the Free Software Foundation. | |
9 | +# | |
10 | +# This program is distributed in the hope that it will be useful, | |
11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +# GNU General Public License for more details. | |
14 | +# | |
15 | +# You should have received a copy of the GNU Lesser General Public License version 3 | |
16 | +# along with this program; if not, see <http://www.gnu.org/licenses/> | |
17 | +# or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
18 | +# Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | +# ---------------------------------------------------------------------------- | |
20 | +# Este arquivo é parte do Framework Demoiselle. | |
21 | +# | |
22 | +# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
23 | +# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
24 | +# do Software Livre (FSF). | |
25 | +# | |
26 | +# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
27 | +# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
28 | +# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
29 | +# para maiores detalhes. | |
30 | +# | |
31 | +# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
32 | +# "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
33 | +# ou escreva para a Fundação do Software Livre (FSF) Inc., | |
34 | +# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
35 | + | |
36 | +integer.array = 2147483647, 10993, 12330, 129399 | |
37 | +short.array = 32767, 123, 5512, 4212 | |
38 | +byte.array = 127, 12, 51, 123, 11, 5, 1, -12 | |
39 | +boolean.array = true, false | |
40 | +long.array = 9223372036854775807, 0901920390123, 1235234523, 134230094, 66123413423 | |
41 | +float.array = 3.4028235E38, 34.244, 2412.423444, 513.234, 10000.000 | |
42 | +double.array = 1.7976931348623157E308, 1231234.00120349192348123, 1234123512341.9134828348238 | |
43 | +big.decimal.array = 16578.69899, 48787.548877788, 4487787.559 | |
44 | +big.integer.array = 1998987987897, 89789498171, 21474836475 | |
45 | +calendar.array = 2012-06-14 10:10:00, 2012-07-14 10:10:00, 2012-06-15 18:10:00 | |
46 | +date.array = 2012-08-14 18:10:50, 2012-07-14 10:10:00, 2012-06-15 18:10:00 | |
47 | +color.array = #808080, #cccccc, #ABCCCC | |
48 | +locale.array = en, pt_br, ca | |
49 | +url.array = http://www.test.com, https://test.of.test.com, ftp://192.168.0.1 | |
50 | +string.array = Test, One, Two | ... | ... |
impl/core/src/test/resources/configuration-with-array.xml
0 → 100644
... | ... | @@ -0,0 +1,145 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | + Demoiselle Framework | |
4 | + Copyright (C) 2010 SERPRO | |
5 | + ============================================================================ | |
6 | + This file is part of Demoiselle Framework. | |
7 | + | |
8 | + Demoiselle Framework is free software; you can redistribute it and/or | |
9 | + modify it under the terms of the GNU Lesser General Public License version 3 | |
10 | + as published by the Free Software Foundation. | |
11 | + | |
12 | + This program is distributed in the hope that it will be useful, | |
13 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | + GNU General Public License for more details. | |
16 | + | |
17 | + You should have received a copy of the GNU Lesser General Public License version 3 | |
18 | + along with this program; if not, see <http://www.gnu.org/licenses/> | |
19 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
20 | + Fifth Floor, Boston, MA 02110-1301, USA. | |
21 | + ============================================================================ | |
22 | + Este arquivo é parte do Framework Demoiselle. | |
23 | + | |
24 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
25 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
26 | + do Software Livre (FSF). | |
27 | + | |
28 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
29 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
30 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
31 | + para maiores detalhes. | |
32 | + | |
33 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
34 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
35 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | |
36 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
37 | +--> | |
38 | + | |
39 | +<configuration> | |
40 | + | |
41 | + <integer> | |
42 | + <array>2147483647</array> | |
43 | + <array>10993</array> | |
44 | + <array>12330</array> | |
45 | + <array>129399</array> | |
46 | + </integer> | |
47 | + | |
48 | + <short> | |
49 | + <array>32767</array> | |
50 | + <array>123</array> | |
51 | + <array>5512</array> | |
52 | + <array>4212</array> | |
53 | + </short> | |
54 | + | |
55 | + <byte> | |
56 | + <array>127</array> | |
57 | + <array>12</array> | |
58 | + <array>51</array> | |
59 | + <array>123</array> | |
60 | + <array>11</array> | |
61 | + <array>5</array> | |
62 | + <array>1</array> | |
63 | + <array>-12</array> | |
64 | + </byte> | |
65 | + | |
66 | + <boolean> | |
67 | + <array>true</array> | |
68 | + <array>false</array> | |
69 | + </boolean> | |
70 | + | |
71 | + <long> | |
72 | + <array>9223372036854775807</array> | |
73 | + <array>0901920390123</array> | |
74 | + <array>1235234523</array> | |
75 | + <array>134230094</array> | |
76 | + <array>66123413423</array> | |
77 | + </long> | |
78 | + | |
79 | + <float> | |
80 | + <array>3.4028235E38</array> | |
81 | + <array>34.244</array> | |
82 | + <array>2412.423444</array> | |
83 | + <array>513.234</array> | |
84 | + <array>10000.000</array> | |
85 | + </float> | |
86 | + | |
87 | + <double> | |
88 | + <array>1.7976931348623157E308</array> | |
89 | + <array>1231234.00120349192348123</array> | |
90 | + <array>1234123512341.9134828348238</array> | |
91 | + </double> | |
92 | + | |
93 | + <big> | |
94 | + <decimal> | |
95 | + <array>16578.69899</array> | |
96 | + <array>48787.548877788</array> | |
97 | + <array>4487787.559</array> | |
98 | + </decimal> | |
99 | + </big> | |
100 | + | |
101 | + <big> | |
102 | + <integer> | |
103 | + <array>1998987987897</array> | |
104 | + <array>89789498171</array> | |
105 | + <array>21474836475</array> | |
106 | + </integer> | |
107 | + </big> | |
108 | + | |
109 | + <calendar> | |
110 | + <array>2012-06-14 10:10:00</array> | |
111 | + <array>2012-07-14 10:10:00</array> | |
112 | + <array>2012-06-15 18:10:00</array> | |
113 | + </calendar> | |
114 | + | |
115 | + <date> | |
116 | + <array>2012-08-14 18:10:50</array> | |
117 | + <array>2012-07-14 10:10:00</array> | |
118 | + <array>2012-06-15 18:10:00</array> | |
119 | + </date> | |
120 | + | |
121 | + <color> | |
122 | + <array>#808080</array> | |
123 | + <array>#cccccc</array> | |
124 | + <array> #ABCCCC</array> | |
125 | + </color> | |
126 | + | |
127 | + <locale> | |
128 | + <array>en</array> | |
129 | + <array>pt_br</array> | |
130 | + <array>ca</array> | |
131 | + </locale> | |
132 | + | |
133 | + <url> | |
134 | + <array>http://www.test.com</array> | |
135 | + <array>https://test.of.test.com</array> | |
136 | + <array>ftp://192.168.0.1</array> | |
137 | + </url> | |
138 | + | |
139 | + <string> | |
140 | + <array>Test</array> | |
141 | + <array>One</array> | |
142 | + <array>Two</array> | |
143 | + </string> | |
144 | + | |
145 | +</configuration> | |
0 | 146 | \ No newline at end of file | ... | ... |
impl/core/src/test/resources/configuration-with-list.properties
0 → 100644
... | ... | @@ -0,0 +1,50 @@ |
1 | +# Demoiselle Framework | |
2 | +# Copyright (C) 2010 SERPRO | |
3 | +# ---------------------------------------------------------------------------- | |
4 | +# This file is part of Demoiselle Framework. | |
5 | +# | |
6 | +# Demoiselle Framework is free software; you can redistribute it and/or | |
7 | +# modify it under the terms of the GNU Lesser General Public License version 3 | |
8 | +# as published by the Free Software Foundation. | |
9 | +# | |
10 | +# This program is distributed in the hope that it will be useful, | |
11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +# GNU General Public License for more details. | |
14 | +# | |
15 | +# You should have received a copy of the GNU Lesser General Public License version 3 | |
16 | +# along with this program; if not, see <http://www.gnu.org/licenses/> | |
17 | +# or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
18 | +# Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | +# ---------------------------------------------------------------------------- | |
20 | +# Este arquivo é parte do Framework Demoiselle. | |
21 | +# | |
22 | +# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
23 | +# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
24 | +# do Software Livre (FSF). | |
25 | +# | |
26 | +# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
27 | +# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
28 | +# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
29 | +# para maiores detalhes. | |
30 | +# | |
31 | +# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
32 | +# "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
33 | +# ou escreva para a Fundação do Software Livre (FSF) Inc., | |
34 | +# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
35 | + | |
36 | +integer.list = 2147483647, 10993, 12330, 129399 | |
37 | +short.list = 32767, 123, 5512, 4212 | |
38 | +byte.list = 127, 12, 51, 123, 11, 5, 1, -12 | |
39 | +boolean.list = true, false | |
40 | +long.list = 9223372036854775807, 0901920390123, 1235234523, 134230094, 66123413423 | |
41 | +float.list = 3.4028235E38, 34.244, 2412.423444, 513.234, 10000.000 | |
42 | +double.list = 1.7976931348623157E308, 1231234.00120349192348123, 1234123512341.9134828348238 | |
43 | +big.decimal.list = 16578.69899, 48787.548877788, 4487787.559 | |
44 | +big.integer.list = 1998987987897, 89789498171, 21474836475 | |
45 | +calendar.list = 2012-06-14 10:10:00, 2012-07-14 10:10:00, 2012-06-15 18:10:00 | |
46 | +date.list = 2012-08-14 18:10:50, 2012-07-14 10:10:00, 2012-06-15 18:10:00 | |
47 | +color.list = #808080, #cccccc, #ABCCCC | |
48 | +locale.list = en, pt_br, ca | |
49 | +url.list = http://www.test.com, https://test.of.test.com, ftp://192.168.0.1 | |
50 | +string.list = Test, One, Two | ... | ... |
impl/core/src/test/resources/configuration-with-list.xml
0 → 100644
... | ... | @@ -0,0 +1,145 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | + Demoiselle Framework | |
4 | + Copyright (C) 2010 SERPRO | |
5 | + ============================================================================ | |
6 | + This file is part of Demoiselle Framework. | |
7 | + | |
8 | + Demoiselle Framework is free software; you can redistribute it and/or | |
9 | + modify it under the terms of the GNU Lesser General Public License version 3 | |
10 | + as published by the Free Software Foundation. | |
11 | + | |
12 | + This program is distributed in the hope that it will be useful, | |
13 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | + GNU General Public License for more details. | |
16 | + | |
17 | + You should have received a copy of the GNU Lesser General Public License version 3 | |
18 | + along with this program; if not, see <http://www.gnu.org/licenses/> | |
19 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
20 | + Fifth Floor, Boston, MA 02110-1301, USA. | |
21 | + ============================================================================ | |
22 | + Este arquivo é parte do Framework Demoiselle. | |
23 | + | |
24 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
25 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
26 | + do Software Livre (FSF). | |
27 | + | |
28 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
29 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
30 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
31 | + para maiores detalhes. | |
32 | + | |
33 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
34 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
35 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | |
36 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
37 | +--> | |
38 | + | |
39 | +<configuration> | |
40 | + | |
41 | + <integer> | |
42 | + <list>2147483647</list> | |
43 | + <list>10993</list> | |
44 | + <list>12330</list> | |
45 | + <list>129399</list> | |
46 | + </integer> | |
47 | + | |
48 | + <short> | |
49 | + <list>32767</list> | |
50 | + <list>123</list> | |
51 | + <list>5512</list> | |
52 | + <list>4212</list> | |
53 | + </short> | |
54 | + | |
55 | + <byte> | |
56 | + <list>127</list> | |
57 | + <list>12</list> | |
58 | + <list>51</list> | |
59 | + <list>123</list> | |
60 | + <list>11</list> | |
61 | + <list>5</list> | |
62 | + <list>1</list> | |
63 | + <list>-12</list> | |
64 | + </byte> | |
65 | + | |
66 | + <boolean> | |
67 | + <list>true</list> | |
68 | + <list>false</list> | |
69 | + </boolean> | |
70 | + | |
71 | + <long> | |
72 | + <list>9223372036854775807</list> | |
73 | + <list>0901920390123</list> | |
74 | + <list>1235234523</list> | |
75 | + <list>134230094</list> | |
76 | + <list>66123413423</list> | |
77 | + </long> | |
78 | + | |
79 | + <float> | |
80 | + <list>3.4028235E38</list> | |
81 | + <list>34.244</list> | |
82 | + <list>2412.423444</list> | |
83 | + <list>513.234</list> | |
84 | + <list>10000.000</list> | |
85 | + </float> | |
86 | + | |
87 | + <double> | |
88 | + <list>1.7976931348623157E308</list> | |
89 | + <list>1231234.00120349192348123</list> | |
90 | + <list>1234123512341.9134828348238</list> | |
91 | + </double> | |
92 | + | |
93 | + <big> | |
94 | + <decimal> | |
95 | + <list>16578.69899</list> | |
96 | + <list>48787.548877788</list> | |
97 | + <list>4487787.559</list> | |
98 | + </decimal> | |
99 | + </big> | |
100 | + | |
101 | + <big> | |
102 | + <integer> | |
103 | + <list>1998987987897</list> | |
104 | + <list>89789498171</list> | |
105 | + <list>21474836475</list> | |
106 | + </integer> | |
107 | + </big> | |
108 | + | |
109 | + <calendar> | |
110 | + <list>2012-06-14 10:10:00</list> | |
111 | + <list>2012-07-14 10:10:00</list> | |
112 | + <list>2012-06-15 18:10:00</list> | |
113 | + </calendar> | |
114 | + | |
115 | + <date> | |
116 | + <list>2012-08-14 18:10:50</list> | |
117 | + <list>2012-07-14 10:10:00</list> | |
118 | + <list>2012-06-15 18:10:00</list> | |
119 | + </date> | |
120 | + | |
121 | + <color> | |
122 | + <list>#808080</list> | |
123 | + <list>#cccccc</list> | |
124 | + <list> #ABCCCC</list> | |
125 | + </color> | |
126 | + | |
127 | + <locale> | |
128 | + <list>en</list> | |
129 | + <list>pt_br</list> | |
130 | + <list>ca</list> | |
131 | + </locale> | |
132 | + | |
133 | + <url> | |
134 | + <list>http://www.test.com</list> | |
135 | + <list>https://test.of.test.com</list> | |
136 | + <list>ftp://192.168.0.1</list> | |
137 | + </url> | |
138 | + | |
139 | + <string> | |
140 | + <list>Test</list> | |
141 | + <list>One</list> | |
142 | + <list>Two</list> | |
143 | + </string> | |
144 | + | |
145 | +</configuration> | |
0 | 146 | \ No newline at end of file | ... | ... |