Package org.evolizer.model.resources.entities.humans

Examples of org.evolizer.model.resources.entities.humans.Person


        Field authorsField = SVNModelMapper.class.getDeclaredField("fPersons");
        authorsField.setAccessible(true);
        HashMap<String, Person> authors = (HashMap<String, Person>) authorsField.get(sModelMapper);
        assertEquals(1, authors.size());

        Person p = sModelMapper.createPerson(sAuthorEmail);
        assertTrue("Author's name is not what is supposed to be", p.getFirstName().compareTo(sAuthorEmail) == 0);
        assertTrue("Author's email is not what is supposed to be", p.getEmail().compareTo(sAuthorEmail) == 0);
        assertEquals("The number of the author's role is not what expected", 1, p.getRoles().size());
        assertTrue(p.getRoles().iterator().next() instanceof CommitterRole);

        // Now I check the number of tracked authors increased by one.
        assertEquals(2, authors.size());
        assertEquals(p, authors.get(sAuthorEmail));
View Full Code Here


        assertEquals("The number of involved revisions for the test transaction is not what expected", 1, toAnalyze.getInvolvedRevisions().size());
        assertEquals("The revision transaction is not the one expected", toAnalyze.getId(), sRev.getChangeSet().getId());
        assertEquals("The test transaction does not contain the test revision", sRev.getId(), toAnalyze.getInvolvedRevisions().iterator().next().getId());
        assertEquals("The test revision's author is not what expected", sRev.getAuthor().getId(), toAnalyze.getInvolvedRevisions().iterator().next().getAuthor().getId());

        Person p = sSession.uniqueResult("from Person as p where p.firstName ='" + sAuthor.getFirstName() + "'", Person.class);
        CommitterRole r = (CommitterRole) p.getRoles().iterator().next();
        SVNVersionedFile f = sSession.uniqueResult("from SVNVersionedFile where path= '/rootDir/dir/file.txt'", SVNVersionedFile.class);
        assertEquals(toAnalyze.getInvolvedRevisions().iterator().next().getId(), f.getRevisions().iterator().next().getId());
        assertEquals("The saved revision was not associated to its saved author", r.getArtifacts().iterator().next(), toAnalyze.getInvolvedRevisions().iterator().next());
    }
View Full Code Here

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

     * @return the {@link Person} created
     */
    private Person createPerson(String author) {
        String authorName = author.substring(0, author.indexOf("<") - 1).trim();
        String authorEmail = author.substring(author.indexOf("<") + 1, author.indexOf(">"));
        Person person;
        if (author.startsWith("<")) {
            authorEmail = author.substring(author.indexOf("<") + 1, author.indexOf(">"));
            person = fPersons.get(authorEmail);
        } else {
            authorName = author.substring(0, author.indexOf("<") - 1).trim();
            authorEmail = author.substring(author.indexOf("<") + 1, author.indexOf(">"));
            person = fPersons.get(authorName);
        }
       
        if (person == null) {
            person = new Person();

            if (isEmail(authorEmail)) {
                person.setEmail(authorEmail);
            }
            if (authorName != null) {
                person.setFirstName(authorName);
            }
            CommitterRole role = new CommitterRole();
            person.addRole(role);
            fSession.saveObject(role);
            if (authorName != null) {
                fPersons.put(authorName, person);
            } else {
                fPersons.put(authorEmail, person);
View Full Code Here

            if (fPersonEmails.containsKey(author)) {
                e = fPersonEmails.get(author);

            } else {
                Person person = new Person();
                person.setEmail(author);

                e = new P();
                e.fPerson = person;
                e.fRole = new CommitterRole();

                fPersonEmails.put(author, e);
            }

            e.fRole.addRevision(revision);
            revision.setAuthor(e.fPerson);
            revision.setAuthorNickName(author); // MW: facilitates e.g. bug linking
        } else { // We guess that author is a nickname

            if (fPersonNickNames.containsKey(author)) {
                e = fPersonNickNames.get(author);
            } else {
                Person person = new Person();
                person.addNickName(author);

                e = new P();
                e.fPerson = person;
                e.fRole = new CommitterRole();
                e.fPerson.addRole(e.fRole);
View Full Code Here

    @Test
    public void testAuthors() {
        assertEquals(
                "The total number of authors found is not what it's supposed to be",
                1, getPersons().size());
        Person author = getSpecificPerson("Giacomo");
        assertNotNull("Author " + author.getFirstName() + " was not found during the import", author);
        List<Long> res =
            sSession.query(
                    "SELECT r.number FROM Revision as r, Person as p, CommitterRole as c WHERE c in elements(p.roles) and r in elements(c.artifacts) AND p.firstName='"
                    + author.getFirstName() + "' GROUP BY r.number",
                    Long.class);
        assertEquals(
                "Total commits found for author " + author.getFirstName() + " is not what expected ",
                17,
                res.size());
    }
View Full Code Here

     * Tests a specific author.
     */
    @Test
    public void testAuthors() {
        assertEquals("The total number of authors found is not what it's supposed to be", 2, getPersons().size());
        Person author = getSpecificPerson("russgold");
        assertNotNull("Author " + author.getFirstName() + " was not found during the import", author);
        List<Long> res =
                sSession
                        .query(
                                "SELECT r.number FROM Revision as r, Person as p, CommitterRole as c WHERE c in elements(p.roles) and r in elements(c.artifacts) AND p.firstName='"
                                        + author.getFirstName() + "' GROUP BY r.number",
                                Long.class);
        assertEquals("Total commits found for author " + author.getFirstName() + " is not what expected ", 226, res
                .size());
    }
View Full Code Here

     * @param nicknames
     *            the nicknames
     * @return the person
     */
    public Person createPerson(String firstName, String lastName, String email, String... nicknames) {
        Person result = new Person();

        result.setFirstName(firstName);
        result.setLastName(lastName);
        result.setEmail(email);

        for (String nickname : nicknames) {
            result.addNickName(nickname);
        }

        return result;
    }
View Full Code Here

     * @param undef
     *            some string representing a person, e.g. an email or a nickname
     * @return the person
     */
    public Person createPerson(String undef) {
        Person result = new Person();

        if (isEmail(undef)) {
            result.setEmail(undef);
        } else { // we guess that undef is a nickname
            result.addNickName(undef);
        }

        return result;
    }
View Full Code Here

  @Test
  public void testFileRevisionMapping() throws ParseException {
    VersionedFile file1 = new VersionedFile("foobar", null);
 
    Person p1 = new Person();
    p1.setFirstName("fn1");
    p1.setLastName("ln1");
    p1.setEmail("1@1.ch");
   
    Person p2 = new Person();
    p2.setFirstName("fn2");
    p2.setLastName("ln2");
    p2.setEmail("2@2.ch");
   
    Person p3 = new Person();
    p3.setFirstName("fn3");
    p3.setLastName("ln3");
    p3.setEmail("3@3.ch");
;

    ModificationReport mr1 = new ModificationReport("2006/11/08 12:00:00");
    mr1.setAuthor(p1);
    ModificationReport mr2 = new ModificationReport("2006/11/09 12:00:00");
View Full Code Here

TOP

Related Classes of org.evolizer.model.resources.entities.humans.Person

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.