use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class MemberV1Test method unmarshallFromPath.
public OrcidMessage unmarshallFromPath(String path) throws Exception {
try (Reader reader = new InputStreamReader(getClass().getResourceAsStream(path))) {
JAXBContext context = JAXBContext.newInstance(OrcidProfile.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
return (OrcidMessage) unmarshaller.unmarshal(reader);
} catch (Exception e) {
throw new RuntimeException("Error reading file from classpath", e);
}
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class LockUnlockRecordTest method checkIfLockedPub.
public boolean checkIfLockedPub() {
ClientResponse response = t1OAuthClient.viewFullDetailsXml(getUser1OrcidId());
assertNotNull(response);
OrcidMessage message = response.getEntity(OrcidMessage.class);
if (message.getOrcidProfile() == null && message.getErrorDesc() != null) {
assertEquals("Account locked : The given account " + getUser1OrcidId() + " is locked", message.getErrorDesc().getContent());
return true;
}
return false;
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class LockUnlockRecordTest method checkIfLockedApi.
public boolean checkIfLockedApi() {
ClientResponse response = t2OAuthClient_1_2.viewFullDetailsXml(getUser1OrcidId(), accessToken);
assertNotNull(response);
OrcidMessage message = response.getEntity(OrcidMessage.class);
if (message.getOrcidProfile() == null && message.getErrorDesc() != null) {
assertEquals("Account locked : The given account " + getUser1OrcidId() + " is locked", message.getErrorDesc().getContent());
return true;
}
return false;
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class PublicV1Test method testPublicSearchUsingToken.
@Test
public void testPublicSearchUsingToken() throws InterruptedException, JSONException {
String accessToken = getAccessToken();
ClientResponse response = publicV1ApiClient.doPublicSearch(getUser1OrcidId(), accessToken);
assertNotNull(response);
OrcidMessage orcidMessage = response.getEntity(OrcidMessage.class);
assertNotNull(orcidMessage);
assertNotNull(orcidMessage.getOrcidSearchResults());
assertNotNull(orcidMessage.getOrcidSearchResults().getOrcidSearchResult());
assertNotNull(orcidMessage.getOrcidSearchResults().getOrcidSearchResult().get(0));
assertNotNull(orcidMessage.getOrcidSearchResults().getOrcidSearchResult().get(0).getOrcidProfile());
assertNotNull(orcidMessage.getOrcidSearchResults().getOrcidSearchResult().get(0).getOrcidProfile().getOrcidIdentifier());
assertEquals(getUser1OrcidId(), orcidMessage.getOrcidSearchResults().getOrcidSearchResult().get(0).getOrcidProfile().getOrcidIdentifier().getPath());
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class PublicV1Test method testPublicSearchUsingPublicClient.
@Test
public void testPublicSearchUsingPublicClient() throws InterruptedException, JSONException {
String accessToken = oauthHelper.getClientCredentialsAccessToken(getPublicClientId(), getPublicClientSecret(), ScopePathType.READ_PUBLIC, APIRequestType.PUBLIC);
ClientResponse response = publicV1ApiClient.doPublicSearch(getUser1OrcidId(), accessToken);
assertNotNull(response);
OrcidMessage orcidMessage = response.getEntity(OrcidMessage.class);
assertNotNull(orcidMessage);
assertNotNull(orcidMessage.getOrcidSearchResults());
assertNotNull(orcidMessage.getOrcidSearchResults().getOrcidSearchResult());
assertNotNull(orcidMessage.getOrcidSearchResults().getOrcidSearchResult().get(0));
assertNotNull(orcidMessage.getOrcidSearchResults().getOrcidSearchResult().get(0).getOrcidProfile());
assertNotNull(orcidMessage.getOrcidSearchResults().getOrcidSearchResult().get(0).getOrcidProfile().getOrcidIdentifier());
assertEquals(getUser1OrcidId(), orcidMessage.getOrcidSearchResults().getOrcidSearchResult().get(0).getOrcidProfile().getOrcidIdentifier().getPath());
}
Aggregations