Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public Concept toConcept(CacheService cacheService, OclConcept oclConcept) throw
conceptClass = new ConceptClass();
conceptClass.setName(oclConcept.getConceptClass());
conceptClass.setDescription("Imported from Open Concept Lab");
conceptClass.setUuid(version5Uuid("conceptClass/" + oclConcept.getConceptClass()).toString());
conceptService.saveConceptClass(conceptClass);
}
concept.setConceptClass(conceptClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,30 @@ public void importConcept_shouldCreateConceptClassIfMissing() throws Exception {

ConceptClass conceptClass = conceptService.getConceptClassByName(concept.getConceptClass());
assertThat(conceptClass, notNullValue());
assertThat(conceptClass.getUuid(), is(version5Uuid("conceptClass/" + concept.getConceptClass()).toString()));
}

/**
* @verifies generate deterministic UUID for new concept class
* @see Saver#saveConcept(CacheService, Import, OclConcept)
*/
@Test
public void importConcept_shouldGenerateDeterministicUuidForNewConceptClass() throws Exception {
Import update = importService.getLastImport();
String className = "Drug route";
String expectedUuid = version5Uuid("conceptClass/" + className).toString();

OclConcept concept = newOclConcept();
concept.setConceptClass(className);

saver.saveConcept(new CacheService(conceptService, oclConceptService), update, concept);

ConceptClass conceptClass = conceptService.getConceptClassByName(className);
assertThat(conceptClass, notNullValue());
assertThat(conceptClass.getUuid(), is(expectedUuid));

// Verify determinism: calling version5Uuid again with the same seed produces the same UUID
assertThat(version5Uuid("conceptClass/" + className).toString(), is(expectedUuid));
}

/**
Expand Down