use of com.enonic.xp.internal.blobstore.MemoryBlobStore 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();
}
use of com.enonic.xp.internal.blobstore.MemoryBlobStore in project xp by enonic.
the class ReadThroughBlobStoreTest method setUp.
@BeforeEach
public void setUp() throws Exception {
this.readThroughStore = new MemoryBlobStore();
this.finalStore = new MemoryBlobStore();
}
use of com.enonic.xp.internal.blobstore.MemoryBlobStore 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();
}
use of com.enonic.xp.internal.blobstore.MemoryBlobStore in project xp by enonic.
the class SegmentVacuumTaskTest method setUp.
@BeforeEach
public void setUp() throws Exception {
this.blobStore = new MemoryBlobStore();
this.repositoryId = RepositoryId.from("test");
this.repositoryId2 = RepositoryId.from("test2");
this.segment = RepositorySegmentUtils.toSegment(repositoryId, NodeConstants.NODE_SEGMENT_LEVEL);
this.segment2 = RepositorySegmentUtils.toSegment(repositoryId2, NodeConstants.NODE_SEGMENT_LEVEL);
this.repositoryService = Mockito.mock(RepositoryService.class);
final Branch branch = Branch.from("master");
final Repository repository = Repository.create().id(repositoryId).branches(branch).build();
final Repository repository2 = Repository.create().id(repositoryId).branches(branch).build();
Mockito.when(repositoryService.list()).thenReturn(Repositories.from(repository, repository2));
this.nodeService = Mockito.mock(NodeService.class);
Mockito.when(nodeService.findVersions(Mockito.any(NodeVersionQuery.class))).thenReturn(NodeVersionQueryResult.empty(0));
}
use of com.enonic.xp.internal.blobstore.MemoryBlobStore in project xp by enonic.
the class AbstractBlobVacuumTaskTest method setUp.
public void setUp() throws Exception {
this.blobStore = new MemoryBlobStore();
this.nodeService = Mockito.mock(NodeService.class);
Mockito.when(nodeService.findVersions(Mockito.any(NodeVersionQuery.class))).thenAnswer((invocation) -> {
final NodeVersionQuery query = invocation.getArgument(0);
final ValueFilter valueFilter = (ValueFilter) query.getQueryFilters().first();
if (valueFilter.getValues().contains(ValueFactory.newString(createBlobKey('a').toString()))) {
return NodeVersionQueryResult.empty(1);
}
return NodeVersionQueryResult.empty(0);
});
}
Aggregations