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);
}
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);
}
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());
}
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());
}
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);
}
Aggregations