Search in sources :

Example 51 with Work

use of org.orcid.jaxb.model.record_rc4.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 52 with Work

use of org.orcid.jaxb.model.record_rc4.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 53 with Work

use of org.orcid.jaxb.model.record_rc4.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 54 with Work

use of org.orcid.jaxb.model.record_rc4.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 55 with Work

use of org.orcid.jaxb.model.record_rc4.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

Test (org.junit.Test)153 Work (org.orcid.jaxb.model.record_v2.Work)151 ClientResponse (com.sun.jersey.api.client.ClientResponse)53 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 Work (org.orcid.jaxb.model.record_rc3.Work)11 ExternalID (org.orcid.jaxb.model.record_rc4.ExternalID)11 Work (org.orcid.jaxb.model.record_rc4.Work)11