Project

General

Profile

Actions

Task #571

closed

Write tests for searching entities using filters

Added by Peter Štrunc almost 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Marek Klement
Category:
Test
Target version:
Start date:
07/12/2017
Due date:
% Done:

100%

Estimated time:
Owner:

Description

The aim of this ticket is to test searching for entities using filters. Inspiration can be drawn from IdmTreeNodeServiceIntegrationTest.

First, tests for searching identities will be created and then the other entitity types acordingly.

Actions #1

Updated by Peter Štrunc almost 7 years ago

  • Subject changed from Improve unit test coverage on backend to Write tests for searching entities using filters
  • Description updated (diff)
Actions #2

Updated by Marek Klement almost 7 years ago

  • Status changed from New to Needs feedback
  • Assignee changed from Marek Klement to Radek Tomiška
  • % Done changed from 0 to 60

Vytvořeny testy pro IdentityFilters

Actions #3

Updated by Radek Tomiška almost 7 years ago

  • Status changed from Needs feedback to In Progress
  • Assignee changed from Radek Tomiška to Marek Klement
  • % Done changed from 60 to 80

I did review, tests look nice, i found some minors:
- @After with logout is missing (see other integration test)
- @author annotation is missing
- wrong formatting (missing new line between methods ...)
- unused variables, imports
- we don't use "final" modifiers everywhere (this is discutable, but i think we should use him only where make a sense (final [static] fields etc.) )

Actions #4

Updated by Marek Klement almost 7 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Marek Klement to Radek Tomiška

Made basic changes after feedback and also made test for IdentityRole Filter, extended TestHelper with createRoleCatalogue

Actions #5

Updated by Radek Tomiška almost 7 years ago

  • Status changed from Needs feedback to In Progress
  • Assignee changed from Radek Tomiška to Marek Klement
  • % Done changed from 80 to 70

I did review a merged branch into develop, thx!

You can continue with test for search roles.

Actions #6

Updated by Marek Klement almost 7 years ago

IdmIdentityDto identity1 = helper.createIdentity();
IdmIdentityDto identity2 = helper.createIdentity();
IdmIdentityDto identity3 = helper.createIdentity();
IdmIdentityDto identity4 = helper.createIdentity();
List<IdmIdentityDto> identities = Arrays.asList(identity1, identity2, identity3, identity4);
IdmNotificationTemplateDto template = createTestTemplate("TestTemplate6", "testSubject6");
IdmMessageDto message = new IdmMessageDto.Builder().setTemplate(template).build();
notificationManager.send(message,identities);

NotificationFilter filter = new NotificationFilter();
filter.setState(NotificationState.ALL);
Page<IdmNotificationLogDto> result = notificationLogService.find(filter, null);
assertEquals("Wrong state ALL", 1, result.getTotalElements());
filter.setState(NotificationState.NOT);
Page<IdmNotificationLogDto> result2 = notificationLogService.find(filter, null);
assertEquals("Wrong state NOT", 0, result2.getTotalElements());
filter.setState(NotificationState.PARTLY);
result = notificationLogService.find(filter, null);
assertEquals("Wrong state PARTLY", 0, result.getTotalElements());

Po nastavení filtru na NotificationState.ALL nalezne správně úspěšně odeslané notifikace, ale po nastavení podobného filtru na NotificationState.NOT by filter neměl vyhledat žádné neodeslané notifikace. Ovšem nalezne znovu vše. Při debugu správně prochází DefaultIdmNotificationLogService (NOT prochází cestou NOT a ALL cestou ALL).

Actions #7

Updated by Marek Klement almost 7 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Marek Klement to Peter Štrunc

Test for other filters were made. It is for DefaultNotificationService,DefaultIdmLongRunningTaskService and DefaultIdmRoleCatalogueService. It fully covers toPredicates.
Branch is klementm/571-test-for-filters

Actions #8

Updated by Radek Tomiška almost 7 years ago

  • Status changed from Needs feedback to In Progress
  • Assignee changed from Peter Štrunc to Marek Klement

Tests are nice, thx!

Add please tests for roles search into DefaultIdmRoleServiceIntegrationTest.

Actions #9

Updated by Marek Klement almost 7 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Marek Klement to Peter Štrunc
  • % Done changed from 70 to 80

Tests for roles filters were made and toPredicates is fully covered now. I added them in DefaultIdmRoleServiceIntegrationTest and in branch klementm/571-test-for-filters

Actions #10

Updated by Radek Tomiška over 6 years ago

  • Assignee changed from Peter Štrunc to Marek Klement
  • Target version changed from Diamond (7.4.0) to Citrine (7.3.0)
  • % Done changed from 80 to 100

Thx for new test! I've merged them into develop.

Actions #11

Updated by Radek Tomiška over 6 years ago

  • Status changed from Needs feedback to Closed
Actions

Also available in: Atom PDF