Search in sources :

Example 1 with IdempotencyService

use of com.nexblocks.authguard.service.IdempotencyService in project AuthGuard by AuthGuard.

the class AccountsServiceImplTest method setup.

@BeforeEach
void setup() {
    accountsRepository = Mockito.mock(AccountsRepository.class);
    permissionsService = Mockito.mock(PermissionsService.class);
    rolesService = Mockito.mock(RolesService.class);
    idempotencyService = Mockito.mock(IdempotencyService.class);
    messageBus = Mockito.mock(MessageBus.class);
    final ConfigContext configContext = Mockito.mock(ConfigContext.class);
    final AccountConfig accountConfig = AccountConfig.builder().verifyEmail(true).verifyPhoneNumber(true).defaultRolesByDomain(ImmutableMap.of("unit", Collections.singleton("def-role"), "main", Collections.singleton("not-def-role"))).build();
    Mockito.when(configContext.asConfigBean(AccountConfig.class)).thenReturn(accountConfig);
    serviceMapper = new ServiceMapperImpl();
    accountService = new AccountsServiceImpl(accountsRepository, permissionsService, rolesService, idempotencyService, serviceMapper, messageBus, configContext);
}
Also used : MessageBus(com.nexblocks.authguard.emb.MessageBus) AccountsRepository(com.nexblocks.authguard.dal.persistence.AccountsRepository) ServiceMapperImpl(com.nexblocks.authguard.service.mappers.ServiceMapperImpl) RolesService(com.nexblocks.authguard.service.RolesService) IdempotencyService(com.nexblocks.authguard.service.IdempotencyService) PermissionsService(com.nexblocks.authguard.service.PermissionsService) ConfigContext(com.nexblocks.authguard.config.ConfigContext) AccountConfig(com.nexblocks.authguard.service.config.AccountConfig) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with IdempotencyService

use of com.nexblocks.authguard.service.IdempotencyService in project AuthGuard by AuthGuard.

the class ApplicationsServiceImplTest method setup.

@BeforeEach
void setup() {
    applicationsRepository = Mockito.mock(ApplicationsRepository.class);
    accountsService = Mockito.mock(AccountsService.class);
    idempotencyService = Mockito.mock(IdempotencyService.class);
    messageBus = Mockito.mock(MessageBus.class);
    serviceMapper = new ServiceMapperImpl();
    applicationsService = new ApplicationsServiceImpl(applicationsRepository, accountsService, idempotencyService, serviceMapper, messageBus);
}
Also used : MessageBus(com.nexblocks.authguard.emb.MessageBus) ApplicationsRepository(com.nexblocks.authguard.dal.persistence.ApplicationsRepository) ServiceMapperImpl(com.nexblocks.authguard.service.mappers.ServiceMapperImpl) AccountsService(com.nexblocks.authguard.service.AccountsService) IdempotencyService(com.nexblocks.authguard.service.IdempotencyService) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with IdempotencyService

use of com.nexblocks.authguard.service.IdempotencyService in project AuthGuard by AuthGuard.

the class CredentialsServiceImplTest method setup.

@BeforeEach
void setup() {
    accountsService = Mockito.mock(AccountsService.class);
    idempotencyService = Mockito.mock(IdempotencyService.class);
    credentialsRepository = Mockito.mock(CredentialsRepository.class);
    credentialsAuditRepository = Mockito.mock(CredentialsAuditRepository.class);
    accountTokensRepository = Mockito.mock(AccountTokensRepository.class);
    securePassword = Mockito.mock(SecurePassword.class);
    securePasswordProvider = Mockito.mock(SecurePasswordProvider.class);
    messageBus = Mockito.mock(MessageBus.class);
    serviceMapper = new ServiceMapperImpl();
    Mockito.when(securePasswordProvider.get()).thenReturn(securePassword);
    Mockito.when(securePasswordProvider.getCurrentVersion()).thenReturn(1);
    final PasswordValidator passwordValidator = new PasswordValidator(PasswordsConfig.builder().conditions(PasswordConditions.builder().build()).build());
    credentialsService = new CredentialsServiceImpl(accountsService, idempotencyService, credentialsRepository, credentialsAuditRepository, accountTokensRepository, securePasswordProvider, passwordValidator, messageBus, serviceMapper);
    Mockito.when(accountsService.getById(any())).thenReturn(Optional.of(RANDOM.nextObject(AccountBO.class)));
}
Also used : MessageBus(com.nexblocks.authguard.emb.MessageBus) CredentialsRepository(com.nexblocks.authguard.dal.persistence.CredentialsRepository) AccountTokensRepository(com.nexblocks.authguard.dal.cache.AccountTokensRepository) SecurePasswordProvider(com.nexblocks.authguard.basic.passwords.SecurePasswordProvider) ServiceMapperImpl(com.nexblocks.authguard.service.mappers.ServiceMapperImpl) AccountsService(com.nexblocks.authguard.service.AccountsService) SecurePassword(com.nexblocks.authguard.basic.passwords.SecurePassword) PasswordValidator(com.nexblocks.authguard.basic.passwords.PasswordValidator) IdempotencyService(com.nexblocks.authguard.service.IdempotencyService) CredentialsAuditRepository(com.nexblocks.authguard.dal.persistence.CredentialsAuditRepository) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

MessageBus (com.nexblocks.authguard.emb.MessageBus)3 IdempotencyService (com.nexblocks.authguard.service.IdempotencyService)3 ServiceMapperImpl (com.nexblocks.authguard.service.mappers.ServiceMapperImpl)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 AccountsService (com.nexblocks.authguard.service.AccountsService)2 PasswordValidator (com.nexblocks.authguard.basic.passwords.PasswordValidator)1 SecurePassword (com.nexblocks.authguard.basic.passwords.SecurePassword)1 SecurePasswordProvider (com.nexblocks.authguard.basic.passwords.SecurePasswordProvider)1 ConfigContext (com.nexblocks.authguard.config.ConfigContext)1 AccountTokensRepository (com.nexblocks.authguard.dal.cache.AccountTokensRepository)1 AccountsRepository (com.nexblocks.authguard.dal.persistence.AccountsRepository)1 ApplicationsRepository (com.nexblocks.authguard.dal.persistence.ApplicationsRepository)1 CredentialsAuditRepository (com.nexblocks.authguard.dal.persistence.CredentialsAuditRepository)1 CredentialsRepository (com.nexblocks.authguard.dal.persistence.CredentialsRepository)1 PermissionsService (com.nexblocks.authguard.service.PermissionsService)1 RolesService (com.nexblocks.authguard.service.RolesService)1 AccountConfig (com.nexblocks.authguard.service.config.AccountConfig)1