Skip to content

Commit

Permalink
SqaleServiceBase#opNamePrefix back to short impl class name + test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Sep 7, 2021
1 parent ff4c10d commit 09caef5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.xml.namespace.QName;

import org.springframework.test.annotation.DirtiesContext;
Expand Down Expand Up @@ -94,15 +93,13 @@ public void test201AutzJackSuperuserRole() throws Exception {
item(AccessCertificationCampaignType.F_CASE).retrieve().build();
assertSearch(AccessCertificationCampaignType.class, null, withCases, new SearchAssertion<>() {

public void assertObjects(String message, List<PrismObject<AccessCertificationCampaignType>> objects) throws Exception {
public void assertObjects(String message, List<PrismObject<AccessCertificationCampaignType>> objects) {
for (PrismObject<AccessCertificationCampaignType> obj : objects) {
assertTrue(!obj.asObjectable().getCase().isEmpty());
assertFalse(obj.asObjectable().getCase().isEmpty());
}

}

public void assertCount(int count) throws Exception {

public void assertCount(int count) {
}

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ public class SqaleServiceBase {
* Class name prefix for operation names, including the dot separator.
* Use with various `RepositoryService.OP_*` constants, not with constants without `OP_`
* prefix because they already contain class name of the service interface.
*
* [NOTE]
* This distinguishes operation names for audit and repository (e.g. `searchObjects`) - both
* in operation results and in performance monitoring (which previously didn't include class names).
* To make things compact enough, simple (short) class name is used.
*/
protected final String opNamePrefix = RepositoryService.class.getName() + '.';
protected final String opNamePrefix = getClass().getSimpleName() + '.';

protected final SqaleRepoContext sqlRepoContext;
protected final SqlPerformanceMonitorsCollection sqlPerformanceMonitorsCollection;
Expand Down Expand Up @@ -142,7 +147,9 @@ protected <T extends Containerable> long registerOperationStart(String kind, Cla
}

protected void registerOperationFinish(long opHandle, int attempt) {
performanceMonitor.registerOperationFinish(opHandle, attempt);
if (performanceMonitor != null) {
performanceMonitor.registerOperationFinish(opHandle, attempt);
}
}

@PreDestroy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ List<OperationResult> getRepoSearches() {
if (searchResults == null) {
searchResults = new ArrayList<>();
result.accept(subresult -> {
if (subresult.getOperation().startsWith("com.evolveum.midpoint.repo.api.RepositoryService.search")) {
// this works for any search operation for any repo implementation under "com...repo" package
if (subresult.getOperation().matches("com\\.evolveum\\.midpoint\\.repo\\..*\\.search.*")) {
searchResults.add(subresult);
}
});
Expand Down

0 comments on commit 09caef5

Please sign in to comment.