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 16477a7
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 @@ -9,6 +9,7 @@
import io.kaicode.elasticvc.repositories.BranchRepository;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.sort.SortBuilders;
import org.junit.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.snomed.snowstorm.core.data.domain.CodeSystem;
Expand Down Expand Up @@ -66,6 +67,10 @@ public Branch create(String branch) {
}

public Branch create(String branchPath, Map<String, Object> metadataMap) {
if (!branchPath.toUpperCase().equals(branchPath)) {
throw new IllegalArgumentException("Branch path must be in UPPER CASE.");
}

// 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 16477a7

Please sign in to comment.