Search in sources :

Example 46 with Json

use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.

the class SnomedRelationshipApiTest method createDuplicateRelationship.

@Test
public void createDuplicateRelationship() {
    String relationshipId = createNewRelationship(branchPath);
    Json requestBody = createRelationshipRequestBody(Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT).with("id", relationshipId).with("commitComment", "Created new relationship with duplicate identifier");
    createComponent(branchPath, SnomedComponentType.RELATIONSHIP, requestBody).statusCode(409);
}
Also used : Json(com.b2international.commons.json.Json) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 47 with Json

use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.

the class SnomedRelationshipApiTest method updateReleasedRelationshipDestinationId.

@Test
public void updateReleasedRelationshipDestinationId() throws Exception {
    String relationshipId = createNewRelationship(branchPath);
    Json update = Json.object(SnomedRf2Headers.FIELD_DESTINATION_ID, Concepts.MODULE_ROOT, "commitComment", "Updated unreleased relationship destinationId");
    // release component
    createCodeSystemAndVersion(branchPath, "SNOMEDCT-RELREL-DESTID", "v1", LocalDate.parse("2017-03-01"));
    updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, update).statusCode(400);
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body(SnomedRf2Headers.FIELD_DESTINATION_ID, equalTo(Concepts.NAMESPACE_ROOT));
}
Also used : Json(com.b2international.commons.json.Json) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 48 with Json

use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.

the class SnomedRelationshipApiTest method updateUnreleasedRelationshipDestinationId.

@Test
public void updateUnreleasedRelationshipDestinationId() throws Exception {
    String relationshipId = createNewRelationship(branchPath);
    Json update = Json.object(SnomedRf2Headers.FIELD_DESTINATION_ID, Concepts.MODULE_ROOT, "commitComment", "Updated unreleased relationship destinationId");
    updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, update).statusCode(204);
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body(SnomedRf2Headers.FIELD_DESTINATION_ID, equalTo(Concepts.MODULE_ROOT));
}
Also used : Json(com.b2international.commons.json.Json) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 49 with Json

use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.

the class SnomedRelationshipApiTest method inactivateRelationship.

@Test
public void inactivateRelationship() {
    String relationshipId = createNewRelationship(branchPath);
    Json requestBody = Json.object("active", false, "commitComment", "Inactivated relationship");
    updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, requestBody).statusCode(204);
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("active", equalTo(false));
}
Also used : Json(com.b2international.commons.json.Json) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 50 with Json

use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.

the class SnomedRelationshipApiTest method updateUnreleasedRelationshipTypeId.

@Test
public void updateUnreleasedRelationshipTypeId() throws Exception {
    String relationshipId = createNewRelationship(branchPath);
    Json update = Json.object(// part of is the initial type
    SnomedRf2Headers.FIELD_TYPE_ID, // part of is the initial type
    Concepts.DEFINING_RELATIONSHIP, "commitComment", "Updated unreleased relationship typeId");
    updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, update).statusCode(204);
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body(SnomedRf2Headers.FIELD_TYPE_ID, equalTo(Concepts.DEFINING_RELATIONSHIP));
}
Also used : Json(com.b2international.commons.json.Json) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Aggregations

Json (com.b2international.commons.json.Json)139 Test (org.junit.Test)134 AbstractSnomedApiTest (com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)111 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)33 LocalDate (java.time.LocalDate)17 RelationshipValue (com.b2international.snowowl.snomed.core.domain.RelationshipValue)11 SnomedDescription (com.b2international.snowowl.snomed.core.domain.SnomedDescription)11 SnomedReferenceSetMember (com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember)11 BaseResourceApiTest (com.b2international.snowowl.core.rest.BaseResourceApiTest)10 SnomedReferenceSetMembers (com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers)10 CodeSystem (com.b2international.snowowl.core.codesystem.CodeSystem)7 ISnomedIdentifierService (com.b2international.snowowl.snomed.cis.ISnomedIdentifierService)6 SnomedConcept (com.b2international.snowowl.snomed.core.domain.SnomedConcept)6 SctId (com.b2international.snowowl.snomed.cis.domain.SctId)4 Pair (com.b2international.commons.Pair)3 ValidatableResponse (io.restassured.response.ValidatableResponse)3 File (java.io.File)3 NotFoundException (com.b2international.commons.exceptions.NotFoundException)2 IBranchPath (com.b2international.snowowl.core.api.IBranchPath)2 TransactionContext (com.b2international.snowowl.core.domain.TransactionContext)2