[bvalid-codewatch] SF.net SVN: bvalid: [7] trunk
Status: Beta
Brought to you by:
cwilper
|
From: <cw...@us...> - 2006-03-10 08:58:40
|
Revision: 7 Author: cwilper Date: 2006-03-10 00:58:29 -0800 (Fri, 10 Mar 2006) ViewCVS: http://svn.sourceforge.net/bvalid/?rev=7&view=rev Log Message: ----------- added test case, started rename Modified Paths: -------------- trunk/build.xml trunk/src/java/net/sf/bvalid/XMLValidatorFactory.java Added Paths: ----------- trunk/src/java/net/sf/bvalid/Validator.java trunk/src/testjava/net/sf/bvalid/XMLValidatorFactoryTest.java Removed Paths: ------------- trunk/src/java/net/sf/bvalid/XMLValidator.java Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2006-03-09 08:07:51 UTC (rev 6) +++ trunk/build.xml 2006-03-10 08:58:29 UTC (rev 7) @@ -73,6 +73,7 @@ <classpath refid="test.path"/> <sysproperty key="propname" value="propvalue"/> <test name="net.sf.bvalid.SchemaLanguageTest"/> + <test name="net.sf.bvalid.XMLValidatorFactoryTest"/> </junit> </target> Copied: trunk/src/java/net/sf/bvalid/Validator.java (from rev 4, trunk/src/java/net/sf/bvalid/XMLValidator.java) =================================================================== --- trunk/src/java/net/sf/bvalid/Validator.java (rev 0) +++ trunk/src/java/net/sf/bvalid/Validator.java 2006-03-10 08:58:29 UTC (rev 7) @@ -0,0 +1,45 @@ +package net.sf.bvalid; + +import java.io.*; +import java.util.*; + +import net.sf.bvalid.locator.SchemaLocator; + +public interface XMLValidator { + + /** + * Set the <code>SchemaLocator</code> for this validator. + */ + public void setSchemaLocator(SchemaLocator locator); + + /** + * Set whether validation should fail if a referenced schema could + * not be found with the locator. This defaults to true. + */ + public void setFailOnMissingReferencedSchema(boolean value); + + /** + * Validate the document according to the given schema. + * + * Validation will fail if: + * - The indicated schema cannot be located + * - The document is not well-formed XML + * - failOnMissingReferencedSchema is true and at least one referenced + * schema cannot be located. + */ + public void validate(InputStream xmlStream, + String schemaURI) throws ValidationException; + + /** + * Validate the document according to the schema(s) referenced within, + * if any. + * + * Validation will fail if: + * - The document is not well-formed XML + * - failOnMissingReferencedSchema is true and at least one referenced + * schema cannot be located. + */ + public void validate(InputStream xmlStream) + throws ValidationException; + +} \ No newline at end of file Deleted: trunk/src/java/net/sf/bvalid/XMLValidator.java =================================================================== --- trunk/src/java/net/sf/bvalid/XMLValidator.java 2006-03-09 08:07:51 UTC (rev 6) +++ trunk/src/java/net/sf/bvalid/XMLValidator.java 2006-03-10 08:58:29 UTC (rev 7) @@ -1,45 +0,0 @@ -package net.sf.bvalid; - -import java.io.*; -import java.util.*; - -import net.sf.bvalid.locator.SchemaLocator; - -public interface XMLValidator { - - /** - * Set the <code>SchemaLocator</code> for this validator. - */ - public void setSchemaLocator(SchemaLocator locator); - - /** - * Set whether validation should fail if a referenced schema could - * not be found with the locator. This defaults to true. - */ - public void setFailOnMissingReferencedSchema(boolean value); - - /** - * Validate the document according to the given schema. - * - * Validation will fail if: - * - The indicated schema cannot be located - * - The document is not well-formed XML - * - failOnMissingReferencedSchema is true and at least one referenced - * schema cannot be located. - */ - public void validate(InputStream xmlStream, - String schemaURI) throws ValidationException; - - /** - * Validate the document according to the schema(s) referenced within, - * if any. - * - * Validation will fail if: - * - The document is not well-formed XML - * - failOnMissingReferencedSchema is true and at least one referenced - * schema cannot be located. - */ - public void validate(InputStream xmlStream) - throws ValidationException; - -} \ No newline at end of file Modified: trunk/src/java/net/sf/bvalid/XMLValidatorFactory.java =================================================================== --- trunk/src/java/net/sf/bvalid/XMLValidatorFactory.java 2006-03-09 08:07:51 UTC (rev 6) +++ trunk/src/java/net/sf/bvalid/XMLValidatorFactory.java 2006-03-10 08:58:29 UTC (rev 7) @@ -8,7 +8,7 @@ public static XMLValidator getValidator(SchemaLanguage lang) throws ValidatorException { - return getValidator(lang, new WebSchemaLocator(), true); + return getValidator(lang, new WebSchemaLocator()); } public static XMLValidator getValidator(SchemaLanguage lang, Added: trunk/src/testjava/net/sf/bvalid/XMLValidatorFactoryTest.java =================================================================== --- trunk/src/testjava/net/sf/bvalid/XMLValidatorFactoryTest.java (rev 0) +++ trunk/src/testjava/net/sf/bvalid/XMLValidatorFactoryTest.java 2006-03-10 08:58:29 UTC (rev 7) @@ -0,0 +1,42 @@ +package net.sf.bvalid; + +import junit.framework.TestCase; +import junit.textui.TestRunner; + +import net.sf.bvalid.locator.WebSchemaLocator; + +public class XMLValidatorFactoryTest extends TestCase { + + public XMLValidatorFactoryTest(String name) { super (name); } + + public void setUp() { + } + + public void tearDown() { + } + + //---------------------------------------------------------[ Test methods ] + + public void testGetValidatorDefaultLocator() + throws ValidatorException { + XMLValidatorFactory.getValidator(SchemaLanguage.XSD); + } + + public void testGetValidatorSpecificLocator() + throws ValidatorException { + XMLValidatorFactory.getValidator(SchemaLanguage.XSD, + new WebSchemaLocator()); + } + + public void testGetValidatorNoFailOnMissingSchema() + throws ValidatorException { + XMLValidatorFactory.getValidator(SchemaLanguage.XSD, + new WebSchemaLocator(), + false); + } + + public static void main(String[] args) { + TestRunner.run(XMLValidatorFactoryTest.class); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |