use of org.orcid.jaxb.model.groupid_rc4.GroupIdRecords in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_GroupIdTest method testGetGroupIdRecords.
@Test
public void testGetGroupIdRecords() {
SecurityContextTestUtils.setUpSecurityContextForGroupIdClientOnly();
/*
* At this point there should be at least 3 group ids and no more than
* 5, since we are not sure if testDeleteGroupIdRecord and
* testCreateGroupIdRecord have ran or not
*/
// So, get a page with all
Response response = serviceDelegator.viewGroupIdRecords("5", "1");
assertNotNull(response);
GroupIdRecords groupIdRecords1 = (GroupIdRecords) response.getEntity();
assertNotNull(groupIdRecords1);
assertNotNull(groupIdRecords1.getGroupIdRecord());
int total = groupIdRecords1.getTotal();
if (total < 3 || total > 5) {
fail("There are more group ids than the expected, we are expecting between 3 and 5, total: " + total);
}
}
use of org.orcid.jaxb.model.groupid_rc4.GroupIdRecords in project ORCID-Source by ORCID.
the class ConvertVrc4ToV2Test method upgradeGroupIdToVrc3Test.
@Test
public void upgradeGroupIdToVrc3Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(GroupIdRecords.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.groupid_v2.GroupIdRecords.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc3Stream = ConvertVrc4ToV2Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc4.xml");
InputStream rc4Stream = ConvertVrc4ToV2Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0.xml");
GroupIdRecords rc4Group = (GroupIdRecords) jaxbUnmarshaller.unmarshal(rc3Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.groupid_v2.GroupIdRecords rc4GroupId1 = (org.orcid.jaxb.model.groupid_v2.GroupIdRecords) jaxbUnmarshaller.unmarshal(rc4Stream);
V2Convertible result = versionConverterV2_0_rc4ToV2_0.upgrade(new V2Convertible(rc4Group, "v2_rc4"));
org.orcid.jaxb.model.groupid_v2.GroupIdRecords rc4GroupId2 = (org.orcid.jaxb.model.groupid_v2.GroupIdRecords) result.getObjectToConvert();
assertEquals(rc4GroupId1, rc4GroupId2);
}
use of org.orcid.jaxb.model.groupid_rc4.GroupIdRecords in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method viewGroupIdRecords.
@Override
public Response viewGroupIdRecords(String pageSize, String pageNum) {
orcidSecurityManager.checkScopes(ScopePathType.GROUP_ID_RECORD_READ);
GroupIdRecords records = groupIdRecordManagerReadOnly.getGroupIdRecords(pageSize, pageNum);
Api2_0_LastModifiedDatesHelper.calculateLastModified(records);
return Response.ok(records).build();
}
use of org.orcid.jaxb.model.groupid_rc4.GroupIdRecords in project ORCID-Source by ORCID.
the class GroupIdRecordManagerReadOnlyImpl method getGroupIdRecords.
@Override
public GroupIdRecords getGroupIdRecords(String pageSize, String pageNum) {
int pageNumInt = convertToInteger(pageNum);
int pageSizeInt = convertToInteger(pageSize);
GroupIdRecords records = new GroupIdRecords();
records.setPage(pageNumInt);
records.setPageSize(pageSizeInt);
List<GroupIdRecordEntity> recordEntities = groupIdRecordDao.getGroupIdRecords(pageSizeInt, pageNumInt);
List<GroupIdRecord> recordsReturned = jpaJaxbGroupIdRecordAdapter.toGroupIdRecords(recordEntities);
if (recordsReturned != null) {
records.setTotal(recordsReturned.size());
records.getGroupIdRecord().addAll(recordsReturned);
} else {
records.setTotal(0);
}
return records;
}
use of org.orcid.jaxb.model.groupid_rc4.GroupIdRecords in project ORCID-Source by ORCID.
the class ConvertVrc1ToVrc2Test method upgradeGroupIdToVrc2Test.
@Test
public void upgradeGroupIdToVrc2Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(GroupIdRecords.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.groupid_rc2.GroupIdRecords.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc1Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc1.xml");
InputStream rc2Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc2.xml");
GroupIdRecords rc1Works = (GroupIdRecords) jaxbUnmarshaller.unmarshal(rc1Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.groupid_rc2.GroupIdRecords rc2GroupId1 = (org.orcid.jaxb.model.groupid_rc2.GroupIdRecords) jaxbUnmarshaller.unmarshal(rc2Stream);
V2Convertible result = versionConverterV2_0_rc1ToV2_0_rc2.upgrade(new V2Convertible(rc1Works, "v2_rc1"));
org.orcid.jaxb.model.groupid_rc2.GroupIdRecords rc2GroupId2 = (org.orcid.jaxb.model.groupid_rc2.GroupIdRecords) result.getObjectToConvert();
assertEquals(rc2GroupId1.getLastModifiedDate(), rc2GroupId2.getLastModifiedDate());
}
Aggregations