Search in sources :

Example 76 with IBranchPath

use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.

the class SnomedMergeApiTest method rebaseConceptDeletionOverNewOutboundRelationships.

@Ignore
@Test
public void rebaseConceptDeletionOverNewOutboundRelationships() throws Exception {
    // new concept on test branch
    final String deletedConcept = createNewConcept(branchPath);
    // new child branch of test parent branch
    final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    branching.createBranch(a).statusCode(201);
    // create a new outbound relationship
    final String newOutboundRelationshipFromDeletedConcept = createNewRelationship(branchPath, deletedConcept, Concepts.FINDING_SITE, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP);
    // delete destination concept on child branch
    deleteComponent(a, SnomedComponentType.CONCEPT, deletedConcept, false);
    // rebase child branch with deletion over new relationship, this should succeed, but should also implicitly delete the relationship
    merge(branchPath, a, "Rebased concept deletion over new outbound relationship").body("status", equalTo(Merge.Status.CONFLICTS.name()));
    merge(branchPath, a, "Rebased concept deletion over new outbound relationship").body("status", equalTo(Merge.Status.COMPLETED.name()));
    // relationships should be deleted along with the already deleted destination concept
    getComponent(a, SnomedComponentType.RELATIONSHIP, newOutboundRelationshipFromDeletedConcept).statusCode(404);
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Ignore(org.junit.Ignore) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 77 with IBranchPath

use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.

the class SnomedMergeApiTest method mergeNewConceptForward.

@Test
public void mergeNewConceptForward() {
    final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    branching.createBranch(a).statusCode(201);
    final String conceptId = createNewConcept(a);
    merge(a, branchPath, "Merged new concept from child branch").body("status", equalTo(Merge.Status.COMPLETED.name()));
    getComponent(a, SnomedComponentType.CONCEPT, conceptId).statusCode(200);
    getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId).statusCode(200);
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 78 with IBranchPath

use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.

the class SnomedMergeApiTest method rebaseOverReusedRelationshipId.

@Test
public void rebaseOverReusedRelationshipId() {
    final String relationshipId = createNewRelationship(branchPath);
    final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    branching.createBranch(a).statusCode(201);
    deleteComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, false).statusCode(204);
    final Map<?, ?> requestBody = ImmutableMap.builder().put("sourceId", Concepts.ROOT_CONCEPT).put("moduleId", Concepts.MODULE_SCT_CORE).put("typeId", Concepts.FINDING_SITE).put("destinationId", Concepts.ROOT_CONCEPT).put("id", relationshipId).put("commitComment", "Created new relationship on parent with same SCTID").build();
    createComponent(branchPath, SnomedComponentType.RELATIONSHIP, requestBody).statusCode(201);
    // Different relationships before rebase
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("typeId", equalTo(Concepts.FINDING_SITE));
    getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("typeId", equalTo(Concepts.PART_OF));
    merge(branchPath, a, "Rebase after new relationship creation on parent").body("status", equalTo(Merge.Status.COMPLETED.name()));
    // Same relationships after rebase
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("typeId", equalTo(Concepts.FINDING_SITE));
    getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("typeId", equalTo(Concepts.FINDING_SITE));
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 79 with IBranchPath

use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.

the class SnomedMergeApiTest method rebaseTextDefinitions.

@Test
public void rebaseTextDefinitions() throws Exception {
    final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    branching.createBranch(a).statusCode(201);
    // Create two new text definitions with "cross-shaped" acceptability on child
    final String textDefinition1Id = createNewTextDefinition(a, ImmutableMap.of(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED, Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.ACCEPTABLE));
    final String textDefinition2Id = createNewTextDefinition(a, ImmutableMap.of(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.ACCEPTABLE, Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
    // Create change on parent
    final String relationshipId = createNewRelationship(branchPath);
    merge(branchPath, a, "Rebased new text definitions over new relationship").body("status", equalTo(Merge.Status.COMPLETED.name()));
    // Relationship should be visible on both branches
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200);
    getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200);
    // Text definitions are only on the child, however
    getComponent(branchPath, SnomedComponentType.DESCRIPTION, textDefinition1Id).statusCode(404);
    getComponent(a, SnomedComponentType.DESCRIPTION, textDefinition1Id).statusCode(200);
    getComponent(branchPath, SnomedComponentType.DESCRIPTION, textDefinition2Id).statusCode(404);
    getComponent(a, SnomedComponentType.DESCRIPTION, textDefinition2Id).statusCode(200);
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Aggregations

IBranchPath (com.b2international.snowowl.core.api.IBranchPath)79 Test (org.junit.Test)73 AbstractSnomedApiTest (com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)70 Merge (com.b2international.snowowl.core.merge.Merge)10 MergeConflict (com.b2international.snowowl.core.merge.MergeConflict)10 SnomedConcept (com.b2international.snowowl.snomed.core.domain.SnomedConcept)8 ConflictingAttribute (com.b2international.snowowl.core.merge.ConflictingAttribute)6 LocalDate (java.time.LocalDate)5 Pair (com.b2international.commons.Pair)4 File (java.io.File)4 Ignore (org.junit.Ignore)2 BackwardListIterator (com.b2international.commons.collections.BackwardListIterator)1 Json (com.b2international.commons.json.Json)1 BaseRevisionBranching (com.b2international.index.revision.BaseRevisionBranching)1 RevisionBranch (com.b2international.index.revision.RevisionBranch)1 ComponentIdentifier (com.b2international.snowowl.core.ComponentIdentifier)1 Repository (com.b2international.snowowl.core.Repository)1 RepositoryManager (com.b2international.snowowl.core.RepositoryManager)1 ResourceURI (com.b2international.snowowl.core.ResourceURI)1 BranchCompareResult (com.b2international.snowowl.core.branch.compare.BranchCompareResult)1