1
2
3
4
5
6
7
8
9
10
11 package org.mule.config.spring;
12
13 import org.mule.tck.AbstractMuleTestCase;
14 import org.mule.util.ClassUtils;
15
16 import org.dom4j.Document;
17 import org.dom4j.Element;
18 import org.dom4j.io.SAXReader;
19
20 public class SchemaDefaultsTestCase extends AbstractMuleTestCase
21 {
22 private static String MULE_CORE_SCHEMA_FILE = "META-INF/mule.xsd";
23 private Document schema;
24
25 @Override
26 protected void doSetUp() throws Exception
27 {
28 super.doSetUp();
29 SAXReader reader = new SAXReader();
30 schema = reader.read(ClassUtils.getResource(MULE_CORE_SCHEMA_FILE, this.getClass()).openStream());
31 }
32
33 @Override
34 protected boolean isGracefulShutdown()
35 {
36 return true;
37 }
38
39 public void testConfigurationDefaults()
40 {
41 Element configurationType = (Element) schema.selectSingleNode("/xsd:schema/xsd:complexType[@name='configurationType']");
42
43 assertEquals(muleContext.getConfiguration().getDefaultResponseTimeout(),
44 configurationType.numberValueOf("xsd:attribute[@name='defaultResponseTimeout']/@default")
45 .intValue());
46 assertEquals(muleContext.getConfiguration().getDefaultTransactionTimeout(),
47 configurationType.numberValueOf("xsd:attribute[@name='defaultTransactionTimeout']/@default")
48 .intValue());
49 assertEquals(muleContext.getConfiguration().getShutdownTimeout(),
50 configurationType.numberValueOf("xsd:attribute[@name='shutdownTimeout']/@default")
51 .intValue());
52 }
53 }