Search in sources :

Example 91 with Work

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

the class ActivityValidatorTest method validateWork_emptyTitleTest.

@Test(expected = ActivityTitleValidationException.class)
public void validateWork_emptyTitleTest() {
    Work work = getWork();
    work.getWorkTitle().getTitle().setContent(null);
    activityValidator.validateWork(work, null, true, true, Visibility.PUBLIC);
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Example 92 with Work

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

the class ActivityValidatorTest method validateWork_invalidPutCodeTest.

@Test(expected = InvalidPutCodeException.class)
public void validateWork_invalidPutCodeTest() {
    Work work = getWork();
    work.setPutCode(1L);
    activityValidator.validateWork(work, null, true, true, Visibility.PUBLIC);
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Example 93 with Work

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

the class ActivityValidatorTest method validateWork_invalidExternalIdentifierTypeTest.

@Test(expected = ActivityIdentifierValidationException.class)
public void validateWork_invalidExternalIdentifierTypeTest() {
    Work work = getWork();
    work.getExternalIdentifiers().getExternalIdentifier().get(0).setType("invalid");
    activityValidator.validateWork(work, null, true, true, Visibility.PUBLIC);
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Example 94 with Work

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

the class ActivityValidatorTest method validateWork_emptyCitationTest.

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

Example 95 with Work

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

the class BlackBoxBaseRC1 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 (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 (Work.class.equals(type)) {
            result = (Work) obj;
        } else if (PeerReview.class.equals(type)) {
            result = (PeerReview) obj;
        }
        return result;
    } catch (IOException e) {
        throw new RuntimeException("Error reading notification from classpath", e);
    }
}
Also used : InputStreamReader(java.io.InputStreamReader) Employment(org.orcid.jaxb.model.record_rc1.Employment) Work(org.orcid.jaxb.model.record_rc1.Work) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) IOException(java.io.IOException)

Aggregations

Work (org.orcid.jaxb.model.record_v2.Work)150 Test (org.junit.Test)148 ClientResponse (com.sun.jersey.api.client.ClientResponse)52 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)33 DBUnitTest (org.orcid.test.DBUnitTest)24 Response (javax.ws.rs.core.Response)23 Title (org.orcid.jaxb.model.common_v2.Title)22 WorkBulk (org.orcid.jaxb.model.record_v2.WorkBulk)22 Url (org.orcid.jaxb.model.common_v2.Url)21 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)21 OrcidError (org.orcid.jaxb.model.error_v2.OrcidError)19 ArrayList (java.util.ArrayList)16 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)16 BaseTest (org.orcid.core.BaseTest)14 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)13 Work (org.orcid.jaxb.model.record_rc1.Work)12 ExternalID (org.orcid.jaxb.model.record_rc3.ExternalID)11 Work (org.orcid.jaxb.model.record_rc3.Work)11 Work (org.orcid.jaxb.model.record_rc4.Work)11 Funding (org.orcid.jaxb.model.record_v2.Funding)11