Package org.exoplatform.services.document.impl.diff

Examples of org.exoplatform.services.document.impl.diff.DiffServiceImpl.compare()


   protected abstract DiffAlgorithm getAlgo();

   public void testCompare()
   {
      DiffService diffService = new DiffServiceImpl(getAlgo());
      assertTrue(!diffService.compare(original, empty));
      assertTrue(!diffService.compare(empty, original));
      assertTrue(diffService.compare(empty, empty));
      assertTrue(diffService.compare(original, original));
   }
View Full Code Here


   public void testCompare()
   {
      DiffService diffService = new DiffServiceImpl(getAlgo());
      assertTrue(!diffService.compare(original, empty));
      assertTrue(!diffService.compare(empty, original));
      assertTrue(diffService.compare(empty, empty));
      assertTrue(diffService.compare(original, original));
   }

   public void testEmptySequences() throws Exception
View Full Code Here

   public void testCompare()
   {
      DiffService diffService = new DiffServiceImpl(getAlgo());
      assertTrue(!diffService.compare(original, empty));
      assertTrue(!diffService.compare(empty, original));
      assertTrue(diffService.compare(empty, empty));
      assertTrue(diffService.compare(original, original));
   }

   public void testEmptySequences() throws Exception
   {
View Full Code Here

   {
      DiffService diffService = new DiffServiceImpl(getAlgo());
      assertTrue(!diffService.compare(original, empty));
      assertTrue(!diffService.compare(empty, original));
      assertTrue(diffService.compare(empty, empty));
      assertTrue(diffService.compare(original, original));
   }

   public void testEmptySequences() throws Exception
   {
      String[] emptyOrig = {};
View Full Code Here

   {
      DiffService diffService = new DiffServiceImpl(getAlgo());
      Revision revision = diffService.diff(original, empty);
      assertEquals(1, revision.size());
      assertTrue(revision.getDelta(0) instanceof DeleteDelta);
      assertTrue(diffService.compare(revision.patch(original), empty));
   }

   public void testTwoDeletes() throws Exception
   {
      DiffService diffService = new DiffServiceImpl(getAlgo());
View Full Code Here

      DiffService diffService = new DiffServiceImpl(getAlgo());
      Revision revision = diffService.diff(original, rev1);
      assertEquals(2, revision.size());
      assertTrue(revision.getDelta(0) instanceof DeleteDelta);
      assertTrue(revision.getDelta(1) instanceof DeleteDelta);
      assertTrue(diffService.compare(revision.patch(original), rev1));
      assertEquals("3d2" + DiffService.NL + "< [3] three" + DiffService.NL + "9d7" + DiffService.NL + "< [9] nine"
         + DiffService.NL, revision.toString());
   }

   public void testChangeAtTheEnd() throws Exception
View Full Code Here

   {
      DiffService diffService = new DiffServiceImpl(getAlgo());
      Revision revision = diffService.diff(original, rev2);
      assertEquals(1, revision.size());
      assertTrue(revision.getDelta(0) instanceof ChangeDelta);
      assertTrue(diffService.compare(revision.patch(original), rev2));
      assertEquals("d7 3" + DiffService.NL + "a9 2" + DiffService.NL + "[7] seven revised" + DiffService.NL
         + "[8] eight revised" + DiffService.NL, revision.toRCSString());
   }

   public void testPatchFailed() throws Exception
View Full Code Here

   {
      try
      {
         DiffService diffService = new DiffServiceImpl(getAlgo());
         Revision revision = diffService.diff(original, rev2);
         assertTrue(!diffService.compare(revision.patch(rev1), rev2));
         fail("Exception not thrown");
      }
      catch (Exception e)
      {
      }
View Full Code Here

      Object[] rev = new String[]{"[3] three", "[1] one", "[5] five", "[2] two", "[6] six", "[4] four"};

      DiffService diffService = new DiffServiceImpl(getAlgo());
      Revision revision = diffService.diff(orig, rev);
      Object[] patched = revision.patch(orig);
      assertTrue(diffService.compare(patched, rev));
   }

   public void testEdit5() throws Exception
   {
      Object[] orig = new String[]{"[1] one", "[2] two", "[3] three", "[4] four", "[5] five", "[6] six"};
View Full Code Here

         new String[]{"one revised", "two revised", "[2] two", "[3] three", "five revised", "six revised", "[5] five"};

      DiffService diffService = new DiffServiceImpl(getAlgo());
      Revision revision = diffService.diff(orig, rev);
      Object[] patched = revision.patch(orig);
      assertTrue(diffService.compare(patched, rev));
   }

   public void testShuffle() throws Exception
   {
      Object[] orig = new String[]{"[1] one", "[2] two", "[3] three", "[4] four", "[5] five", "[6] six"};
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.