Search in sources :

Example 6 with FuzzyDate

use of org.orcid.jaxb.model.message.FuzzyDate in project ORCID-Source by ORCID.

the class T2OrcidApiServiceVersionedDelegatorTest method addAffiliationTest.

@Test
public void addAffiliationTest() {
    setUpSecurityContext();
    OrcidMessage orcidMessage = new OrcidMessage();
    orcidMessage.setMessageVersion("1.2_rc6");
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidMessage.setOrcidProfile(orcidProfile);
    orcidProfile.setOrcidIdentifier(new OrcidIdentifier("4444-4444-4444-4441"));
    OrcidActivities orcidActivities = new OrcidActivities();
    orcidProfile.setOrcidActivities(orcidActivities);
    Affiliations affiliations = new Affiliations();
    Affiliation affiliation = new Affiliation();
    affiliation.setStartDate(new FuzzyDate(2010, 01, 01));
    affiliation.setEndDate(new FuzzyDate(2015, 01, 01));
    affiliation.setDepartmentName("Dep Name");
    affiliation.setRoleTitle("Role Title");
    affiliation.setType(AffiliationType.EDUCATION);
    Organization organization = new Organization();
    organization.setName("My Org");
    OrganizationAddress add = new OrganizationAddress();
    add.setCity("My City");
    add.setCountry(Iso3166Country.US);
    organization.setAddress(add);
    affiliation.setOrganization(organization);
    affiliations.getAffiliation().add(affiliation);
    orcidActivities.setAffiliations(affiliations);
    Response response = t2OrcidApiServiceDelegatorLatest.addAffiliations(mockedUriInfo, "4444-4444-4444-4441", orcidMessage);
    assertNotNull(response);
    assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
    assertEquals(1, orgAffiliationRelationDao.getByUserAndType("4444-4444-4444-4441", org.orcid.jaxb.model.record_v2.AffiliationType.EDUCATION).size());
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Response(javax.ws.rs.core.Response) DisambiguatedOrganization(org.orcid.jaxb.model.message.DisambiguatedOrganization) Organization(org.orcid.jaxb.model.message.Organization) Affiliations(org.orcid.jaxb.model.message.Affiliations) OrcidIdentifier(org.orcid.jaxb.model.message.OrcidIdentifier) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) OrganizationAddress(org.orcid.jaxb.model.message.OrganizationAddress) FuzzyDate(org.orcid.jaxb.model.message.FuzzyDate) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) Affiliation(org.orcid.jaxb.model.message.Affiliation) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

FuzzyDate (org.orcid.jaxb.model.message.FuzzyDate)6 Organization (org.orcid.jaxb.model.message.Organization)4 OrganizationAddress (org.orcid.jaxb.model.message.OrganizationAddress)4 Affiliation (org.orcid.jaxb.model.message.Affiliation)3 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)3 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)3 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)3 Affiliations (org.orcid.jaxb.model.message.Affiliations)2 DisambiguatedOrganization (org.orcid.jaxb.model.message.DisambiguatedOrganization)2 FundingTitle (org.orcid.jaxb.model.message.FundingTitle)2 OrcidIdentifier (org.orcid.jaxb.model.message.OrcidIdentifier)2 EndDateEntity (org.orcid.persistence.jpa.entities.EndDateEntity)2 OrgEntity (org.orcid.persistence.jpa.entities.OrgEntity)2 StartDateEntity (org.orcid.persistence.jpa.entities.StartDateEntity)2 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 BigDecimal (java.math.BigDecimal)1 GregorianCalendar (java.util.GregorianCalendar)1 Response (javax.ws.rs.core.Response)1 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)1 Test (org.junit.Test)1