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

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


                for (CommitFile commitFile : commit.getFiles()) {
                    LOGGER.debug("found file " + commitFile.getName());
                    // Check if the file in this commit has already been found in an earlier commit
                    VersionedFile file = this.createFile(commitFile.getName());
                    Revision revision = new Revision(commit.getSha());
                    revision.setFile(file);
                    if (filesContent != null && !filesContent.isEmpty()) {
                        String source = filesContent.get(commitFile.getName());
                        if (source != null) {
                            revision.setSource(source);
                        }
                    }
                    revision.setState(commitFile.getChangeType());
                    Person author = this.createPerson(commit.getAuthor());
                    this.createModificationReport(commitFile, commit, revision, author);

                    // Getting the committer role and adding this new revision to it
                    for (Role r : author.getRoles()) {
                        if (r instanceof CommitterRole) {
                            ((CommitterRole) r).addRevision(revision);
                            break;
                        }
                    }

                    Revision latestRevision = file.getLatestRevision();
                    if (latestRevision != null) {
                        latestRevision.setNextRevision(revision);
                        revision.setPreviousRevision(latestRevision);
                    }
                    file.addRevision(revision);
                    revision.addRelease(fCurrRelease);
                    fCurrRelease.addRevision(revision);
View Full Code Here


            String relName = sn.getReleaseOrBranchTag();
            String revNumber = sn.getRevisionOrBranchNumber();

            if (fAllocatedReleases.containsKey(relName) && hashedRevisions.containsKey(revNumber)) {
                Release release = fAllocatedReleases.get(relName);
                Revision revision = hashedRevisions.get(revNumber);
                release.addRevision(revision);
                revision.addRelease(release);
            }
        }
    }
View Full Code Here

     */
    private void createRevisions() {
        List<Revision> revisions = new Vector<Revision>();

        List<RevisionEntry> entries = fCurrentLogEntry.getRevisionEntriesOrderedAsc();
        Revision lastRevision = null;
        for (RevisionEntry entry : entries) {
            Revision currentRevision = createRevision(entry);
            revisions.add(currentRevision);

            if (lastRevision != null) {
                String currentRevNumber = currentRevision.getNumber();
                String currentParentNumber = currentRevNumber.substring(0, currentRevNumber.lastIndexOf('.'));
                String lastRevNumber = lastRevision.getNumber();
                String lastParentNumber = lastRevNumber.substring(0, lastRevNumber.lastIndexOf('.'));

                if (currentParentNumber.equals(lastParentNumber)) {
                    currentRevision.setPreviousRevision(lastRevision);
                    lastRevision.setNextRevision(currentRevision);
                }
            }

            lastRevision = currentRevision;
View Full Code Here

        String state = entry.getState();
        int linesAdd = entry.getLinesAdd();
        int linesDel = entry.getLinesDel();
        String commitMessage = entry.getCommitMessage();

        Revision revision = new Revision(revNumber);
        revision.setState(state);
        revision.setCreationTime(creationDate);
        revision.setLinesAdd(linesAdd);
        revision.setLinesDel(linesDel);
        revision.setCommitMessage(commitMessage);

        createPerson(author, revision);
        return revision;
    }
View Full Code Here

        assertEquals("Release " + rel.getName() + " was not created with its real date",
        "Fri Oct 09 13:42:55 CEST 2009", rel.getTimeStamp().toString());
        Set<Revision> revisions = ((SVNRelease) rel).getReleaseRevisions();
        int versionsCount = 0;
        for (Revision tempVer : revisions) {
            Revision ver = ((SVNRevision) tempVer).getAncestor();
            if (ver.getState() == null) {
                versionsCount++;
            }
        }
        assertEquals("Wrong number of FileVersions for release " + rel.getName(), 6, versionsCount);
        String normFileName = "/importer_test/tags/project_0_2/TestFolder1/TestFile4.txt";
View Full Code Here

    fEvolizerSession.saveObject(mr1.getAuthor());
    fEvolizerSession.saveObject(mr2.getAuthor());
    fEvolizerSession.saveObject(mr3.getAuthor());
    fEvolizerSession.endTransaction();
   
    Revision rev1 = new Revision("1");
    rev1.setReport(mr1);
    Revision rev2 = new Revision("2");
    rev2.setReport(mr2);
    Revision rev3 = new Revision("3");
    rev3.setReport(mr3);   
   
    file1.addRevision(rev1);
    file1.addRevision(rev2);
    file1.addRevision(rev3);
    VersionedFile loadedFile = saveAndReloadUniqueFromDB(file1,
        "from File f where f.path = 'foobar'", VersionedFile.class);
    assertNotNull(loadedFile);
    assertEquals(rev3.getId(), loadedFile.getLatestRevision().getId());
    assertEquals(rev3.getNumber(), loadedFile.getLatestRevision().getNumber());
    assertEquals(3, loadedFile.getRevisions().size());
  }
View Full Code Here

    Person author = new Person();
    author.setFirstName("Emanuel");
    author.setLastName("Giger");
    author.setEmail("gigs@orc-warriors.ogrimmar.horde");

    Revision oldRevision = new Revision("1.1");
    oldRevision.setState("active");

    ModificationReport oldReport = new ModificationReport();
    oldReport.setCommitMessage("old message");
    oldReport.setCreationTime(date);
    oldReport.setLinesAdd(12);
    oldReport.setLinesDel(14);
    oldReport.setAuthor(author);

    Revision currentRevision = new Revision("1.2");
    currentRevision.setState("active");
    currentRevision.setSource("source code of rev 1.2");

    ModificationReport currentReport = new ModificationReport();
    currentReport.setCommitMessage("current message");
    currentReport.setCreationTime(date);
    currentReport.setLinesAdd(16);
    currentReport.setLinesDel(18);
    currentReport.setAuthor(author);

    Revision newRevision = new Revision("1.3");
    newRevision.setState("active");

    ModificationReport newReport = new ModificationReport();
    newReport.setCommitMessage("new message");
    newReport.setCreationTime(date);
    newReport.setLinesAdd(22);
    newReport.setLinesDel(17);
    newReport.setAuthor(author);

    oldRevision.setReport(oldReport);
    currentRevision.setReport(currentReport);
    newRevision.setReport(newReport);

    currentRevision.setPreviousRevision(oldRevision);
    currentRevision.setNextRevision(newRevision);
   
   
    fEvolizerSession.startTransaction();
    fEvolizerSession.saveObject(author);
    fEvolizerSession.saveObject(oldRevision);
    fEvolizerSession.saveObject(newRevision);
    fEvolizerSession.saveObject(currentRevision);
    fEvolizerSession.endTransaction();
    fEvolizerSession.close();

    fEvolizerSession = fSessionHandler.getCurrentSession(fDBUrl);

    List<Revision> revResults = fEvolizerSession
        .query("from Revision as b where b.number = '1.2'", Revision.class);
    assertEquals(1, revResults.size());

    Revision resultCurrentRevision = (Revision) revResults.get(0);
    assertEquals("1.2", resultCurrentRevision.getNumber());
    assertEquals("source code of rev 1.2", resultCurrentRevision.getSource());
    assertEquals("1.1", resultCurrentRevision.getPreviousRevision()
        .getNumber());
    assertEquals("1.3", resultCurrentRevision.getNextRevision().getNumber());

    ModificationReport resultReport = resultCurrentRevision.getReport();
    assertEquals("current message", resultReport.getCommitMessage());
    assertEquals(date, resultReport.getCreationTime());
    assertEquals(16, resultReport.getLinesAdd());
    assertEquals(18, resultReport.getLinesDel());
    assertEquals("Emanuel", resultReport.getAuthor().getFirstName());
    assertEquals("gigs@orc-warriors.ogrimmar.horde", resultReport
        .getAuthor().getEmail());

    resultReport = resultCurrentRevision.getPreviousRevision().getReport();
    assertEquals("old message", resultReport.getCommitMessage());
    assertEquals(date, resultReport.getCreationTime());
    assertEquals(12, resultReport.getLinesAdd());
    assertEquals(14, resultReport.getLinesDel());
    assertEquals("Giger", resultReport.getAuthor().getLastName());
    assertEquals("gigs@orc-warriors.ogrimmar.horde", resultReport
        .getAuthor().getEmail());

    resultReport = resultCurrentRevision.getNextRevision().getReport();
    assertEquals("new message", resultReport.getCommitMessage());
    assertEquals(date, resultReport.getCreationTime());
    assertEquals(22, resultReport.getLinesAdd());
    assertEquals(17, resultReport.getLinesDel());
    assertEquals("Emanuel", resultReport.getAuthor().getFirstName());
View Full Code Here

        }
        return res;
    }

    protected static Revision getFirstRevision(VersionedFile f) {
        Revision res = null;
        for (Revision r : f.getRevisions()) {
            if (res == null) {
                res = r;
            } else {
                if (Long.parseLong(r.getNumber()) < Long.parseLong(res.getNumber())) {
                    res = r;
                }
            }
        }
        return res;
View Full Code Here

   
    ModificationReport modReport = new ModificationReport();
   
    modReport.setAuthor(new Person());
   
    Revision revOne = new Revision("1.1");
    Revision revTwo = new Revision("1.2");
    Revision revThree= new Revision("1.3");
    Revision revFour = new Revision("1.4");
    Revision revFive = new Revision("1.5");
   
    //A dummy report otherwise Hibernate throws an eception
    revOne.setReport(modReport);
    revTwo.setReport(modReport);
    revThree.setReport(modReport);revOne.setReport(modReport);
    revFour.setReport(modReport);
    revFive.setReport(modReport);
   
    releaseOne.addRevision(revOne);
    releaseOne.addRevision(revFour);
    releaseOne.addRevision(revFive);
   

    releaseTwo.addRevision(revTwo);
    releaseTwo.addRevision(revThree);
    releaseTwo.addRevision(revOne);
   
    for(Iterator<Revision> iter = releaseOne.getRevisions().iterator();iter.hasNext();){
      iter.next().addRelease(releaseOne);
    }
   
    for(Iterator<Revision> iter = releaseTwo.getRevisions().iterator();iter.hasNext();){
      iter.next().addRelease(releaseTwo);
    }
   
    fEvolizerSession.startTransaction();
    fEvolizerSession.saveObject(modReport.getAuthor());
    fEvolizerSession.saveObject(releaseOne);
    fEvolizerSession.saveObject(releaseTwo);
    fEvolizerSession.saveObject(revOne);
    fEvolizerSession.saveObject(revTwo);
    fEvolizerSession.saveObject(revThree);
    fEvolizerSession.saveObject(revFour);
    fEvolizerSession.saveObject(revFive);
    fEvolizerSession.endTransaction();
    fEvolizerSession.close();
   
    fEvolizerSession = fSessionHandler.getCurrentSession(fDBUrl);
   
    List<Release> releaseResultsList = fEvolizerSession.query("from Release", Release.class);
    assertEquals(2, releaseResultsList.size());
    assertEquals("releaseNameOne", ((Release)releaseResultsList.get(0)).getName());
    assertEquals("releaseNameTwo", ((Release)releaseResultsList.get(1)).getName());
   
    assertEquals(3, ((Release)releaseResultsList.get(0)).getRevisions().size());
    assertEquals(3, ((Release)releaseResultsList.get(1)).getRevisions().size());
   
    //Test if first Release and Revision were mapped were mapped correctly
    for(Iterator<Revision> iter = ((Release)releaseResultsList.get(0)).getRevisions().iterator();iter.hasNext();){
      Revision rev = iter.next();
      if(!(rev.getNumber().equals("1.1")|| rev.getNumber().equals("1.4") || rev.getNumber().equals("1.5"))){
        Assert.fail("Release and Revision were not properly mapped! Please check Database");
      }
    }
    //Test if second Realse and Revision were mapped were mapped correctly
    for(Iterator<Revision> iter = ((Release)releaseResultsList.get(1)).getRevisions().iterator();iter.hasNext();){
      Revision rev = iter.next();
      if(!(rev.getNumber().equals("1.2")|| rev.getNumber().equals("1.3") || rev.getNumber().equals("1.1"))){
        Assert.fail("Release and Revision were not properly mapped! Please check Database");
      }
    }
  }
View Full Code Here

    Transaction transaction = new Transaction();
    SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    Date date = df.parse("2006/01/02 01:02:03");
    transaction.setStarted(date);
    transaction.setFinished(date);
    Revision rev = new Revision("1.1");
    transaction.addRevision(rev);
   
    ModificationReport modReport = new ModificationReport();
    modReport.setAuthor(new Person());
    rev.setReport(modReport);
   
    fEvolizerSession.startTransaction();
    fEvolizerSession.saveObject(modReport.getAuthor());
    fEvolizerSession.saveObject(rev);
    fEvolizerSession.saveObject(transaction);
    fEvolizerSession.endTransaction();
    fEvolizerSession.close();
   
    fEvolizerSession = fSessionHandler.getCurrentSession(fDBUrl);
   
    List<Transaction> transactionResults = fEvolizerSession.query("from Transaction", Transaction.class);
    assertEquals(1, transactionResults.size());
   
    Transaction transactionResult = (Transaction) transactionResults.get(0);
    assertEquals(date, transactionResult.getStarted());
    assertEquals(date, transactionResult.getFinished());
    assertEquals(1, transactionResult.getInvolvedRevisions().size());
   
    Revision resultInvolvedRevision = transactionResult.getInvolvedRevisions().iterator().next();
    assertEquals("1.1", resultInvolvedRevision.getNumber());
  }
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.