Search in sources :

Example 1 with BinaryServiceImpl

use of com.enonic.xp.repo.impl.binary.BinaryServiceImpl 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 BinaryServiceImpl

use of com.enonic.xp.repo.impl.binary.BinaryServiceImpl 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 3 with BinaryServiceImpl

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

Example 4 with BinaryServiceImpl

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

Example 5 with BinaryServiceImpl

use of com.enonic.xp.repo.impl.binary.BinaryServiceImpl in project xp by enonic.

the class AbstractContentServiceTest method setUpAbstractContentServiceTest.

@BeforeEach
public void setUpAbstractContentServiceTest() {
    executorService = Executors.newSingleThreadExecutor();
    deleteAllIndices();
    ContextAccessor.INSTANCE.set(ctxDefault());
    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);
    CommitServiceImpl commitService = new CommitServiceImpl();
    commitService.setStorageDao(storageDao);
    IndexServiceInternalImpl indexServiceInternal = new IndexServiceInternalImpl();
    indexServiceInternal.setClient(client);
    indexService = new IndexServiceImpl();
    indexService.setIndexServiceInternal(indexServiceInternal);
    NodeVersionServiceImpl nodeDao = new NodeVersionServiceImpl();
    nodeDao.setBlobStore(blobStore);
    IndexDataServiceImpl indexedDataService = new IndexDataServiceImpl();
    indexedDataService.setStorageDao(storageDao);
    NodeStorageServiceImpl storageService = new NodeStorageServiceImpl();
    storageService.setBranchService(branchService);
    storageService.setVersionService(versionService);
    storageService.setCommitService(commitService);
    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();
    mixinService = Mockito.mock(MixinService.class);
    Mockito.when(mixinService.inlineFormItems(Mockito.isA(Form.class))).then(AdditionalAnswers.returnsFirstArg());
    xDataService = Mockito.mock(XDataService.class);
    Map<String, List<String>> metadata = new HashMap<>();
    metadata.put(HttpHeaders.CONTENT_TYPE, List.of("image/jpg"));
    final ExtractedData extractedData = ExtractedData.create().metadata(metadata).build();
    final BinaryExtractor extractor = Mockito.mock(BinaryExtractor.class);
    Mockito.when(extractor.extract(Mockito.isA(ByteSource.class))).thenReturn(extractedData);
    mediaInfoService = new MediaInfoServiceImpl();
    mediaInfoService.setBinaryExtractor(extractor);
    final ResourceService resourceService = Mockito.mock(ResourceService.class);
    final SiteServiceImpl siteService = new SiteServiceImpl();
    siteService.setResourceService(resourceService);
    siteService.setMixinService(mixinService);
    contentTypeService = new ContentTypeServiceImpl(null, null, mixinService);
    PageDescriptorService pageDescriptorService = Mockito.mock(PageDescriptorService.class);
    PartDescriptorService partDescriptorService = Mockito.mock(PartDescriptorService.class);
    LayoutDescriptorService layoutDescriptorService = Mockito.mock(LayoutDescriptorService.class);
    auditLogService = Mockito.mock(AuditLogService.class);
    final ContentConfig contentConfig = Mockito.mock(ContentConfig.class);
    Mockito.when(contentConfig.auditlog_enabled()).thenReturn(Boolean.TRUE);
    final ContentAuditLogSupportImpl contentAuditLogSupport = new ContentAuditLogSupportImpl(contentConfig, new ContentAuditLogExecutorImpl(), auditLogService);
    final SecurityServiceImpl securityService = new SecurityServiceImpl(nodeService, indexService);
    securityService.initialize();
    final ProjectPermissionsContextManagerImpl projectAccessContextManager = new ProjectPermissionsContextManagerImpl();
    final ProjectServiceImpl projectService = new ProjectServiceImpl(repositoryService, indexService, nodeService, securityService, projectAccessContextManager, eventPublisher);
    projectService.initialize();
    contentService = new ContentServiceImpl(nodeService, pageDescriptorService, partDescriptorService, layoutDescriptorService);
    contentService.setEventPublisher(eventPublisher);
    contentService.setMediaInfoService(mediaInfoService);
    contentService.setSiteService(siteService);
    contentService.setContentTypeService(contentTypeService);
    contentService.setxDataService(xDataService);
    contentService.setFormDefaultValuesProcessor((form, data) -> {
    });
    contentService.setContentAuditLogSupport(contentAuditLogSupport);
    contentService.addContentValidator(new ContentNameValidator());
    contentService.addContentValidator(new SiteConfigsValidator(siteService));
    contentService.addContentValidator(new OccurrenceValidator());
    contentService.addContentValidator(new ExtraDataValidator(xDataService));
    contentService.initialize(mock(ContentConfig.class, invocation -> invocation.getMethod().getDefaultValue()));
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) IndexServiceInternalImpl(com.enonic.xp.repo.impl.elasticsearch.IndexServiceInternalImpl) AbstractElasticsearchIntegrationTest(com.enonic.xp.repo.impl.elasticsearch.AbstractElasticsearchIntegrationTest) NodeRepositoryServiceImpl(com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl) RepositoryId(com.enonic.xp.repository.RepositoryId) HttpHeaders(com.google.common.net.HttpHeaders) ContextAccessor(com.enonic.xp.context.ContextAccessor) Map(java.util.Map) CreateAttachment(com.enonic.xp.attachment.CreateAttachment) IndexServiceImpl(com.enonic.xp.repo.impl.index.IndexServiceImpl) ExtraDataValidator(com.enonic.xp.core.impl.content.validate.ExtraDataValidator) LayoutDescriptorService(com.enonic.xp.region.LayoutDescriptorService) ExtraDatas(com.enonic.xp.content.ExtraDatas) Executors(java.util.concurrent.Executors) InputTypeName(com.enonic.xp.inputtype.InputTypeName) VersionServiceImpl(com.enonic.xp.repo.impl.version.VersionServiceImpl) NodeStorageServiceImpl(com.enonic.xp.repo.impl.storage.NodeStorageServiceImpl) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) BinaryServiceImpl(com.enonic.xp.repo.impl.binary.BinaryServiceImpl) RoleKeys(com.enonic.xp.security.RoleKeys) ContentAuditLogSupportImpl(com.enonic.xp.core.impl.content.ContentAuditLogSupportImpl) Mockito.mock(org.mockito.Mockito.mock) SecurityServiceImpl(com.enonic.xp.core.impl.security.SecurityServiceImpl) ContentConstants(com.enonic.xp.content.ContentConstants) LocalDateTime(java.time.LocalDateTime) FindContentVersionsResult(com.enonic.xp.content.FindContentVersionsResult) ContentNameValidator(com.enonic.xp.core.impl.content.validate.ContentNameValidator) ContentTypeName(com.enonic.xp.schema.content.ContentTypeName) FormItemSet(com.enonic.xp.form.FormItemSet) NodeServiceImpl(com.enonic.xp.repo.impl.node.NodeServiceImpl) InputTypeProperty(com.enonic.xp.inputtype.InputTypeProperty) MediaInfoServiceImpl(com.enonic.xp.core.impl.media.MediaInfoServiceImpl) PageDescriptorService(com.enonic.xp.page.PageDescriptorService) GeoPoint(com.enonic.xp.util.GeoPoint) OccurrenceValidator(com.enonic.xp.core.impl.content.validate.OccurrenceValidator) ContentTypeServiceImpl(com.enonic.xp.core.impl.schema.content.ContentTypeServiceImpl) RelationshipTypeName(com.enonic.xp.schema.relationship.RelationshipTypeName) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) ByteSource(com.google.common.io.ByteSource) RepositoryEntryServiceImpl(com.enonic.xp.repo.impl.repository.RepositoryEntryServiceImpl) ResourceService(com.enonic.xp.resource.ResourceService) ContentPath(com.enonic.xp.content.ContentPath) PropertySet(com.enonic.xp.data.PropertySet) Content(com.enonic.xp.content.Content) IOException(java.io.IOException) AuthenticationInfo(com.enonic.xp.security.auth.AuthenticationInfo) AfterEach(org.junit.jupiter.api.AfterEach) ExtractedData(com.enonic.xp.extractor.ExtractedData) ContentIds(com.enonic.xp.content.ContentIds) ContentConfig(com.enonic.xp.core.impl.content.ContentConfig) MemoryBlobStore(com.enonic.xp.internal.blobstore.MemoryBlobStore) FindContentByParentResult(com.enonic.xp.content.FindContentByParentResult) IdProviderKey(com.enonic.xp.security.IdProviderKey) Branch(com.enonic.xp.branch.Branch) IndexDataServiceImpl(com.enonic.xp.repo.impl.storage.IndexDataServiceImpl) CommitServiceImpl(com.enonic.xp.repo.impl.commit.CommitServiceImpl) ContentId(com.enonic.xp.content.ContentId) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) FindContentByParentParams(com.enonic.xp.content.FindContentByParentParams) LocalTime(java.time.LocalTime) ContextBuilder(com.enonic.xp.context.ContextBuilder) StorageDaoImpl(com.enonic.xp.repo.impl.elasticsearch.storage.StorageDaoImpl) ProjectPermissionsContextManagerImpl(com.enonic.xp.core.impl.project.ProjectPermissionsContextManagerImpl) User(com.enonic.xp.security.User) ContentServiceImpl(com.enonic.xp.core.impl.content.ContentServiceImpl) UUID(java.util.UUID) Instant(java.time.Instant) ContentType(com.enonic.xp.schema.content.ContentType) AccessControlList(com.enonic.xp.security.acl.AccessControlList) AdditionalAnswers(org.mockito.AdditionalAnswers) BinaryExtractor(com.enonic.xp.extractor.BinaryExtractor) SearchDaoImpl(com.enonic.xp.repo.impl.elasticsearch.search.SearchDaoImpl) List(java.util.List) LocalDate(java.time.LocalDate) NodeSearchServiceImpl(com.enonic.xp.repo.impl.search.NodeSearchServiceImpl) FindContentByQueryResult(com.enonic.xp.content.FindContentByQueryResult) Context(com.enonic.xp.context.Context) ProjectServiceImpl(com.enonic.xp.core.impl.project.ProjectServiceImpl) MixinService(com.enonic.xp.schema.mixin.MixinService) ContentAuditLogExecutorImpl(com.enonic.xp.core.impl.content.ContentAuditLogExecutorImpl) SiteServiceImpl(com.enonic.xp.core.impl.site.SiteServiceImpl) CreateContentParams(com.enonic.xp.content.CreateContentParams) HashMap(java.util.HashMap) RepositoryServiceImpl(com.enonic.xp.repo.impl.repository.RepositoryServiceImpl) ContentVersion(com.enonic.xp.content.ContentVersion) CreateAttachments(com.enonic.xp.attachment.CreateAttachments) FindContentVersionsParams(com.enonic.xp.content.FindContentVersionsParams) ContentInitializer(com.enonic.xp.core.impl.project.init.ContentInitializer) AuditLogService(com.enonic.xp.audit.AuditLogService) ExecutorService(java.util.concurrent.ExecutorService) XDataService(com.enonic.xp.schema.xdata.XDataService) PropertyTree(com.enonic.xp.data.PropertyTree) PartDescriptorService(com.enonic.xp.region.PartDescriptorService) Iterator(java.util.Iterator) EventPublisherImpl(com.enonic.xp.core.impl.event.EventPublisherImpl) ContentPublishInfo(com.enonic.xp.content.ContentPublishInfo) Form(com.enonic.xp.form.Form) Mockito(org.mockito.Mockito) NodeVersionServiceImpl(com.enonic.xp.repo.impl.node.dao.NodeVersionServiceImpl) PrincipalKey(com.enonic.xp.security.PrincipalKey) Reference(com.enonic.xp.util.Reference) SiteConfigsValidator(com.enonic.xp.core.impl.content.validate.SiteConfigsValidator) Input(com.enonic.xp.form.Input) BranchServiceImpl(com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl) InputStream(java.io.InputStream) VersionServiceImpl(com.enonic.xp.repo.impl.version.VersionServiceImpl) NodeVersionServiceImpl(com.enonic.xp.repo.impl.node.dao.NodeVersionServiceImpl) EventPublisherImpl(com.enonic.xp.core.impl.event.EventPublisherImpl) ContentAuditLogExecutorImpl(com.enonic.xp.core.impl.content.ContentAuditLogExecutorImpl) Form(com.enonic.xp.form.Form) HashMap(java.util.HashMap) XDataService(com.enonic.xp.schema.xdata.XDataService) ResourceService(com.enonic.xp.resource.ResourceService) NodeRepositoryServiceImpl(com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl) RepositoryServiceImpl(com.enonic.xp.repo.impl.repository.RepositoryServiceImpl) SiteServiceImpl(com.enonic.xp.core.impl.site.SiteServiceImpl) LayoutDescriptorService(com.enonic.xp.region.LayoutDescriptorService) IndexServiceImpl(com.enonic.xp.repo.impl.index.IndexServiceImpl) NodeServiceImpl(com.enonic.xp.repo.impl.node.NodeServiceImpl) ProjectServiceImpl(com.enonic.xp.core.impl.project.ProjectServiceImpl) BinaryExtractor(com.enonic.xp.extractor.BinaryExtractor) RepositoryEntryServiceImpl(com.enonic.xp.repo.impl.repository.RepositoryEntryServiceImpl) IndexServiceInternalImpl(com.enonic.xp.repo.impl.elasticsearch.IndexServiceInternalImpl) AccessControlList(com.enonic.xp.security.acl.AccessControlList) List(java.util.List) SiteConfigsValidator(com.enonic.xp.core.impl.content.validate.SiteConfigsValidator) NodeSearchServiceImpl(com.enonic.xp.repo.impl.search.NodeSearchServiceImpl) ExtraDataValidator(com.enonic.xp.core.impl.content.validate.ExtraDataValidator) BinaryServiceImpl(com.enonic.xp.repo.impl.binary.BinaryServiceImpl) PartDescriptorService(com.enonic.xp.region.PartDescriptorService) SearchDaoImpl(com.enonic.xp.repo.impl.elasticsearch.search.SearchDaoImpl) CommitServiceImpl(com.enonic.xp.repo.impl.commit.CommitServiceImpl) NodeVersionServiceImpl(com.enonic.xp.repo.impl.node.dao.NodeVersionServiceImpl) NodeRepositoryServiceImpl(com.enonic.xp.repo.impl.repository.NodeRepositoryServiceImpl) PageDescriptorService(com.enonic.xp.page.PageDescriptorService) AuditLogService(com.enonic.xp.audit.AuditLogService) MediaInfoServiceImpl(com.enonic.xp.core.impl.media.MediaInfoServiceImpl) ContentTypeServiceImpl(com.enonic.xp.core.impl.schema.content.ContentTypeServiceImpl) IndexDataServiceImpl(com.enonic.xp.repo.impl.storage.IndexDataServiceImpl) BranchServiceImpl(com.enonic.xp.repo.impl.branch.storage.BranchServiceImpl) SecurityServiceImpl(com.enonic.xp.core.impl.security.SecurityServiceImpl) MixinService(com.enonic.xp.schema.mixin.MixinService) ContentConfig(com.enonic.xp.core.impl.content.ContentConfig) ExtractedData(com.enonic.xp.extractor.ExtractedData) OccurrenceValidator(com.enonic.xp.core.impl.content.validate.OccurrenceValidator) StorageDaoImpl(com.enonic.xp.repo.impl.elasticsearch.storage.StorageDaoImpl) ContentAuditLogSupportImpl(com.enonic.xp.core.impl.content.ContentAuditLogSupportImpl) ContentServiceImpl(com.enonic.xp.core.impl.content.ContentServiceImpl) ContentNameValidator(com.enonic.xp.core.impl.content.validate.ContentNameValidator) ProjectPermissionsContextManagerImpl(com.enonic.xp.core.impl.project.ProjectPermissionsContextManagerImpl) ByteSource(com.google.common.io.ByteSource) NodeStorageServiceImpl(com.enonic.xp.repo.impl.storage.NodeStorageServiceImpl) MemoryBlobStore(com.enonic.xp.internal.blobstore.MemoryBlobStore) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

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