Search in sources :

Example 1 with RepositoryServiceImpl

use of com.enonic.xp.repo.impl.repository.RepositoryServiceImpl in project xp by enonic.

the class AbstractIssueServiceTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    executorService = Executors.newSingleThreadExecutor();
    deleteAllIndices();
    final Context ctx = ContextBuilder.create().branch(WS_DEFAULT).repositoryId(TEST_REPO_ID).authInfo(TEST_DEFAULT_USER_AUTHINFO).build();
    ContextAccessor.INSTANCE.set(ctx);
    final MemoryBlobStore blobStore = new MemoryBlobStore();
    binaryService = new BinaryServiceImpl();
    binaryService.setBlobStore(blobStore);
    final StorageDaoImpl storageDao = new StorageDaoImpl();
    storageDao.setClient(client);
    final EventPublisherImpl eventPublisher = new EventPublisherImpl(executorService);
    SearchDaoImpl searchDao = new SearchDaoImpl();
    searchDao.setClient(client);
    BranchServiceImpl branchService = new BranchServiceImpl();
    branchService.setStorageDao(storageDao);
    branchService.setSearchDao(searchDao);
    VersionServiceImpl versionService = new VersionServiceImpl();
    versionService.setStorageDao(storageDao);
    IndexServiceInternalImpl indexServiceInternal = new IndexServiceInternalImpl();
    indexServiceInternal.setClient(client);
    NodeVersionServiceImpl nodeDao = new NodeVersionServiceImpl();
    nodeDao.setBlobStore(blobStore);
    issueService = new IssueServiceImpl();
    IndexDataServiceImpl indexedDataService = new IndexDataServiceImpl();
    indexedDataService.setStorageDao(storageDao);
    indexService = new IndexServiceImpl();
    indexService.setIndexServiceInternal(indexServiceInternal);
    NodeStorageServiceImpl storageService = new NodeStorageServiceImpl();
    storageService.setBranchService(branchService);
    storageService.setVersionService(versionService);
    storageService.setNodeVersionService(nodeDao);
    storageService.setIndexDataService(indexedDataService);
    NodeSearchServiceImpl searchService = new NodeSearchServiceImpl();
    searchService.setSearchDao(searchDao);
    final NodeRepositoryServiceImpl nodeRepositoryService = new NodeRepositoryServiceImpl();
    nodeRepositoryService.setIndexServiceInternal(indexServiceInternal);
    final IndexServiceInternalImpl elasticsearchIndexService = new IndexServiceInternalImpl();
    elasticsearchIndexService.setClient(client);
    final RepositoryEntryServiceImpl repositoryEntryService = new RepositoryEntryServiceImpl();
    repositoryEntryService.setIndexServiceInternal(elasticsearchIndexService);
    repositoryEntryService.setNodeStorageService(storageService);
    repositoryEntryService.setNodeSearchService(searchService);
    repositoryEntryService.setEventPublisher(eventPublisher);
    repositoryEntryService.setBinaryService(binaryService);
    repositoryService = new RepositoryServiceImpl(repositoryEntryService, elasticsearchIndexService, nodeRepositoryService, storageService, searchService);
    repositoryService.initialize();
    nodeService = new NodeServiceImpl();
    nodeService.setIndexServiceInternal(indexServiceInternal);
    nodeService.setNodeStorageService(storageService);
    nodeService.setNodeSearchService(searchService);
    nodeService.setEventPublisher(eventPublisher);
    nodeService.setBinaryService(binaryService);
    nodeService.setRepositoryService(repositoryService);
    nodeService.initialize();
    Map<String, List<String>> metadata = new HashMap<>();
    metadata.put(HttpHeaders.CONTENT_TYPE, List.of("image/jpg"));
    issueService.setNodeService(nodeService);
    initializeRepository();
}
Also used : Context(com.enonic.xp.context.Context) 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) HashMap(java.util.HashMap) IndexDataServiceImpl(com.enonic.xp.repo.impl.storage.IndexDataServiceImpl) BranchServiceImpl(com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl) IssueServiceImpl(com.enonic.xp.core.impl.issue.IssueServiceImpl) 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) RepositoryEntryServiceImpl(com.enonic.xp.repo.impl.repository.RepositoryEntryServiceImpl) StorageDaoImpl(com.enonic.xp.repo.impl.elasticsearch.storage.StorageDaoImpl) IndexServiceInternalImpl(com.enonic.xp.repo.impl.elasticsearch.IndexServiceInternalImpl) NodeStorageServiceImpl(com.enonic.xp.repo.impl.storage.NodeStorageServiceImpl) List(java.util.List) MemoryBlobStore(com.enonic.xp.internal.blobstore.MemoryBlobStore) NodeSearchServiceImpl(com.enonic.xp.repo.impl.search.NodeSearchServiceImpl) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with RepositoryServiceImpl

use of com.enonic.xp.repo.impl.repository.RepositoryServiceImpl in project xp by enonic.

the class AbstractNodeTest method setUpRepositoryServices.

private void setUpRepositoryServices() {
    nodeService = new NodeServiceImpl();
    nodeService.setIndexServiceInternal(indexServiceInternal);
    nodeService.setNodeStorageService(this.storageService);
    nodeService.setNodeSearchService(this.searchService);
    nodeService.setBinaryService(this.binaryService);
    nodeService.setEventPublisher(eventPublisher);
    this.nodeRepositoryService = new NodeRepositoryServiceImpl();
    this.nodeRepositoryService.setIndexServiceInternal(this.indexServiceInternal);
    this.repositoryEntryService = new RepositoryEntryServiceImpl();
    this.repositoryEntryService.setIndexServiceInternal(this.indexServiceInternal);
    this.repositoryEntryService.setNodeStorageService(this.storageService);
    this.repositoryEntryService.setEventPublisher(eventPublisher);
    this.repositoryEntryService.setNodeSearchService(this.searchService);
    this.repositoryEntryService.setBinaryService(this.binaryService);
    this.repositoryService = new RepositoryServiceImpl(this.repositoryEntryService, this.indexServiceInternal, nodeRepositoryService, this.storageService, this.searchService);
    this.nodeService.setRepositoryService(this.repositoryService);
}
Also used : NodeRepositoryServiceImpl(com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl) RepositoryEntryServiceImpl(com.enonic.xp.repo.impl.repository.RepositoryEntryServiceImpl) NodeRepositoryServiceImpl(com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl) RepositoryServiceImpl(com.enonic.xp.repo.impl.repository.RepositoryServiceImpl)

Example 3 with RepositoryServiceImpl

use of com.enonic.xp.repo.impl.repository.RepositoryServiceImpl 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)

Example 4 with RepositoryServiceImpl

use of com.enonic.xp.repo.impl.repository.RepositoryServiceImpl in project xp by enonic.

the class SnapshotServiceImplTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    for (String repository : client.admin().cluster().prepareGetRepositories().execute().actionGet().repositories().stream().map(RepositoryMetaData::name).collect(Collectors.toList())) {
        for (String snapshot : client.admin().cluster().prepareGetSnapshots(repository).execute().actionGet().getSnapshots().stream().map(SnapshotInfo::name).collect(Collectors.toList())) {
            client.admin().cluster().prepareDeleteSnapshot(repository, snapshot).execute().actionGet();
        }
        client.admin().cluster().prepareDeleteRepository(repository).execute().actionGet();
    }
    final NodeRepositoryServiceImpl nodeRepositoryService = new NodeRepositoryServiceImpl();
    nodeRepositoryService.setIndexServiceInternal(this.indexServiceInternal);
    this.repositoryService = new RepositoryServiceImpl(this.repositoryEntryService, this.indexServiceInternal, nodeRepositoryService, this.storageService, this.searchService);
    eventPublisher = Mockito.mock(EventPublisher.class);
    final RepoConfiguration configuration = Mockito.mock(RepoConfiguration.class);
    Mockito.when(configuration.getSnapshotsDir()).thenReturn(getSnapshotsDir());
    this.snapshotService = new SnapshotServiceImpl(client, configuration, repositoryEntryService, eventPublisher, indexServiceInternal);
}
Also used : NodeRepositoryServiceImpl(com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl) EventPublisher(com.enonic.xp.event.EventPublisher) RepoConfiguration(com.enonic.xp.repo.impl.config.RepoConfiguration) NodeRepositoryServiceImpl(com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl) RepositoryServiceImpl(com.enonic.xp.repo.impl.repository.RepositoryServiceImpl) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with RepositoryServiceImpl

use of com.enonic.xp.repo.impl.repository.RepositoryServiceImpl 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);
    securityService = new SecurityServiceImpl(this.nodeService, indexService);
    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) 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) RepositoryEntryServiceImpl(com.enonic.xp.repo.impl.repository.RepositoryEntryServiceImpl) StorageDaoImpl(com.enonic.xp.repo.impl.elasticsearch.storage.StorageDaoImpl) 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

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