use of org.springframework.jdbc.core.RowCallbackHandler in project dhis2-core by dhis2.
the class TrackedEntityProgramAttributeEncryptionTest method testTrackedEntityProgramAttributeEncryptedValue.
@Test
void testTrackedEntityProgramAttributeEncryptedValue() throws IOException {
TrackerImportParams trackerImportParams = fromJson("tracker/te_program_with_tea_encryption_data.json");
TrackerBundle trackerBundle = trackerBundleService.create(trackerImportParams);
trackerBundleService.commit(trackerBundle);
List<TrackedEntityInstance> trackedEntityInstances = manager.getAll(TrackedEntityInstance.class);
assertEquals(1, trackedEntityInstances.size());
TrackedEntityInstance trackedEntityInstance = trackedEntityInstances.get(0);
List<TrackedEntityAttributeValue> attributeValues = trackedEntityAttributeValueService.getTrackedEntityAttributeValues(trackedEntityInstance);
assertEquals(5, attributeValues.size());
// not really a great test, but we are using a random seed for salt, so
// it changes on every run... we might want to
// add another EncryptionConfig test profile
RowCallbackHandler handler = resultSet -> assertNotNull(resultSet.getString("encryptedvalue"));
jdbcTemplate.query("select * from trackedentityattributevalue where encryptedvalue is not null ", handler);
}
Aggregations