Search in sources :

Example 1 with AuditLogConfig

use of com.enonic.xp.core.impl.audit.config.AuditLogConfig in project xp by enonic.

the class AuditLogRepoInitializerTest method setUp.

@BeforeEach
public void setUp() {
    RepositoryService repositoryService = Mockito.mock(RepositoryService.class);
    IndexService indexService = Mockito.mock(IndexService.class);
    AuditLogConfig config = Mockito.mock(AuditLogConfig.class);
    Mockito.when(config.isEnabled()).thenReturn(true);
    Mockito.when(config.isOutputLogs()).thenReturn(true);
    auditLogService = new AuditLogServiceImpl(config, indexService, repositoryService, null);
    Mockito.when(indexService.isMaster()).thenReturn(true);
    Mockito.when(indexService.waitForYellowStatus()).thenReturn(true);
    Mockito.when(repositoryService.createRepository(Mockito.any(CreateRepositoryParams.class))).thenReturn(null);
    Mockito.when(repositoryService.isInitialized(Mockito.any(RepositoryId.class))).thenReturn(false);
}
Also used : CreateRepositoryParams(com.enonic.xp.repository.CreateRepositoryParams) IndexService(com.enonic.xp.index.IndexService) RepositoryId(com.enonic.xp.repository.RepositoryId) AuditLogConfig(com.enonic.xp.core.impl.audit.config.AuditLogConfig) RepositoryService(com.enonic.xp.repository.RepositoryService) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with AuditLogConfig

use of com.enonic.xp.core.impl.audit.config.AuditLogConfig in project xp by enonic.

the class AuditLogServiceImplDisabledTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    AuditLogConfig config = Mockito.mock(AuditLogConfig.class);
    Mockito.when(config.isEnabled()).thenReturn(false);
    Mockito.when(config.isOutputLogs()).thenReturn(true);
    IndexService indexService = Mockito.mock(IndexService.class);
    Mockito.when(indexService.waitForYellowStatus()).thenReturn(true);
    Mockito.when(indexService.isMaster()).thenReturn(true);
    RepositoryService repositoryService = Mockito.mock(RepositoryService.class);
    auditLogService = new AuditLogServiceImpl(config, indexService, repositoryService, null);
    auditLogService.initialize();
}
Also used : IndexService(com.enonic.xp.index.IndexService) AuditLogConfig(com.enonic.xp.core.impl.audit.config.AuditLogConfig) RepositoryService(com.enonic.xp.repository.RepositoryService) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with AuditLogConfig

use of com.enonic.xp.core.impl.audit.config.AuditLogConfig in project xp by enonic.

the class AbstractAuditLogServiceTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    executorService = Executors.newSingleThreadExecutor();
    deleteAllIndices();
    final MemoryBlobStore blobStore = new MemoryBlobStore();
    this.binaryService = new BinaryServiceImpl();
    this.binaryService.setBlobStore(blobStore);
    final StorageDaoImpl storageDao = new StorageDaoImpl();
    storageDao.setClient(client);
    final EventPublisherImpl eventPublisher = new EventPublisherImpl(executorService);
    this.searchDao = new SearchDaoImpl();
    this.searchDao.setClient(client);
    this.branchService = new BranchServiceImpl();
    this.branchService.setStorageDao(storageDao);
    this.branchService.setSearchDao(this.searchDao);
    this.versionService = new VersionServiceImpl();
    this.versionService.setStorageDao(storageDao);
    this.indexServiceInternal = new IndexServiceInternalImpl();
    this.indexServiceInternal.setClient(client);
    this.nodeDao = new NodeVersionServiceImpl();
    this.nodeDao.setBlobStore(blobStore);
    this.indexedDataService = new IndexDataServiceImpl();
    this.indexedDataService.setStorageDao(storageDao);
    this.indexService = new IndexServiceImpl();
    this.indexService.setIndexServiceInternal(this.indexServiceInternal);
    this.storageService = new NodeStorageServiceImpl();
    this.storageService.setBranchService(this.branchService);
    this.storageService.setVersionService(this.versionService);
    this.storageService.setNodeVersionService(this.nodeDao);
    this.storageService.setIndexDataService(this.indexedDataService);
    this.searchService = new NodeSearchServiceImpl();
    this.searchService.setSearchDao(this.searchDao);
    final NodeRepositoryServiceImpl nodeRepositoryService = new NodeRepositoryServiceImpl();
    nodeRepositoryService.setIndexServiceInternal(this.indexServiceInternal);
    final IndexServiceInternalImpl elasticsearchIndexService = new IndexServiceInternalImpl();
    elasticsearchIndexService.setClient(client);
    final RepositoryEntryServiceImpl repositoryEntryService = new RepositoryEntryServiceImpl();
    repositoryEntryService.setIndexServiceInternal(elasticsearchIndexService);
    repositoryEntryService.setNodeStorageService(this.storageService);
    repositoryEntryService.setNodeSearchService(this.searchService);
    repositoryEntryService.setEventPublisher(eventPublisher);
    repositoryEntryService.setBinaryService(this.binaryService);
    this.repositoryService = new RepositoryServiceImpl(repositoryEntryService, elasticsearchIndexService, nodeRepositoryService, this.storageService, this.searchService);
    this.repositoryService.initialize();
    this.nodeService = new NodeServiceImpl();
    this.nodeService.setIndexServiceInternal(indexServiceInternal);
    this.nodeService.setNodeStorageService(storageService);
    this.nodeService.setNodeSearchService(searchService);
    this.nodeService.setEventPublisher(eventPublisher);
    this.nodeService.setBinaryService(this.binaryService);
    this.nodeService.setRepositoryService(this.repositoryService);
    this.nodeService.initialize();
    AuditLogConfig config = Mockito.mock(AuditLogConfig.class);
    Mockito.when(config.isEnabled()).thenReturn(true);
    Mockito.when(config.isOutputLogs()).thenReturn(true);
    this.auditLogService = new AuditLogServiceImpl(config, this.indexService, this.repositoryService, this.nodeService);
    this.auditLogService.initialize();
    initializeRepository();
}
Also used : BinaryServiceImpl(com.enonic.xp.repo.impl.binary.BinaryServiceImpl) SearchDaoImpl(com.enonic.xp.repo.impl.elasticsearch.search.SearchDaoImpl) NodeVersionServiceImpl(com.enonic.xp.repo.impl.node.dao.NodeVersionServiceImpl) VersionServiceImpl(com.enonic.xp.repo.impl.version.VersionServiceImpl) NodeVersionServiceImpl(com.enonic.xp.repo.impl.node.dao.NodeVersionServiceImpl) NodeRepositoryServiceImpl(com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl) EventPublisherImpl(com.enonic.xp.core.impl.event.EventPublisherImpl) 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) IndexServiceImpl(com.enonic.xp.repo.impl.index.IndexServiceImpl) NodeServiceImpl(com.enonic.xp.repo.impl.node.NodeServiceImpl) 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

AuditLogConfig (com.enonic.xp.core.impl.audit.config.AuditLogConfig)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 IndexService (com.enonic.xp.index.IndexService)2 RepositoryService (com.enonic.xp.repository.RepositoryService)2 AuditLogServiceImpl (com.enonic.xp.core.impl.audit.AuditLogServiceImpl)1 EventPublisherImpl (com.enonic.xp.core.impl.event.EventPublisherImpl)1 MemoryBlobStore (com.enonic.xp.internal.blobstore.MemoryBlobStore)1 BinaryServiceImpl (com.enonic.xp.repo.impl.binary.BinaryServiceImpl)1 BranchServiceImpl (com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl)1 IndexServiceInternalImpl (com.enonic.xp.repo.impl.elasticsearch.IndexServiceInternalImpl)1 SearchDaoImpl (com.enonic.xp.repo.impl.elasticsearch.search.SearchDaoImpl)1 StorageDaoImpl (com.enonic.xp.repo.impl.elasticsearch.storage.StorageDaoImpl)1 IndexServiceImpl (com.enonic.xp.repo.impl.index.IndexServiceImpl)1 NodeServiceImpl (com.enonic.xp.repo.impl.node.NodeServiceImpl)1 NodeVersionServiceImpl (com.enonic.xp.repo.impl.node.dao.NodeVersionServiceImpl)1 NodeRepositoryServiceImpl (com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl)1 RepositoryEntryServiceImpl (com.enonic.xp.repo.impl.repository.RepositoryEntryServiceImpl)1 RepositoryServiceImpl (com.enonic.xp.repo.impl.repository.RepositoryServiceImpl)1 NodeSearchServiceImpl (com.enonic.xp.repo.impl.search.NodeSearchServiceImpl)1 IndexDataServiceImpl (com.enonic.xp.repo.impl.storage.IndexDataServiceImpl)1