use of org.orcid.jaxb.model.record_rc3.Education in project ORCID-Source by ORCID.
the class AffiliationsManagerTest method getEducation.
private Education getEducation() {
Education education = new Education();
Organization org = new Organization();
org.setName("org-name");
OrganizationAddress address = new OrganizationAddress();
address.setCity("city");
address.setCountry(Iso3166Country.US);
org.setAddress(address);
education.setOrganization(org);
education.setStartDate(new FuzzyDate(new Year(2016), new Month(3), new Day(29)));
education.setVisibility(Visibility.PUBLIC);
return education;
}
use of org.orcid.jaxb.model.record_rc3.Education in project ORCID-Source by ORCID.
the class AffiliationsManagerTest method testAddEducationToUnclaimedRecordPreserveEducationVisibility.
@Test
public void testAddEducationToUnclaimedRecordPreserveEducationVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Education education = getEducation();
education = affiliationsManager.createEducationAffiliation(unclaimedOrcid, education, true);
education = affiliationsManager.getEducationAffiliation(unclaimedOrcid, education.getPutCode());
assertNotNull(education);
assertEquals(Visibility.PUBLIC, education.getVisibility());
}
use of org.orcid.jaxb.model.record_rc3.Education in project ORCID-Source by ORCID.
the class ActivityValidatorTest method getEducation.
public Education getEducation() {
Education education = new Education();
education.setDepartmentName("department name");
education.setEndDate(getFuzzyDate());
education.setOrganization(getOrganization());
education.setRoleTitle("role");
education.setStartDate(getFuzzyDate());
education.setVisibility(Visibility.PUBLIC);
return education;
}
use of org.orcid.jaxb.model.record_rc3.Education in project ORCID-Source by ORCID.
the class BlackBoxBase method unmarshallFromPath.
public Object unmarshallFromPath(String path, Class<?> type) {
try (Reader reader = new InputStreamReader(getClass().getResourceAsStream(path))) {
Object obj = unmarshall(reader, type);
Object result = null;
if (Address.class.equals(type)) {
result = (Address) obj;
} else if (Education.class.equals(type)) {
result = (Education) obj;
} else if (Employment.class.equals(type)) {
result = (Employment) obj;
} else if (Funding.class.equals(type)) {
result = (Funding) obj;
} else if (Keyword.class.equals(type)) {
result = (Keyword) obj;
} else if (Work.class.equals(type)) {
result = (Work) obj;
} else if (PeerReview.class.equals(type)) {
result = (PeerReview) obj;
} else if (ResearcherUrl.class.equals(type)) {
result = (ResearcherUrl) obj;
} else if (PersonalDetails.class.equals(type)) {
result = (PersonalDetails) obj;
} else if (OtherName.class.equals(type)) {
result = (OtherName) obj;
} else if (PersonExternalIdentifier.class.equals(type)) {
result = (PersonExternalIdentifier) obj;
}
return result;
} catch (IOException e) {
throw new RuntimeException("Error reading notification from classpath", e);
}
}
use of org.orcid.jaxb.model.record_rc3.Education in project ORCID-Source by ORCID.
the class MemberV2Test method testUpdateEducationWithProfileCreationTokenWhenClaimedAndNotSource.
@Test
public void testUpdateEducationWithProfileCreationTokenWhenClaimedAndNotSource() throws JSONException, InterruptedException, URISyntaxException {
Education education = (Education) unmarshallFromPath("/record_2.0/samples/read_samples/education-2.0.xml", Education.class);
education.setPutCode(null);
education.setVisibility(Visibility.PUBLIC);
String accessToken = getAccessToken();
ClientResponse postResponse = memberV2ApiClient.createEducationXml(this.getUser1OrcidId(), education, accessToken);
assertNotNull(postResponse);
assertEquals(Response.Status.CREATED.getStatusCode(), postResponse.getStatus());
String locationPath = postResponse.getLocation().getPath();
assertTrue("Location header path should match pattern, but was " + locationPath, locationPath.matches(".*/v2.0/" + this.getUser1OrcidId() + "/education/\\d+"));
ClientResponse getResponse = memberV2ApiClient.viewLocationXml(postResponse.getLocation(), accessToken);
assertEquals(Response.Status.OK.getStatusCode(), getResponse.getStatus());
Education gotEducation = getResponse.getEntity(Education.class);
assertEquals("education:department-name", gotEducation.getDepartmentName());
assertEquals("education:role-title", gotEducation.getRoleTitle());
gotEducation.setDepartmentName("updated dept. name");
gotEducation.setRoleTitle("updated role title");
String profileCreateToken = oauthHelper.getClientCredentialsAccessToken(this.getClient2ClientId(), this.getClient2ClientSecret(), ScopePathType.ORCID_PROFILE_CREATE);
ClientResponse putResponse = memberV2ApiClient.updateLocationXml(postResponse.getLocation(), profileCreateToken, gotEducation);
assertEquals(Response.Status.FORBIDDEN.getStatusCode(), putResponse.getStatus());
ClientResponse getAfterUpdateResponse = memberV2ApiClient.viewLocationXml(postResponse.getLocation(), accessToken);
assertEquals(Response.Status.OK.getStatusCode(), getAfterUpdateResponse.getStatus());
Education gotAfterUpdateEducation = getAfterUpdateResponse.getEntity(Education.class);
assertEquals("education:department-name", gotAfterUpdateEducation.getDepartmentName());
assertEquals("education:role-title", gotAfterUpdateEducation.getRoleTitle());
ClientResponse deleteResponse = memberV2ApiClient.deleteEducationXml(this.getUser1OrcidId(), gotEducation.getPutCode(), accessToken);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), deleteResponse.getStatus());
}
Aggregations