use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class CodeSystemApiTest method codesystem17_UpdateTitle.
@Test
public void codesystem17_UpdateTitle() {
final String codeSystemId = "cs2";
final Map<String, Object> requestBody = prepareCodeSystemCreateRequestBody(codeSystemId);
assertCodeSystemCreated(requestBody);
final Json updateRequestBody = Json.object("title", "updated name");
assertCodeSystemUpdated(codeSystemId, updateRequestBody);
assertCodeSystemHasAttributeValue(codeSystemId, "title", "updated name");
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class CodeSystemApiTest method codesystem23_DeleteVersioned.
@Test
public void codesystem23_DeleteVersioned() throws Exception {
final String codeSystemId = "cs23";
assertCodeSystemCreated(prepareCodeSystemCreateRequestBody(codeSystemId));
assertCodeSystemGet(codeSystemId).statusCode(200);
// version codesystem
final Json versionRequestBody = prepareVersionCreateRequestBody(CodeSystem.uri(codeSystemId), "v1", LocalDate.now().toString());
assertVersionCreated(versionRequestBody).statusCode(201);
// TODO add REST API
ResourceRequests.prepareDelete(codeSystemId).build(RestExtensions.USER, "Delete " + codeSystemId).execute(Services.bus()).getSync();
assertCodeSystemGet(codeSystemId).statusCode(404);
String branch = Branch.get(Branch.MAIN_PATH, codeSystemId);
assertThat(RepositoryRequests.branching().prepareGet(branch).build(TOOLING_ID).execute(Services.bus()).getSync().isDeleted()).isTrue();
CodeSystemVersionRestRequests.assertGetVersion(codeSystemId, "v1").statusCode(404);
// Check if the branch has been created
String versionBranch = Branch.get(Branch.MAIN_PATH, codeSystemId, "v1");
assertThat(RepositoryRequests.branching().prepareGet(versionBranch).build(TOOLING_ID).execute(Services.bus()).getSync().isDeleted()).isTrue();
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class CodeSystemApiTest method codesystem21_UpdateExtensionOf.
@Test
public void codesystem21_UpdateExtensionOf() {
final String parentCodeSystemId = "cs13";
final Json parentRequestBody = prepareCodeSystemCreateRequestBody(parentCodeSystemId);
assertCodeSystemCreated(parentRequestBody);
assertCodeSystemGet(parentCodeSystemId).statusCode(200);
final Json v3RequestBody = prepareVersionCreateRequestBody(CodeSystem.uri(parentCodeSystemId), "v3", "2020-04-16");
assertVersionCreated(v3RequestBody).statusCode(201);
final Json v4RequestBody = prepareVersionCreateRequestBody(CodeSystem.uri(parentCodeSystemId), "v4", "2020-04-17");
assertVersionCreated(v4RequestBody).statusCode(201);
final String codeSystemId = "cs14";
final Json requestBody = prepareCodeSystemCreateRequestBody(codeSystemId).without("branchPath").with("extensionOf", CodeSystem.uri("cs13/v3"));
assertCodeSystemCreated(requestBody);
assertCodeSystemUpdated(codeSystemId, Json.object("extensionOf", CodeSystem.uri("cs13/v4")));
final String expectedBranchPath = Branch.get(Branch.MAIN_PATH, "cs13", "v4", codeSystemId);
assertCodeSystemHasAttributeValue(codeSystemId, "extensionOf", "codesystems/cs13/v4");
assertCodeSystemHasAttributeValue(codeSystemId, "branchPath", expectedBranchPath);
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class CodeSystemApiTest method codesystem25_UpdateBundleIdNotExist.
@Test
public void codesystem25_UpdateBundleIdNotExist() {
final String codeSystemId = "cs25";
final Map<String, Object> requestBody = prepareCodeSystemCreateRequestBody(codeSystemId);
assertCodeSystemCreated(requestBody);
final Json updateRequestBody = Json.object("bundleId", "not-existing-bundle");
assertCodeSystemNotUpdated(codeSystemId, updateRequestBody);
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class CodeSystemApiTest method codesystem20_UpdateInvalidBranchPath.
@Test
public void codesystem20_UpdateInvalidBranchPath() {
final String codeSystemId = "cs3";
final Map<String, Object> requestBody = prepareCodeSystemCreateRequestBody(codeSystemId);
assertCodeSystemCreated(requestBody);
final Json updateRequestBody = Json.object("branchPath", "non-existent-branch-path");
assertCodeSystemUpdatedWithStatus(codeSystemId, updateRequestBody, 400);
}
Aggregations