Package org.evolizer.versioncontrol.svn.model.entities

Examples of org.evolizer.versioncontrol.svn.model.entities.SVNRevision


         */

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


                    1,
                    3);

        sModelMapper.deleteRelease(1, sAuthorName, "/releaseTag2");

        SVNRevision rev = sSession.uniqueResult("from SVNRevision where id = " + sRev.getId(), SVNRevision.class);
        assertEquals(1, rev.getReleases().size());
        assertTrue(rev.getReleases().iterator().next().getName().compareTo("releaseTag") == 0);
    }
View Full Code Here

        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);
        assertEquals("the two successive revisions of the test file are not linked together", fetched.getPreviousRevision().getId(), previous.getId());
        assertEquals("the two successive revisions of the test file are not linked together", fetched.getId(), previous.getNextRevision().getId());
        assertNotNull("The test revision was not saved", fetched);
        sModelMapper.deleteRevision(6, sAuthorName, null);
        assertTrue("The deleted revision still exists", sSession.query("from SVNRevision where number = " + 6, SVNRevision.class).isEmpty());
        previous = sSession.uniqueResult("from SVNRevision where id = " + previousRevId, SVNRevision.class);
        assertNull("The deleted revision is still around...", previous.getNextRevision());
    }
View Full Code Here

            if (currRev.getFile().getPath().compareTo(
                    "/tags/httpunit_1_2_2/httpunit/src/com/meterware/httpunit/WebResponse.java") == 0) {

                totFilesTested++;
                assertEquals("Wrong File Version", "93", currRev.getNumber());
                SVNRevision ancestor = ((SVNRevision) currRev).getAncestor();
                assertEquals("Wrong ancestor", "/trunk/httpunit/src/com/meterware/httpunit/WebResponse.java", ancestor
                        .getFile().getPath());

                ArrayList<String> versionNums = new ArrayList<String>();
                versionNums.add("85");
                versionNums.add("83");
                versionNums.add("82");
                versionNums.add("79");
                versionNums.add("77");
                versionNums.add("75");
                versionNums.add("72");
                versionNums.add("69");
                versionNums.add("67");
                versionNums.add("60");
                versionNums.add("59");
                versionNums.add("58");
                versionNums.add("56");
                versionNums.add("54");
                versionNums.add("51");
                versionNums.add("48");
                versionNums.add("42");
                versionNums.add("40");
                versionNums.add("38");
                versionNums.add("37");
                versionNums.add("32");
                versionNums.add("29");
                versionNums.add("26");
                versionNums.add("22");
                versionNums.add("21");
                versionNums.add("18");
                versionNums.add("9");
                versionNums.add("8");
                versionNums.add("2");

                for (String version : versionNums) {
                    assertTrue("Wrong version number for file " + ancestor.getFile().getPath(), version
                            .compareTo(ancestor.getNumber()) == 0);

                    if (version.compareTo("37") == 0) {
                        assertTrue("Wrong commit message for version " + version
                                + " of file /trunk/httpunit/src/com/meterware/httpunit/WebResponse.java for release "
                                + rel.getName(), ancestor.getReport().getCommitMessage().contains(
                                "Added getTitle, getURLString"));
                        assertTrue(
                                "Wrong commit author for version "
                                        + version
                                        + " of file /trunk/httpunit/src/com/meterware/httpunit/WebResponse.java for release "
                                        + rel.getName(),
                                ancestor.getReport().getAuthor().getFirstName().compareTo("russgold") == 0);

                        for (Role r : ancestor.getReport().getAuthor().getRoles()) {
                            if (r instanceof CommitterRole) {
                                assertTrue("Author of " + ancestor.getFile().getName() + ":" + ancestor.getNumber()
                                        + " doesn't have it in its artifacts", ((CommitterRole) r).getArtifacts()
                                        .contains(ancestor));
                                break;
                            }
                        }
                        assertTrue("Wrong commit date for version " + version
                                + " of file /trunk/httpunit/src/com/meterware/httpunit/WebResponse.java for release "
                                + rel.getName(), sDateFormat.parse("2000-09-11 16:23:48 +0200").equals(
                                        ancestor.getReport().getCreationTime()));
                    }
                    if (ancestor.getPreviousRevision() != null) {
                        assertEquals("Next and PreviousVersion of two successive FileVersions don't match for release "
                                + rel.getName(), ancestor.getPreviousRevision().getNextRevision().getId(), ancestor.getId());
                    }
                    if (ancestor.getPreviousRevision() != null) {
                        ancestor = sSession.load(SVNRevision.class, ancestor
                                .getPreviousRevision().getId());
                    }

                }
            } else if (currRev.getFile().getPath().compareTo("/tags/httpunit_1_2_2/httpunit/examples/NearWords.java") == 0) {
View Full Code Here

     * Tests a specific FileVersion over multiple releases.
     */
    @Test
    public void testFileVersionInMultipleReleases() {
        String fileName = "/trunk/httpunit/src/com/meterware/httpunit/WebResponse.java";
        SVNRevision fileVersion = getSpecificFileVersion(48, fileName);

        ArrayList<String> releases = new ArrayList<String>();
        releases.add("httpunit_1_1");
        releases.add("httpunit_1_2");
        releases.add("httpunit_1_2_1");
        releases.add("httpunit_1_2_2");
        releases.add("httpunit_1_2_3");
        releases.add("httpunit_1_2_4");
        releases.add("httpunit_1_2_5");
        releases.add("httpunit_1_2_6");
        releases.add("httpunit_1_2_7");
        releases.add("httpunit_1_3");
        releases.add("httpunit_1_4");
        assertEquals(
                "The number of releases associated to FileVersion "
                        + "/trunk/httpunit/src/com/meterware/httpunit/WebResponse.java is incorrect",
                releases.size(),
                fileVersion.getReleases().size());

        for (Release r : fileVersion.getReleases()) {
            assertTrue("Fileversion is linked to a wrong release", releases.contains(r.getName()));
            releases.remove(r.getName());
        }
        assertTrue(
                "Some releases associated to FileVersion /trunk/httpunit/src/com/meterware/httpunit/WebResponse.java were not found",
View Full Code Here

            if (currRev.getFile().getPath().compareTo(normFileName) == 0) {

               
                assertEquals("Wrong File Version", "15", currRev.getNumber());
                SVNRevision ancestor = ((SVNRevision) currRev).getAncestor();
                assertEquals("Wrong ancestor", normFileAncestorName, ancestor.getFile().getPath());

                ArrayList<String> versionNums = new ArrayList<String>();
                versionNums.add("13");
                versionNums.add("9");
                versionNums.add("8");
                versionNums.add("6");
                versionNums.add("5");
                versionNums.add("3");

                for (String version : versionNums) {
                    assertTrue("Wrong version number for file " + ancestor.getFile().getPath(), version.compareTo(ancestor.getNumber()) == 0);

                    if (version.compareTo("13") == 0) {
                        totFilesTested++;
                        assertTrue("Wrong commit message for version " + version + " of file " + normFileAncestorName + " for release "
                                + rel.getName(), ancestor.getReport().getCommitMessage().contains("modified all files"));
                        assertTrue("Wrong commit author for version " + version + " of file " + normFileAncestorName + " for release "
                                + rel.getName(), ancestor.getReport().getAuthor().getFirstName().compareTo("Giacomo") == 0);

                        for (Role r : ancestor.getReport().getAuthor().getRoles()) {
                            if (r instanceof CommitterRole) {
                                assertTrue("Author of " + ancestor.getFile().getName() + ":" + ancestor.getNumber() + " doesn't have it in its artifacts", ((CommitterRole) r).getArtifacts().contains(ancestor));
                                break;
                            }
                        }
                        assertTrue("Wrong commit date for version " + version + " of file " + normFileAncestorName + " for release "
                                + rel.getName(), "Fri Oct 09 13:40:12 CEST 2009".equals(ancestor.getReport().getCreationTime().toString()));
                    } else if (version.compareTo("3") == 0) {
                        totFilesTested++;
                        assertTrue("Wrong commit message for version " + version + " of file " + normFileAncestorName + " for release "
                                + rel.getName(), ancestor.getReport().getCommitMessage().contains(""));
                        assertTrue("Wrong commit author for version " + version + " of file " + normFileAncestorName + " for release "
                                + rel.getName(), ancestor.getReport().getAuthor().getFirstName().compareTo("Giacomo") == 0);

                        for (Role r : ancestor.getReport().getAuthor().getRoles()) {
                            if (r instanceof CommitterRole) {
                                assertTrue("Author of " + ancestor.getFile().getName() + ":" + ancestor.getNumber() + " doesn't have it in its artifacts", ((CommitterRole) r).getArtifacts().contains(ancestor));
                                break;
                            }
                        }
                        assertTrue("Wrong commit date for version " + version + " of file " + normFileAncestorName + " for release "
                                + rel.getName(), ancestor.getReport().getCreationTime().toString().equals("Fri Oct 09 11:41:31 CEST 2009"));
                     // assert ancestor has no more previous versions
                        assertNull("The number of versions for " + normFileAncestorName + " is more then expected", ancestor.getPreviousRevision());
                       
                    }
                    if (ancestor.getPreviousRevision() != null) {
                        assertEquals(
                                "Next and PreviousVersion of two successive FileVersions don't match for release "
                                + rel.getName(),
                                ancestor.getPreviousRevision().getNextRevision().getId(),
                                ancestor.getId());
                    }
                    if (ancestor.getPreviousRevision() != null) {
                        ancestor = sSession.load(SVNRevision.class, ancestor
                            .getPreviousRevision().getId());
                        }

                }
                break;
View Full Code Here

    public void testFileVersionInMultipleReleases() {
        ArrayList<String> releases = new ArrayList<String>();
        releases.add("project_0_2");
        releases.add("project_0_3");
        releases.add("project_0_4");
        SVNRevision fileVersion = getSpecificFileVersion(8, "/importer_test/trunk/project/TestFolder1/TestFile4.txt");
        assertEquals("The number of releases associated to FileVersion /importer_test/trunk/project/TestFolder1/TestFile4.txt:8 is incorrect",
                releases.size(), fileVersion.getReleases().size());
       
        for (Release r : fileVersion.getReleases()) {
            assertTrue("Fileversion is linked to a wrong release", releases.contains(r.getName()));
            releases.remove(r.getName());
        }
        assertTrue("Some releases associated to FileVersion /importer_test/trunk/project/TestFolder1/TestFile4.txt:8 were not found", releases.isEmpty());
    }
View Full Code Here

                        if (fileIndex >= 0) {
                            totFilesTested++;
                            String fileRef = releaseRef + ".file" + (fileIndex + 1);
                            assertEquals("Wrong File Version", (Long) Long.parseLong(props.getProperty(fileRef
                                    + ".releaseVersion")), (Long) Long.parseLong(currRev.getNumber()));
                            SVNRevision ancestor = ((SVNRevision) currRev).getAncestor();
                            assertEquals("Wrong ancestor", props.getProperty(fileRef + ".realFile"), ancestor.getFile()
                                    .getPath());
                            String versions = props.getProperty(fileRef + ".versions");
                            StringTokenizer tokenizer = new StringTokenizer(versions, ",");
                            ArrayList<String> versionNums = new ArrayList<String>();
                            while (tokenizer.hasMoreTokens()) {
                                versionNums.add(tokenizer.nextToken());
                            }
                            for (String version : versionNums) {
                                assertTrue("Wrong version number for file " + ancestor.getFile().getPath(), version
                                        .compareTo(ancestor.getNumber()) == 0);
                                if (props.getProperty(fileRef + version + ".message") != null) {
                                    assertTrue("Wrong commit message for version " + version + " of file "
                                            + props.getProperty(fileRef + ".realFile") + " for release "
                                            + rel.getName(), ancestor.getReport().getCommitMessage().contains(
                                            props.getProperty(fileRef + version + ".message")));
                                    assertTrue("Wrong commit author for version " + version + " of file "
                                            + props.getProperty(fileRef + ".realFile") + " for release "
                                            + rel.getName(), ancestor.getReport().getAuthor().getFirstName().compareTo(
                                            props.getProperty(fileRef + version + ".author")) == 0);

                                    for (Role r : ancestor.getReport().getAuthor().getRoles()) {
                                        if (r instanceof CommitterRole) {
                                            assertTrue(
                                                    "Author of " + ancestor.getFile().getName() + ":"
                                                            + ancestor.getNumber()
                                                            + " doesn't have it in its artifacts",
                                                    ((CommitterRole) r).getArtifacts().contains(ancestor));
                                            break;
                                        }
                                    }
                                    assertTrue("Wrong commit date for version " + version + " of file "
                                            + props.getProperty(fileRef + ".realFile") + " for release "
                                            + rel.getName(), sDateFormat.parse(
                                            props.getProperty(fileRef + version + ".date")).equals(
                                            ancestor.getReport().getCreationTime()));
                                }
                                if (ancestor.getPreviousRevision() != null) {
                                    assertEquals(
                                            "Next and PreviousVersion of two successive FileVersions don't match for release "
                                                    + rel.getName(),
                                            ancestor.getPreviousRevision().getNextRevision(),
                                            ancestor);
                                }
                                ancestor = (SVNRevision) ancestor.getPreviousRevision();

                            }
                            // assert ancestor has no more previous versions
                            assertNull("The number of versions for " + props.getProperty(fileRef + ".realFile")
                                    + " is more then expected", ancestor);
View Full Code Here

                            props.getProperty("crossReleaseFileVersion" + i).indexOf(":") + 1));
            String fileName =
                    props.getProperty("crossReleaseFileVersion" + i).substring(
                            0,
                            props.getProperty("crossReleaseFileVersion" + i).indexOf(":"));
            SVNRevision fileVersion = getSpecificFileVersion(verNum, fileName);
            StringTokenizer tokenizer =
                    new StringTokenizer(props.getProperty("crossReleaseFileVersion" + i + ".releases"), ",");
            assertEquals(
                    "The number of releases associated to FileVersion "
                            + props.getProperty("crossReleaseFileVersion" + i) + " is incorrect",
                    tokenizer.countTokens(),
                    fileVersion.getReleases().size());
            ArrayList<String> releases = new ArrayList<String>();
            while (tokenizer.hasMoreTokens()) {
                releases.add(tokenizer.nextToken());
            }
            for (Release r : fileVersion.getReleases()) {
                assertTrue("Fileversion is linked to a wrong release", releases.contains(r.getName()));
                releases.remove(r.getName());
            }
            assertTrue("Some releases associated to FileVersion " + props.getProperty("crossReleaseFileVersion" + i)
                    + " were not found", releases.isEmpty());
View Full Code Here

        /*
         * I create the new revision which will have as a revision number the one of the release creation
         * Then I link it the modification report (with the branch creation message) and the other related objects, and I link those
         * objects too (ex. Person to ModReport, etc.)
         */
        SVNRevision revision = getClosestRevision(fromFile, fromRevNum);
        SVNRevision newRevision = new SVNRevision("" + toRevNum);
        newRevision.setChangeSet(changeSet);
        changeSet.addRevision(newRevision); // Transaction -> SVNRevision
        ModificationReport report = this.createModificationReport(date, message, author);

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

        newRevision.setReport(report); // SVNRevision -> ModificationReport
        newRevision.setAncestor(revision);
        newFile.addRevision(newRevision); // File -> SVNRevision
        newRevision.setFile(newFile); // SVNRevision ->File
        if ((release != null) && (branch == null)) {
            release.addReleaseRevision(newRevision);
        } else if ((branch != null) && (release == null)) {
            branch.addRevision(newRevision); // Branch -> SVNRevision
        } else {
View Full Code Here

TOP

Related Classes of org.evolizer.versioncontrol.svn.model.entities.SVNRevision

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.