From: <bo...@us...> - 2013-04-25 14:11:09
|
Revision: 531 http://sourceforge.net/p/xmlunit/code/531 Author: bodewig Date: 2013-04-25 14:10:50 +0000 (Thu, 25 Apr 2013) Log Message: ----------- Infrastructure for a jar of hamcrest matchers Modified Paths: -------------- trunk/xmlunit/build.xml Added Paths: ----------- trunk/xmlunit/src/main/java-hamcrest/ trunk/xmlunit/src/main/java-hamcrest/net/ trunk/xmlunit/src/main/java-hamcrest/net/sf/ trunk/xmlunit/src/main/java-hamcrest/net/sf/xmlunit/ trunk/xmlunit/src/tests/java-hamcrest/ trunk/xmlunit/src/tests/java-hamcrest/net/ trunk/xmlunit/src/tests/java-hamcrest/net/sf/ trunk/xmlunit/src/tests/java-hamcrest/net/sf/xmlunit/ Modified: trunk/xmlunit/build.xml =================================================================== --- trunk/xmlunit/build.xml 2013-04-14 18:52:18 UTC (rev 530) +++ trunk/xmlunit/build.xml 2013-04-25 14:10:50 UTC (rev 531) @@ -28,8 +28,10 @@ <property name="lib.dir" value="${build.dir}/lib"/> <property name="core.out.dir" value="${build.dir}/core-classes"/> <property name="legacy.out.dir" value="${build.dir}/legacy-classes"/> + <property name="hamcrest.out.dir" value="${build.dir}/hamcrest-classes"/> <property name="coretest.out.dir" value="${build.dir}/core-test-classes"/> <property name="legacytest.out.dir" value="${build.dir}/legacy-test-classes"/> + <property name="hamcresttest.out.dir" value="${build.dir}/hamcrest-test-classes"/> <property name="userguide.out.dir" value="${build.dir}/ug-classes"/> <property name="test.report.dir" value="${build.dir}/test-report"/> <property name="dist.dir" value="${build.dir}/dist"/> @@ -55,8 +57,10 @@ <mkdir dir="${lib.dir}"/> <mkdir dir="${core.out.dir}"/> <mkdir dir="${legacy.out.dir}"/> + <mkdir dir="${hamcrest.out.dir}"/> <mkdir dir="${coretest.out.dir}"/> <mkdir dir="${legacytest.out.dir}"/> + <mkdir dir="${hamcresttest.out.dir}"/> <mkdir dir="${test.report.dir}"/> <mkdir dir="${dist.dir}"/> <mkdir dir="${docs.dir}"/> @@ -70,8 +74,10 @@ <fileset dir="${lib.dir}"/> <fileset dir="${core.out.dir}"/> <fileset dir="${legacy.out.dir}"/> + <fileset dir="${hamcrest.out.dir}"/> <fileset dir="${coretest.out.dir}"/> <fileset dir="${legacytest.out.dir}"/> + <fileset dir="${hamcresttest.out.dir}"/> <fileset dir="${test.report.dir}"/> <fileset dir="${dist.dir}"/> <fileset dir="${docs.dir}"/> @@ -133,9 +139,36 @@ </javac> </target> - <target name="compile" depends="compile-core,compile-legacy"/> + <target name="compile-hamcrest" depends="compile-core" + description="compiles hamcrest matchers"> + <javac srcdir="${src.dir}/java-hamcrest" destdir="${hamcrest.out.dir}" + includeantruntime="false" debug="${javac.debug}" + target="${javac.target}" source="${javac.source}"> + <classpath> + <pathelement location="${core.out.dir}"/> + <pathelement path="${java.class.path}"/> + <fileset dir="lib" includes="junit-4*.jar"/> + </classpath> + </javac> + </target> + + <target name="compile-hamcrest-tests" depends="compile-hamcrest" + description="Compiles the tests for hamcrest matchers"> + <javac srcdir="${test.dir}/java-hamcrest" destdir="${hamcresttest.out.dir}" + includeantruntime="false" debug="${javac.debug}" + target="${javac.target}" source="${javac.source}"> + <classpath> + <pathelement location="${core.out.dir}"/> + <pathelement location="${hamcrest.out.dir}"/> + <pathelement path="${java.class.path}"/> + <fileset dir="lib" includes="junit-4*.jar"/> + </classpath> + </javac> + </target> + + <target name="compile" depends="compile-core,compile-legacy,compile-hamcrest"/> <target name="compile-tests" - depends="compile-core-tests,compile-legacy-tests"/> + depends="compile-core-tests,compile-legacy-tests,compile-hamcrest-tests"/> <target name="test" depends="compile-tests" description="runs the tests"> <junit printsummary="yes" haltonfailure="no" fork="${junit.fork}" @@ -145,8 +178,10 @@ <classpath> <pathelement location="${core.out.dir}"/> <pathelement location="${legacy.out.dir}"/> + <pathelement location="${hamcrest.out.dir}"/> <pathelement location="${legacytest.out.dir}"/> <pathelement location="${coretest.out.dir}"/> + <pathelement location="${hamcresttest.out.dir}"/> <pathelement path="${java.class.path}"/> <fileset dir="lib" includes="junit-4*.jar"/> </classpath> @@ -159,6 +194,9 @@ <include name="**/*Test.java"/> <exclude name="**/Abstract*.java"/> </fileset> + <fileset dir="${test.dir}/java-hamcrest"> + <include name="**/*Test.java"/> + </fileset> </batchtest> </junit> @@ -214,9 +252,13 @@ <jar jarfile="${lib.dir}/xmlunit-legacy-${xmlunit.version}.jar" basedir="${legacy.out.dir}" /> + <jar jarfile="${lib.dir}/xmlunit-hamcrest-${xmlunit.version}.jar" + basedir="${hamcrest.out.dir}" + /> <jar jarfile="${lib.dir}/xmlunit-sumo-${xmlunit.version}.jar"> <fileset dir="${core.out.dir}"/> <fileset dir="${legacy.out.dir}"/> + <fileset dir="${hamcrest.out.dir}"/> </jar> <tstamp> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2013-04-25 15:15:02
|
Revision: 532 http://sourceforge.net/p/xmlunit/code/532 Author: bodewig Date: 2013-04-25 15:14:36 +0000 (Thu, 25 Apr 2013) Log Message: ----------- infrastructure for NUnit Constraints Modified Paths: -------------- trunk/xmlunit/xmlunit.nant.build Added Paths: ----------- trunk/xmlunit/src/main/net-constraints/ trunk/xmlunit/src/tests/net-constraints/ Modified: trunk/xmlunit/xmlunit.nant.build =================================================================== --- trunk/xmlunit/xmlunit.nant.build 2013-04-25 14:10:50 UTC (rev 531) +++ trunk/xmlunit/xmlunit.nant.build 2013-04-25 15:14:36 UTC (rev 532) @@ -21,10 +21,17 @@ <property name="core.src.dir" value="${base.dir}/src/main/net-core" overwrite="false"/> <property name="core.tests.src.dir" value="${base.dir}/src/tests/net-core" overwrite="false"/> + <property name="constraints.src.dir" value="${base.dir}/src/main/net-constraints" overwrite="false"/> + <property name="constraints.tests.src.dir" value="${base.dir}/src/tests/net-constraints" + overwrite="false"/> <property name="build.dir" value="${base.dir}/build/net" overwrite="false"/> <property name="gen.src.dir" value="${build.dir}/generated" overwrite="false"/> + <property name="gen.core.dir" value="${gen.src.dir}/core" + overwrite="false"/> + <property name="gen.constraints.dir" value="${gen.src.dir}/constraints" + overwrite="false"/> <property name="test.report.dir" value="${build.dir}/test-report"/> <property name="bin.dir" value="${build.dir}/bin" overwrite="false"/> @@ -39,7 +46,8 @@ value="lib" /> <target name="init" description="prepare for other targets"> - <mkdir dir="${gen.src.dir}"/> + <mkdir dir="${gen.core.dir}"/> + <mkdir dir="${gen.constraints.dir}"/> <mkdir dir="${bin.dir}"/> <copy file="${nunit.v2.bin.dir}/${nunit.v2.assembly}" tofile="${bin.dir}/${nunit.v2.assembly}"/> @@ -51,7 +59,7 @@ <target name="compile-core" description="compile core source files" depends="init"> - <asminfo output="${gen.src.dir}/AssemblyInfo.cs" language="CSharp"> + <asminfo output="${gen.core.dir}/AssemblyInfo.cs" language="CSharp"> <imports> <import namespace="System" /> <import namespace="System.Reflection" /> @@ -69,21 +77,56 @@ value="${project::get-name()}-core.tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100fdec9d5858956ff10ff9cf39935441a7d4a216475a467e951ddd8fcce0b74443696680a6cfb58f8b1d96166acb76f9eae0431a223cecb30e224c21f30e57c457747f6ba176e6c22f48e105b200b458509b6de815cccdfc9ebe59ae4024c4b8659d2f2fcb65b1688f8327b10c96ed7e5f536ba6a1978ae86aca438439efbd6cb6"/> </attributes> </asminfo> - <copy todir="${gen.src.dir}"> + <copy todir="${gen.core.dir}"> <fileset basedir="${core.src.dir}"> <include name="**/*.cs"/> </fileset> </copy> <csc target="library" output="${bin.dir}/${project::get-name()}-core.dll" debug="true" verbose="${csc.verbose}" keyfile="xmlunit.snk"> - <sources basedir="${gen.src.dir}"> + <sources basedir="${gen.core.dir}"> <include name="**/*.cs"/> </sources> </csc> </target> + <target name="compile-constraints" depends="compile-core" + description="compile constraints source files"> + <asminfo output="${gen.constraints.dir}/AssemblyInfo.cs" language="CSharp"> + <imports> + <import namespace="System" /> + <import namespace="System.Reflection" /> + <import namespace="System.Runtime.InteropServices" /> + <import namespace="System.Runtime.CompilerServices" /> + </imports> + <attributes> + <attribute type="ComVisibleAttribute" value="false"/> + <attribute type="CLSCompliantAttribute" value="true"/> + <attribute type="AssemblyVersionAttribute" value="${project.version4}"/> + <attribute type="AssemblyTitleAttribute" value="XMLUnit Constraints for NUnit" /> + <attribute type="AssemblyDescriptionAttribute" + value="Constraints Classes of XMLUnit for .NET" /> + <attribute type="InternalsVisibleToAttribute" + value="${project::get-name()}-constraints.tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100fdec9d5858956ff10ff9cf39935441a7d4a216475a467e951ddd8fcce0b74443696680a6cfb58f8b1d96166acb76f9eae0431a223cecb30e224c21f30e57c457747f6ba176e6c22f48e105b200b458509b6de815cccdfc9ebe59ae4024c4b8659d2f2fcb65b1688f8327b10c96ed7e5f536ba6a1978ae86aca438439efbd6cb6"/> + </attributes> + </asminfo> + <copy todir="${gen.constraints.dir}"> + <fileset basedir="${constraints.src.dir}"> + <include name="**/*.cs"/> + </fileset> + </copy> + <csc target="library" output="${bin.dir}/${project::get-name()}-constraints.dll" + debug="true" verbose="${csc.verbose}" keyfile="xmlunit.snk"> + <sources basedir="${gen.constraints.dir}"> + <include name="**/*.cs"/> + </sources> + </csc> + </target> + <target name="compile" description="compile all source files" - depends="compile-core"> + depends="compile-core,compile-constraints"/> + + <target name="compile-core-tests" depends="compile"> <csc target="library" output="${bin.dir}/${project::get-name()}-core.tests.dll" debug="true" verbose="${csc.verbose}" keyfile="xmlunit.snk"> @@ -97,11 +140,30 @@ </csc> </target> - <target name="test" description="run all tests" depends="compile"> + <target name="compile-constraints-tests" depends="compile-constraints"> + <!--csc target="library" + output="${bin.dir}/${project::get-name()}-constraints.tests.dll" + debug="true" verbose="${csc.verbose}" keyfile="xmlunit.snk"> + <references basedir="${bin.dir}"> + <include name="${project::get-name()}-core.dll"/> + <include name="${project::get-name()}-constraints.dll"/> + <include name="${nunit.v2.assembly}"/> + </references> + <sources basedir="${constraints.tests.src.dir}"> + <include name="**/*.cs"/> + </sources> + </csc--> + </target> + + <target name="compile-tests" + depends="compile-core-tests,compile-constraints-tests"/> + + <target name="test" description="run all tests" depends="compile-tests"> <nunit2> <formatter type="Plain"/> <formatter type="Xml" usefile="true" outputdir="${test.report.dir}"/> <test assemblyname="${bin.dir}/${project::get-name()}-core.tests.dll"/> + <!--test assemblyname="${bin.dir}/${project::get-name()}-constraints.tests.dll"/--> </nunit2> </target> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2013-04-25 15:40:16
|
Revision: 533 http://sourceforge.net/p/xmlunit/code/533 Author: bodewig Date: 2013-04-25 15:40:13 +0000 (Thu, 25 Apr 2013) Log Message: ----------- Upgrade to JUnit 4.11 Modified Paths: -------------- trunk/xmlunit/build.xml Added Paths: ----------- trunk/xmlunit/lib/hamcrest-core-1.3.jar trunk/xmlunit/lib/junit-4.11.jar Removed Paths: ------------- trunk/xmlunit/lib/junit-4.10.jar Modified: trunk/xmlunit/build.xml =================================================================== --- trunk/xmlunit/build.xml 2013-04-25 15:14:36 UTC (rev 532) +++ trunk/xmlunit/build.xml 2013-04-25 15:40:13 UTC (rev 533) @@ -135,6 +135,7 @@ <pathelement location="${core.out.dir}"/> <pathelement path="${java.class.path}"/> <fileset dir="lib" includes="junit-4*.jar"/> + <fileset dir="lib" includes="hamcrest-core-*.jar"/> </classpath> </javac> </target> @@ -147,7 +148,7 @@ <classpath> <pathelement location="${core.out.dir}"/> <pathelement path="${java.class.path}"/> - <fileset dir="lib" includes="junit-4*.jar"/> + <fileset dir="lib" includes="hamcrest-core-*.jar"/> </classpath> </javac> </target> @@ -162,6 +163,7 @@ <pathelement location="${hamcrest.out.dir}"/> <pathelement path="${java.class.path}"/> <fileset dir="lib" includes="junit-4*.jar"/> + <fileset dir="lib" includes="hamcrest-core-*.jar"/> </classpath> </javac> </target> @@ -184,6 +186,7 @@ <pathelement location="${hamcresttest.out.dir}"/> <pathelement path="${java.class.path}"/> <fileset dir="lib" includes="junit-4*.jar"/> + <fileset dir="lib" includes="hamcrest-core-*.jar"/> </classpath> <formatter type="xml"/> <batchtest todir="${test.report.dir}"> Added: trunk/xmlunit/lib/hamcrest-core-1.3.jar =================================================================== (Binary files differ) Index: trunk/xmlunit/lib/hamcrest-core-1.3.jar =================================================================== --- trunk/xmlunit/lib/hamcrest-core-1.3.jar 2013-04-25 15:14:36 UTC (rev 532) +++ trunk/xmlunit/lib/hamcrest-core-1.3.jar 2013-04-25 15:40:13 UTC (rev 533) Property changes on: trunk/xmlunit/lib/hamcrest-core-1.3.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Deleted: trunk/xmlunit/lib/junit-4.10.jar =================================================================== (Binary files differ) Added: trunk/xmlunit/lib/junit-4.11.jar =================================================================== (Binary files differ) Index: trunk/xmlunit/lib/junit-4.11.jar =================================================================== --- trunk/xmlunit/lib/junit-4.11.jar 2013-04-25 15:14:36 UTC (rev 532) +++ trunk/xmlunit/lib/junit-4.11.jar 2013-04-25 15:40:13 UTC (rev 533) Property changes on: trunk/xmlunit/lib/junit-4.11.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2013-04-27 15:09:01
|
Revision: 536 http://sourceforge.net/p/xmlunit/code/536 Author: bodewig Date: 2013-04-27 15:08:57 +0000 (Sat, 27 Apr 2013) Log Message: ----------- NUnit Constraint for XML Schema validation Modified Paths: -------------- trunk/xmlunit/src/main/net-core/validation/ValidationProblem.cs trunk/xmlunit/xmlunit.nant.build Added Paths: ----------- trunk/xmlunit/src/main/net-constraints/ValidationConstraints.cs trunk/xmlunit/src/tests/net-constraints/ValidationConstraintsTest.cs Added: trunk/xmlunit/src/main/net-constraints/ValidationConstraints.cs =================================================================== --- trunk/xmlunit/src/main/net-constraints/ValidationConstraints.cs (rev 0) +++ trunk/xmlunit/src/main/net-constraints/ValidationConstraints.cs 2013-04-27 15:08:57 UTC (rev 536) @@ -0,0 +1,83 @@ +/* + This file is licensed to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +using NUnit.Framework.Constraints; +using net.sf.xmlunit.util; +using net.sf.xmlunit.validation; + +namespace net.sf.xmlunit.constraints { + + /// <summary> + /// Constraint that validates a document against a given XML + /// schema. + /// </summary> + public class SchemaValidConstraint : Constraint { + private readonly Validator validator; + private ValidationResult result; + + /// <summary> + /// Creates the constraint validating against the given schema(s). + /// </summary> + public SchemaValidConstraint(params ISource[] schema) : base(schema) { + validator = Validator.ForLanguage(Languages.W3C_XML_SCHEMA_NS_URI); + validator.SchemaSources = schema; + } + + public override bool Matches(object o) { + this.actual = o; + if (o is ISource) { + result = validator.ValidateInstance(o as ISource); + return result.Valid; + } + return false; + } + + public override void WriteDescriptionTo(MessageWriter writer) { + writer.Write("{0} validates against {1}", GrabActual(), + GrabSystemIds()); + } + + public override void WriteActualValueTo(MessageWriter writer) { + if (actual is ISource) { + writer.Write("got validation errors: {0}", GrabProblems()); + } else { + writer.Write("{0} that is not ISource", GrabActual()); + } + } + + private string GrabSystemIds() { + return string.Join("\n", Linqy.Map<ISource, + string>(validator.SchemaSources, GrabSystemId)); + } + + private string GrabActual() { + ISource actualSource = actual as ISource; + return actualSource != null ? GrabSystemId(actualSource) + : (actual ?? "null").ToString(); + } + + private string GrabSystemId(ISource s) { + return s.SystemId; + } + + private string GrabProblems() { + return string.Join(", ", Linqy.Map<ValidationProblem, + string>(result.Problems, ProblemToString)); + } + + private string ProblemToString(ValidationProblem problem) { + return problem.ToString(); + } + } +} \ No newline at end of file Property changes on: trunk/xmlunit/src/main/net-constraints/ValidationConstraints.cs ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/xmlunit/src/main/net-core/validation/ValidationProblem.cs =================================================================== --- trunk/xmlunit/src/main/net-core/validation/ValidationProblem.cs 2013-04-27 15:04:45 UTC (rev 535) +++ trunk/xmlunit/src/main/net-core/validation/ValidationProblem.cs 2013-04-27 15:08:57 UTC (rev 536) @@ -76,5 +76,10 @@ ex == null ? UNKNOWN : ex.LinePosition, e.Severity); } + + public override string ToString() { + return string.Format("ValidationProblem {{ line={0}, column={1}, type={2}," + + " message=\'{3}'\' }}", Line, Column, Type, Message); + } } } Added: trunk/xmlunit/src/tests/net-constraints/ValidationConstraintsTest.cs =================================================================== --- trunk/xmlunit/src/tests/net-constraints/ValidationConstraintsTest.cs (rev 0) +++ trunk/xmlunit/src/tests/net-constraints/ValidationConstraintsTest.cs 2013-04-27 15:08:57 UTC (rev 536) @@ -0,0 +1,39 @@ +/* + This file is licensed to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +using System; +using NUnit.Framework; +using net.sf.xmlunit.input; + +namespace net.sf.xmlunit.constraints { + [TestFixture] + public class ValidationConstraintTest { + [Test] + public void ShouldSuccessfullyValidateInstance() { + Assert.That(new StreamSource(TestResources.TESTS_DIR + + "BookXsdGeneratedNoSchema.xml"), + new SchemaValidConstraint( + new StreamSource(TestResources.TESTS_DIR + "Book.xsd"))); + } + + [Test] + public void ShouldFailOnBrokenSchema() { + Assert.That(new StreamSource(TestResources.TESTS_DIR + + "invalidBook.xml"), + !new SchemaValidConstraint(new StreamSource(TestResources + .TESTS_DIR + + "Book.xsd"))); + } + + } +} Property changes on: trunk/xmlunit/src/tests/net-constraints/ValidationConstraintsTest.cs ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/xmlunit/xmlunit.nant.build =================================================================== --- trunk/xmlunit/xmlunit.nant.build 2013-04-27 15:04:45 UTC (rev 535) +++ trunk/xmlunit/xmlunit.nant.build 2013-04-27 15:08:57 UTC (rev 536) @@ -120,6 +120,10 @@ <sources basedir="${gen.constraints.dir}"> <include name="**/*.cs"/> </sources> + <references basedir="${bin.dir}"> + <include name="${project::get-name()}-core.dll"/> + <include name="${nunit.v2.assembly}"/> + </references> </csc> </target> @@ -140,19 +144,21 @@ </csc> </target> - <target name="compile-constraints-tests" depends="compile-constraints"> - <!--csc target="library" + <target name="compile-constraints-tests" + depends="compile-constraints,compile-core-tests"> + <csc target="library" output="${bin.dir}/${project::get-name()}-constraints.tests.dll" debug="true" verbose="${csc.verbose}" keyfile="xmlunit.snk"> <references basedir="${bin.dir}"> <include name="${project::get-name()}-core.dll"/> <include name="${project::get-name()}-constraints.dll"/> + <include name="${project::get-name()}-core.tests.dll"/> <include name="${nunit.v2.assembly}"/> </references> <sources basedir="${constraints.tests.src.dir}"> <include name="**/*.cs"/> </sources> - </csc--> + </csc> </target> <target name="compile-tests" @@ -163,7 +169,7 @@ <formatter type="Plain"/> <formatter type="Xml" usefile="true" outputdir="${test.report.dir}"/> <test assemblyname="${bin.dir}/${project::get-name()}-core.tests.dll"/> - <!--test assemblyname="${bin.dir}/${project::get-name()}-constraints.tests.dll"/--> + <test assemblyname="${bin.dir}/${project::get-name()}-constraints.tests.dll"/> </nunit2> </target> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2014-11-24 13:34:18
|
Revision: 547 http://sourceforge.net/p/xmlunit/code/547 Author: bodewig Date: 2014-11-24 13:34:14 +0000 (Mon, 24 Nov 2014) Log Message: ----------- no reason to copy around sources Modified Paths: -------------- trunk/xmlunit/xmlunit.nant.build Property Changed: ---------------- trunk/xmlunit/ Index: trunk/xmlunit =================================================================== --- trunk/xmlunit 2013-09-16 12:15:24 UTC (rev 546) +++ trunk/xmlunit 2014-11-24 13:34:14 UTC (rev 547) Property changes on: trunk/xmlunit ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,2 ## +build +docbook.properties Modified: trunk/xmlunit/xmlunit.nant.build =================================================================== --- trunk/xmlunit/xmlunit.nant.build 2013-09-16 12:15:24 UTC (rev 546) +++ trunk/xmlunit/xmlunit.nant.build 2014-11-24 13:34:14 UTC (rev 547) @@ -18,14 +18,14 @@ overwrite="false"/> <property name="base.dir" value="${project::get-base-directory()}" overwrite="false"/> - <property name="core.src.dir" value="${base.dir}/src/main/net-core" overwrite="false"/> + <property name="core.src.dir" value="src/main/net-core" overwrite="false"/> <property name="core.tests.src.dir" value="${base.dir}/src/tests/net-core" overwrite="false"/> - <property name="constraints.src.dir" value="${base.dir}/src/main/net-constraints" overwrite="false"/> + <property name="constraints.src.dir" value="src/main/net-constraints" overwrite="false"/> <property name="constraints.tests.src.dir" value="${base.dir}/src/tests/net-constraints" overwrite="false"/> - <property name="build.dir" value="${base.dir}/build/net" overwrite="false"/> + <property name="build.dir" value="build/net" overwrite="false"/> <property name="gen.src.dir" value="${build.dir}/generated" overwrite="false"/> <property name="gen.core.dir" value="${gen.src.dir}/core" @@ -77,15 +77,11 @@ value="${project::get-name()}-core.tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100fdec9d5858956ff10ff9cf39935441a7d4a216475a467e951ddd8fcce0b74443696680a6cfb58f8b1d96166acb76f9eae0431a223cecb30e224c21f30e57c457747f6ba176e6c22f48e105b200b458509b6de815cccdfc9ebe59ae4024c4b8659d2f2fcb65b1688f8327b10c96ed7e5f536ba6a1978ae86aca438439efbd6cb6"/> </attributes> </asminfo> - <copy todir="${gen.core.dir}"> - <fileset basedir="${core.src.dir}"> - <include name="**/*.cs"/> - </fileset> - </copy> <csc target="library" output="${bin.dir}/${project::get-name()}-core.dll" debug="true" verbose="${csc.verbose}" keyfile="xmlunit.snk"> - <sources basedir="${gen.core.dir}"> - <include name="**/*.cs"/> + <sources basedir="${base.dir}"> + <include name="${gen.core.dir}**/*.cs"/> + <include name="${core.src.dir}/**/*.cs"/> </sources> </csc> </target> @@ -110,15 +106,11 @@ value="${project::get-name()}-constraints.tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100fdec9d5858956ff10ff9cf39935441a7d4a216475a467e951ddd8fcce0b74443696680a6cfb58f8b1d96166acb76f9eae0431a223cecb30e224c21f30e57c457747f6ba176e6c22f48e105b200b458509b6de815cccdfc9ebe59ae4024c4b8659d2f2fcb65b1688f8327b10c96ed7e5f536ba6a1978ae86aca438439efbd6cb6"/> </attributes> </asminfo> - <copy todir="${gen.constraints.dir}"> - <fileset basedir="${constraints.src.dir}"> - <include name="**/*.cs"/> - </fileset> - </copy> <csc target="library" output="${bin.dir}/${project::get-name()}-constraints.dll" debug="true" verbose="${csc.verbose}" keyfile="xmlunit.snk"> - <sources basedir="${gen.constraints.dir}"> - <include name="**/*.cs"/> + <sources basedir="${base.dir}"> + <include name="${gen.constraints.dir}/**/*.cs"/> + <include name="${constraints.src.dir}/**/*.cs"/> </sources> <references basedir="${bin.dir}"> <include name="${project::get-name()}-core.dll"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2014-11-29 17:37:37
|
Revision: 555 http://sourceforge.net/p/xmlunit/code/555 Author: bodewig Date: 2014-11-29 17:37:30 +0000 (Sat, 29 Nov 2014) Log Message: ----------- System.Xml.Linq may provide input as well Modified Paths: -------------- trunk/xmlunit/src/main/net-core/builder/Input.cs trunk/xmlunit/src/tests/net-core/builder/InputTest.cs trunk/xmlunit/xmlunit.nant.build Added Paths: ----------- trunk/xmlunit/src/main/net-core/input/LinqSource.cs Modified: trunk/xmlunit/src/main/net-core/builder/Input.cs =================================================================== --- trunk/xmlunit/src/main/net-core/builder/Input.cs 2014-11-29 16:35:47 UTC (rev 554) +++ trunk/xmlunit/src/main/net-core/builder/Input.cs 2014-11-29 17:37:30 UTC (rev 555) @@ -14,6 +14,7 @@ using System; using System.IO; using System.Xml; +using System.Xml.Linq; using net.sf.xmlunit.exceptions; using net.sf.xmlunit.input; @@ -171,5 +172,30 @@ public static ITransformationBuilder ByTransforming(IBuilder b) { return ByTransforming(b.Build()); } + + internal class LinqBuilder : IBuilder { + private readonly ISource source; + internal LinqBuilder(XNode d) { + source = new LinqSource(d); + } + public ISource Build() { + return source; + } + } + + /// <summary> + /// Build an ISource from a System.Xml.Linq Document. + /// </summary> + public static IBuilder FromDocument(XDocument d) { + return new LinqBuilder(d); + } + + /// <summary> + /// Build an ISource from a System.Xml.Linq Node. + /// </summary> + public static IBuilder FromNode(XNode n) { + return new LinqBuilder(n); + } + } } Copied: trunk/xmlunit/src/main/net-core/input/LinqSource.cs (from rev 546, trunk/xmlunit/src/main/net-core/input/DOMSource.cs) =================================================================== --- trunk/xmlunit/src/main/net-core/input/LinqSource.cs (rev 0) +++ trunk/xmlunit/src/main/net-core/input/LinqSource.cs 2014-11-29 17:37:30 UTC (rev 555) @@ -0,0 +1,36 @@ +/* + This file is licensed to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +using System.Xml.Linq; + +namespace net.sf.xmlunit.input { + /// <summary> + /// ISource implementation encapsulating a System.Xml.Linq XNode. + /// </summary> + public class LinqSource : AbstractSource { + private readonly XNode node; + public LinqSource(XNode node) + : base(node.CreateReader()) { + this.node = node; + } + + /// <summary> + /// The node this source is wrapping + /// </summary> + public XNode Node { + get { + return node; + } + } + } +} Modified: trunk/xmlunit/src/tests/net-core/builder/InputTest.cs =================================================================== --- trunk/xmlunit/src/tests/net-core/builder/InputTest.cs 2014-11-29 16:35:47 UTC (rev 554) +++ trunk/xmlunit/src/tests/net-core/builder/InputTest.cs 2014-11-29 17:37:30 UTC (rev 555) @@ -15,6 +15,7 @@ using System.IO; using System.Text; using System.Xml; +using System.Xml.Linq; using NUnit.Framework; namespace net.sf.xmlunit.builder { @@ -28,12 +29,22 @@ return d; } + private static XDocument XParse(ISource s) { + return XDocument.Load(s.Reader); + } + [Test] public void ShouldParseADocument() { XmlDocument d = Parse(Input.FromFile(TestResources.ANIMAL_FILE) .Build()); AllIsWellFor(Input.FromDocument(d).Build()); } + [Test] public void ShouldParseAnXDocument() { + XDocument d = XParse(Input.FromFile(TestResources.ANIMAL_FILE) + .Build()); + AllIsWellFor(Input.FromDocument(d).Build()); + } + [Test] public void ShouldParseAnExistingFileByName() { ISource s = Input.FromFile(TestResources.ANIMAL_FILE).Build(); AllIsWellFor(s); Modified: trunk/xmlunit/xmlunit.nant.build =================================================================== --- trunk/xmlunit/xmlunit.nant.build 2014-11-29 16:35:47 UTC (rev 554) +++ trunk/xmlunit/xmlunit.nant.build 2014-11-29 17:37:30 UTC (rev 555) @@ -83,6 +83,9 @@ <include name="${gen.core.dir}**/*.cs"/> <include name="${core.src.dir}/**/*.cs"/> </sources> + <references> + <include name="System.Xml.Linq.dll"/> + </references> </csc> </target> @@ -129,6 +132,7 @@ <references basedir="${bin.dir}"> <include name="${project::get-name()}-core.dll"/> <include name="${nunit.v2.assembly}"/> + <include name="System.Xml.Linq.dll"/> </references> <sources basedir="${core.tests.src.dir}"> <include name="**/*.cs"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |