Search in sources :

Example 1 with ImportResponse

use of com.b2international.snowowl.core.request.io.ImportResponse in project snow-owl by b2ihealthcare.

the class SnomedImportRowValidatorTest method importRelationshipWithSameSourceDestination.

@Test
public void importRelationshipWithSameSourceDestination() throws FileNotFoundException {
    final String archiveFilePath = "SnomedCT_Release_INT_20150202_new_relationship_with_same_source_destination.zip";
    final ImportResponse response = importArchive(archiveFilePath, Rf2ReleaseType.DELTA);
    final Collection<String> issues = getDefectMessages(response);
    final String issue = Iterables.getOnlyElement(issues);
    assertThat(issues).hasSize(1);
    assertThat(issue).containsSequence(Rf2ValidationDefects.RELATIONSHIP_SOURCE_DESTINATION_EQUALS.getLabel());
    assertFalse(response.isSuccess());
}
Also used : ImportResponse(com.b2international.snowowl.core.request.io.ImportResponse) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 2 with ImportResponse

use of com.b2international.snowowl.core.request.io.ImportResponse in project snow-owl by b2ihealthcare.

the class SnomedImportRowValidatorTest method importAssociationRefSetMemberWithInvalidTargetComponent.

@Test
public void importAssociationRefSetMemberWithInvalidTargetComponent() throws FileNotFoundException {
    final String archiveFilePath = "SnomedCT_RF2Release_INT_20180223_association_member_with_invalid_target_component.zip";
    final ImportResponse response = importArchive(archiveFilePath, Rf2ReleaseType.DELTA);
    final Collection<String> issues = getDefectMessages(response);
    final String issue = Iterables.getOnlyElement(issues);
    assertThat(issues).hasSize(1);
    assertThat(issue).containsSequence(Rf2ValidationDefects.INVALID_ID.getLabel());
    assertFalse(response.isSuccess());
}
Also used : ImportResponse(com.b2international.snowowl.core.request.io.ImportResponse) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 3 with ImportResponse

use of com.b2international.snowowl.core.request.io.ImportResponse in project snow-owl by b2ihealthcare.

the class SnomedRf2ImportRestService method toRf2ImportConfiguration.

private SnomedRf2ImportConfiguration toRf2ImportConfiguration(RemoteJobEntry job) {
    ApiError error = null;
    ImportResponse response = null;
    ObjectMapper mapper = ApplicationContext.getServiceForClass(ObjectMapper.class);
    if (RemoteJobState.FAILED == job.getState()) {
        error = job.getResultAs(mapper, ApiError.class);
    } else if (job.isSuccessful()) {
        response = job.getResultAs(mapper, ImportResponse.class);
    }
    return new SnomedRf2ImportConfiguration(IDs.sha1(job.getId()), job.getState(), error, response);
}
Also used : ImportResponse(com.b2international.snowowl.core.request.io.ImportResponse) SnomedRf2ImportConfiguration(com.b2international.snowowl.snomed.core.rest.domain.SnomedRf2ImportConfiguration) ApiError(com.b2international.commons.exceptions.ApiError) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 4 with ImportResponse

use of com.b2international.snowowl.core.request.io.ImportResponse in project snow-owl by b2ihealthcare.

the class SnomedImportRowValidatorTest method importDescriptionWithDescriptionAsConceptId.

@Test
public void importDescriptionWithDescriptionAsConceptId() throws FileNotFoundException {
    final String archiveFilePath = "SnomedCT_Release_INT_20150201_new_description_with_description_as_concept_id.zip";
    final ImportResponse response = importArchive(archiveFilePath, Rf2ReleaseType.DELTA);
    final Collection<String> issues = getDefectMessages(response);
    assertThat(issues).hasSize(1);
    assertEquals(Rf2ValidationDefects.UNEXPECTED_COMPONENT_CATEGORY.getLabel(), Iterables.getOnlyElement(issues));
    assertFalse(response.isSuccess());
}
Also used : ImportResponse(com.b2international.snowowl.core.request.io.ImportResponse) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 5 with ImportResponse

use of com.b2international.snowowl.core.request.io.ImportResponse in project snow-owl by b2ihealthcare.

the class SnomedImportRowValidatorTest method importAttributeValueRefSetMemberWithInvalidValueId.

@Test
public void importAttributeValueRefSetMemberWithInvalidValueId() throws FileNotFoundException {
    final String archiveFilePath = "SnomedCT_RF2Release_INT_20180223_attribute_member_with_invalid_valueId.zip";
    final ImportResponse response = importArchive(archiveFilePath, Rf2ReleaseType.DELTA);
    final Collection<String> issues = getDefectMessages(response);
    final String issue = Iterables.getOnlyElement(issues);
    assertThat(issues).hasSize(1);
    assertThat(issue).containsSequence(Rf2ValidationDefects.INVALID_ID.getLabel());
    assertFalse(response.isSuccess());
}
Also used : ImportResponse(com.b2international.snowowl.core.request.io.ImportResponse) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Aggregations

ImportResponse (com.b2international.snowowl.core.request.io.ImportResponse)7 AbstractSnomedApiTest (com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)6 Test (org.junit.Test)6 ApiError (com.b2international.commons.exceptions.ApiError)1 SnomedRf2ImportConfiguration (com.b2international.snowowl.snomed.core.rest.domain.SnomedRf2ImportConfiguration)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1