blob: 34d0f2fc9e7cab9156da0d4141c086573078a186 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* 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.
*/
import java.io.*;
import java.util.*;
import java.util.regex.*;
import org.apache.commons.io.*;
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLUnit;
try
{
String reference = IOUtils.toString(new File(basedir,
"reference/TestAnnotator.xml").toURI().toURL());
String actual = IOUtils.toString(new File(basedir,
"target/classes/TestAnnotator.xml").toURI().toURL());
// In a local build, I get indented XML but on the Apache Jenkins I get non-indented XML. This
// settings tells XMLUnit to ignore this difference in whitespace - rec 2013-02-16
XMLUnit.setIgnoreWhitespace(true);
Diff diff = XMLUnit.compareXML(reference, actual);
if (!diff.identical()) {
System.out.println("Actual descriptor does not match expected descriptor: " + diff);
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}
return true;