Search in sources :

Example 16 with Json

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

the class SnomedConcreteValueApiTest method changeConcreteValueCharacteristicType.

@Test
public void changeConcreteValueCharacteristicType() {
    String relationshipId = createNewConcreteValue(branchPath);
    Json requestBody = Json.object("characteristicTypeId", Concepts.ADDITIONAL_RELATIONSHIP, "commitComment", "Updated concrete value characteristic type");
    updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, requestBody).statusCode(204);
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("characteristicTypeId", equalTo(Concepts.ADDITIONAL_RELATIONSHIP));
}
Also used : Json(com.b2international.commons.json.Json) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 17 with Json

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

the class SnomedConcreteValueApiTest method changeConcreteValueModifier.

@Test
public void changeConcreteValueModifier() {
    String relationshipId = createNewConcreteValue(branchPath);
    Json requestBody = Json.object("modifierId", Concepts.UNIVERSAL_RESTRICTION_MODIFIER, "commitComment", "Updated concrete value modifier");
    updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, requestBody).statusCode(204);
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("modifierId", equalTo(Concepts.UNIVERSAL_RESTRICTION_MODIFIER));
}
Also used : Json(com.b2international.commons.json.Json) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 18 with Json

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

the class SnomedConcreteValueApiTest method updateReleasedConcreteValueTypeId.

@Test
public void updateReleasedConcreteValueTypeId() throws Exception {
    String relationshipId = createNewConcreteValue(branchPath);
    Json update = Json.object(// "part of" is the initial type ID
    SnomedRf2Headers.FIELD_TYPE_ID, // "part of" is the initial type ID
    Concepts.DEFINING_RELATIONSHIP, "commitComment", "Updated released concrete value typeId");
    // release component first
    createCodeSystemAndVersion(branchPath, "SNOMEDCT-CONCVAL-TYPEID", "v1", LocalDate.parse("2017-03-01"));
    // then try to update - it should fail as typeId is immutable
    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 19 with Json

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

the class SnomedConcreteValueApiTest method createConcreteValue.

@Test
public void createConcreteValue() {
    Json requestBody = createConcreteValueRequestBody(Concepts.ROOT_CONCEPT, Concepts.PART_OF, new RelationshipValue("string value")).with("commitComment", "Created new concrete value");
    createComponent(branchPath, SnomedComponentType.RELATIONSHIP, requestBody).statusCode(201);
}
Also used : Json(com.b2international.commons.json.Json) RelationshipValue(com.b2international.snowowl.snomed.core.domain.RelationshipValue) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 20 with Json

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

the class SnomedConcreteValueApiTest method createConcreteValueNonExistentBranch.

@Test
public void createConcreteValueNonExistentBranch() {
    Json requestBody = createConcreteValueRequestBody(Concepts.ROOT_CONCEPT, Concepts.PART_OF, new RelationshipValue("Hello world!")).with("commitComment", "Created new concrete value on non-existent branch");
    createComponent(BranchPathUtils.createPath("MAIN/x/y/z"), SnomedComponentType.RELATIONSHIP, requestBody).statusCode(404);
}
Also used : Json(com.b2international.commons.json.Json) RelationshipValue(com.b2international.snowowl.snomed.core.domain.RelationshipValue) 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