Search in sources :

Example 71 with IBranchPath

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

the class SnomedMergeApiTest method rebaseConceptDeletionOverNewInboundRelationships.

@Test
public void rebaseConceptDeletionOverNewInboundRelationships() 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 relationship to newly created destination concept on parent branch
    final String newInboundRelationshipToDeletedConcept = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.FINDING_SITE, deletedConcept, 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 inbound relationship").body("status", equalTo(Merge.Status.CONFLICTS.name()));
    // relationships should be deleted along with the already deleted destination concept
    getComponent(a, SnomedComponentType.RELATIONSHIP, newInboundRelationshipToDeletedConcept).statusCode(404);
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 72 with IBranchPath

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

the class SnomedMergeApiTest method rebaseDivergedThenMerge.

@Test
public void rebaseDivergedThenMerge() throws Exception {
    final IBranchPath task1 = BranchPathUtils.createPath(branchPath, "task1");
    branching.createBranch(task1).statusCode(201);
    final IBranchPath task2 = BranchPathUtils.createPath(branchPath, "task2");
    branching.createBranch(task2).statusCode(201);
    final String task1Concept = createNewConcept(task1);
    final String task2Concept = createNewConcept(task2);
    final String parentConcept = createNewConcept(branchPath);
    // Synchronization makes parentConcept visible on task 2
    getComponent(task2, SnomedComponentType.CONCEPT, parentConcept).statusCode(404);
    merge(branchPath, task2, "Synchronize task 2").body("status", equalTo(Merge.Status.COMPLETED.name()));
    getComponent(task2, SnomedComponentType.CONCEPT, parentConcept).statusCode(200);
    // Synchronization makes parentConcept visible on task 1
    getComponent(task1, SnomedComponentType.CONCEPT, parentConcept).statusCode(404);
    merge(branchPath, task1, "Synchronize task 1").body("status", equalTo(Merge.Status.COMPLETED.name()));
    getComponent(task1, SnomedComponentType.CONCEPT, parentConcept).statusCode(200);
    // Promotion makes task2Concept visible on parent branch
    getComponent(branchPath, SnomedComponentType.CONCEPT, task2Concept).statusCode(404);
    merge(task2, branchPath, "Promote task 2").body("status", equalTo(Merge.Status.COMPLETED.name()));
    getComponent(branchPath, SnomedComponentType.CONCEPT, task2Concept).statusCode(200);
    // Synchronization makes task2Concept (that was just promoted to the parent branch) visible on task 1
    getComponent(task1, SnomedComponentType.CONCEPT, task2Concept).statusCode(404);
    merge(branchPath, task1, "Synchronize task 1 after promoting task 2").body("status", equalTo(Merge.Status.COMPLETED.name()));
    getComponent(task1, SnomedComponentType.CONCEPT, task2Concept).statusCode(200);
    // Promotion makes task1Concept visible on parent branch
    getComponent(branchPath, SnomedComponentType.CONCEPT, task1Concept).statusCode(404);
    merge(task1, branchPath, "Promote task 1").body("status", equalTo(Merge.Status.COMPLETED.name()));
    getComponent(branchPath, SnomedComponentType.CONCEPT, task1Concept).statusCode(200);
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 73 with IBranchPath

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

the class SnomedMergeApiTest method mergeNewConceptForwardWithChildBranchDelete.

@Test
public void mergeNewConceptForwardWithChildBranchDelete() {
    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()));
    branching.deleteBranch(a).statusCode(204);
    // getComponent(a, SnomedComponentType.CONCEPT, conceptId).statusCode(404);
    SnomedConcept concept = getConcept(conceptId, "descriptions(),relationships()");
    assertFalse(concept.getDescriptions().isEmpty());
    assertFalse(concept.getRelationships().isEmpty());
}
Also used : SnomedConcept(com.b2international.snowowl.snomed.core.domain.SnomedConcept) IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 74 with IBranchPath

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

the class SnomedMergeApiTest method mergeNewRelationshipForward.

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

Example 75 with IBranchPath

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

the class SnomedMergeApiTest method rebaseChangedDescriptionOnParentDeletedOnBranch.

@Test
public void rebaseChangedDescriptionOnParentDeletedOnBranch() {
    final String descriptionId = createNewDescription(branchPath);
    final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    branching.createBranch(a).statusCode(201);
    // Parent branch changes to CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE
    changeCaseSignificance(branchPath, descriptionId);
    deleteComponent(a, SnomedComponentType.DESCRIPTION, descriptionId, false).statusCode(204);
    merge(branchPath, a, "Rebased deletion over case significance change").body("status", equalTo(Merge.Status.COMPLETED.name()));
    getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200).body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_SENSITIVE));
    getComponent(a, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(404);
}
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