Examples of ArtifactIdentifier


Examples of net.sf.collabreview.core.ArtifactIdentifier

  private synchronized List<Artifact> loadTodoArtifacts() throws Exception {
    // consolidated identifier list
    Collection<ArtifactIdentifier> consolidatedList = new HashSet<ArtifactIdentifier>();
    // now check each of the files in the todoList to make sure only the most recent version is checked and that a review does not already exist
    for (int i = 0; i < todoList.size(); i++) {
      ArtifactIdentifier ai1 = todoList.get(i);
      boolean isOk = true;
      Review previousReview;
      // really check this file if recheckAll or no previous review or old review refers to a different artifact
      if (!recheckAll
          && (previousReview = agentManager.getCollabReview().getRepository().getReview(ai1.getName(), ai1.getBranch(), getCheckstyleAuthor())) != null
          && previousReview.getArtifactIdentifier().equals(ai1)) {
        isOk = false;
      }
      // compare to all other Artifacts in the todoList but terminate if the Artifact is found to be a duplicate
      for (int j = i + 1; j < todoList.size() && isOk; j++) {
        ArtifactIdentifier ai2 = todoList.get(j);
        if (ai1 == ai2) {
          // don't add ai1 this time, because the Artifact will be added when it is ai2's turn
          isOk = false;
        }
        if (ai1.getName().equals(ai2.getName()) && ai1.getBranch().equals(ai2.getBranch()) && ai1.getRevision() <= ai2.getRevision()) {
          isOk = false;
        }
      }
      if (isOk) {
        consolidatedList.add(ai1);
View Full Code Here

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

Examples of net.sf.collabreview.core.ArtifactIdentifier

   * @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

Examples of net.sf.collabreview.core.ArtifactIdentifier

  @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

Examples of net.sf.collabreview.core.ArtifactIdentifier

  @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

Examples of net.sf.collabreview.core.ArtifactIdentifier

    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

Examples of net.sf.collabreview.core.ArtifactIdentifier

    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

Examples of net.sf.collabreview.core.ArtifactIdentifier

    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

Examples of net.sf.collabreview.core.ArtifactIdentifier

  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

Examples of net.sf.collabreview.core.ArtifactIdentifier

  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
TOP
Copyright © 2018 www.massapi.com. 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.