Search in sources :

Example 1 with EventPublisher

use of com.enonic.xp.event.EventPublisher in project xp by enonic.

the class ApplicationServiceImplTest method initService.

@BeforeEach
public void initService() {
    final BundleContext bundleContext = getBundleContext();
    this.applicationRegistry = new ApplicationRegistryImpl(bundleContext, new ApplicationListenerHub(), new ApplicationFactoryServiceMock());
    this.eventPublisher = mock(EventPublisher.class);
    this.appFilterService = mock(AppFilterService.class);
    when(appFilterService.accept(any(ApplicationKey.class))).thenReturn(true);
    this.service = new ApplicationServiceImpl(bundleContext, applicationRegistry, repoService, eventPublisher, appFilterService);
}
Also used : ApplicationKey(com.enonic.xp.app.ApplicationKey) EventPublisher(com.enonic.xp.event.EventPublisher) BundleContext(org.osgi.framework.BundleContext) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with EventPublisher

use of com.enonic.xp.event.EventPublisher 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 3 with EventPublisher

use of com.enonic.xp.event.EventPublisher in project xp by enonic.

the class AbstractNodeTest method setUpNode.

@BeforeEach
protected void setUpNode() throws Exception {
    eventPublisher = Mockito.mock(EventPublisher.class);
    deleteAllIndices();
    final RepoConfiguration repoConfig = Mockito.mock(RepoConfiguration.class);
    Mockito.when(repoConfig.getSnapshotsDir()).thenReturn(this.temporaryFolder.resolve("repo").resolve("snapshots"));
    System.setProperty("xp.home", temporaryFolder.toFile().getPath());
    System.setProperty("mapper.allow_dots_in_name", "true");
    ContextAccessor.INSTANCE.set(ctxDefault());
    this.blobStore = new MemoryBlobStore();
    this.binaryService = new BinaryServiceImpl();
    this.binaryService.setBlobStore(blobStore);
    storageDao = new StorageDaoImpl();
    storageDao.setClient(client);
    this.searchDao = new SearchDaoImpl();
    this.searchDao.setClient(client);
    this.indexServiceInternal = new IndexServiceInternalImpl();
    this.indexServiceInternal.setClient(client);
    // Branch and version-services
    this.branchService = new BranchServiceImpl();
    this.branchService.setStorageDao(storageDao);
    this.branchService.setSearchDao(this.searchDao);
    this.versionService = new VersionServiceImpl();
    this.versionService.setStorageDao(storageDao);
    this.commitService = new CommitServiceImpl();
    this.commitService.setStorageDao(storageDao);
    // Storage-service
    this.nodeDao = new NodeVersionServiceImpl();
    this.nodeDao.setBlobStore(blobStore);
    this.indexedDataService = new IndexDataServiceImpl();
    this.indexedDataService.setStorageDao(storageDao);
    this.storageService = new NodeStorageServiceImpl();
    this.storageService.setVersionService(this.versionService);
    this.storageService.setBranchService(this.branchService);
    this.storageService.setCommitService(this.commitService);
    this.storageService.setNodeVersionService(this.nodeDao);
    this.storageService.setIndexDataService(this.indexedDataService);
    // Search-service
    this.searchService = new NodeSearchServiceImpl();
    this.searchService.setSearchDao(this.searchDao);
    setUpRepositoryServices();
    indexService = new IndexServiceImpl();
    indexService.setIndexDataService(this.indexedDataService);
    indexService.setIndexServiceInternal(this.indexServiceInternal);
    indexService.setNodeSearchService(this.searchService);
    indexService.setNodeVersionService(this.nodeDao);
    indexService.setRepositoryEntryService(this.repositoryEntryService);
    bootstrap();
    createTestRepository();
}
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) CommitServiceImpl(com.enonic.xp.repo.impl.commit.CommitServiceImpl) NodeVersionServiceImpl(com.enonic.xp.repo.impl.node.dao.NodeVersionServiceImpl) EventPublisher(com.enonic.xp.event.EventPublisher) IndexDataServiceImpl(com.enonic.xp.repo.impl.storage.IndexDataServiceImpl) BranchServiceImpl(com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl) IndexServiceImpl(com.enonic.xp.repo.impl.index.IndexServiceImpl) StorageDaoImpl(com.enonic.xp.repo.impl.elasticsearch.storage.StorageDaoImpl) RepoConfiguration(com.enonic.xp.repo.impl.config.RepoConfiguration) 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

EventPublisher (com.enonic.xp.event.EventPublisher)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 RepoConfiguration (com.enonic.xp.repo.impl.config.RepoConfiguration)2 ApplicationKey (com.enonic.xp.app.ApplicationKey)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 CommitServiceImpl (com.enonic.xp.repo.impl.commit.CommitServiceImpl)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 NodeVersionServiceImpl (com.enonic.xp.repo.impl.node.dao.NodeVersionServiceImpl)1 NodeRepositoryServiceImpl (com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl)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 NodeStorageServiceImpl (com.enonic.xp.repo.impl.storage.NodeStorageServiceImpl)1 VersionServiceImpl (com.enonic.xp.repo.impl.version.VersionServiceImpl)1 BundleContext (org.osgi.framework.BundleContext)1