-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure that we create delete events when deleting units
verinice-veo#2854
- Loading branch information
1 parent
6240e12
commit 5811fa0
Showing
1 changed file
with
11 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,8 +30,10 @@ import org.veo.core.usecase.catalogitem.GetProfileIncarnationDescriptionUseCase | |
import org.veo.core.usecase.unit.DeleteUnitUseCase | ||
import org.veo.core.usecase.unit.DeleteUnitUseCase.InputData | ||
import org.veo.persistence.access.ClientRepositoryImpl | ||
import org.veo.persistence.access.jpa.StoredEventDataRepository | ||
import org.veo.persistence.metrics.DataSourceProxyBeanPostProcessor | ||
|
||
import groovy.json.JsonSlurper | ||
import net.ttddyy.dsproxy.QueryCountHolder | ||
|
||
@WithUserDetails("[email protected]") | ||
|
@@ -52,6 +54,9 @@ class DeleteUnitUseCaseITSpec extends AbstractPerformanceITSpec { | |
@Autowired | ||
private DeleteUnitUseCase deleteUnitUseCase | ||
|
||
@Autowired | ||
private StoredEventDataRepository storedEventDataRepository | ||
|
||
@DynamicPropertySource | ||
static void setRowCount(DynamicPropertyRegistry registry) { | ||
registry.add("veo.logging.datasource.row_count", { -> true }) | ||
|
@@ -87,6 +92,7 @@ class DeleteUnitUseCaseITSpec extends AbstractPerformanceITSpec { | |
queryCounts.time < 1000 | ||
// 115 is the currently observed count of 108 rows plus an acceptable safety margin | ||
DataSourceProxyBeanPostProcessor.totalResultSetRowsRead - rowCountBefore <= 115 | ||
storedDeleteEvents.size() == 10 | ||
} | ||
} | ||
|
||
|
@@ -186,9 +192,14 @@ class DeleteUnitUseCaseITSpec extends AbstractPerformanceITSpec { | |
queryCounts.time < 6000 | ||
// 16500 is the currently observed count of 15824 rows plus an acceptable safety margin | ||
DataSourceProxyBeanPostProcessor.totalResultSetRowsRead - rowCountBefore <= 16500 | ||
storedDeleteEvents.size() == 1100 | ||
} | ||
} | ||
|
||
def getStoredDeleteEvents() { | ||
storedEventDataRepository.findAll().findAll{it.content != null && new JsonSlurper().parseText(it.content).type == 'HARD_DELETION'} | ||
} | ||
|
||
def runUseCase(Unit unit) { | ||
executeInTransaction { | ||
deleteUnitUseCase.execute(new InputData(unit.id, unit.client)) | ||
|