Package org.evolizer.versioncontrol.cvs.model.entities

Examples of org.evolizer.versioncontrol.cvs.model.entities.Revision


    assertEquals("Initial check-in", revision.getCommitMessage())
  }
 
  @Test
  public void testSampleRevision4() throws ParseException{
    Revision revision = fSession.uniqueResult("select revision from Revision as revision " +
                      "join revision.file as file " +
                      "where file.path like '%punct_marks.ccmap' " +
                      "and revision.number='1.5'", Revision.class);
   
    SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");

        Date date = df.parse("2004/10/08 05:00:53");
   
    assertEquals(date, revision.getCreationTime());
    assertTrue(revision.getAuthor().getNickNames().contains("jshin%mailaps.org"));
    assertEquals("Exp", revision.getState());
    assertEquals(509, revision.getLinesAdd());
    assertEquals(144, revision.getLinesDel());
    assertEquals("bug 263411 : :first-letter pseudo-element doesn't include all punctuation marks in the Unicode (r/sr=dbaron)", revision.getCommitMessage())
  }
View Full Code Here


  private void assertCorrectRevisionOrder(String fileName, String firstRevisionNumber, String lastRevisionNumber) {
    String parent = firstRevisionNumber.substring(0, firstRevisionNumber.lastIndexOf('.') + 1);
    int firstRevNumber = Integer.parseInt(firstRevisionNumber.substring(firstRevisionNumber.lastIndexOf('.') + 1, firstRevisionNumber.length()));
    int lastRevNumber = Integer.parseInt(lastRevisionNumber.substring(lastRevisionNumber.lastIndexOf('.') + 1, lastRevisionNumber.length()));
   
    Revision firstRevision = getRevisionByNumber(fileName, firstRevisionNumber);
    assertNull(firstRevision.getPreviousRevision());
    Revision nextRevision = firstRevision;
   
    for(int i = firstRevNumber + 1; i <= lastRevNumber; i++) {
      nextRevision = nextRevision.getNextRevision();
      assertEquals(parent + i, nextRevision.getNumber());
    }
   
    assertNull(nextRevision.getNextRevision());
   
    Revision previousRevision = nextRevision;
    for(int i = lastRevNumber - 1; i >= firstRevNumber; i--){
      previousRevision = previousRevision.getPreviousRevision();
      assertEquals(parent + i, previousRevision.getNumber());
    }
    assertNull(previousRevision.getPreviousRevision());
  }
View Full Code Here

                        props.getProperty(releaseRef + ".date")).toString(), rel.getTimeStamp().toString());
                Set<Revision> revisions = ((SVNRelease) rel).getReleaseRevisions();
                int versionsCount = 0;
                int deletionsCount = 0;
                for (Revision tempVer : revisions) {
                    Revision ver = ((SVNRevision) tempVer).getAncestor();
                    if (ver.getState() == null) {
                        versionsCount++;
                    }
                }
                assertEquals("Wrong number of FileVersions for release " + rel.getName(), props.getProperty(releaseRef
                        + ".totFileVersions"), versionsCount + "");
View Full Code Here

        Transaction transaction = null;

        LOGGER.debug("Reconstructing transactions from CVS information.");
        int revTotal = revisionsOrderedByCreationTimeAsc.size();
        for (int i = 0; (i < revisionsOrderedByCreationTimeAsc.size()) && !monitor.isCanceled(); i++) {
            Revision revision = revisionsOrderedByCreationTimeAsc.get(i);
            monitor.subTask("Examining revision " + i + " / " + revTotal);

            Person currentAuthor = revision.getAuthor();
            long currentCheckInTime = revision.getCreationTime().getTime();
            String currentLogMessage = revision.getCommitMessage();

            // Two authors (or log messages) a1 and a2 are equal if both are null or if a1 equals a2
            boolean authorsAreEqual =
                    (precedingAuthor == null ? currentAuthor == null : precedingAuthor.equals(currentAuthor));
            boolean logMessagesAreEqual =
                    (precedingLogMessage == null ? currentLogMessage == null : precedingLogMessage
                            .equals(currentLogMessage));

            // A new Transaction has to be created if current ModificationReport has another author, log message than
            // the preceding mr or if maxDist or tMax has been exeeded.
            if (!authorsAreEqual || !logMessagesAreEqual || (currentCheckInTime > (precedingCheckInTime + maxDist))
                    || (currentCheckInTime > (precedingTransactionStart + tMax))) {
                LOGGER.debug("New transaction found. Check-in time was: " + currentCheckInTime + ".");

                transaction = new Transaction();
                transactions.add(transaction);
                transaction.setStarted(new Date(currentCheckInTime));

                precedingTransactionStart = currentCheckInTime;
            }

            precedingAuthor = currentAuthor;
            precedingCheckInTime = currentCheckInTime;
            precedingLogMessage = currentLogMessage;
            // checkInTime of the current revision is temporarly the point in time where the current transaction
            // finished until we find a newer revision.
            transaction.setFinished(new Date(currentCheckInTime));
            transaction.addRevision(revision);

            // The revision.getFile() == null check is needed for testcases --> we did not want to initialize the whole
            // object tree, so file can be null.
            LOGGER.debug("Added revision " + ((revision.getFile() == null) ? "null" : revision.getFile().getName())
                    + " - " + revision.getNumber() + " to transaction.");
            monitor.worked(100000 / revTotal);
        }

        LOGGER.debug("Starting to make transactions persistent.");
        // TODO: If we notify the listener(s)/save the transaction to db immediately after creating the instance then we
View Full Code Here

        repositoryProvider.cleanup();
        repositoryProvider.open();
        monitor.beginTask("Fetching source files content", revisionsArray.length);
        for (int i = 0; i < revisionsArray.length; i++) {
            Revision revision = revisionsArray[i];

            try {
                monitor.setTaskName("Fetching source files content (" + (i + 1) + " out of " + revisionsArray.length + ")");
                monitor.subTask("Fetching revision " + revision.getNumber() + " of file " + revision.getFile().getPath());
                InputStream stream = repositoryProvider.checkout(revision, new NullProgressMonitor());

                String source = inputStreamAsString(stream);

                stream.close();

                Content sw = persistenceProvider.load(Content.class, revision.getSourceCodeWrapper().getId());
                sw.setSource(source);

                persistenceProvider.update(sw);

                // now we can release the revision to the garbage collector,
                // since it was made persistent.
                revisionsArray[i] = null;

                if ((i % 24 == 0) && (i != 0)) {
                    persistenceProvider.flush();
                    persistenceProvider.clear();
                }

                sLogger.debug("Saved src for " + revision.getFile().getPath() + "- " + revision.getNumber() + " (" + i
                        + "/" + size + ").");

            } catch (IOException e) {
                sLogger.warn("IOException: Cannot save source of " + revision.getFile().getPath() + " - "
                        + revision.getNumber());
                throw new EvolizerException(e);
            } catch (EvolizerException e) {
                sLogger.warn("EvolizerException: Cannot save source of " + revision.getFile().getPath() + " - "
                        + revision.getNumber());
            }
            monitor.worked(1);
        }

        repositoryProvider.close();
View Full Code Here

        assertEquals("Wrong number of revisions in tested transaction", 3, transaction.getInvolvedRevisions().size());
        Set<Revision> revs = transaction.getInvolvedRevisions();
        ArrayList<Revision> found = new ArrayList<Revision>();
        Iterator<Revision> iter = revs.iterator();
        while (iter.hasNext()) {
            Revision t = iter.next();
            assertFalse("The transaction is associated to the same revision more than one time", found.contains(t));
            assertTrue("The name of one of the files associated to the transaction is wrong", t.getFile().getPath()
                    .equals("test_package/Base.java")
                    || t.getFile().getPath().equals("test_package/Sum.java")
                    || t.getFile().getPath().equals("test_package/ae/Test.java"));
        }
    }
View Full Code Here

        VersionedFile file =
                sSession.uniqueResult("from VersionedFile where path ='test_package/Base.java'", VersionedFile.class);
        // Testing the tot number of revisions
        assertEquals("The tested VersionedFile has the wrong number of revisions", 3, file.getRevisions().size());
        // Testing first revision
        Revision rev = file.getRevisions().get(0);
        assertEquals(
                "Wrong revision associated to VersionedFile test_package/Base.java",
                "3c7a872a1cf0f1a15b17cee278b356f7113e7005",
                rev.getNumber());
        assertNull("Previous revision of the first ever revision is not null", rev.getPreviousRevision());
        assertEquals("Wrong number of releases associated to VersionedFile test_package/Base.java", 2, rev
                .getReleases().size());
        Object[] rel = rev.getReleases().toArray();
        assertTrue(
                "Wrong releases associated to the first revision of File test_package/Base.java",
                (((Release) rel[0]).getName().equals("first_tag") && ((Release) rel[1]).getName().equals("second_tag"))
                        || (((Release) rel[0]).getName().equals("second_tag") && ((Release) rel[0]).getName().equals(
                                "first_tag")));
        // Testing second revision
        rev = file.getRevisions().get(1);
        assertEquals(
                "Wrong revision associated to VersionedFile test_package/Base.java",
                "49affa954287880a1d569a39c089723523567dee",
                rev.getNumber());
        assertEquals(
                "Broken link between the first and second releases of VersionedFile test_package/Base.java",
                rev,
                file.getRevisions().get(0).getNextRevision());
        assertEquals(
                "Broken link between the second and the first releases of VersionedFile test_package/Base.java",
                file.getRevisions().get(0),
                rev.getPreviousRevision());
        rel = rev.getReleases().toArray();
        assertTrue(
                "Wrong releases associated to the second revision of File test_package/Base.java",
                (((Release) rel[0]).getName().equals("first_tag") && ((Release) rel[1]).getName().equals("second_tag"))
                        || (((Release) rel[0]).getName().equals("second_tag") && ((Release) rel[0]).getName().equals(
                                "first_tag")));
        // Testing third revision
        rev = file.getRevisions().get(2);
        assertEquals(
                "Wrong revision associated to VersionedFile test_package/Base.java",
                "6c92c63b36973d991ca84d8ce6e8a74f8c45cec3",
                rev.getNumber());
        assertEquals(
                "Broken link between the second and third releases of VersionedFile test_package/Base.java",
                rev,
                file.getRevisions().get(1).getNextRevision());
        assertEquals("Broken link between the thrid and second releases of VersionedFile test_package/Base.java", file
                .getRevisions().get(1), rev.getPreviousRevision());
        rel = rev.getReleases().toArray();
        assertTrue(
                "Wrong releases associated to the third revision of File test_package/Base.java",
                (((Release) rel[0]).getName().equals("first_tag") && ((Release) rel[1]).getName().equals("second_tag"))
                        || (((Release) rel[0]).getName().equals("second_tag") && ((Release) rel[0]).getName().equals(
                                "first_tag")));
View Full Code Here

            SVNVersionedFile f = (SVNVersionedFile) fv.getFile();
            if (f.getCopiedFrom() != null) {
                ((SVNVersionedFile) f.getCopiedFrom()).setCopiedTo(null);
                fPersistenceProvider.update((SVNVersionedFile) f.getCopiedFrom());
            }
            Revision rev = f.getLatestRevision();
            if (Long.parseLong(rev.getNumber()) == revNum) {
                List<Revision> revs = f.getRevisions();
                revs.remove(f.getLatestRevision());
                f.setRevisions(revs);
                fPersistenceProvider.update(f);
            }
View Full Code Here

TOP

Related Classes of org.evolizer.versioncontrol.cvs.model.entities.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.