Search in sources :

Example 26 with IBranchPath

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

the class SnomedBranchingApiTest method createBranchTwice.

@Test
public void createBranchTwice() {
    IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    branching.createBranch(a).statusCode(201);
    branching.createBranch(a).statusCode(409);
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 27 with IBranchPath

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

the class SnomedBranchingApiTest method createBranchOnDeletedBranch.

@Test
public void createBranchOnDeletedBranch() {
    IBranchPath a = createPath(branchPath, "a");
    IBranchPath b = createPath(a, "b");
    branching.createBranch(a).statusCode(201);
    branching.deleteBranch(a).statusCode(204);
    branching.createBranch(b).statusCode(400);
}
Also used : IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 28 with IBranchPath

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

the class SnomedMergeConflictTest method addedInSourceDetachedInTargetMergeConflict.

@Test
public void addedInSourceDetachedInTargetMergeConflict() {
    String conceptId = createNewConcept(branchPath);
    IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    branching.createBranch(a).statusCode(201);
    createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, conceptId);
    deleteComponent(a, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204);
    Collection<MergeConflict> conflicts = merge(branchPath, a, "Rebased deleted concept over new relationship").body("status", equalTo(Merge.Status.CONFLICTS.name())).extract().as(Merge.class).getConflicts();
    assertEquals(1, conflicts.size());
    MergeConflict conflict = Iterables.getOnlyElement(conflicts);
    assertEquals(conceptId, conflict.getComponentId());
    assertEquals("concept", conflict.getComponentType());
    assertEquals(ConflictType.CAUSES_MISSING_REFERENCE, conflict.getType());
}
Also used : MergeConflict(com.b2international.snowowl.core.merge.MergeConflict) Merge(com.b2international.snowowl.core.merge.Merge) IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 29 with IBranchPath

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

the class SnomedMergeConflictTest method noMergeNewRelationshipToUnrelatedBranch.

@Test
public void noMergeNewRelationshipToUnrelatedBranch() {
    String conceptId = createNewConcept(branchPath);
    IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
    branching.createBranch(a).statusCode(201);
    createNewRelationship(a, Concepts.ROOT_CONCEPT, Concepts.PART_OF, conceptId);
    IBranchPath b = BranchPathUtils.createPath(branchPath, "b");
    branching.createBranch(b).statusCode(201);
    deleteComponent(b, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204);
    Collection<MergeConflict> conflicts = merge(a, b, "Merged new relationship to unrelated branch").body("status", equalTo(Merge.Status.CONFLICTS.name())).extract().as(Merge.class).getConflicts();
    assertEquals(1, conflicts.size());
    MergeConflict conflict = Iterables.getOnlyElement(conflicts);
    assertEquals(conceptId, conflict.getComponentId());
    assertEquals("concept", conflict.getComponentType());
    assertEquals(ConflictType.CAUSES_MISSING_REFERENCE, conflict.getType());
    assertEquals(0, conflict.getConflictingAttributes().size());
}
Also used : MergeConflict(com.b2international.snowowl.core.merge.MergeConflict) Merge(com.b2international.snowowl.core.merge.Merge) IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Test(org.junit.Test) AbstractSnomedApiTest(com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest)

Example 30 with IBranchPath

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

the class SnomedExportApiTest method exportContentFromVersionFixerTaskTransEffTime.

@Test
public void exportContentFromVersionFixerTaskTransEffTime() throws Exception {
    String codeSystemShortName = "SNOMEDCT-FIXERTASK-TRANSIENT";
    createCodeSystem(branchPath, codeSystemShortName).statusCode(201);
    // create a refset, a concept, and reference the concept from the refset
    final String createdRefSetId = createNewRefSet(branchPath, SnomedRefSetType.SIMPLE);
    final String createdConceptId = createNewConcept(branchPath, ROOT_CONCEPT);
    final String memberId = createNewRefSetMember(branchPath, createdConceptId, createdRefSetId);
    final String versionEffectiveTime = "20170301";
    createVersion(codeSystemShortName, "v1", EffectiveTimes.parse(versionEffectiveTime, DateFormats.SHORT)).statusCode(201);
    IBranchPath versionPath = BranchPathUtils.createPath(branchPath, "v1");
    IBranchPath taskBranch = BranchPathUtils.createPath(versionPath, "Fix01");
    // create fixer branch for version branch
    branching.createBranch(taskBranch).statusCode(201);
    // change an existing component
    Map<?, ?> updateRequest = ImmutableMap.builder().put("active", false).put("commitComment", "Inactivated reference set member").build();
    updateRefSetComponent(taskBranch, SnomedComponentType.MEMBER, memberId, updateRequest, false).statusCode(204);
    getComponent(taskBranch, SnomedComponentType.MEMBER, memberId).statusCode(200).body("active", equalTo(false)).body("effectiveTime", equalTo(null)).body("released", equalTo(true));
    // add a new component
    String newMemberId = createNewRefSetMember(taskBranch, createdConceptId, createdRefSetId);
    final Map<String, Object> config = ImmutableMap.<String, Object>builder().put("type", Rf2ReleaseType.SNAPSHOT.name()).put("startEffectiveTime", versionEffectiveTime).put("transientEffectiveTime", versionEffectiveTime).put("includeUnpublished", true).build();
    final File exportArchive = doExport(taskBranch, config);
    String refsetMemberLine = getComponentLine(List.<String>of(memberId, versionEffectiveTime, "0", MODULE_SCT_CORE, createdRefSetId, createdConceptId));
    String invalidRefsetMemberLine = getComponentLine(List.<String>of(memberId, versionEffectiveTime, "1", MODULE_SCT_CORE, createdRefSetId, createdConceptId));
    String newRefsetMemberLine = getComponentLine(List.<String>of(newMemberId, versionEffectiveTime, "1", MODULE_SCT_CORE, createdRefSetId, createdConceptId));
    final Multimap<String, Pair<Boolean, String>> fileToLinesMap = ArrayListMultimap.<String, Pair<Boolean, String>>create();
    String refsetFileName = "der2_Refset_SimpleSnapshot";
    fileToLinesMap.put(refsetFileName, Pair.of(true, refsetMemberLine));
    fileToLinesMap.put(refsetFileName, Pair.of(true, newRefsetMemberLine));
    fileToLinesMap.put(refsetFileName, Pair.of(false, invalidRefsetMemberLine));
    assertArchiveContainsLines(exportArchive, fileToLinesMap);
}
Also used : File(java.io.File) IBranchPath(com.b2international.snowowl.core.api.IBranchPath) Pair(com.b2international.commons.Pair) 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