Package org.apache.wicket.util.diff

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


    return "xmlLicense.txt";
  }

  public boolean checkLicenseHeader(File file)
  {
    Revision revision = null;

    try
    {
      String header = extractLicenseHeader(file, 0, 17);

      if (header.startsWith("<?xml"))
      {
        header = header.substring(header.indexOf(LINE_ENDING) + LINE_ENDING.length());
      }
      else
      {
        // Then only take the first 16 lines
        String[] headers = header.split(LINE_ENDING);
        header = "";
        for (int i = 0; i < 16 && i < headers.length; i++)
        {
          if (header.length() > 0)
          {
            header += LINE_ENDING;
          }
          header += headers[i];
        }
      }

      revision = Diff.diff(getLicenseHeader().split(LINE_ENDING), header.split(LINE_ENDING));
    }
    catch (Exception e)
    {
      e.printStackTrace();
      Assert.fail(e.getMessage());
    }

    return revision.size() == 0;
  }
View Full Code Here


      /* */

      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)
View Full Code Here

    return "xmlLicense.txt";
  }

  public boolean checkLicenseHeader(File file)
  {
    Revision revision = null;

    try
    {
      String header = extractLicenseHeader(file, 0, 17);

      if (header.startsWith("<?xml"))
      {
        header = header.substring(header.indexOf(LINE_ENDING) + LINE_ENDING.length());
      }
      else
      {
        // Then only take the first 16 lines
        String[] headers = header.split(LINE_ENDING);
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 16 && i < headers.length; i++)
        {
          if (sb.length() > 0)
          {
            sb.append(LINE_ENDING);
          }
          sb.append(headers[i]);
        }
        header = sb.toString();
      }

      revision = Diff.diff(getLicenseHeader().split(LINE_ENDING), header.split(LINE_ENDING));
    }
    catch (Exception e)
    {
      e.printStackTrace();
      Assert.fail(e.getMessage());
    }

    return revision.size() == 0;
  }
View Full Code Here

    return "velocityLicense.txt";
  }

  public boolean checkLicenseHeader(File file)
  {
    Revision revision = null;

    try
    {
      String header = extractLicenseHeader(file, 0, 16);

      revision = Diff.diff(getLicenseHeader().split(LINE_ENDING), header.split(LINE_ENDING));
    }
    catch (Exception e)
    {
      Assert.fail(e.getMessage());
    }

    return revision.size() == 0;
  }
View Full Code Here

    return "propertiesLicense.txt";
  }

  public boolean checkLicenseHeader(File file)
  {
    Revision revision = null;

    try
    {
      String header = extractLicenseHeader(file, 0, 14);

      revision = Diff.diff(getLicenseHeader().split(LINE_ENDING), header.split(LINE_ENDING));
    }
    catch (Exception e)
    {
      Assert.fail(e.getMessage());
    }

    return revision.size() == 0;
  }
View Full Code Here

    return "cssLicense.txt";
  }

  public boolean checkLicenseHeader(File file)
  {
    Revision revision = null;

    try
    {
      String header = extractLicenseHeader(file, 0, 16);

      revision = Diff.diff(getLicenseHeader().split(LINE_ENDING), header.split(LINE_ENDING));
    }
    catch (Exception e)
    {
      Assert.fail(e.getMessage());
    }

    return revision.size() == 0;
  }
View Full Code Here

    if (rev == null)
    {
      throw new IllegalArgumentException("revised sequence is null");
    }

    Revision revision = new Revision();
    if (path.isSnake())
    {
      path = path.prev;
    }
    while (path != null && path.prev != null && path.prev.j >= 0)
    {
      if (path.isSnake())
      {
        throw new IllegalStateException("bad diffpath: found snake when looking for diff");
      }
      int i = path.i;
      int j = path.j;

      path = path.prev;
      int ianchor = path.i;
      int janchor = path.j;

      Delta delta = Delta.newDelta(new Chunk(orig, ianchor, i - ianchor), new Chunk(rev,
          janchor, j - janchor));
      revision.insertDelta(delta);
      if (path.isSnake())
      {
        path = path.prev;
      }
    }
View Full Code Here

      /* */

      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);
      }

      System.out.println(r.toString());

      if (failWithAssert)
      {
        Assert.assertEquals(filename, reference, document);
      }
View Full Code Here

    return "xmlLicense.txt";
  }

  public boolean checkLicenseHeader(File file)
  {
    Revision revision = null;

    try
    {
      String header = extractLicenseHeader(file, 0, 17);

      if (header.startsWith("<?xml"))
      {
        header = header.substring(header.indexOf(LINE_ENDING) + LINE_ENDING.length());
      }
      else
      {
        // Then only take the first 16 lines
        String[] headers = header.split(LINE_ENDING);
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 16 && i < headers.length; i++)
        {
          if (sb.length() > 0)
          {
            sb.append(LINE_ENDING);
          }
          sb.append(headers[i]);
        }
        header = sb.toString();
      }

      revision = Diff.diff(getLicenseHeader().split(LINE_ENDING), header.split(LINE_ENDING));
    }
    catch (Exception e)
    {
      e.printStackTrace();
      Assert.fail(e.getMessage());
    }

    return revision.size() == 0;
  }
View Full Code Here

   * @see org.apache.wicket.util.license.XmlLicenseHeaderHandler#checkLicenseHeader(java.io.File)
   */
  @Override
  public boolean checkLicenseHeader(final File file)
  {
    Revision revision = null;

    try
    {
      String header = extractLicenseHeader(file, 0, 1);
      return header.startsWith("<?xml") == true;
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.diff.Revision

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.