Search in sources :

Example 6 with GroupIdRecords

use of org.orcid.jaxb.model.groupid_v2.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());
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) GroupIdRecords(org.orcid.jaxb.model.groupid_rc1.GroupIdRecords) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 7 with GroupIdRecords

use of org.orcid.jaxb.model.groupid_v2.GroupIdRecords in project ORCID-Source by ORCID.

the class ConvertVrc2ToVrc3Test method upgradeGroupIdToVrc3Test.

@Test
public void upgradeGroupIdToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(GroupIdRecords.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.groupid_rc3.GroupIdRecords.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc2Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc2.xml");
    InputStream rc3Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc3.xml");
    GroupIdRecords rc2Group = (GroupIdRecords) jaxbUnmarshaller.unmarshal(rc2Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.groupid_rc3.GroupIdRecords rc3GroupId1 = (org.orcid.jaxb.model.groupid_rc3.GroupIdRecords) jaxbUnmarshaller.unmarshal(rc3Stream);
    V2Convertible result = versionConverterV2_0_rc2ToV2_0_rc3.upgrade(new V2Convertible(rc2Group, "v2_rc2"));
    org.orcid.jaxb.model.groupid_rc3.GroupIdRecords rc3GroupId2 = (org.orcid.jaxb.model.groupid_rc3.GroupIdRecords) result.getObjectToConvert();
    assertEquals(rc3GroupId1, rc3GroupId2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) GroupIdRecords(org.orcid.jaxb.model.groupid_rc2.GroupIdRecords) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 8 with GroupIdRecords

use of org.orcid.jaxb.model.groupid_v2.GroupIdRecords in project ORCID-Source by ORCID.

the class ConvertVrc3ToVrc4Test method upgradeGroupIdToVrc3Test.

@Test
public void upgradeGroupIdToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(GroupIdRecords.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.groupid_rc4.GroupIdRecords.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc3Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc3.xml");
    InputStream rc4Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc4.xml");
    GroupIdRecords rc4Group = (GroupIdRecords) jaxbUnmarshaller.unmarshal(rc3Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.groupid_rc4.GroupIdRecords rc4GroupId1 = (org.orcid.jaxb.model.groupid_rc4.GroupIdRecords) jaxbUnmarshaller.unmarshal(rc4Stream);
    V2Convertible result = versionConverterV2_0_rc3ToV2_0_rc4.upgrade(new V2Convertible(rc4Group, "v2_rc3"));
    org.orcid.jaxb.model.groupid_rc4.GroupIdRecords rc4GroupId2 = (org.orcid.jaxb.model.groupid_rc4.GroupIdRecords) result.getObjectToConvert();
    assertEquals(rc4GroupId1, rc4GroupId2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) GroupIdRecords(org.orcid.jaxb.model.groupid_rc3.GroupIdRecords) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 9 with GroupIdRecords

use of org.orcid.jaxb.model.groupid_v2.GroupIdRecords in project ORCID-Source by ORCID.

the class ConvertV2ToV2_1Test method upgradeGroupIdToV21Test.

@Test
public void upgradeGroupIdToV21Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(GroupIdRecords.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(GroupIdRecords.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream v20Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0.xml");
    InputStream v21Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-group-id-2.1.xml");
    GroupIdRecords v20Group = (GroupIdRecords) jaxbUnmarshaller.unmarshal(v20Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    GroupIdRecords v21GroupId1 = (GroupIdRecords) jaxbUnmarshaller.unmarshal(v21Stream);
    V2Convertible result = versionConverterV2_0ToV2_1.upgrade(new V2Convertible(v20Group, "v2.1"));
    GroupIdRecords v21GroupId2 = (GroupIdRecords) result.getObjectToConvert();
    assertEquals(v21GroupId1, v21GroupId2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) GroupIdRecords(org.orcid.jaxb.model.groupid_v2.GroupIdRecords) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 10 with GroupIdRecords

use of org.orcid.jaxb.model.groupid_v2.GroupIdRecords in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorImpl method viewGroupIdRecords.

@Override
public Response viewGroupIdRecords(String pageSize, String pageNum) {
    GroupIdRecords records = groupIdRecordManagerReadOnly.getGroupIdRecords(pageSize, pageNum);
    Api2_0_LastModifiedDatesHelper.calculateLastModified(records);
    return Response.ok(records).build();
}
Also used : GroupIdRecords(org.orcid.jaxb.model.groupid_v2.GroupIdRecords)

Aggregations

Test (org.junit.Test)6 InputStream (java.io.InputStream)5 JAXBContext (javax.xml.bind.JAXBContext)5 Unmarshaller (javax.xml.bind.Unmarshaller)5 BaseTest (org.orcid.core.BaseTest)5 V2Convertible (org.orcid.core.version.V2Convertible)5 GroupIdRecords (org.orcid.jaxb.model.groupid_v2.GroupIdRecords)5 GroupIdRecord (org.orcid.jaxb.model.groupid_v2.GroupIdRecord)2 Response (javax.ws.rs.core.Response)1 LastModifiedDate (org.orcid.jaxb.model.common_v2.LastModifiedDate)1 GroupIdRecords (org.orcid.jaxb.model.groupid_rc1.GroupIdRecords)1 GroupIdRecords (org.orcid.jaxb.model.groupid_rc2.GroupIdRecords)1 GroupIdRecords (org.orcid.jaxb.model.groupid_rc3.GroupIdRecords)1 GroupIdRecords (org.orcid.jaxb.model.groupid_rc4.GroupIdRecords)1 GroupIdRecordEntity (org.orcid.persistence.jpa.entities.GroupIdRecordEntity)1 DBUnitTest (org.orcid.test.DBUnitTest)1