Search in sources :

Example 6 with BranchServiceImpl

use of com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl in project xp by enonic.

the class SecurityServiceImplTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    deleteAllIndices();
    final MemoryBlobStore blobStore = new MemoryBlobStore();
    final BinaryServiceImpl binaryService = new BinaryServiceImpl();
    binaryService.setBlobStore(blobStore);
    final StorageDaoImpl storageDao = new StorageDaoImpl();
    storageDao.setClient(client);
    final SearchDaoImpl searchDao = new SearchDaoImpl();
    searchDao.setClient(client);
    final BranchServiceImpl branchService = new BranchServiceImpl();
    branchService.setStorageDao(storageDao);
    branchService.setSearchDao(searchDao);
    final VersionServiceImpl versionService = new VersionServiceImpl();
    versionService.setStorageDao(storageDao);
    final NodeVersionServiceImpl nodeDao = new NodeVersionServiceImpl();
    nodeDao.setBlobStore(blobStore);
    this.indexServiceInternal = new IndexServiceInternalImpl();
    this.indexServiceInternal.setClient(client);
    final NodeSearchServiceImpl searchService = new NodeSearchServiceImpl();
    searchService.setSearchDao(searchDao);
    IndexDataServiceImpl indexedDataService = new IndexDataServiceImpl();
    indexedDataService.setStorageDao(storageDao);
    final NodeStorageServiceImpl storageService = new NodeStorageServiceImpl();
    storageService.setBranchService(branchService);
    storageService.setVersionService(versionService);
    storageService.setNodeVersionService(nodeDao);
    storageService.setIndexDataService(indexedDataService);
    final NodeRepositoryServiceImpl nodeRepositoryService = new NodeRepositoryServiceImpl();
    nodeRepositoryService.setIndexServiceInternal(this.indexServiceInternal);
    final RepositoryEntryServiceImpl repositoryEntryService = new RepositoryEntryServiceImpl();
    repositoryEntryService.setIndexServiceInternal(this.indexServiceInternal);
    repositoryEntryService.setNodeStorageService(storageService);
    repositoryEntryService.setEventPublisher(Mockito.mock(EventPublisher.class));
    this.repositoryService = new RepositoryServiceImpl(repositoryEntryService, this.indexServiceInternal, nodeRepositoryService, storageService, searchService);
    this.repositoryService.initialize();
    this.eventPublisher = Mockito.mock(EventPublisher.class);
    this.nodeService = new NodeServiceImpl();
    this.nodeService.setIndexServiceInternal(indexServiceInternal);
    this.nodeService.setNodeSearchService(searchService);
    this.nodeService.setNodeStorageService(storageService);
    this.nodeService.setBinaryService(binaryService);
    this.nodeService.setRepositoryService(repositoryService);
    this.nodeService.setEventPublisher(this.eventPublisher);
    this.nodeService.initialize();
    IndexServiceImpl indexService = new IndexServiceImpl();
    indexService.setNodeSearchService(searchService);
    indexService.setIndexServiceInternal(this.indexServiceInternal);
    AuditLogConfig auditLogConfig = Mockito.mock(AuditLogConfig.class);
    Mockito.when(auditLogConfig.isEnabled()).thenReturn(true);
    Mockito.when(auditLogConfig.isOutputLogs()).thenReturn(true);
    AuditLogService auditLogService = new AuditLogServiceImpl(auditLogConfig, indexService, repositoryService, nodeService);
    SecurityConfig securityConfig = Mockito.mock(SecurityConfig.class);
    Mockito.when(securityConfig.auditlog_enabled()).thenReturn(true);
    SecurityAuditLogSupportImpl securityAuditLogSupport = new SecurityAuditLogSupportImpl(auditLogService);
    securityAuditLogSupport.activate(securityConfig);
    securityService = new SecurityServiceImpl(this.nodeService, indexService, securityAuditLogSupport);
    runAsAdmin(() -> securityService.initialize());
}
Also used : BinaryServiceImpl(com.enonic.xp.repo.impl.binary.BinaryServiceImpl) SearchDaoImpl(com.enonic.xp.repo.impl.elasticsearch.search.SearchDaoImpl) VersionServiceImpl(com.enonic.xp.repo.impl.version.VersionServiceImpl) NodeVersionServiceImpl(com.enonic.xp.repo.impl.node.dao.NodeVersionServiceImpl) NodeVersionServiceImpl(com.enonic.xp.repo.impl.node.dao.NodeVersionServiceImpl) NodeRepositoryServiceImpl(com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl) AuditLogService(com.enonic.xp.audit.AuditLogService) EventPublisher(com.enonic.xp.event.EventPublisher) IndexDataServiceImpl(com.enonic.xp.repo.impl.storage.IndexDataServiceImpl) BranchServiceImpl(com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl) NodeRepositoryServiceImpl(com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl) RepositoryServiceImpl(com.enonic.xp.repo.impl.repository.RepositoryServiceImpl) NodeServiceImpl(com.enonic.xp.repo.impl.node.NodeServiceImpl) IndexServiceImpl(com.enonic.xp.repo.impl.index.IndexServiceImpl) AuditLogConfig(com.enonic.xp.core.impl.audit.config.AuditLogConfig) RepositoryEntryServiceImpl(com.enonic.xp.repo.impl.repository.RepositoryEntryServiceImpl) StorageDaoImpl(com.enonic.xp.repo.impl.elasticsearch.storage.StorageDaoImpl) AuditLogServiceImpl(com.enonic.xp.core.impl.audit.AuditLogServiceImpl) IndexServiceInternalImpl(com.enonic.xp.repo.impl.elasticsearch.IndexServiceInternalImpl) NodeStorageServiceImpl(com.enonic.xp.repo.impl.storage.NodeStorageServiceImpl) MemoryBlobStore(com.enonic.xp.internal.blobstore.MemoryBlobStore) NodeSearchServiceImpl(com.enonic.xp.repo.impl.search.NodeSearchServiceImpl) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

BranchServiceImpl (com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl)6 BeforeEach (org.junit.jupiter.api.BeforeEach)6 MemoryBlobStore (com.enonic.xp.internal.blobstore.MemoryBlobStore)5 BinaryServiceImpl (com.enonic.xp.repo.impl.binary.BinaryServiceImpl)5 IndexServiceInternalImpl (com.enonic.xp.repo.impl.elasticsearch.IndexServiceInternalImpl)5 SearchDaoImpl (com.enonic.xp.repo.impl.elasticsearch.search.SearchDaoImpl)5 StorageDaoImpl (com.enonic.xp.repo.impl.elasticsearch.storage.StorageDaoImpl)5 IndexServiceImpl (com.enonic.xp.repo.impl.index.IndexServiceImpl)5 NodeVersionServiceImpl (com.enonic.xp.repo.impl.node.dao.NodeVersionServiceImpl)5 NodeSearchServiceImpl (com.enonic.xp.repo.impl.search.NodeSearchServiceImpl)5 IndexDataServiceImpl (com.enonic.xp.repo.impl.storage.IndexDataServiceImpl)5 NodeStorageServiceImpl (com.enonic.xp.repo.impl.storage.NodeStorageServiceImpl)5 VersionServiceImpl (com.enonic.xp.repo.impl.version.VersionServiceImpl)5 NodeServiceImpl (com.enonic.xp.repo.impl.node.NodeServiceImpl)4 NodeRepositoryServiceImpl (com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl)4 RepositoryEntryServiceImpl (com.enonic.xp.repo.impl.repository.RepositoryEntryServiceImpl)4 RepositoryServiceImpl (com.enonic.xp.repo.impl.repository.RepositoryServiceImpl)4 AuditLogService (com.enonic.xp.audit.AuditLogService)2 Context (com.enonic.xp.context.Context)2 EventPublisherImpl (com.enonic.xp.core.impl.event.EventPublisherImpl)2