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

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


         * If the branch does not exists already (can happen if the project was moved around),
         * it is created on the fly.
         */

        Transaction t = sModelMapper.createTransaction(new Date(13143647));
        ModificationReport m = sModelMapper.createModificationReport(new Date(132323), "another message", sAuthorName);
        SVNVersionedFile f = sModelMapper.createFile("/file.txt");
        SVNRevision rev2 =
            sModelMapper.createBranchRevision(2, f, t, m, null, false, "These are the new contents", "branch");

        // Check the branch was created and was added to the related field
        Field branchesField = SVNModelMapper.class.getDeclaredField("fBranches");
        branchesField.setAccessible(true);
        HashMap<String, Branch> branches = (HashMap<String, Branch>) branchesField.get(sModelMapper);
        assertEquals(1, branches.size());

        assertTrue("The created branch does not exist", branches.get("branch") != null);
        assertEquals("Wrong creation time for the newly created branch", m.getCreationTime(), branches.get("branch")
                .getCreationDate());
        assertTrue("The branch has children, when it shoudn't", branches.get("branch").getChildren().isEmpty());
        assertEquals(rev2, branches.get("branch").getRevisions().iterator().next());
        assertEquals("Wrong number of revisions for test branch", 1, branches.get("branch").getRevisions().size());
        // Check that the revision and file were added to the related data structure
View Full Code Here


     */
    @Test
    public void testDeleteRevision() throws Exception{
        Date d = new Date(1234563999);
        Transaction newTrans = sModelMapper.createTransaction(d);
        ModificationReport newReport = sModelMapper.createModificationReport(new Date(1243548890), "test message", sAuthorName);
        Long previousRevId = sFile.getLatestRevision().getId();
        sModelMapper.createRevision(6, sFile, newTrans, newReport, null, false, "These are the contents");
        sModelMapper.finalizeTransaction(newTrans, new ArrayList<String>());
        SVNRevision fetched = sSession.uniqueResult("from SVNRevision where number = " + 6, SVNRevision.class);
        SVNRevision previous = sSession.uniqueResult("from SVNRevision where id = " + previousRevId, SVNRevision.class);
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testRemoveFromRelease() throws Exception{
        Transaction t = sModelMapper.createTransaction(new Date(97897899));
        ModificationReport m = sModelMapper.createModificationReport(new Date(155323), "another message", sAuthorName);
        SVNVersionedFile f = sModelMapper.createFile("/rootDir/dir/file2.txt");
        sModelMapper.createRevision(2, f, t, m, null, false, "These are the new contents");
        sModelMapper.finalizeTransaction(t, new ArrayList<String>());
       
        Transaction newTrans = sModelMapper.createTransaction(new Date(1576763378));
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testReplaceInRelease() throws Exception{
        Transaction t = sModelMapper.createTransaction(new Date(97897899));
        ModificationReport m = sModelMapper.createModificationReport(new Date(155323), "another message", sAuthorName);
        SVNVersionedFile f = sModelMapper.createFile("/rootDir2/dir/file3.txt");
        sModelMapper.createRevision(2, f, t, m, null, false, "These are the new contents");
        sModelMapper.finalizeTransaction(t, new ArrayList<String>());
       
       
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testRemoveFromBranch() throws Exception {
        Transaction t = sModelMapper.createTransaction(new Date(97897899));
        ModificationReport m = sModelMapper.createModificationReport(new Date(155323), "another message", sAuthorName);
        SVNVersionedFile f = sModelMapper.createFile("/rootDir/dir/file2.txt");
        sModelMapper.createRevision(2, f, t, m, null, false, "These are the new contents");
        sModelMapper.finalizeTransaction(t, new ArrayList<String>());
       
        Transaction newTrans = sModelMapper.createTransaction(new Date(1576763378));
View Full Code Here

     *            the {@link Revision} associated to this report
     * @param author
     *            the {@link Person} author of the report
     */
    private void createModificationReport(CommitFile commitFile, Commit c, Revision revision, Person author) {
        ModificationReport report = new ModificationReport();
        // Need to do that (due to a sort of a bug in in javagit)
        if (c.getMessage() == null) {
            report.setCommitMessage("");
        } else {
            report.setCommitMessage(c.getMessage().trim());
        }
        report.setLinesAdd(commitFile.getLinesAdded());
        report.setLinesDel(commitFile.getLinesDeleted());
        try {
            report.setCreationTime(this.translateDateString(c.getDateString()));
        } catch (ParseException e) {
            LOGGER.error("Error while adding the creation date to the modification report for commit " + c.getSha());
        }
        report.setAuthor(author);
        revision.setReport(report);
    }
View Full Code Here

    SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    Date date = df.parse("2006/01/02 01:02:03");
    releaseOne.setTimeStamp(date);
    releaseTwo.setTimeStamp(date);
   
    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);
View Full Code Here

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

  }
 
 
  @Test
  public void testModReportEqualsAndHashCode(){
    ModificationReport m1 = new ModificationReport();
    ModificationReport m2 = new ModificationReport();
    Date date = new Date();
    Person author = new Person();
    m1.setCreationTime(date);
    m2.setCreationTime(date);
   
    m1.setAuthor(author);
    m2.setAuthor(author);
   
    m1.setCommitMessage("message");
    m2.setCommitMessage("message");
   
    m1.setLinesAdd(3);
    m2.setLinesAdd(3);
   
    m1.setLinesDel(4);
    m2.setLinesDel(4);
   
   
    assertFalse(m1.equals(null));
    assertEquals(true, m1.equals(m1));
    assertTrue(m1.equals(m2));
    assertTrue(m1.hashCode()==m2.hashCode());
  }
View Full Code Here

  public void testRevisionEqualsAndHashCode(){
    Revision rev1 = new Revision("1.1");
    Revision rev2 = new Revision("1.1");
   
    VersionedFile file = new VersionedFile("foo.bar", null);
    ModificationReport modRe = new ModificationReport();
   
    rev1.setFile(file);
    rev2.setFile(file);
   
    rev1.setReport(modRe);
View Full Code Here

TOP

Related Classes of org.evolizer.versioncontrol.cvs.model.entities.ModificationReport

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.