Examples of Difference


Examples of org.custommonkey.xmlunit.Difference

        XMLUnit.setIgnoreWhitespace(true);
        try {
            DetailedDiff diffs = new DetailedDiff(XMLUnit.compareXML(expected, StubbedChannel.getOutput()));
            List allDiffs = diffs.getAllDifferences();
            assertEquals("Only expected 1 difference", 1, allDiffs.size());
            Difference diff = (Difference) allDiffs.get(0);
            String expectedDiffPath = "/Envelope[1]/Body[1]/Fault[1]/detail[1]/Exception[1]/text()[1]";
            assertEquals("Expected difference to be at " + expectedDiffPath, expectedDiffPath, diff.getTestNodeDetail()
                .getXpathLocation());
            String expectedText = diff.getControlNodeDetail().getValue();
            String actualText = diff.getTestNodeDetail().getValue();
            assertTrue("Expected <Exception> element text to start with " + expectedText, actualText
                .startsWith(expectedText));
            String methodName = "testSendFaultOnExceptionWithStackTrace";
            assertTrue("Expected <Exception> element text to include " + methodName + " in stack trace", actualText
                .indexOf(methodName) != -1);
View Full Code Here

Examples of org.dbunit.assertion.Difference

        Assertion.assertEquals(expectedTable, actualTable, failureHandler);
        List differenceList = failureHandler.getDiffList();
        if (!differenceList.isEmpty()) {
            log.info("Query {} FAILED!", queryNumber);
            for (Object obj : differenceList) {
                Difference difference = (Difference) obj;
                log.info("Column={}, expected={}, actual={},", difference.getColumnName(),
                        difference.getExpectedValue(), difference.getActualValue());
            }
            Assert.fail();
        }
    }
View Full Code Here

Examples of org.incava.util.diff.Difference

   * some context.
   */
  private static List<WikiDiff> generateWikiDiffs(List<Difference> diffs,
      String[] oldArray, String[] newArray) {
    List<WikiDiff> wikiDiffs = new ArrayList<WikiDiff>();
    Difference previousDiff = null;
    Difference nextDiff = null;
    List<WikiDiff> changedLineWikiDiffs = null;
    String[] oldLineArray = null;
    String[] newLineArray = null;
    List<Difference> changedLineDiffs = null;
    List<WikiDiff> wikiSubDiffs = null;
    Difference nextLineDiff = null;
    int i = 0;
    for (Difference currentDiff : diffs) {
      i++;
      wikiDiffs.addAll(DiffUtil.preBufferDifference(currentDiff, previousDiff,
          oldArray, newArray, DIFF_UNCHANGED_LINE_DISPLAY));
View Full Code Here

Examples of org.jtester.hamcrest.matcher.property.difference.Difference

    public Difference compare(Object left, Object right, boolean onlyFirstDifference, ReflectionComparator reflectionComparator) {
        // check if right and left have same number value (including NaN and Infinity)
        Double leftDouble = getDoubleValue(left);
        Double rightDouble = getDoubleValue(right);
        if (!leftDouble.equals(rightDouble)) {
            return new Difference("Different primitive values", left, right);
        }
        return null;
    }
View Full Code Here

Examples of org.neo4j.gis.spatial.pipes.processing.Difference

   
    /**
     * @see Difference
     */
    public GeoPipeline difference(Geometry geometry) {
      return addPipe(new Difference(geometry));
    }
View Full Code Here

Examples of org.netbeans.api.diff.Difference

                        if (leftFileRevision == null) {
                            leftFileRevision = line.substring(CHANGE_LEFT.length());
                        }
                        if (isChangeLeft) {
                            f1l2 = i - 1;
                            diffList.add((f1l1 > f1l2) ? new Difference(Difference.ADD,
                                    f1l1 - 1, 0, f2l1, f2l2,
                                    text1.toString(),
                                    text2.toString()) : (f2l1 > f2l2) ? new Difference(Difference.DELETE,
                                    f1l1, f1l2, f2l1 - 1, 0,
                                    text1.toString(),
                                    text2.toString())
                                    : new Difference(Difference.CHANGE,
                                    f1l1, f1l2, f2l1, f2l2,
                                    text1.toString(),
                                    text2.toString()));
                            f1l1 = f1l2 = f2l1 = f2l2 = 0;
                            text1.delete(0, text1.length());
                            text2.delete(0, text2.length());
                        } else {
                            f1l1 = i;
                        }
                    }
                    isChangeLeft = !isChangeLeft;
                    continue;
                } else if (line.startsWith(CHANGE_RIGHT)) {
                    if (generateDiffs) {
                        if (rightFileRevision == null) {
                            rightFileRevision = line.substring(CHANGE_RIGHT.length());
                        }
                        if (isChangeRight) {
                            f2l2 = j - 1;
                            diffList.add((f1l1 > f1l2) ? new Difference(Difference.ADD,
                                    f1l1 - 1, 0, f2l1, f2l2,
                                    text1.toString(),
                                    text2.toString()) : (f2l1 > f2l2) ? new Difference(Difference.DELETE,
                                    f1l1, f1l2, f2l1 - 1, 0,
                                    text1.toString(),
                                    text2.toString())
                                    : new Difference(Difference.CHANGE,
                                    f1l1, f1l2, f2l1, f2l2,
                                    text1.toString(),
                                    text2.toString()));
                            /*
                            diffList.add(new Difference((f1l1 > f1l2) ? Difference.ADD :
                            (f2l1 > f2l2) ? Difference.DELETE :
                            Difference.CHANGE,
                            f1l1, f1l2, f2l1, f2l2));
                             */
                            f1l1 = f1l2 = f2l1 = f2l2 = 0;
                            text1.delete(0, text1.length());
                            text2.delete(0, text2.length());
                        } else {
                            f2l1 = j;
                        }
                    }
                    isChangeRight = !isChangeRight;
                    continue;
                } else if (isChangeRight && line.indexOf(CHANGE_RIGHT) != -1) {
                    String lineText = line.substring(0, line.lastIndexOf(CHANGE_RIGHT));
                    if (generateDiffs) {
                        if (rightFileRevision == null) {
                            rightFileRevision = line.substring(line.lastIndexOf(CHANGE_RIGHT) + CHANGE_RIGHT.length());
                        }
                        text2.append(lineText);
                        f2l2 = j;
                        diffList.add((f1l1 > f1l2) ? new Difference(Difference.ADD,
                                f1l1 - 1, 0, f2l1, f2l2,
                                text1.toString(),
                                text2.toString()) : (f2l1 > f2l2) ? new Difference(Difference.DELETE,
                                f1l1, f1l2, f2l1 - 1, 0,
                                text1.toString(),
                                text2.toString())
                                : new Difference(Difference.CHANGE,
                                f1l1, f1l2, f2l1, f2l2,
                                text1.toString(),
                                text2.toString()));
                        f1l1 = f1l2 = f2l1 = f2l2 = 0;
                        text1.delete(0, text1.length());
View Full Code Here

Examples of org.openoffice.xmerge.merger.Difference

        if (i == 0 || j == 0) {
            if (i == 0 && j == 0) {
                // return
            } else if (j == 0) {
                for (int cnt = 0; cnt < i; cnt++) {
                    Difference diff =
                        new Difference(Difference.DELETE, cnt, j);
                    diffVector.add(diff);
                }
            } else {
                for (int cnt = 0; cnt < j; cnt++) {
                    Difference diff =
                        new Difference(Difference.ADD, i, cnt);
                    diffVector.add(diff);
                }
            }
            return;
        }

        // for the detail of this algorithm, refer to the book mentioned on
        // the top and page 317 and 318.
        if ((diffTable[i-1][j-1] == diffTable[i][j] -1) &&
            (diffTable[i-1][j-1] == diffTable[i-1][j]) &&
            (diffTable[i-1][j-1] == diffTable[i][j-1])) {

            // the element of ith and jth in org and mod sequence is the same
            generateResult(diffTable, i-1, j-1, diffVector);
        } else {
            if (diffTable[i-1][j] > diffTable[i][j-1]) {

                // recursively call first, then add the result so that
                // the beginning of the diffs will be stored first
                generateResult(diffTable, i-1, j, diffVector);

                Difference diff =
                    new Difference(Difference.DELETE, i-1, j);
                diffVector.add(diff);
            } else if (diffTable[i-1][j] < diffTable[i][j-1]) {

                // recursively call first, then add the result so that
                // the beginning of the diffs will be stored first
                generateResult(diffTable, i, j-1, diffVector);

                Difference diff =
                    new Difference(Difference.ADD, i, j-1);
                diffVector.add(diff);
            } else { // diffTable[i-1][j] == diffTable[i][j-1]
                // recursively call first, then add the result so that
                // the beginning of the diffs will be stored first
                generateResult(diffTable, i-1, j-1, diffVector);

                Difference diff =
                    new Difference(Difference.CHANGE, i-1, j-1);
                diffVector.add(diff);

            }
        }
    }
View Full Code Here

Examples of org.openoffice.xmerge.merger.Difference

        if (i == 0 && j == 0) {
            return;

        } else if (j == 0) {
            for (int cnt = 0; cnt < i; cnt++) {
                Difference diff =
                    new Difference(Difference.DELETE, cnt, j);
                diffVector.add(diff);
            }
            return;

        } else if (i == 0) {
            for (int cnt = 0; cnt < j; cnt++) {
                Difference diff =
                    new Difference(Difference.ADD, i, cnt);
                diffVector.add(diff);
            }
            return;
        }

        // for the detail of this algorithm, refer to the book mentioned on
        // the top and page 317 and 318.
        if ((diffTable[i-1][j-1] == diffTable[i][j] -1) &&
            (diffTable[i-1][j-1] == diffTable[i-1][j]) &&
            (diffTable[i-1][j-1] == diffTable[i][j-1])) {

            // the element of ith and jth in org and mod sequence is the same
            generateResult(diffTable, i-1, j-1, diffVector);
        } else {
            if (diffTable[i-1][j] > diffTable[i][j-1]) {

                // recursively call first, then add the result so that
                // the beginning of the diffs will be stored first
                generateResult(diffTable, i-1, j, diffVector);

                Difference diff =
                    new Difference(Difference.DELETE, i-1, j);
                diffVector.add(diff);
            } else if (diffTable[i-1][j] < diffTable[i][j-1]) {

                // recursively call first, then add the result so that
                // the beginning of the diffs will be stored first
                generateResult(diffTable, i, j-1, diffVector);

                Difference diff =
                    new Difference(Difference.ADD, i, j-1);
                diffVector.add(diff);
            } else { // diffTable[i-1][j] == diffTable[i][j-1]
                // recursively call first, then add the result so that
                // the beginning of the diffs will be stored first
                generateResult(diffTable, i-1, j-1, diffVector);

                Difference diff =
                    new Difference(Difference.CHANGE, i-1, j-1);
                diffVector.add(diff);

            }
        }
    }
View Full Code Here

Examples of org.openoffice.xmerge.merger.Difference

            different = true;

            if (modSeqObject ==  null)  {
                // no more modsequence, all the remaining org sequence objs
                // should consider as a delete.
                Difference diff = new Difference(Difference.DELETE, i, j);
                diffVector.add(diff);
                orgSeqObject = orgSeq.next();

            } else {
                if (!orgSeq.equivalent(orgSeqObject, modSeqObject)) {

                    orgRow = (Element)orgSeqObject;
                    modRow = (Element)modSeqObject;

                    // check whether the original Row with multiple row
                    // if so, need to split one out for merge
                    String orgRowRepeated = orgRow.getAttribute(
                        OfficeConstants.ATTRIBUTE_TABLE_NUM_ROWS_REPEATED);
                    String modRowRepeated = modRow.getAttribute(
                        OfficeConstants.ATTRIBUTE_TABLE_NUM_ROWS_REPEATED);


                    int orgRowNum = 1;
                    int modRowNum = 1;

                    if (orgRowRepeated.length() > 0) {
                        orgRowNum =
                            Integer.valueOf(orgRowRepeated).intValue();
                    }
                    if (modRowRepeated.length() > 0) {
                        modRowNum =
                            Integer.valueOf(modRowRepeated).intValue();
                    }

                    // try to find out the common number of repeated Rows
                    if (orgRowNum == modRowNum) {
                        orgSeqObject = orgSeq.next();
                        modSeqObject = modSeq.next();

                    // cut the original row into two halves, first half
                    // have the repeated attribute = modify row attr
                    } else if (orgRowNum > modRowNum) {
                        Element orgSplitRow = splitRepeatedRow(
                                    orgRow, modRowNum,
                                    orgRowNum - modRowNum);
                        // it may equal after the split!
                        if (orgSeq.equivalent(orgSplitRow, modRow)) {
                            different = false;
                        }
                        orgSplited = true;
                        modSeqObject = modSeq.next();

                    // cut the modified Row into two halves, first half
                    // have the repeated attribute = original Row attr
                    } else {
                        Element modSplitRow = splitRepeatedRow(
                                    modRow, orgRowNum,
                                    modRowNum - orgRowNum);

                        // check whether rows are equal after the split
                        if (modSeq.equivalent(orgRow, modSplitRow)) {
                            different = false;
                        }
                        modSplited = true;
                        orgSeqObject = orgSeq.next();
                    }

                    if (different) {
                        Difference diff = new Difference(Difference.CHANGE,
                                          i, j);
                        diffVector.add(diff);
                    }

                } else {
                    // Rows are equivalent, move on to next one.
                    orgSeqObject = orgSeq.next();
                    modSeqObject = modSeq.next();
                } // end if-else
                j++;
            } // end if-else
            i++;
        } // end while loop

        // any extra objects in modify sequence should consider as an add
        // to the original sequence
        for (; modSeqObject != null; modSeqObject = modSeq.next(), j++) {
            Difference diff = new Difference(Difference.ADD, i, j);
            diffVector.add(diff);
        }

        // need to refresh the iterator if we split the rows
        if (orgSplited) {
View Full Code Here

Examples of org.openoffice.xmerge.merger.Difference

        if (i == 0 || j == 0) {
            if (i == 0 && j == 0) {
                // return
            } else if (j == 0) {
                for (int cnt = 0; cnt < i; cnt++) {
                    Difference diff =
                        new Difference(Difference.DELETE, cnt, j);
                    diffVector.add(diff);
                }
            } else {
                for (int cnt = 0; cnt < j; cnt++) {
                    Difference diff =
                        new Difference(Difference.ADD, i, cnt);
                    diffVector.add(diff);
                }
            }
            return;
        }

        // for the detail of this algorithm, refer to the book mentioned on
        // the top and page 317 and 318.
        if ((diffTable[i-1][j-1] == diffTable[i][j] -1) &&
            (diffTable[i-1][j-1] == diffTable[i-1][j]) &&
            (diffTable[i-1][j-1] == diffTable[i][j-1])) {

            // the element of ith and jth in org and mod sequence is the same
            generateResult(diffTable, i-1, j-1, diffVector);
        } else {
            if (diffTable[i-1][j] > diffTable[i][j-1]) {

                // recursively call first, then add the result so that
                // the beginning of the diffs will be stored first
                generateResult(diffTable, i-1, j, diffVector);

                Difference diff =
                    new Difference(Difference.DELETE, i-1, j);
                diffVector.add(diff);
            } else if (diffTable[i-1][j] < diffTable[i][j-1]) {

                // recursively call first, then add the result so that
                // the beginning of the diffs will be stored first
                generateResult(diffTable, i, j-1, diffVector);

                Difference diff =
                    new Difference(Difference.ADD, i, j-1);
                diffVector.add(diff);
            } else { // diffTable[i-1][j] == diffTable[i][j-1]
                // recursively call first, then add the result so that
                // the beginning of the diffs will be stored first
                generateResult(diffTable, i-1, j-1, diffVector);

                Difference diff =
                    new Difference(Difference.CHANGE, i-1, j-1);
                diffVector.add(diff);

            }
        }
    }
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.