1
2
3
4
5
6
7 package org.mule.config.spring;
8
9 import java.io.IOException;
10
11 import org.junit.Test;
12 import org.junit.After;
13 import org.xml.sax.SAXException;
14 import org.apache.commons.collections.map.HashedMap;
15 import static org.junit.Assert.assertTrue;
16
17 public class InvalidSchemaValidationTestCase extends AbstractSchemaValidationTestCase
18 {
19 @After
20 public void doCleanUp()
21 {
22 schemas = new HashedMap();
23 }
24
25 @Test(expected = SAXException.class)
26 public void testTransformerReference() throws SAXException, IOException
27 {
28 addSchema("http://www.mulesoft.org/schema/mule/vm","META-INF/mule-vm.xsd");
29 doTest("org/mule/config/spring/schema-validation-transformer-ref-test.xml");
30 }
31
32 @Test(expected = SAXException.class)
33 public void testFilterReference() throws SAXException, IOException
34 {
35 addSchema("http://www.mulesoft.org/schema/mule/vm","META-INF/mule-vm.xsd");
36 doTest("org/mule/config/spring/schema-validation-filter-ref-test.xml");
37 }
38
39 @Test
40 public void testTransactedConnectors() throws SAXException, IOException
41 {
42 addSchema("http://www.mulesoft.org/schema/mule/vm","META-INF/mule-vm.xsd");
43 addSchema("http://www.mulesoft.org/schema/mule/jdbc","META-INF/mule-jdbc.xsd");
44 addSchema("http://www.springframework.org/schema/beans","http://www.springframework.org/schema/beans/spring-beans-3.0.xsd");
45 doTest("org/mule/config/spring/schema-validation-transacted-connectors-test.xml");
46 }
47
48 @Test(expected = SAXException.class)
49 public void testNotTransactedFileConnector() throws SAXException, IOException
50 {
51 addSchema("http://www.mulesoft.org/schema/mule/file", "META-INF/mule-file.xsd");
52 doTest("org/mule/config/spring/schema-validation-not-transacted-file-connector-test.xml");
53 }
54
55 @Test(expected = SAXException.class)
56 public void testNotTransactedFtpConnector() throws SAXException, IOException
57 {
58 addSchema("http://www.mulesoft.org/schema/mule/ftp", "META-INF/mule-ftp.xsd");
59 doTest("org/mule/config/spring/schema-validation-not-transacted-ftp-connector-test.xml");
60 }
61
62 @Test
63 public void testJdbcInvalidPollingFrequencyInOutboundEndpoint() throws SAXException, IOException
64 {
65 addSchema("http://www.mulesoft.org/schema/mule/jdbc","META-INF/mule-jdbc.xsd");
66 addSchema("http://www.mulesoft.org/schema/mule/test", "http://www.mulesoft.org/schema/mule/test/3.1/mule-test.xsd");
67 try
68 {
69 doTest("org/mule/config/spring/schema-validation-jdbc-invalid-polling-frequency.xml");
70 }
71 catch(SAXException e)
72 {
73
74 assertTrue(e.getMessage() != null && e.getMessage().contains("jdbc:outbound-endpoint"));
75 }
76 }
77
78 @Test
79 public void testExpressionPattern() throws SAXException, IOException
80 {
81 doTest("org/mule/config/spring/schema-validation-expression-pattern-test.xml");
82 }
83
84 @Test
85 public void testRouterWithFilter() throws SAXException, IOException
86 {
87 addSchema("http://www.mulesoft.org/schema/mule/vm","META-INF/mule-vm.xsd");
88 doTest("org/mule/config/spring/schema-validation-router-filter-test.xml");
89 }
90 }