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);
}
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);
}
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();
}
Aggregations