Skip to content

Commit

Permalink
FRI-398 Force branch paths to be in UPPER CASE
Browse files Browse the repository at this point in the history
  • Loading branch information
QuyenLy87 committed Dec 28, 2022
1 parent e989674 commit fb8b879
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.*;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -66,6 +67,10 @@ public Branch create(String branch) {
}

public Branch create(String branchPath, Map<String, Object> metadataMap) {
if (StringUtils.hasLength(branchPath)) {
branchPath = branchPath.toUpperCase();
}

// Copy classification state from parent branch
final String parentPath = PathUtil.getParentPath(branchPath);
final Metadata metadata = new Metadata(metadataMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void createCodeSystems() {
void createCodeSystemWithBadBranchPath() {
codeSystemService.createCodeSystem(new CodeSystem("SNOMEDCT", "MAIN"));
assertEquals(1, codeSystemService.findAll().size());
CodeSystem codeSystemBe = new CodeSystem("SNOMEDCT-TEST", "MAIN.test");
CodeSystem codeSystemBe = new CodeSystem("SNOMEDCT-TEST", "MAIN.TEST");
assertThrows(IllegalArgumentException.class, () -> codeSystemService.createCodeSystem(codeSystemBe));
}

Expand Down
Loading

0 comments on commit fb8b879

Please sign in to comment.