use of com.alibaba.json.bvt.bug.Bug_for_issue_729.Person in project fastjson by alibaba.
the class Bug_for_issue_729 method test_for_issue.
public void test_for_issue() throws Exception {
Person person = new Person();
person.setName("bob");
person.startTime = new Date();
String result = JSON.toJSONString(person);
Person person2 = JSON.parseObject(result, Person.class);
person2.toString();
}
use of com.alibaba.json.bvt.bug.Bug_for_issue_729.Person in project ORCID-Source by ORCID.
the class MemberV2ApiServiceVersionedDelegatorTest method test2_0.
@Test
public void test2_0() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0003", ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewRecord("0000-0000-0000-0003");
Record record = (Record) response.getEntity();
assertNotNull(record.getActivitiesSummary());
ActivitiesSummary activitiesSummary = record.getActivitiesSummary();
if (activitiesSummary.getEducations() != null) {
activitiesSummary.getEducations().getSummaries().forEach(e -> assertSourceElement(e, false));
}
if (activitiesSummary.getEmployments() != null) {
activitiesSummary.getEmployments().getSummaries().forEach(e -> assertSourceElement(e, false));
}
if (activitiesSummary.getFundings() != null) {
activitiesSummary.getFundings().getFundingGroup().forEach(g -> {
g.getFundingSummary().forEach(e -> assertSourceElement(e, false));
});
}
if (activitiesSummary.getWorks() != null) {
activitiesSummary.getWorks().getWorkGroup().forEach(g -> {
g.getWorkSummary().forEach(e -> assertSourceElement(e, false));
});
}
if (activitiesSummary.getPeerReviews() != null) {
activitiesSummary.getPeerReviews().getPeerReviewGroup().forEach(g -> {
g.getPeerReviewSummary().forEach(e -> assertSourceElement(e, false));
});
}
assertNotNull(record.getPerson());
Person person = record.getPerson();
if (person.getAddresses() != null) {
person.getAddresses().getAddress().forEach(e -> assertSourceElement(e, false));
}
if (person.getExternalIdentifiers() != null) {
person.getExternalIdentifiers().getExternalIdentifiers().forEach(e -> assertSourceElement(e, false));
}
if (person.getKeywords() != null) {
person.getKeywords().getKeywords().forEach(e -> assertSourceElement(e, false));
}
if (person.getOtherNames() != null) {
person.getOtherNames().getOtherNames().forEach(e -> assertSourceElement(e, false));
}
if (person.getResearcherUrls() != null) {
person.getResearcherUrls().getResearcherUrls().forEach(e -> assertSourceElement(e, false));
}
}
use of com.alibaba.json.bvt.bug.Bug_for_issue_729.Person in project ORCID-Source by ORCID.
the class MemberV2ApiServiceVersionedDelegatorTest method test2_1.
@Test
public void test2_1() {
SecurityContextTestUtils.setUpSecurityContext("0000-0000-0000-0003", ScopePathType.READ_LIMITED);
Response response = serviceDelegator_v2_1.viewRecord("0000-0000-0000-0003");
Record record = (Record) response.getEntity();
assertNotNull(record.getActivitiesSummary());
ActivitiesSummary activitiesSummary = record.getActivitiesSummary();
if (activitiesSummary.getEducations() != null) {
activitiesSummary.getEducations().getSummaries().forEach(e -> assertSourceElement(e, true));
}
if (activitiesSummary.getEmployments() != null) {
activitiesSummary.getEmployments().getSummaries().forEach(e -> assertSourceElement(e, true));
}
if (activitiesSummary.getFundings() != null) {
activitiesSummary.getFundings().getFundingGroup().forEach(g -> {
g.getFundingSummary().forEach(e -> assertSourceElement(e, true));
});
}
if (activitiesSummary.getWorks() != null) {
activitiesSummary.getWorks().getWorkGroup().forEach(g -> {
g.getWorkSummary().forEach(e -> assertSourceElement(e, true));
});
}
if (activitiesSummary.getPeerReviews() != null) {
activitiesSummary.getPeerReviews().getPeerReviewGroup().forEach(g -> {
g.getPeerReviewSummary().forEach(e -> assertSourceElement(e, true));
});
}
assertNotNull(record.getPerson());
Person person = record.getPerson();
if (person.getAddresses() != null) {
person.getAddresses().getAddress().forEach(e -> assertSourceElement(e, true));
}
if (person.getExternalIdentifiers() != null) {
person.getExternalIdentifiers().getExternalIdentifiers().forEach(e -> assertSourceElement(e, true));
}
if (person.getKeywords() != null) {
person.getKeywords().getKeywords().forEach(e -> assertSourceElement(e, true));
}
if (person.getOtherNames() != null) {
person.getOtherNames().getOtherNames().forEach(e -> assertSourceElement(e, true));
}
if (person.getResearcherUrls() != null) {
person.getResearcherUrls().getResearcherUrls().forEach(e -> assertSourceElement(e, true));
}
}
use of com.alibaba.json.bvt.bug.Bug_for_issue_729.Person in project ORCID-Source by ORCID.
the class PersonDetailsManagerReadOnlyImpl method getPersonDetails.
@Override
public Person getPersonDetails(String orcid) {
long lastModifiedTime = getLastModified(orcid);
Person person = new Person();
person.setName(recordNameManager.getRecordName(orcid, lastModifiedTime));
person.setBiography(biographyManager.getBiography(orcid, lastModifiedTime));
Addresses addresses = addressManager.getAddresses(orcid, lastModifiedTime);
if (addresses.getAddress() != null) {
Addresses filteredAddresses = new Addresses();
filteredAddresses.setAddress(new ArrayList<Address>(addresses.getAddress()));
person.setAddresses(filteredAddresses);
}
PersonExternalIdentifiers extIds = externalIdentifierManager.getExternalIdentifiers(orcid, lastModifiedTime);
if (extIds.getExternalIdentifiers() != null) {
PersonExternalIdentifiers filteredExtIds = new PersonExternalIdentifiers();
filteredExtIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers()));
person.setExternalIdentifiers(filteredExtIds);
}
Keywords keywords = profileKeywordManager.getKeywords(orcid, lastModifiedTime);
if (keywords.getKeywords() != null) {
Keywords filteredKeywords = new Keywords();
filteredKeywords.setKeywords(new ArrayList<Keyword>(keywords.getKeywords()));
person.setKeywords(filteredKeywords);
}
OtherNames otherNames = otherNameManager.getOtherNames(orcid, lastModifiedTime);
if (otherNames.getOtherNames() != null) {
OtherNames filteredOtherNames = new OtherNames();
filteredOtherNames.setOtherNames(new ArrayList<OtherName>(otherNames.getOtherNames()));
person.setOtherNames(filteredOtherNames);
}
ResearcherUrls rUrls = researcherUrlManager.getResearcherUrls(orcid, lastModifiedTime);
if (rUrls.getResearcherUrls() != null) {
ResearcherUrls filteredRUrls = new ResearcherUrls();
filteredRUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(rUrls.getResearcherUrls()));
person.setResearcherUrls(filteredRUrls);
}
Emails emails = emailManager.getEmails(orcid, lastModifiedTime);
if (emails.getEmails() != null) {
Emails filteredEmails = new Emails();
filteredEmails.setEmails(new ArrayList<Email>(emails.getEmails()));
person.setEmails(filteredEmails);
}
return person;
}
use of com.alibaba.json.bvt.bug.Bug_for_issue_729.Person in project ORCID-Source by ORCID.
the class OrcidSecurityManager_EmailTest method testPerson_NoReadLimited.
@Test
public void testPerson_NoReadLimited() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
Email e1 = createEmail(Visibility.PUBLIC, CLIENT_2);
Email e2 = createEmail(Visibility.LIMITED, CLIENT_2);
Email e3 = createEmail(Visibility.PRIVATE, CLIENT_2);
List<Email> emailList = new ArrayList<Email>(Arrays.asList(e1, e2, e3));
Emails emails = new Emails();
emails.setEmails(emailList);
Person p = new Person();
p.setEmails(emails);
orcidSecurityManager.checkAndFilter(ORCID_1, p);
assertNotNull(p);
assertNotNull(p.getEmails());
assertEquals(1, p.getEmails().getEmails().size());
assertTrue(p.getEmails().getEmails().contains(e1));
assertFalse(p.getEmails().getEmails().contains(e2));
assertFalse(p.getEmails().getEmails().contains(e3));
}
Aggregations