Package net.sf.collabreview.core

Examples of net.sf.collabreview.core.ArtifactIdentifier


   * @param auditEvent the audit event that is asking for its list
   * @return the AuditEventList for audit events about the same artifact or a new list if this is the first audit event about the artifact
   */
  private AuditEventList getAuditEventListForAuditEvent(AuditEvent auditEvent) {
    File sourceFile = new File(auditEvent.getFileName());
    ArtifactIdentifier ai = artifactIdentifierForTemporaryFile.get(sourceFile);
    if (ai == null) {
      logger.warn("No source file: " + sourceFile);
      return null;
    } else {
      AuditEventList list = artifactsAuditEvents.get(ai);
View Full Code Here


   * @param auditEvent the event for which the source code is to be obtained
   * @return the source code to which this audit event refers
   */
  private String getEventSourceLine(AuditEvent auditEvent) {
    File sourceFile = new File(auditEvent.getFileName());
    ArtifactIdentifier ai = artifactIdentifierForTemporaryFile.get(sourceFile);
    if (ai == null) {
      logger.warn("No source file: " + sourceFile);
      return null;
    }
    String source = agentManager.getCollabReview().getRepository().getArtifact(ai).getContent();
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    CollabReview collabReview = AutoConfigurator.newConfiguredApplication();
    repository = collabReview.getRepository();
    a1 = new ArtifactIdentifier("", 0, "");
    a2 = new ArtifactIdentifier("HelloWorld.java", 5, "");
    a3 = new ArtifactIdentifier("xyz", 534, "tag");
    a4 = new ArtifactIdentifier("ping/pong/Plop.cs", 1, "branch");
    a5 = new ArtifactIdentifier("JibbyJabba.java", 70, "");
    a6 = new ArtifactIdentifier("HelloWorld2.java", 30, "branch");
    // the empty artifact is always in the repository
    repository.addArtifact(a2, new Date(), "Test content", author1);
    repository.addArtifact(a3, new Date(), "Test content", author1);
    repository.addArtifact(a4, new Date(), "Test content", author1);
    repository.addArtifact(a5, new Date(), "Test content", author1);
View Full Code Here

  @Override
  public boolean preFilter(String name, int revision, String branch) {
    if (!childFilter.preFilter(name, revision, branch)) {
      return false;
    }
    if (partitions.get(selectedPartition).contains(new ArtifactIdentifier(name, revision, branch))) {
      return !inverted;
    } else {
      return inverted;
    }
  }
View Full Code Here

    int increment=0;
    String artifactName = artifact.getId().getName();
    //Get Contribution for the latest artifact
    NavigableMap<Author, Float> latest_contributions = getOwner().getCollabReview().getMeasurementsManager().getArtifactResponsibility().listResponsibilities(artifact);
    //get previous artifact
    ArtifactIdentifier ai = getPreviousArtifact(artifactName, last_revision-1);
    for (Author docAuthor : latest_contributions.keySet()) {
      String latest_name=docAuthor.getName();   
      int latest_contribution=(int)(latest_contributions.get(docAuthor)*100+0.5);
        //check conditions for incrementing the counter
        if(latest_contribution>=30)
View Full Code Here

    int last_revision = artifact.getId().getRevision();
    String artifactName = artifact.getId().getName();
    NavigableMap<Author, Float> latest_contributions = getOwner().getCollabReview().getMeasurementsManager().getArtifactResponsibility().listResponsibilities(artifact);
    //get Artifact with Revision latest-1...
    ArtifactIdentifier ai = getPreviousArtifact(artifactName, last_revision-1);
    if (ai!=null) {
      Artifact child = getRepository().getArtifact(ai);
      NavigableMap<Author,Float> previous_contributions =  getOwner().getCollabReview().getMeasurementsManager().getArtifactResponsibility().listResponsibilities(child);
      for (Author docAuthor : latest_contributions.keySet()) {
        String latest_name = docAuthor.getName();   
View Full Code Here

    Query query=HibernateUtil.getCurrentSession().createQuery("FROM ArtifactIdentifier Ai WHERE Ai.revision=:id AND Ai.name=:author");   
    query.setParameter("id",revision);
    query.setParameter("author", artifactName);
    query.setMaxResults(1);
    ArtifactIdentifier ai = (ArtifactIdentifier) query.uniqueResult();
    return ai;
  }
View Full Code Here

  public synchronized void reviewUpdated(Repository repository, Review oldReview, Review newReview) {
    if (reviews == null || isUpdateInProgress()) {
      setUpToDate(false);
      return;
    }
    ArtifactIdentifier artifactIdentifier = newReview.getArtifactIdentifier();
    if (getFilter() != null && !getFilter().filter(artifactIdentifier, repository)) {
      return;
    }
    Collection<Review> reviews = repository.listReviews(artifactIdentifier.getName(), artifactIdentifier.getBranch());
    Set<Author> authors = new HashSet<Author>();
    Author secondReviewer = null;
    for (Review review : reviews) {
      authors.add(review.getAuthor());
      if (!review.getAuthor().equals(newReview.getAuthor())) {
View Full Code Here

  protected void tearDown() throws Exception {
    Thread.sleep(30);
  }

  public void testCastigateChecker() {
    Artifact artifact = repository.addArtifact(new ArtifactIdentifier("ArtifactIdentifier(x,1,t)"), new Date(0), content + "a", author1);
    repository.commit();
    assertEquals(0, MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, new Date(2).getTime(), 600 * 1000));
    assertEquals(0, repository.getReviewCount());
    artifact = repository.addArtifact(new ArtifactIdentifier("ArtifactIdentifier(x,2,t)"), new Date(5), content + "a\nb", author1);
    repository.commit();
    assertEquals(0, MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, new Date(7).getTime(), 600 * 1000));
    assertEquals(0, repository.getReviewCount());
    artifact = repository.addArtifact(new ArtifactIdentifier("ArtifactIdentifier(x,3,t)"), new Date(15), content + "a\nb\nc", author1);
    repository.commit();
    assertEquals(1, MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, new Date(17).getTime(), 600 * 1000));
    assertEquals(1, repository.getReviewCount());
    artifact = repository.addArtifact(new ArtifactIdentifier("ArtifactIdentifier(x,4,t)"), new Date(25), content + "a\nb\nc\nd", author1);
    repository.commit();
    assertEquals(1, MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, new Date(27).getTime(), 600 * 1000));
    assertEquals(1, repository.getReviewCount());
    repository.commit(); // release the database connection
  }
View Full Code Here

    assertEquals(1, repository.getReviewCount());
    repository.commit(); // release the database connection
  }

  public void testOneTooLongAgo() {
    Artifact artifact = repository.addArtifact(new ArtifactIdentifier("ArtifactIdentifier(x,1,t)"), new Date(0), content + "a", author1);
    repository.commit();
    assertEquals(0, MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, new Date(0).getTime(), 600 * 1000));
    assertEquals(0, repository.getReviewCount());
    artifact = repository.addArtifact(new ArtifactIdentifier("ArtifactIdentifier(x,2,t)"), new Date(1000 * 60 * 6), content + "a\nb", author1);
    repository.commit();
    assertEquals(0, MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, new Date(1000 * 60 * 6).getTime(), 600 * 1000));
    assertEquals(0, repository.getReviewCount());
    artifact = repository.addArtifact(new ArtifactIdentifier("ArtifactIdentifier(x,3,t)"), new Date(1000 * 60 * 11), content + "a\nb\nc", author1);
    repository.commit();
    assertEquals(0, MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, new Date(1000 * 60 * 11).getTime(), 600 * 1000));
    assertEquals(0, repository.getReviewCount());
    artifact = repository.addArtifact(new ArtifactIdentifier("ArtifactIdentifier(x,4,t)"), new Date(1000 * 60 * 14), content + "a\nb\nc\nd", author1);
    repository.commit();
    assertEquals(0, MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, new Date(1000 * 60 * 14).getTime(), 600 * 1000));
    assertEquals(0, repository.getReviewCount());
    artifact = repository.addArtifact(new ArtifactIdentifier("ArtifactIdentifier(x,5,t)"), new Date(1000 * 60 * 17), content + "a\nb\ne", author1);
    repository.commit();
    assertEquals(1, MicroEditCastigator.countMicroEdits(repository, artifact, 3, 300 * 1000, new Date(1000 * 60 * 17).getTime(), 600 * 1000));
    assertEquals(1, repository.getReviewCount());
    repository.commit(); // release the database connection
  }
View Full Code Here

TOP

Related Classes of net.sf.collabreview.core.ArtifactIdentifier

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.