Examples of Diff


Examples of org.apache.jackrabbit.oak.plugins.document.MongoDiffCache.Diff

    @Test
    public void diff() {
        Revision from = Revision.fromString("r1-0-1");
        Revision to = Revision.fromString("r2-0-1");
        Diff diff = new Diff(from, to);
        diff.append("/", "^\"foo\":{}");
        diff.append("/foo", "^\"bar\":{}");
        diff.append("/foo/bar", "-\"qux\"");

        assertEquals("^\"foo\":{}", diff.getChanges("/"));
        assertEquals("^\"bar\":{}", diff.getChanges("/foo"));
        assertEquals("-\"qux\"", diff.getChanges("/foo/bar"));
        assertEquals("", diff.getChanges("/baz"));
    }
View Full Code Here

Examples of org.apache.jackrabbit.vault.vlt.actions.Diff

        List<File> localFiles = app.getPlatformFiles(localPaths, false);
        File localDir = app.getPlatformFile("", true);

        VltContext vCtx = app.createVaultContext(localDir);
        vCtx.setVerbose(cl.hasOption(OPT_VERBOSE));
        Diff a = new Diff(localDir, localFiles, cl.hasOption(optNonRecursive));
        vCtx.execute(a);
    }
View Full Code Here

Examples of org.apache.pig.builtin.DIFF

        for (int i = 0; i < 10; i++) b1.add(tf.newTuple(new Integer(i)));
        for (int i = 0; i < 10; i += 2) b2.add(tf.newTuple(new Integer(i)));
        Tuple t = tf.newTuple(2);
        t.set(0, b1);
        t.set(1, b2);
        DIFF d = new DIFF();
        DataBag result = d.exec(t);

        assertEquals(5, result.size());
        Iterator<Tuple> i = result.iterator();
        int[] values = new int[5];
        for (int j = 0; j < 5; j++) values[j] = (Integer)i.next().get(0);
        Arrays.sort(values);
        for (int j = 1; j < 10; j += 2) assertEquals(j, values[j/2]);

        // Test it in the case of two objects that are equals
        t = tf.newTuple(2);
        t.set(0, new Integer(1));
        t.set(1, new Integer(1));
        result = d.exec(t);
        assertEquals(0, result.size());

        // Test it in the case of two objects that are not equal
        t = tf.newTuple(2);
        t.set(0, new Integer(1));
        t.set(1, new Integer(2));
        result = d.exec(t);
        assertEquals(2, result.size());
    }
View Full Code Here

Examples of org.apache.pig.builtin.DIFF

        for (int i = 0; i < 10; i++) b1.add(tf.newTuple(new Integer(i)));
        for (int i = 0; i < 10; i += 2) b2.add(tf.newTuple(new Integer(i)));
        Tuple t = tf.newTuple(2);
        t.set(0, b1);
        t.set(1, b2);
        DIFF d = new DIFF();
        DataBag result = d.exec(t);

        assertEquals(5, result.size());
        Iterator<Tuple> i = result.iterator();
        int[] values = new int[5];
        for (int j = 0; j < 5; j++) values[j] = (Integer)i.next().get(0);
        Arrays.sort(values);
        for (int j = 1; j < 10; j += 2) assertEquals(j, values[j/2]);

        // Test it in the case of two objects that are equals
        t = tf.newTuple(2);
        t.set(0, new Integer(1));
        t.set(1, new Integer(1));
        result = d.exec(t);
        assertEquals(0, result.size());

        // Test it in the case of two objects that are not equal
        t = tf.newTuple(2);
        t.set(0, new Integer(1));
        t.set(1, new Integer(2));
        result = d.exec(t);
        assertEquals(2, result.size());
    }
View Full Code Here

Examples of org.apache.pig.builtin.DIFF

        for (int i = 0; i < 10; i++) b1.add(tf.newTuple(new Integer(i)));
        for (int i = 0; i < 10; i += 2) b2.add(tf.newTuple(new Integer(i)));
        Tuple t = tf.newTuple(2);
        t.set(0, b1);
        t.set(1, b2);
        DIFF d = new DIFF();
        DataBag result = d.exec(t);

        assertEquals(5, result.size());
        Iterator<Tuple> i = result.iterator();
        int[] values = new int[5];
        for (int j = 0; j < 5; j++) values[j] = (Integer)i.next().get(0);
        Arrays.sort(values);
        for (int j = 1; j < 10; j += 2) assertEquals(j, values[j/2]);

        // Test it in the case of two objects that are equals
        t = tf.newTuple(2);
        t.set(0, new Integer(1));
        t.set(1, new Integer(1));
        result = d.exec(t);
        assertEquals(0, result.size());

        // Test it in the case of two objects that are not equal
        t = tf.newTuple(2);
        t.set(0, new Integer(1));
        t.set(1, new Integer(2));
        result = d.exec(t);
        assertEquals(2, result.size());
    }
View Full Code Here

Examples of org.apache.wicket.util.diff.Diff

      log.error("===================");
      /* */

      String[] test1 = StringList.tokenize(reference, "\n").toArray();
      String[] test2 = StringList.tokenize(document, "\n").toArray();
      Diff df = new Diff(test1);
      Revision r;
      try
      {
        r = df.diff(test2);
      }
      catch (DifferentiationFailedException e)
      {
        throw new RuntimeException(e);
      }
View Full Code Here

Examples of org.assertj.core.internal.Diff

  private final static String LINE_SEPARATOR = System.getProperty("line.separator");
  private static Diff diff;

  @BeforeClass
  public static void setUpOnce() {
    diff = new Diff();
  }
View Full Code Here

Examples of org.custommonkey.xmlunit.Diff

    public void invokeQueryPushMode() throws XQueryException, XMLStreamException, XPathException,
            SAXException, IOException {
        String query = "declare namespace hoge=\"http://www.hoge.jp/dtd\"; <records xmlns:hoge=\"http://www.hoge.jp/dtd\"> {for $t in doc(\"./main/test/java/scenario/multithread/data-s.xml\")/records/record return <record>{$t/@*}{$t/author/text()}{ fn:concat(\"《\", $t/title/text() , \"》\") }</record>} </records>";
        String xbirdOut = invokeQueryPushModeUsingSAX(query);
        String saxonOut = invokeQueryBySaxon(query);
        Diff diff = new Diff(saxonOut, xbirdOut);
        if(!diff.identical()) {
            if(!diff.similar()) {
                Assert.fail(diff.toString());
            } else {               
                System.out.println(diff.toString());
            }
        }
    }
View Full Code Here

Examples of org.custommonkey.xmlunit.Diff

                            println(expectedStr);
                        }

                        final String compareForm = output.getAttribute("compare");
                        if("XML".equals(compareForm)) {
                            Diff diff = new Diff(expectedStr, resString);
                            if(diff.similar()) {
                                reportTestResult(testName, "pass", null);
                                break;
                            } else {
                                if(oi == lastoi) {
                                    String errmsg = diff.toString();
                                    reportTestResult(testName, "fail", errmsg);
                                    Assert.fail(errmsg);
                                }
                            }
                        } else if("Fragment".equals(compareForm)) {
                            Document expectedDoc = _expectedDocumentCache.get(expFileName);
                            if(expectedDoc == null) {
                                expectedDoc = buildFragment(expectedStr);
                                _expectedDocumentCache.put(expFileName, expectedDoc);
                            }
                            String actual = "<doc>" + resString + "</doc>";
                            Document actualDoc = buildDocument(new ByteArrayInputStream(actual.getBytes("UTF-8")));
                            Diff diff = new Diff(expectedDoc, actualDoc);
                            if(diff.similar()) {
                                reportTestResult(testName, "pass", null);
                                break;
                            } else {
                                if(oi == lastoi) {
                                    String errmsg = diff.toString();
                                    reportTestResult(testName, "fail", errmsg);
                                    Assert.fail(errmsg);
                                }
                            }
                        } else if("Text".equals(compareForm)) {
                            if(expectedStr.equals(resString)) {
                                reportTestResult(testName, "pass", null);
                                break;
                            } else {
                                Document expectedDoc = _expectedDocumentCache.get(expFileName);
                                if(expectedDoc == null) {
                                    expectedDoc = buildFragment(expectedStr);
                                    _expectedDocumentCache.put(expFileName, expectedDoc);
                                }
                                String actual = "<doc>" + XMLUtils.escapeXML(resString) + "</doc>";
                                Document actualDoc = buildDocument(new ByteArrayInputStream(actual.getBytes("UTF-8")));
                                Diff diff = new Diff(expectedDoc, actualDoc);
                                if(diff.identical()) {
                                    reportTestResult(testName, "pass", null);
                                    break;
                                } else {
                                    if(oi == lastoi) {
                                        String errmsg = new ComparisonFailure("[Text comparison]", expectedStr, resString).getMessage();
                                        reportTestResult(testName, "fail", errmsg);
                                        Assert.assertEquals("[Text comparison]", expectedStr, resString);
                                    }
                                }
                            }
                        } else if("Ignore".equals(compareForm)) {
                            // no comparison needs to be applied; the result is always true
                            // if the implementation successfully executes the test case.
                            reportTestResult(testName, "pass", null);
                            break;
                        } else if("Inspect".equals(compareForm)) {
                            System.err.println("#" + i + " Inspection is required");
                            Document expectedDoc = _expectedDocumentCache.get(expFileName);
                            if(expectedDoc == null) {
                                expectedDoc = buildFragment(expectedStr);
                                _expectedDocumentCache.put(expFileName, expectedDoc);
                            }
                            String actual = "<doc>" + resString + "</doc>";
                            Document actualDoc = buildDocument(new ByteArrayInputStream(actual.getBytes("UTF-8")));
                            Diff diff = new Diff(expectedDoc, actualDoc);
                            if(diff.similar()) {
                                reportTestResult(testName, "pass", null);
                                break;
                            } else {
                                if(oi == lastoi) {
                                    reportTestResult(testName, "not tested", "Inspectection is required");
                                }
                            }
                            if(ispect && !diff.similar()) {
                                if(oi == lastoi) {
                                    Assert.fail("Inspectection is required: \n" + diff.toString());
                                }
                            }
                        } else {
                            String errmsg = "[BUG] could'nt compare in " + compareForm;
                            reportTestResult(testName, "fail", errmsg);
View Full Code Here

Examples of org.custommonkey.xmlunit.Diff

   *
   * @return Diff object describing differences in documents
   */
  public final Diff compareXML(Document control, Document test)
  {
    return new Diff(control, test);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.