Search in sources :

Example 26 with Work

use of org.orcid.jaxb.model.record_rc1.Work in project ORCID-Source by ORCID.

the class BibtexManagerTest method testGenerateBibtexForSingleWorkFromCitationField.

@Test
public void testGenerateBibtexForSingleWorkFromCitationField() {
    Work w = new Work();
    Citation c = new Citation();
    c.setWorkCitationType(CitationType.BIBTEX);
    c.setCitation("HELLO");
    w.setWorkCitation(c);
    String bib = bibtexManager.generateBibtex(ORCID, w);
    Assert.assertEquals("HELLO", bib);
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Citation(org.orcid.jaxb.model.record_v2.Citation) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 27 with Work

use of org.orcid.jaxb.model.record_rc1.Work in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validateWork_emptyCountryTest.

@Test(expected = ActivityTypeValidationException.class)
public void validateWork_emptyCountryTest() {
    Work work = getWork();
    work.getCountry().setValue((Iso3166Country) null);
    activityValidator.validateWork(work, null, true, true, Visibility.PUBLIC);
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Example 28 with Work

use of org.orcid.jaxb.model.record_rc1.Work in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validateWork_emptyContributorCreditNameTest.

@Test(expected = OrcidValidationException.class)
public void validateWork_emptyContributorCreditNameTest() {
    Work work = getWork();
    work.getWorkContributors().getContributor().get(0).getCreditName().setContent("");
    activityValidator.validateWork(work, null, true, true, Visibility.PUBLIC);
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Example 29 with Work

use of org.orcid.jaxb.model.record_rc1.Work in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validateWork_invalidCitationTypeTest.

@Test(expected = ActivityTypeValidationException.class)
public void validateWork_invalidCitationTypeTest() {
    Work work = getWork();
    work.getWorkCitation().setWorkCitationType(null);
    activityValidator.validateWork(work, null, true, true, Visibility.PUBLIC);
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Example 30 with Work

use of org.orcid.jaxb.model.record_rc1.Work in project ORCID-Source by ORCID.

the class BlackBoxBaseRC2 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);
    }
}
Also used : InputStreamReader(java.io.InputStreamReader) Education(org.orcid.jaxb.model.record_rc2.Education) Funding(org.orcid.jaxb.model.record_rc2.Funding) Work(org.orcid.jaxb.model.record_rc2.Work) OtherName(org.orcid.jaxb.model.record_rc2.OtherName) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) ResearcherUrl(org.orcid.jaxb.model.record_rc2.ResearcherUrl) IOException(java.io.IOException)

Aggregations

Test (org.junit.Test)152 Work (org.orcid.jaxb.model.record_v2.Work)151 ClientResponse (com.sun.jersey.api.client.ClientResponse)56 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)35 WorkBulk (org.orcid.jaxb.model.record_v2.WorkBulk)26 DBUnitTest (org.orcid.test.DBUnitTest)25 Response (javax.ws.rs.core.Response)24 Title (org.orcid.jaxb.model.common_v2.Title)24 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)23 Url (org.orcid.jaxb.model.common_v2.Url)22 OrcidError (org.orcid.jaxb.model.error_v2.OrcidError)22 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)17 ArrayList (java.util.ArrayList)16 BaseTest (org.orcid.core.BaseTest)16 BulkElement (org.orcid.jaxb.model.record.bulk.BulkElement)16 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)15 Work (org.orcid.jaxb.model.record_rc1.Work)12 WorkExternalIdentifier (org.orcid.jaxb.model.record_rc1.WorkExternalIdentifier)12 WorkExternalIdentifierId (org.orcid.jaxb.model.record_rc1.WorkExternalIdentifierId)12 Work (org.orcid.jaxb.model.record_rc3.Work)11