Search in sources :

Example 21 with IBranchPath

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

the class SnomedMergeConflictTest method rebaseModuleChangeOverNewRelationship.

@Test
public void rebaseModuleChangeOverNewRelationship() throws Exception {
    final String concept = createNewConcept(branchPath);
    final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    branching.createBranch(a).statusCode(201);
    String relationshipOnChild = createNewRelationship(a, concept, Concepts.IS_A, Concepts.REFSET_ALL);
    final Map<?, ?> moduleUpdateOnParent = Map.of("moduleId", Concepts.MODULE_ROOT, "commitComment", "Update module");
    updateComponent(branchPath, SnomedComponentType.CONCEPT, concept, moduleUpdateOnParent);
    merge(branchPath, a, "Rebase branch A").body("status", equalTo(Merge.Status.COMPLETED.name()));
    getComponent(branchPath, SnomedComponentType.CONCEPT, concept).statusCode(200).body("moduleId", equalTo(Concepts.MODULE_ROOT));
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipOnChild).statusCode(404);
    getComponent(a, SnomedComponentType.CONCEPT, concept).statusCode(200).body("moduleId", equalTo(Concepts.MODULE_ROOT));
    getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipOnChild).statusCode(200);
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 22 with IBranchPath

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

the class SnomedMergeApiTest method mergeNewDescriptionForward.

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

Example 23 with IBranchPath

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

the class SnomedDescriptionApiTest method deleteDescriptionOnNestedBranch.

@Test
public void deleteDescriptionOnNestedBranch() {
    String conceptId = createNewConcept(branchPath);
    List<String> descriptionIds = newArrayList();
    for (int i = 0; i < 5; i++) {
        String descriptionId = createNewDescription(branchPath, conceptId);
        descriptionIds.add(descriptionId);
    }
    IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    IBranchPath b = BranchPathUtils.createPath(a, "b");
    branching.createBranchRecursively(b);
    // New description on nested branch resets the concept's version to 1 again
    createNewDescription(b, conceptId);
    // Deleting a description from the middle should work
    String descriptionToDeleteId = descriptionIds.remove(2);
    deleteComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionToDeleteId, false).statusCode(204);
    getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionToDeleteId).statusCode(404);
    deleteComponent(b, SnomedComponentType.DESCRIPTION, descriptionToDeleteId, false).statusCode(204);
    getComponent(b, SnomedComponentType.DESCRIPTION, descriptionToDeleteId).statusCode(404);
    // All the remaining descriptions should be visible
    for (String descriptionId : descriptionIds) {
        getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200);
        getComponent(b, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200);
    }
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest) Test(org.junit.Test)

Example 24 with IBranchPath

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

the class SnomedRelationshipApiTest method createRelationshipOnNestedBranch.

@Test
public void createRelationshipOnNestedBranch() {
    IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    IBranchPath b = BranchPathUtils.createPath(a, "b");
    branching.createBranchRecursively(b);
    String relationshipId = createNewRelationship(b);
    getComponent(b, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200);
    getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(404);
    getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(404);
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 25 with IBranchPath

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

the class SnomedDescriptionApiTest method createDescriptionOnNestedBranch.

@Test
public void createDescriptionOnNestedBranch() {
    IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    IBranchPath b = BranchPathUtils.createPath(a, "b");
    branching.createBranchRecursively(b);
    String descriptionId = createNewDescription(b);
    getComponent(b, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200);
    getComponent(a, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(404);
    getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(404);
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest) Test(org.junit.Test)

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