Search in sources :

Example 86 with OrcidMessage

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

the class Api12PublicTest method testViewBioDetailsJson.

@Test
public void testViewBioDetailsJson() throws Exception {
    ClientResponse clientResponse = t1OAuthClient.viewBioDetailsJson(getUser1OrcidId());
    assertNotNull(clientResponse);
    assertEquals(200, clientResponse.getStatus());
    OrcidMessage orcidMessage = clientResponse.getEntity(OrcidMessage.class);
    assertNotNull(orcidMessage);
    assertEquals(getUser1OrcidId(), orcidMessage.getOrcidProfile().getOrcidIdentifier().getPath());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) Test(org.junit.Test)

Example 87 with OrcidMessage

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

the class Api12PublicTest method testViewFullDetailsXml.

@Test
public void testViewFullDetailsXml() throws Exception {
    ClientResponse clientResponse = t1OAuthClient.viewFullDetailsXml(getUser1OrcidId());
    assertNotNull(clientResponse);
    assertEquals(200, clientResponse.getStatus());
    OrcidMessage orcidMessage = clientResponse.getEntity(OrcidMessage.class);
    assertNotNull(orcidMessage);
    assertEquals(getUser1OrcidId(), orcidMessage.getOrcidProfile().getOrcidIdentifier().getPath());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) Test(org.junit.Test)

Example 88 with OrcidMessage

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

the class MarshallingTest method getOrcidMessage.

private OrcidMessage getOrcidMessage() throws JAXBException {
    JAXBContext context = JAXBContext.newInstance("org.orcid.jaxb.model.message");
    Unmarshaller unmarshaller = context.createUnmarshaller();
    InputStream inputStream = MarshallingTest.class.getResourceAsStream("/orcid-internal-full-message-latest.xml");
    return (OrcidMessage) unmarshaller.unmarshal(inputStream);
}
Also used : InputStream(java.io.InputStream) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller)

Example 89 with OrcidMessage

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

the class T1OrcidApiServiceImplLatestMetricsTest method orcidWithMultipleResults.

private Response orcidWithMultipleResults() {
    OrcidMessage orcidMessage = new OrcidMessage();
    OrcidProfile orcidProfile1 = new OrcidProfile();
    OrcidProfile orcidProfile2 = new OrcidProfile();
    OrcidProfile orcidProfile3 = new OrcidProfile();
    OrcidSearchResult orcidSearchResult1 = new OrcidSearchResult();
    OrcidSearchResult orcidSearchResult2 = new OrcidSearchResult();
    OrcidSearchResult orcidSearchResult3 = new OrcidSearchResult();
    orcidSearchResult1.setOrcidProfile(orcidProfile1);
    orcidSearchResult2.setOrcidProfile(orcidProfile2);
    orcidSearchResult3.setOrcidProfile(orcidProfile3);
    List<OrcidSearchResult> searchResults = new ArrayList<OrcidSearchResult>();
    searchResults.add(orcidSearchResult1);
    searchResults.add(orcidSearchResult2);
    searchResults.add(orcidSearchResult3);
    OrcidSearchResults orcidSearchResults = new OrcidSearchResults();
    orcidSearchResults.getOrcidSearchResult().addAll(searchResults);
    orcidMessage.setOrcidSearchResults(orcidSearchResults);
    return Response.ok(orcidMessage).build();
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidSearchResult(org.orcid.jaxb.model.message.OrcidSearchResult) OrcidSearchResults(org.orcid.jaxb.model.message.OrcidSearchResults) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) ArrayList(java.util.ArrayList)

Example 90 with OrcidMessage

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

the class NotificationManagerTest method testSendVerificationEmail.

@Test
public void testSendVerificationEmail() throws JAXBException, IOException, URISyntaxException {
    OrcidMessage orcidMessage = (OrcidMessage) unmarshaller.unmarshal(getClass().getResourceAsStream(ORCID_INTERNAL_FULL_XML));
    OrcidProfile orcidProfile = orcidMessage.getOrcidProfile();
    notificationManager.sendVerificationEmail(orcidProfile.getOrcidIdentifier().getPath(), orcidProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue());
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)173 Test (org.junit.Test)108 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)64 DBUnitTest (org.orcid.test.DBUnitTest)49 ClientResponse (com.sun.jersey.api.client.ClientResponse)36 Response (javax.ws.rs.core.Response)26 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)22 Transactional (org.springframework.transaction.annotation.Transactional)22 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)20 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)19 Email (org.orcid.jaxb.model.message.Email)18 BaseTest (org.orcid.core.BaseTest)17 OrcidIdentifier (org.orcid.jaxb.model.message.OrcidIdentifier)16 Affiliation (org.orcid.jaxb.model.message.Affiliation)13 OrcidSearchResult (org.orcid.jaxb.model.message.OrcidSearchResult)12 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)12 JAXBContext (javax.xml.bind.JAXBContext)11 Unmarshaller (javax.xml.bind.Unmarshaller)11 Organization (org.orcid.jaxb.model.message.Organization)11 OrganizationAddress (org.orcid.jaxb.model.message.OrganizationAddress)11