use of com.b2international.snowowl.core.ResourceURI in project snow-owl by b2ihealthcare.
the class SnomedExtensionUpgradeTest method upgrade19UpgradeFromCodeSystemVersionWithUnpublishedAndPublishedChanges.
@Test
public void upgrade19UpgradeFromCodeSystemVersionWithUnpublishedAndPublishedChanges() {
// create extension on the latest SI VERSION
CodeSystem extension = createExtension(latestInternationalVersion, branchPath.lastSegment());
// new SI concept
String newConceptId = createConcept(SnomedContentRule.SNOMEDCT, createConceptRequestBody(Concepts.ROOT_CONCEPT, Concepts.MODULE_SCT_CORE));
// create a new INT version
LocalDate effectiveDate = getNextAvailableEffectiveDate(SNOMEDCT);
createVersion(SNOMEDCT, effectiveDate).statusCode(201);
ResourceURI upgradeVersion = CodeSystem.uri(SNOMEDCT, effectiveDate.toString());
// new SE concept
String extensionModuleId = createModule(extension);
String newConceptId2 = createConcept(extension.getResourceURI(), createConceptRequestBody(Concepts.ROOT_CONCEPT, extensionModuleId));
// version extension
LocalDate effectiveDate2 = LocalDate.now();
createVersion(extension.getId(), effectiveDate2).statusCode(201);
ResourceURI extensionVersion = CodeSystem.uri(extension.getId(), effectiveDate2.toString());
// start upgrade to the new available upgrade version
CodeSystem upgradeCodeSystem = createExtensionUpgrade(extensionVersion, upgradeVersion);
assertEquals(upgradeVersion, upgradeCodeSystem.getExtensionOf());
// new SE concept
String newConceptId3 = createConcept(extension.getResourceURI(), createConceptRequestBody(Concepts.ROOT_CONCEPT, extensionModuleId));
getComponent(upgradeCodeSystem.getResourceURI(), SnomedComponentType.CONCEPT, newConceptId).statusCode(200);
getComponent(upgradeCodeSystem.getResourceURI(), SnomedComponentType.CONCEPT, newConceptId2).statusCode(200);
getComponent(upgradeCodeSystem.getResourceURI(), SnomedComponentType.CONCEPT, newConceptId3).statusCode(404);
}
use of com.b2international.snowowl.core.ResourceURI in project snow-owl by b2ihealthcare.
the class SnomedExtensionUpgradeTest method upgrade14CompleteUpgrade.
@Test
public void upgrade14CompleteUpgrade() throws Exception {
// create extension on the latest SI VERSION
CodeSystem extension = createExtension(latestInternationalVersion, branchPath.lastSegment());
// create a new INT version without any changes
LocalDate effectiveTime = getNextAvailableEffectiveDate(SNOMEDCT);
createVersion(SNOMEDCT, effectiveTime).statusCode(201);
ResourceURI upgradeVersion = CodeSystem.uri(SNOMEDCT, effectiveTime.toString());
// create new extension version with one new concept, module in this case
String moduleId = createModule(extension);
createVersion(extension.getId(), "v1", LocalDate.now()).statusCode(201);
// start upgrade to the new available upgrade version
CodeSystem upgradeCodeSystem = createExtensionUpgrade(extension.getResourceURI(), upgradeVersion);
assertEquals(upgradeVersion, upgradeCodeSystem.getExtensionOf());
getComponent(upgradeCodeSystem.getResourceURI(), SnomedComponentType.CONCEPT, moduleId).statusCode(200);
Boolean success = CodeSystemRequests.prepareComplete(upgradeCodeSystem.getId()).buildAsync().execute(getBus()).getSync(1, TimeUnit.MINUTES);
assertTrue(success);
// after upgrade completion, the upgrade Code System is no longer available
CodeSystemRestRequests.assertGetCodeSystem(upgradeCodeSystem.getId()).statusCode(404);
// the extension should use the upgrade's branch
CodeSystem afterUpgrade = CodeSystemRestRequests.getCodeSystem(upgradeCodeSystem.getUpgradeOf().getResourceId());
assertThat(afterUpgrade.getBranchPath()).isEqualTo(upgradeCodeSystem.getBranchPath());
assertThat(afterUpgrade.getExtensionOf()).isEqualByComparingTo(upgradeCodeSystem.getExtensionOf());
}
use of com.b2international.snowowl.core.ResourceURI in project snow-owl by b2ihealthcare.
the class SnomedExtensionUpgradeTest method upgrade16UpgradeFromCodeSystemVersion.
@Test
public void upgrade16UpgradeFromCodeSystemVersion() {
// create extension on the latest SI VERSION
CodeSystem extension = createExtension(latestInternationalVersion, branchPath.lastSegment());
// new SI concept
String newConceptId = createConcept(SnomedContentRule.SNOMEDCT, createConceptRequestBody(Concepts.ROOT_CONCEPT, Concepts.MODULE_SCT_CORE));
// create a new INT version
LocalDate effectiveTime = getNextAvailableEffectiveDate(SNOMEDCT);
createVersion(SNOMEDCT, effectiveTime).statusCode(201);
ResourceURI upgradeVersion = CodeSystem.uri(SNOMEDCT, effectiveTime.toString());
// version extension
LocalDate effectiveDate2 = LocalDate.now();
createVersion(extension.getId(), effectiveDate2).statusCode(201);
ResourceURI extensionVersion = CodeSystem.uri(extension.getId(), effectiveDate2.toString());
// start upgrade to the new available upgrade version
CodeSystem upgradeCodeSystem = createExtensionUpgrade(extensionVersion, upgradeVersion);
assertEquals(upgradeVersion, upgradeCodeSystem.getExtensionOf());
getComponent(upgradeCodeSystem.getResourceURI(), SnomedComponentType.CONCEPT, newConceptId).statusCode(200);
}
use of com.b2international.snowowl.core.ResourceURI in project snow-owl by b2ihealthcare.
the class SnomedExtensionUpgradeTest method upgrade21ExpandUpgradeInfo.
@Test
public void upgrade21ExpandUpgradeInfo() throws Exception {
// create extension on the latest SI VERSION
CodeSystem extension = createExtension(latestInternationalVersion, branchPath.lastSegment());
// new SI concept
createConcept(SnomedContentRule.SNOMEDCT, createConceptRequestBody(Concepts.ROOT_CONCEPT, Concepts.MODULE_SCT_CORE));
// create a new INT version
LocalDate effectiveDate = getNextAvailableEffectiveDate(SNOMEDCT);
createVersion(SNOMEDCT, effectiveDate).statusCode(201);
ResourceURI upgradeVersion = CodeSystem.uri(SNOMEDCT, effectiveDate.toString());
// new SE concept
String extensionModuleId = createModule(extension);
createConcept(extension.getResourceURI(), createConceptRequestBody(Concepts.ROOT_CONCEPT, extensionModuleId));
// version extension
LocalDate effectiveDate2 = LocalDate.now();
createVersion(extension.getId(), effectiveDate2).statusCode(201);
ResourceURI extensionVersion = CodeSystem.uri(extension.getId(), effectiveDate2.toString());
// start upgrade to the new available upgrade version
CodeSystem upgradeCodeSystem = createExtensionUpgrade(extensionVersion, upgradeVersion);
// new SE concept
createConcept(extension.getResourceURI(), createConceptRequestBody(Concepts.ROOT_CONCEPT, extensionModuleId));
// version extension
LocalDate effectiveDate3 = getNextAvailableEffectiveDate(extension.getId());
createVersion(extension.getId(), effectiveDate3).statusCode(201);
ResourceURI extensionVersion2 = CodeSystem.uri(extension.getId(), effectiveDate3.toString());
CodeSystems expandedCodeSystems = CodeSystemRestRequests.search(upgradeCodeSystem.getId(), CodeSystem.Expand.UPGRADE_INFO + "()");
assertEquals(upgradeVersion, upgradeCodeSystem.getExtensionOf());
assertThat(expandedCodeSystems.first().get().getUpgradeInfo().getAvailableVersions()).doesNotContainSequence(extensionVersion);
assertThat(expandedCodeSystems.first().get().getUpgradeInfo().getAvailableVersions()).contains(extensionVersion2);
}
use of com.b2international.snowowl.core.ResourceURI in project snow-owl by b2ihealthcare.
the class SnomedExtensionUpgradeTest method upgrade04InternationalAddedDirectlyToExtensionResultsInConflict.
@Test
public void upgrade04InternationalAddedDirectlyToExtensionResultsInConflict() {
// create extension on the latest SI VERSION
CodeSystem extension = createExtension(latestInternationalVersion, branchPath.lastSegment());
// new SI concept
String newConceptId = createConcept(SnomedContentRule.SNOMEDCT, createConceptRequestBody(Concepts.ROOT_CONCEPT, Concepts.MODULE_SCT_CORE));
// create a new INT version
LocalDate effectiveTime = getNextAvailableEffectiveDate(SNOMEDCT);
createVersion(SNOMEDCT, effectiveTime).statusCode(201);
ResourceURI upgradeVersion = CodeSystem.uri(SNOMEDCT, effectiveTime.toString());
// replay SI concept on extension branch, simulating direct import of a preview or release SI RF2
createConcept(extension.getResourceURI(), createConceptRequestBody(Concepts.ROOT_CONCEPT, Concepts.MODULE_SCT_CORE).with("id", newConceptId));
createVersion(extension.getId(), "v1", LocalDate.now()).statusCode(201);
// start upgrade but it fails due to same content present on both sides
assertCodeSystemUpgrade(extension.getResourceURI(), upgradeVersion).statusCode(409);
}
Aggregations