Search in sources :

Example 21 with SctId

use of com.b2international.snowowl.snomed.cis.domain.SctId in project snow-owl by b2ihealthcare.

the class SnomedConceptApiTest method createConceptWithReservedId.

@Test
public void createConceptWithReservedId() {
    ISnomedIdentifierService identifierService = ApplicationContext.getServiceForClass(ISnomedIdentifierService.class);
    String conceptId = Iterables.getOnlyElement(identifierService.reserve(null, ComponentCategory.CONCEPT, 1));
    String createConceptId = createConcept(branchPath, createConceptRequestBody(Concepts.ROOT_CONCEPT).with("id", conceptId));
    assertEquals(conceptId, createConceptId);
    SctId conceptSctId = SnomedRequests.identifiers().prepareGet().setComponentId(conceptId).buildAsync().execute(getBus()).getSync(1, TimeUnit.MINUTES).first().get();
    assertEquals(IdentifierStatus.ASSIGNED.getSerializedName(), conceptSctId.getStatus());
}
Also used : ISnomedIdentifierService(com.b2international.snowowl.snomed.cis.ISnomedIdentifierService) SctId(com.b2international.snowowl.snomed.cis.domain.SctId) Test(org.junit.Test)

Example 22 with SctId

use of com.b2international.snowowl.snomed.cis.domain.SctId in project snow-owl by b2ihealthcare.

the class SnomedConcreteValueApiTest method createConcreteValueWithReservedId.

@Test
public void createConcreteValueWithReservedId() {
    ISnomedIdentifierService identifierService = getServiceForClass(ISnomedIdentifierService.class);
    String relationshipId = Iterables.getOnlyElement(identifierService.reserve(null, ComponentCategory.RELATIONSHIP, 1));
    Json requestBody = createConcreteValueRequestBody(Concepts.ROOT_CONCEPT, Concepts.PART_OF, new RelationshipValue("string value")).with("id", relationshipId).with("commitComment", "Created new concrete value with reserved identifier");
    createComponent(branchPath, SnomedComponentType.RELATIONSHIP, requestBody).statusCode(201).header("Location", endsWith("/" + relationshipId));
    SctId concreteValueSctId = SnomedRequests.identifiers().prepareGet().setComponentId(relationshipId).buildAsync().execute(getBus()).getSync().first().get();
    assertEquals(IdentifierStatus.ASSIGNED.getSerializedName(), concreteValueSctId.getStatus());
}
Also used : ISnomedIdentifierService(com.b2international.snowowl.snomed.cis.ISnomedIdentifierService) Json(com.b2international.commons.json.Json) RelationshipValue(com.b2international.snowowl.snomed.core.domain.RelationshipValue) SctId(com.b2international.snowowl.snomed.cis.domain.SctId) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Aggregations

SctId (com.b2international.snowowl.snomed.cis.domain.SctId)22 Test (org.junit.Test)10 SnowowlRuntimeException (com.b2international.snowowl.core.api.SnowowlRuntimeException)7 IOException (java.io.IOException)7 ISnomedIdentifierService (com.b2international.snowowl.snomed.cis.ISnomedIdentifierService)4 Collection (java.util.Collection)4 HttpPost (org.apache.http.client.methods.HttpPost)4 Json (com.b2international.commons.json.Json)3 AbstractSnomedApiTest (com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)3 HttpGet (org.apache.http.client.methods.HttpGet)3 HttpPut (org.apache.http.client.methods.HttpPut)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 RelationshipValue (com.b2international.snowowl.snomed.core.domain.RelationshipValue)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ImmutableMap (com.google.common.collect.ImmutableMap)1