Search in sources :

Example 51 with Json

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

the class SnomedRelationshipApiTest method changeRelationshipUnionGroup.

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

Example 52 with Json

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

the class SnomedRelationshipApiTest method updateReleasedRelationshipTypeId.

@Test
public void updateReleasedRelationshipTypeId() 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");
    // release component
    createCodeSystemAndVersion(branchPath, "SNOMEDCT-RELREL-TYPEID", "v1", LocalDate.parse("2017-03-01"));
    updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, update).statusCode(400);
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body(SnomedRf2Headers.FIELD_TYPE_ID, equalTo(Concepts.PART_OF));
}
Also used : Json(com.b2international.commons.json.Json) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 53 with Json

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

the class SnomedRelationshipApiTest method updateGroup.

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

Example 54 with Json

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

the class SnomedRelationshipApiTest method updateGroupToInvalidValue.

@Test
public void updateGroupToInvalidValue() {
    String relationshipId = createNewRelationship(branchPath);
    Json requestBody = Json.object("relationshipGroup", -5, "commitComment", "Updated relationship group to invalid value");
    updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, requestBody).statusCode(400);
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("relationshipGroup", equalTo(0));
}
Also used : Json(com.b2international.commons.json.Json) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 55 with Json

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

the class SnomedRelationshipApiTest method createRelationshipNonExistentBranch.

@Test
public void createRelationshipNonExistentBranch() {
    Json requestBody = createRelationshipRequestBody(Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT).with("commitComment", "Created new relationship on non-existent branch");
    createComponent(BranchPathUtils.createPath("MAIN/x/y/z"), SnomedComponentType.RELATIONSHIP, requestBody).statusCode(404);
}
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