From: <bo...@us...> - 2009-06-09 11:46:02
|
Revision: 345 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=345&view=rev Author: bodewig Date: 2009-06-09 11:45:58 +0000 (Tue, 09 Jun 2009) Log Message: ----------- test for forum thread 3292605 Modified Paths: -------------- branches/xmlunit-1.x/tests/csharp/XmlDiffTests.cs branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/AbstractXpathEngineTests.java branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java Modified: branches/xmlunit-1.x/tests/csharp/XmlDiffTests.cs =================================================================== --- branches/xmlunit-1.x/tests/csharp/XmlDiffTests.cs 2009-06-05 15:51:43 UTC (rev 344) +++ branches/xmlunit-1.x/tests/csharp/XmlDiffTests.cs 2009-06-09 11:45:58 UTC (rev 345) @@ -125,5 +125,53 @@ AssertExpectedResult(input1, input2, false); } + [Test] public void NamespaceAttributeDifferences() { + string control = "<?xml version = \"1.0\" encoding = \"UTF-8\"?>" + + "<ns0:Message xmlns:ns0 = \"http://mynamespace\">" + + "<ns0:EventHeader>" + + "<ns0:EventID>9999</ns0:EventID>" + + "<ns0:MessageID>1243409665297</ns0:MessageID>" + + "<ns0:MessageVersionID>1.0</ns0:MessageVersionID>" + + "<ns0:EventName>TEST-EVENT</ns0:EventName>" + + "<ns0:BWDomain>TEST</ns0:BWDomain>" + + "<ns0:DateTimeStamp>2009-01-01T12:00:00</ns0:DateTimeStamp>" + + "<ns0:SchemaPayloadRef>anything</ns0:SchemaPayloadRef>" + + "<ns0:MessageURI>anything</ns0:MessageURI>" + + "<ns0:ResendFlag>F</ns0:ResendFlag>" + + "</ns0:EventHeader>" + + "<ns0:EventBody>" + + "<ns0:XMLContent>" + + "<xyz:root xmlns:xyz=\"http://test.com/xyz\">" + + "<xyz:test1>A</xyz:test1>" + + "<xyz:test2>B</xyz:test2>" + + "</xyz:root>" + + "</ns0:XMLContent>" + + "</ns0:EventBody>" + + "</ns0:Message>"; + string test = + "<abc:Message xmlns:abc=\"http://mynamespace\" xmlns:xyz=\"http://test.com/xyz\">" + + "<abc:EventHeader>" + + "<abc:EventID>9999</abc:EventID>" + + "<abc:MessageID>1243409665297</abc:MessageID>" + + "<abc:MessageVersionID>1.0</abc:MessageVersionID>" + + "<abc:EventName>TEST-EVENT</abc:EventName>" + + "<abc:BWDomain>TEST</abc:BWDomain>" + + "<abc:DateTimeStamp>2009-01-01T12:00:00</abc:DateTimeStamp>" + + "<abc:SchemaPayloadRef>anything</abc:SchemaPayloadRef>" + + "<abc:MessageURI>anything</abc:MessageURI>" + + "<abc:ResendFlag>F</abc:ResendFlag>" + + "</abc:EventHeader>" + + "<abc:EventBody>" + + "<abc:XMLContent>" + + "<xyz:root>" + + "<xyz:test1>A</xyz:test1>" + + "<xyz:test2>B</xyz:test2>" + + "</xyz:root>" + + "</abc:XMLContent>" + + "</abc:EventBody>" + + "</abc:Message>"; + AssertExpectedResult(control, test, true); + } + } } Modified: branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/AbstractXpathEngineTests.java =================================================================== --- branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/AbstractXpathEngineTests.java 2009-06-05 15:51:43 UTC (rev 344) +++ branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/AbstractXpathEngineTests.java 2009-06-09 11:45:58 UTC (rev 345) @@ -192,4 +192,20 @@ // acceptable in the JAXP 1.2 case } } + + // https://sourceforge.net/forum/forum.php?thread_id=3292605&forum_id=73274 + public void testDefaultNamespace() throws Exception { + String t = "<a xmlns=\"http://www.acme.com\"><b c='cv'>bv</b></a>"; + + Document d = XMLUnit.buildControlDocument(t); + HashMap m = new HashMap(); + m.put("", "http://www.acme.com"); + m.put("q", "http://www.acme.com"); + + NamespaceContext ctx = new SimpleNamespaceContext(m); + XpathEngine engine = newXpathEngine(); + engine.setNamespaceContext(ctx); + // fails assertEquals("bv", engine.evaluate("//b", d)); + assertEquals("bv", engine.evaluate("//q:b", d)); + } } Modified: branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java =================================================================== --- branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java 2009-06-05 15:51:43 UTC (rev 344) +++ branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java 2009-06-09 11:45:58 UTC (rev 345) @@ -925,7 +925,6 @@ + "</abc:XMLContent>" + "</abc:EventBody>" + "</abc:Message>"; - listener.tracing = true; listenToDifferences(control, test); assertFalse(listener.different); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2011-03-16 15:19:47
|
Revision: 491 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=491&view=rev Author: bodewig Date: 2011-03-16 15:19:40 +0000 (Wed, 16 Mar 2011) Log Message: ----------- Test for mailing list thread that suggests Validator required xsd as prefix Modified Paths: -------------- branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/jaxp13/test_Validator.java Added Paths: ----------- branches/xmlunit-1.x/tests/etc/Book.xsd2 Added: branches/xmlunit-1.x/tests/etc/Book.xsd2 =================================================================== --- branches/xmlunit-1.x/tests/etc/Book.xsd2 (rev 0) +++ branches/xmlunit-1.x/tests/etc/Book.xsd2 2011-03-16 15:19:40 UTC (rev 491) @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<foo:schema xmlns:foo="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.publishing.org" + xmlns="http://www.publishing.org" + version="1.0" + elementFormDefault="qualified"> + + <foo:element name="Book" type="BookType"/> + + <foo:complexType name="BookType"> + <foo:sequence> + <foo:element name="Title" type="foo:string" minOccurs="1" maxOccurs="1"/> + <foo:element name="Author" type="foo:string" minOccurs="1" maxOccurs="unbounded"/> + <foo:element name="Date" type="foo:string" minOccurs="1" maxOccurs="1"/> + <foo:element name="ISBN" type="foo:string" minOccurs="1" maxOccurs="1"/> + <foo:element name="Publisher" type="foo:string" minOccurs="1" maxOccurs="1"/> + </foo:sequence> + </foo:complexType> +</foo:schema> + Modified: branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/jaxp13/test_Validator.java =================================================================== --- branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/jaxp13/test_Validator.java 2011-02-07 08:06:33 UTC (rev 490) +++ branches/xmlunit-1.x/tests/java/org/custommonkey/xmlunit/jaxp13/test_Validator.java 2011-03-16 15:19:40 UTC (rev 491) @@ -1,6 +1,6 @@ /* ****************************************************************** -Copyright (c) 2008, Jeff Martin, Tim Bacon +Copyright (c) 2008,2011, Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without @@ -58,6 +58,13 @@ assertTrue(v.isSchemaValid()); } + public void testGoodSchemaIsValidWithCustomPrefix() throws Exception { + Validator v = new Validator(); + v.addSchemaSource(new StreamSource(new File(test_Constants.BASEDIR + + "/tests/etc/Book.xsd2"))); + assertTrue(v.isSchemaValid()); + } + public void testGoodSchemaHasNoErrors() throws Exception { Validator v = new Validator(); v.addSchemaSource(new StreamSource(new File(test_Constants.BASEDIR This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |