Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jan 13, 2016
2 parents 4aeed7d + f4ca9bc commit 65d5857
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
26 changes: 26 additions & 0 deletions qulice-xml/src/test/java/com/qulice/xml/XmlValidatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,30 @@ public void passesValidationIfCommentsAreBeforeParentTag()
final Validator validator = new XmlValidator();
validator.validate(env);
}

/**
* XmlValidatorTest can pass validation if schema file is in classpath.
* @throws Exception If something goes wrong
*/
@Test
public void passesValidationForClasspathSchema() throws Exception {
final Environment env = new Environment.Mock().withFile(
"test-classpath-schema.xml",
new StringBuilder()
.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
.append("<foo xmlns=\"http://qulice.com/test/schema\" ")
.append("xmlns:xsi=\"")
.append("http://www.w3.org/2001/XMLSchema-instance")
.append("\" ")
.append("xsi:schemaLocation=\"")
.append("http://qulice.com/test/schema ")
.append("test-classpath-schema.xsd")
.append("\">")
.append("<bar>333</bar>")
.append("<baz>444</baz>")
.append("</foo>").toString()
);
new XmlValidator().validate(env);
}

}
12 changes: 12 additions & 0 deletions qulice-xml/src/test/resources/test-classpath-schema.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<xsd:schema xmlns="http://qulice.com/test/schema"
targetNamespace="http://qulice.com/test/schema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:complexType name="foo">
<xsd:all>
<xsd:element name="bar"/>
<xsd:element name="baz"/>
</xsd:all>
</xsd:complexType>
<xsd:element name="abcd" type="foo"/>
</xsd:schema>

0 comments on commit 65d5857

Please sign in to comment.