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

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


     */
    @Test
    public void testChangeSets() throws ParseException {
        int totCs = Integer.parseInt(props.getProperty("testChangeSets"));
        for (int i = 1; i <= totCs; i++) {
            Transaction cs = getTransaction(props.getProperty("changeSet" + i + ".date"));
            if (cs != null) {
                ArrayList<String> modified = new ArrayList<String>();
                ArrayList<String> deleted = new ArrayList<String>();
                ArrayList<String> added = new ArrayList<String>();
                ArrayList<String> moved = new ArrayList<String>();

                if (props.getProperty("changeSet" + i + ".modifiedFiles") != null
                        && props.getProperty("changeSet" + i + ".modifiedFiles").compareTo("") != 0) {
                    StringTokenizer tokenizer =
                            new StringTokenizer(props.getProperty("changeSet" + i + ".modifiedFiles"), ",");
                    while (tokenizer.hasMoreTokens()) {
                        modified.add(tokenizer.nextToken());
                    }
                }
                if (props.getProperty("changeSet" + i + ".deletedFiles") != null
                        && props.getProperty("changeSet" + i + ".deletedFiles").compareTo("") != 0) {
                    StringTokenizer tokenizer =
                            new StringTokenizer(props.getProperty("changeSet" + i + ".deletedFiles"), ",");
                    while (tokenizer.hasMoreTokens()) {
                        deleted.add(tokenizer.nextToken());
                    }

                }
                if (props.getProperty("changeSet" + i + ".addedFiles") != null
                        && props.getProperty("changeSet" + i + ".addedFiles").compareTo("") != 0) {
                    StringTokenizer tokenizer =
                            new StringTokenizer(props.getProperty("changeSet" + i + ".addedFiles"), ",");
                    while (tokenizer.hasMoreTokens()) {
                        added.add(tokenizer.nextToken());
                    }
                }
                if (props.getProperty("changeSet" + i + ".movedFiles") != null
                        && props.getProperty("changeSet" + i + ".movedFiles").compareTo("") != 0) {
                    StringTokenizer tokenizer =
                            new StringTokenizer(props.getProperty("changeSet" + i + ".movedFiles"), ",");
                    while (tokenizer.hasMoreTokens()) {
                        moved.add(tokenizer.nextToken());
                    }
                }
                assertEquals(
                        "Erroneous number of involved file versions for ChangeSet at date " + cs.getStarted(),
                        modified.size() + deleted.size() + added.size() + moved.size(),
                        cs.getInvolvedRevisions().size());
                for (Revision ver : cs.getInvolvedRevisions()) {
                    String fileVersionId = ver.getFile().getPath() + ":" + ver.getNumber();
                    assertEquals(
                            "FileVersion " + fileVersionId + " has not the number of associated to the change set",
                            (Long) Long.parseLong(props.getProperty("changeSet" + i)),
                            (Long) Long.parseLong(ver.getNumber()));
View Full Code Here


        Person precedingAuthor = null;
        long precedingCheckInTime = 0;
        long precedingTransactionStart = 0;
        String precedingLogMessage = null;

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

    /**
     * Tests a specific transaction
     */
    @Test
    public void testSpecificTransaction() {
        Transaction transaction =
                sSession.uniqueResult("from Transaction where started = '2009-07-06 12:06:57'", Transaction.class);
        assertEquals(
                "Start and End date in tested transaction are not the same",
                transaction.getFinished(),
                transaction.getStarted());
        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));
View Full Code Here

            fConnector.connectSVN();
            LOGGER.info(ImporterMessages.EvolizerSVNImporter_connected);
            this.processFileExtensionRegEx(fileExtensionRegex);

            if (end == -1) {
                Transaction t =
                        persistenceProvider.query("from Transaction order by finished DESC", Transaction.class).get(0);
                end = Long.parseLong(t.getInvolvedRevisions().iterator().next().getNumber());
            }

            if (start == 0) {
                for (Transaction t : persistenceProvider.query(
                        "from Transaction order by finished ASC",
                        Transaction.class)) {
                    if (t.getInvolvedRevisions() != null && !t.getInvolvedRevisions().isEmpty()) {
                        start = Long.parseLong(t.getInvolvedRevisions().iterator().next().getNumber());
                        break;
                    }
                }
            }
            /*
 
View Full Code Here

        String parentTag = null;
        if (isSubBranch) {
            parentTag = tagPath.getCopyPath().substring(tagPath.getCopyPath().lastIndexOf("/") + 1);
        }
        // Create the ChangeSet related to the branch creation
        Transaction changeSet = fModelMapper.createTransaction(logEntry.getDate());
        // Here I don't check whether the logEntryPath points to a directory as It should already be done in isBranch.
        Branch branch =
                fModelMapper.createBranch(
                        logEntry.getDate(),
                        changeSet,
View Full Code Here

         *  specific order to avoid inconsistent data.
         *  This is why I need to convert the SVN log entry paths Map into a TreeMap, so I get the entries sorted.
         *  In this way I am sure that the first item is the release creation (as it is the shortest path).
         */
        TreeMap<String, SVNLogEntryPath> sortedPaths = new TreeMap<String, SVNLogEntryPath>(logEntry.getChangedPaths());
        Transaction changeSet = fModelMapper.createTransaction(logEntry.getDate());
        // I get the first logEntryPath, the one containing the creation of the tag folder and I create a release with
        // that
        SVNLogEntryPath tagPath = sortedPaths.values().iterator().next();
        SVNRelease release =
                fModelMapper.createRelease(
View Full Code Here

                }
            }
        }
        // Now I proceed to the actual revision handling/creation
        Date date = logEntry.getDate();
        Transaction changeSet = fModelMapper.createTransaction(date);

        for (SVNLogEntryPath logEntryPath : changedPaths) {

            // Check if path points to a directory or a file on current revision
            SVNNodeKind nodeKind = getEntryType(logEntryPath, logEntry);
View Full Code Here

     *            The Transaction creation date.
     * @return The Transaction created.
     * @see org.evolizer.versioncontrol.cvs.model.entities.Transaction
     */
    public Transaction createTransaction(Date date) {
        Transaction changeSet = new Transaction();
        changeSet.setStarted(date); // start and end date are the same
        changeSet.setFinished(date);
        LOGGER.debug(NLS.bind(MapperMessages.SVNModelMapper_createdTransaction, date));
        return changeSet;
    }
View Full Code Here

TOP

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

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.