Package org.jibx.extras

Examples of org.jibx.extras.DocumentComparator


        // compare with original input document
        InputStreamReader brdr = new InputStreamReader
            (new ByteArrayInputStream(bos.toByteArray()), enc);
        InputStreamReader frdr = new InputStreamReader
            (new FileInputStream(fin), enc);
        DocumentComparator comp = new DocumentComparator(System.err);
        if (comp.compare(frdr, brdr)) {
            return true;
        } else {
           
            // save file before returning failure
            try {
View Full Code Here


                    InputStreamReader brdr =
                        new InputStreamReader(new ByteArrayInputStream(bos.toByteArray()), "UTF-8");
                    InputStreamReader frdr = new InputStreamReader(resolver.getContent(), enc);
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    PrintStream pstream = new PrintStream(baos);
                    DocumentComparator comp = new DocumentComparator(pstream);
                    if (comp.compare(frdr, brdr)) {
                       
                        // report schema roundtripped successfully
                        s_logger.debug("Successfully roundtripped schema " + id);
                       
                    } else {
View Full Code Here

                    InputStreamReader brdr =
                        new InputStreamReader(new ByteArrayInputStream(bos.toByteArray()), "UTF-8");
                    InputStreamReader frdr = new InputStreamReader(resolver.getContent(), enc);
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    PrintStream pstream = new PrintStream(baos);
                    DocumentComparator comp = new DocumentComparator(pstream);
                    if (comp.compare(frdr, brdr)) {
                       
                        // report schema roundtripped successfully
                        s_logger.debug("Successfully roundtripped schema " + id);
                       
                    } else {
View Full Code Here

              File fileIn = new File(inFile);
              File fileOut = new File(outFile);
                // compare with output document to be matched
                InputStreamReader brdr = new FileReader(fileIn);
                InputStreamReader frdr = new FileReader(fileOut);
              DocumentComparator comp = new DocumentComparator(System.err);
              if (comp.compare(frdr, brdr))
                getLog().info("JiBX document compare successful");
              else
                throw new MojoExecutionException("Documents are not equal on document-compare");               
            } catch (XmlPullParserException e) {
              Throwable cause = (e.getCause() != null) ? e.getCause() : e;
View Full Code Here

        StringReader rdr1 = new StringReader(match);
        String gen = bindingText(holder);
        StringReader rdr2 = new StringReader(gen);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        PrintStream pstr = new PrintStream(bos);
        DocumentComparator comp = new DocumentComparator(pstr);
        boolean same = comp.compare(rdr1, rdr2);
        if (!same) {
            pstr.close();
            fail("Generated binding error:\n" + new String(bos.toByteArray()) + "\nGenerated binding:\n" + gen
                + "\nExpected binding:\n" + match);
        }
View Full Code Here

    protected void verifySchema(String text1, String text2) throws Exception {
        StringReader rdr1 = new StringReader(text1);
        StringReader rdr2 = new StringReader(text2);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        PrintStream pstr = new PrintStream(bos);
        DocumentComparator comp = new DocumentComparator(pstr);
        boolean match = comp.compare(rdr1, rdr2);
        if (!match) {
            pstr.close();
            fail("Error roundtripping schema:\n" + new String(bos.toByteArray()) + "\nOriginal schema:\n" + text1
                + "\nOutput schema:\n" + text2);
        }
View Full Code Here

                   
                    // compare with original input document
                    InputStreamReader brdr = new InputStreamReader
                        (new ByteArrayInputStream(bos.toByteArray()), "UTF-8");
                    InputStreamReader frdr = new InputStreamReader(new FileInputStream(file), encoding);
                    DocumentComparator comp = new DocumentComparator(System.err, true);
                    System.out.println("Comparing round-tripped file '" + file.getPath() + "' with original file");
                    if (comp.compare(frdr, brdr)) {
                        System.out.println("Successfully round-tripped file '" + file.getPath() + '\'');
                    } else {
                       
                        // save output for comparison failure
                        try {
View Full Code Here

                    (new ByteArrayInputStream(bos.toByteArray()), "UTF-8");
                FileReader frdr = new FileReader(args[0]);
                FileOutputStream fos = new FileOutputStream("temp.xml");
                fos.write(bos.toByteArray());
                fos.close();
                DocumentComparator comp = new DocumentComparator(System.err);
                if (!comp.compare(frdr, brdr)) {
                   
                    // report mismatch with output saved to file
//                    FileOutputStream fos = new FileOutputStream("temp.xml");
//                    fos.write(bos.toByteArray());
//                    fos.close();
View Full Code Here

TOP

Related Classes of org.jibx.extras.DocumentComparator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.