Package net.sf.collabreview.core

Examples of net.sf.collabreview.core.Artifact


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


    repository.commit(); // release the database connection
  }

  public void testInCombinationWithReputation() throws Exception {
    new Configurator().configureReputationMetricManager((ConfigurationConfigurableCollabReview) collabReview, reputationConfigurationData);
    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(5), content + "a\nb", author1);
    repository.commit();
View Full Code Here

  private Correlation correlateQualityPredictions(Collection<ArtifactIdentifier> partition, ReputationMetricManager rmm) {
    Correlation correlation = new Correlation();
    // predict the quality of the artifacts in the partition using the reputation results from rmm
    for (ArtifactIdentifier aid : partition) {
      Artifact artifact = collabReview.getRepository().getArtifact(aid);
      double predicted = predictQuality(artifact, rmm.findReputationMetric("quality"));
      Float assessedFloat = collabReview.getMeasurementsManager().getArtifactQualityAssessor().assessQuality(aid);
      assert assessedFloat != null;
      double assessed = assessedFloat;
      //correlation.addRow(assessed, predicted, collabReview.getMeasurementsManager().getArtifactWeight().measure(artifact));
View Full Code Here

    Author author2 = author(2);
    assertEquals(author2, HibernateUtil.getCurrentSession().load(Author.class, "2"));
  }

  public void testSaveArtifact() {
    Artifact a = new HibernateArtifact(createIdentifier(1), null, new Date(), "bula bula");
    HibernateUtil.save(a);
  }
View Full Code Here

    ArtifactIdentifier aid2 = (ArtifactIdentifier) HibernateUtil.getCurrentSession().get(ArtifactIdentifier.class, aid.getPk());
    assertEquals(aid, aid2);
  }

  public void testLoadArtifactInSameSession() {
    Artifact a = new HibernateArtifact(createIdentifier(1), null, new Date(), "bula bula");
    MarkupElement me = new TrivialLineMarkup(0, 5);
    a.getMarkup().add(me);
    HibernateUtil.save(a);
    HibernateUtil.commit();
    Artifact loaded = (Artifact) HibernateUtil.getCurrentSession().get(HibernateArtifact.class, a.getId().getPk());
    assertNotNull(loaded);
    assertEquals("bula bula", loaded.getContent());
    assertEquals(me, loaded.getMarkup().get(0));
  }
View Full Code Here

    assertEquals("bula bula", loaded.getContent());
    assertEquals(me, loaded.getMarkup().get(0));
  }

  public void testLoadArtifactInNewSession() {
    Artifact a = new HibernateArtifact(createIdentifier(1), null, new Date(), "bula bula");
    MarkupElement me = new TrivialLineMarkup(0, 5);
    a.getMarkup().add(me);
    HibernateUtil.save(a);
    HibernateUtil.closeSession();
    Artifact loaded = (Artifact) HibernateUtil.getCurrentSession().get(HibernateArtifact.class, a.getId().getPk());
    assertNotNull(loaded);
    assertEquals("bula bula", loaded.getContent());
    assertEquals(me, loaded.getMarkup().get(0));
  }
View Full Code Here

    assertEquals("bula bula", loaded.getContent());
    assertEquals(me, loaded.getMarkup().get(0));
  }

  public void testLoadArtifactWithRetrieveMethod() throws Exception {
    Artifact a = new HibernateArtifact(createIdentifier(1), null, new Date(), "bula bula");
    HibernateUtil.save(a);
    HibernateUtil.closeSession();
    HibernateRepository repo = (HibernateRepository) AutoConfigurator.newConfiguredApplication().getRepository();
    Artifact loaded = repo.retrieve(createIdentifier(1));
    assertNotNull(loaded);
    assertEquals("bula bula", loaded.getContent());
  }
View Full Code Here

  protected void initNewSearch() {
  }

  protected void executeSingleSearchStep() {
    Artifact predecessor = null;
    try {
      predecessor = getRepository().getLatestForName(getNewArtifactIdentifier().getName(), getNewArtifactIdentifier().getBranch());
    } catch (Exception e) {
      logger.error("Error while loading predecessor", e);
    }
View Full Code Here

        }
        int rating = newReview.getRating();
        String comment = newReview.getReviewText();
        boolean anonymous = newReview.getIsAnonymous();
        Author author = newReview.getAuthor();
        Artifact artifact = collabReview.getRepository().getArtifact(newReview.getArtifactIdentifier());
        String articleName = newReview.getArtifactIdentifier().getName();
        int mailCount = 3;
        String ratingName = "";
        switch (rating) {
          case 0:
View Full Code Here

TOP

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

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.