Search in sources :

Example 41 with ResearcherUrls

use of org.orcid.jaxb.model.record_rc2.ResearcherUrls in project ORCID-Source by ORCID.

the class ValidateV2_1SamplesTest method testUnmarshallResearcherUrl.

@Test
public void testUnmarshallResearcherUrl() throws SAXException, URISyntaxException {
    ResearcherUrls rUrls = (ResearcherUrls) unmarshallFromPath("/record_2.1/samples/read_samples/researcher-urls-2.1.xml", ResearcherUrls.class, "/record_2.1/researcher-url-2.1.xsd");
    assertNotNull(rUrls);
    assertNotNull(rUrls.getResearcherUrls());
    assertEquals(1, rUrls.getResearcherUrls().size());
    assertNotNull(rUrls.getResearcherUrls().get(0).getCreatedDate());
    assertNotNull(rUrls.getResearcherUrls().get(0).getLastModifiedDate());
    validateSourceInHttps(rUrls.getResearcherUrls().get(0).getSource());
    assertEquals("Site # 1", rUrls.getResearcherUrls().get(0).getUrlName());
    assertEquals("http://site1.com/", rUrls.getResearcherUrls().get(0).getUrl().getValue());
    assertEquals(Long.valueOf(1248), rUrls.getResearcherUrls().get(0).getPutCode());
    assertEquals(Visibility.PUBLIC.value(), rUrls.getResearcherUrls().get(0).getVisibility().value());
    assertNotNull(rUrls.getResearcherUrls().get(0).getSource());
    assertEquals("https://www.orcid.org/8888-8888-8888-8880", rUrls.getResearcherUrls().get(0).getSource().retriveSourceUri());
    assertEquals("8888-8888-8888-8880", rUrls.getResearcherUrls().get(0).getSource().retrieveSourcePath());
    ResearcherUrl rUrl = (ResearcherUrl) unmarshallFromPath("/record_2.1/samples/read_samples/researcher-url-2.1.xml", ResearcherUrl.class);
    assertNotNull(rUrl);
    assertEquals("Site # 1", rUrl.getUrlName());
    assertNotNull(rUrl.getUrl());
    assertEquals("http://site1.com/", rUrl.getUrl().getValue());
    assertNotNull(rUrl.getCreatedDate());
    assertNotNull(rUrl.getLastModifiedDate());
    assertNotNull(rUrl.getSource());
    validateSourceInHttps(rUrl.getSource());
    assertEquals("8888-8888-8888-8880", rUrl.getSource().retrieveSourcePath());
}
Also used : ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Test(org.junit.Test)

Example 42 with ResearcherUrls

use of org.orcid.jaxb.model.record_rc2.ResearcherUrls in project ORCID-Source by ORCID.

the class ValidateV2_1SamplesTest method testMarshallResearcherUrl.

@Test
public void testMarshallResearcherUrl() throws JAXBException, SAXException, URISyntaxException {
    ResearcherUrls object = (ResearcherUrls) unmarshallFromPath("/record_2.1/samples/read_samples/researcher-urls-2.1.xml", ResearcherUrls.class);
    marshall(object, "/record_2.1/researcher-url-2.1.xsd");
}
Also used : ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) Test(org.junit.Test)

Example 43 with ResearcherUrls

use of org.orcid.jaxb.model.record_rc2.ResearcherUrls in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorTest method testViewResearcherUrls.

@Test
public void testViewResearcherUrls() {
    Response response = serviceDelegator.viewResearcherUrls(ORCID);
    assertNotNull(response);
    ResearcherUrls rUrls = (ResearcherUrls) response.getEntity();
    assertNotNull(rUrls);
    assertNotNull(rUrls.getLastModifiedDate());
    assertNotNull(rUrls.getLastModifiedDate().getValue());
    assertEquals("/0000-0000-0000-0003/researcher-urls", rUrls.getPath());
    assertEquals(1, rUrls.getResearcherUrls().size());
    ResearcherUrl rUrl = rUrls.getResearcherUrls().get(0);
    assertNotNull(rUrl);
    assertNotNull(rUrl.getLastModifiedDate());
    assertNotNull(rUrl.getLastModifiedDate().getValue());
    assertNotNull(rUrl.getUrl());
    assertEquals("http://www.researcherurl.com?id=13", rUrl.getUrl().getValue());
    assertEquals("public_rurl", rUrl.getUrlName());
    assertEquals(Visibility.PUBLIC.value(), rUrl.getVisibility().value());
    assertEquals("/0000-0000-0000-0003/researcher-urls/13", rUrl.getPath());
    assertEquals("APP-5555555555555555", rUrl.getSource().retrieveSourcePath());
}
Also used : Response(javax.ws.rs.core.Response) ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 44 with ResearcherUrls

use of org.orcid.jaxb.model.record_rc2.ResearcherUrls in project ORCID-Source by ORCID.

the class JpaJaxbResearcherUrlAdapterTest method getResearcherUrls.

private ResearcherUrls getResearcherUrls() throws JAXBException {
    JAXBContext context = JAXBContext.newInstance(new Class[] { ResearcherUrls.class });
    Unmarshaller unmarshaller = context.createUnmarshaller();
    String name = "/record_2.0/samples/read_samples/researcher-urls-2.0.xml";
    InputStream inputStream = getClass().getResourceAsStream(name);
    return (ResearcherUrls) unmarshaller.unmarshal(inputStream);
}
Also used : InputStream(java.io.InputStream) ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller)

Example 45 with ResearcherUrls

use of org.orcid.jaxb.model.record_rc2.ResearcherUrls in project ORCID-Source by ORCID.

the class ResearcherUrlManagerTest method getPublicTest.

@Test
public void getPublicTest() {
    String orcid = "0000-0000-0000-0003";
    ResearcherUrls elements = researcherUrlManager.getPublicResearcherUrls(orcid, System.currentTimeMillis());
    assertNotNull(elements);
    assertNotNull(elements.getResearcherUrls());
    assertEquals(1, elements.getResearcherUrls().size());
    assertEquals(Long.valueOf(13), elements.getResearcherUrls().get(0).getPutCode());
}
Also used : ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)56 Test (org.junit.Test)52 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)43 Addresses (org.orcid.jaxb.model.record_v2.Addresses)35 Keywords (org.orcid.jaxb.model.record_v2.Keywords)35 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)35 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)35 Biography (org.orcid.jaxb.model.record_v2.Biography)33 Emails (org.orcid.jaxb.model.record_v2.Emails)33 Address (org.orcid.jaxb.model.record_v2.Address)32 OtherName (org.orcid.jaxb.model.record_v2.OtherName)32 Email (org.orcid.jaxb.model.record_v2.Email)31 Keyword (org.orcid.jaxb.model.record_v2.Keyword)31 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)31 Name (org.orcid.jaxb.model.record_v2.Name)28 Person (org.orcid.jaxb.model.record_v2.Person)25 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)15 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)15 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)15 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)15