Search in sources :

Example 26 with PeerReview

use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.

the class PeerReviewManagerTest method testAddPeerReviewToUnclaimedRecordPreservePeerReviewVisibility.

@Test
public void testAddPeerReviewToUnclaimedRecordPreservePeerReviewVisibility() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    PeerReview peer = getPeerReview(null);
    peer = peerReviewManager.createPeerReview(unclaimedOrcid, peer, true);
    peer = peerReviewManager.getPeerReview(unclaimedOrcid, peer.getPutCode());
    assertNotNull(peer);
    assertEquals(Visibility.PUBLIC, peer.getVisibility());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 27 with PeerReview

use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.

the class PeerReviewManagerTest method displayIndexIsSetTo_0_FromAPI.

@Test
public void displayIndexIsSetTo_0_FromAPI() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    PeerReview p1 = getPeerReview("fromAPI-1");
    p1 = peerReviewManager.createPeerReview(claimedOrcid, p1, true);
    PeerReviewEntity p = peerReviewDao.find(p1.getPutCode());
    assertNotNull(91);
    assertEquals(Long.valueOf(0), p.getDisplayIndex());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) PeerReviewEntity(org.orcid.persistence.jpa.entities.PeerReviewEntity) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 28 with PeerReview

use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.

the class PeerReviewManagerTest method getPeerReview.

private PeerReview getPeerReview(String extIdValue) {
    PeerReview peerReview = new PeerReview();
    peerReview.setRole(Role.CHAIR);
    ExternalIDs extIds = new ExternalIDs();
    ExternalID extId = new ExternalID();
    extId.setRelationship(Relationship.SELF);
    extId.setType("doi");
    extId.setUrl(new Url("http://orcid.org"));
    if (extIdValue == null) {
        extId.setValue("ext-id-value");
    } else {
        extId.setValue("ext-id-value-" + extIdValue);
    }
    extIds.getExternalIdentifier().add(extId);
    peerReview.setExternalIdentifiers(extIds);
    if (extIdValue == null) {
        peerReview.setSubjectContainerName(new Title("Peer review title"));
    } else {
        peerReview.setSubjectContainerName(new Title("Peer review title " + extIdValue));
    }
    peerReview.setSubjectExternalIdentifier(extId);
    Organization org = new Organization();
    org.setName("org-name");
    OrganizationAddress address = new OrganizationAddress();
    address.setCity("city");
    address.setCountry(Iso3166Country.US);
    org.setAddress(address);
    peerReview.setOrganization(org);
    peerReview.setType(PeerReviewType.EVALUATION);
    peerReview.setVisibility(Visibility.PUBLIC);
    return peerReview;
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) Organization(org.orcid.jaxb.model.common_v2.Organization) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) OrganizationAddress(org.orcid.jaxb.model.common_v2.OrganizationAddress) Title(org.orcid.jaxb.model.common_v2.Title) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Url(org.orcid.jaxb.model.common_v2.Url)

Example 29 with PeerReview

use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.

the class PeerReviewManagerTest method testAddMultipleModifiesIndexingStatus.

@Test
public void testAddMultipleModifiesIndexingStatus() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    PeerReview p1 = getPeerReview("extId1");
    p1 = peerReviewManager.createPeerReview(claimedOrcid, p1, true);
    PeerReview p2 = getPeerReview("extId2");
    p2 = peerReviewManager.createPeerReview(claimedOrcid, p2, true);
    PeerReview p3 = getPeerReview("extId3");
    p3 = peerReviewManager.createPeerReview(claimedOrcid, p3, true);
    PeerReviewEntity entity1 = peerReviewDao.find(p1.getPutCode());
    PeerReviewEntity entity2 = peerReviewDao.find(p2.getPutCode());
    PeerReviewEntity entity3 = peerReviewDao.find(p3.getPutCode());
    assertNotNull(entity1.getDisplayIndex());
    assertNotNull(entity2.getDisplayIndex());
    assertNotNull(entity3.getDisplayIndex());
    assertEquals(Long.valueOf(0), entity3.getDisplayIndex());
    //Rollback all changes
    peerReviewDao.remove(entity1.getId());
    peerReviewDao.remove(entity2.getId());
    peerReviewDao.remove(entity3.getId());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) PeerReviewEntity(org.orcid.persistence.jpa.entities.PeerReviewEntity) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 30 with PeerReview

use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validatePeerReview_invalidExternalIdentifiersTest.

@Test(expected = ActivityIdentifierValidationException.class)
public void validatePeerReview_invalidExternalIdentifiersTest() {
    PeerReview pr = getPeerReview();
    pr.getExternalIdentifiers().getExternalIdentifier().get(0).setType(null);
    activityValidator.validatePeerReview(pr, null, true, true, Visibility.PUBLIC);
}
Also used : PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)72 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)68 ClientResponse (com.sun.jersey.api.client.ClientResponse)35 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)19 Response (javax.ws.rs.core.Response)18 DBUnitTest (org.orcid.test.DBUnitTest)18 Url (org.orcid.jaxb.model.common_v2.Url)11 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)11 Funding (org.orcid.jaxb.model.record_v2.Funding)10 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)10 ArrayList (java.util.ArrayList)9 PeerReview (org.orcid.jaxb.model.record_rc1.PeerReview)9 Education (org.orcid.jaxb.model.record_v2.Education)9 Work (org.orcid.jaxb.model.record_v2.Work)9 PeerReviewEntity (org.orcid.persistence.jpa.entities.PeerReviewEntity)9 OtherName (org.orcid.jaxb.model.record_v2.OtherName)8 BaseTest (org.orcid.core.BaseTest)6 Title (org.orcid.jaxb.model.common_v2.Title)6 WorkExternalIdentifier (org.orcid.jaxb.model.record_rc1.WorkExternalIdentifier)6 WorkExternalIdentifierId (org.orcid.jaxb.model.record_rc1.WorkExternalIdentifierId)6