use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class PublicV1Test method testGetInfoWithEmptyToken.
@Test
public void testGetInfoWithEmptyToken() throws InterruptedException, JSONException {
ClientResponse response = publicV1ApiClient.viewRootProfile(getUser1OrcidId(), "");
assertNotNull(response);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
OrcidMessage message = response.getEntity(OrcidMessage.class);
assertNotNull(message);
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class PublicV1Test method testViewPublicProfileUsingToken.
@Test
public void testViewPublicProfileUsingToken() throws JSONException, InterruptedException {
String accessToken = getAccessToken();
ClientResponse response = publicV1ApiClient.viewRootProfile(getUser1OrcidId(), accessToken);
assertNotNull(response);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
OrcidMessage message = response.getEntity(OrcidMessage.class);
assertNotNull(message);
assertNotNull(message.getOrcidProfile());
assertNotNull(message.getOrcidProfile().getOrcidIdentifier());
assertEquals(getUser1OrcidId(), message.getOrcidProfile().getOrcidIdentifier().getPath());
response = publicV1ApiClient.viewPublicProfile(getUser1OrcidId(), accessToken);
assertNotNull(response);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
message = response.getEntity(OrcidMessage.class);
assertNotNull(message);
assertNotNull(message.getOrcidProfile());
assertNotNull(message.getOrcidProfile().getOrcidIdentifier());
assertEquals(getUser1OrcidId(), message.getOrcidProfile().getOrcidIdentifier().getPath());
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class PublicV1Test method testPublicSearchAnonymously.
@Test
public void testPublicSearchAnonymously() {
ClientResponse response = publicV1ApiClient.doPublicSearch(getUser1OrcidId());
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 S3UpdaterTest method updateS3_OrcidProfileTest.
@Test
public void updateS3_OrcidProfileTest() throws JAXBException, JsonProcessingException, AmazonClientException {
String bucketPrefix = "bucket-production";
String orcid = "0000-0000-0000-000X";
OrcidMessage om = new OrcidMessage();
OrcidProfile op = new OrcidProfile();
op.setOrcidIdentifier(orcid);
om.setOrcidProfile(op);
S3Updater s3 = new S3Updater(bucketPrefix);
s3.setS3MessagingService(s3MessagingService);
s3.updateS3(orcid, om);
verify(s3MessagingService, times(1)).send(Matchers.eq(bucketPrefix + "-api-1-2-json-x"), Matchers.eq(orcid + ".json"), Matchers.anyString());
verify(s3MessagingService, times(1)).send(Matchers.eq(bucketPrefix + "-api-1-2-xml-x"), Matchers.eq(orcid + ".xml"), Matchers.anyString());
verify(s3MessagingService, times(0)).send(Matchers.eq(bucketPrefix + "-api-2-0-json-x"), Matchers.eq(orcid + ".xml"), Matchers.anyString());
verify(s3MessagingService, times(0)).send(Matchers.eq(bucketPrefix + "-api-2-0-xml-x"), Matchers.eq(orcid + ".xml"), Matchers.anyString());
}
use of org.orcid.jaxb.model.message.OrcidMessage in project ORCID-Source by ORCID.
the class LastModifiedMessageProcessorTest method recrodStatusMarkAsSentForLockedRecordException20Test.
@Test
public void recrodStatusMarkAsSentForLockedRecordException20Test() throws LockedRecordException, DeprecatedRecordException {
when(mock_orcid12ApiClient.fetchPublicProfile(Matchers.anyString())).thenReturn(null);
when(mock_orcid20ApiClient.fetchPublicProfile(Matchers.anyString())).thenThrow(new LockedRecordException(new OrcidMessage()));
String orcid = "0000-0000-0000-0000";
execute(orcid);
verify(mock_recordStatusManager, times(0)).markAsSent(orcid, AvailableBroker.DUMP_STATUS_1_2_API);
verify(mock_recordStatusManager, times(0)).markAsFailed(orcid, AvailableBroker.DUMP_STATUS_1_2_API);
verify(mock_recordStatusManager, times(1)).markAsSent(orcid, AvailableBroker.DUMP_STATUS_2_0_API);
verify(mock_recordStatusManager, times(0)).markAsFailed(orcid, AvailableBroker.DUMP_STATUS_2_0_API);
}
Aggregations