use of com.enonic.xp.site.SiteService in project xp by enonic.
the class ProcessorChainResolverTest method before.
@BeforeEach
public void before() {
portalRequest = new PortalRequest();
siteService = Mockito.mock(SiteService.class);
resolver = new ProcessorChainResolver();
resolver.setSiteService(siteService);
}
use of com.enonic.xp.site.SiteService in project xp by enonic.
the class UpdateNodeParamsFactory method toNodeEditor.
private NodeEditor toNodeEditor(final UpdateContentTranslatorParams params) {
final Content content = params.getEditedContent();
final PropertyTree nodeData = contentDataSerializer.toUpdateNodeData(params);
final ContentIndexConfigFactory indexConfigFactory = ContentIndexConfigFactory.create().contentTypeService(contentTypeService).pageDescriptorService(pageDescriptorService).partDescriptorService(partDescriptorService).layoutDescriptorService(layoutDescriptorService).siteService(this.siteService).xDataService(this.xDataService).contentTypeName(content.getType()).page(content.getPage()).siteConfigs(content.isSite() ? ((Site) content).getSiteConfigs() : null).extraDatas(content.getAllExtraData()).language(content.getLanguage() != null ? content.getLanguage().getLanguage() : null).build();
return editableNode -> {
editableNode.indexConfigDocument = indexConfigFactory.produce();
editableNode.data = nodeData;
editableNode.manualOrderValue = content.getManualOrderValue();
editableNode.permissions = content.getPermissions();
editableNode.inheritPermissions = content.inheritsPermissions();
};
}
use of com.enonic.xp.site.SiteService in project xp by enonic.
the class HtmlAreaContentProcessorTest method setUp.
@BeforeEach
public void setUp() throws Exception {
this.siteService = Mockito.mock(SiteService.class);
this.xDataService = Mockito.mock(XDataService.class);
this.contentTypeService = Mockito.mock(ContentTypeService.class);
this.pageDescriptorService = Mockito.mock(PageDescriptorService.class);
this.partDescriptorService = Mockito.mock(PartDescriptorService.class);
this.layoutDescriptorService = Mockito.mock(LayoutDescriptorService.class);
contentTypeName = ContentTypeName.from("myContentType");
final GetContentTypeParams params = GetContentTypeParams.from(contentTypeName);
contentType = ContentType.create().name(contentTypeName).superType(ContentTypeName.folder()).form(Form.create().addFormItem(Input.create().name("htmlData").label("htmlData").inputType(InputTypeName.HTML_AREA).build()).build()).build();
final ProcessUpdateParams processUpdateParams = ProcessUpdateParams.create().contentType(contentType).build();
Mockito.when(contentTypeService.getByName(params)).thenReturn(contentType);
Mockito.when(xDataService.getByNames(Mockito.isA(XDataNames.class))).thenReturn(XDatas.empty());
htmlAreaContentProcessor = new HtmlAreaContentProcessor();
htmlAreaContentProcessor.setContentTypeService(contentTypeService);
htmlAreaContentProcessor.setSiteService(siteService);
htmlAreaContentProcessor.setXDataService(xDataService);
htmlAreaContentProcessor.setPageDescriptorService(pageDescriptorService);
htmlAreaContentProcessor.setPartDescriptorService(partDescriptorService);
htmlAreaContentProcessor.setLayoutDescriptorService(layoutDescriptorService);
result = htmlAreaContentProcessor.processUpdate(processUpdateParams);
}
use of com.enonic.xp.site.SiteService in project xp by enonic.
the class MappingHandlerTest method setup.
@BeforeEach
public final void setup() throws Exception {
this.request = new PortalRequest();
final ControllerScriptFactory controllerScriptFactory = mock(ControllerScriptFactory.class);
ControllerScript controllerScript = mock(ControllerScript.class);
when(controllerScriptFactory.fromDir(Mockito.any())).thenReturn(controllerScript);
final PortalResponse portalResponse = PortalResponse.create().build();
when(controllerScript.execute(Mockito.any())).thenReturn(portalResponse);
FilterScriptFactory filterScriptFactory = mock(FilterScriptFactory.class);
FilterScript filterScript = mock(FilterScript.class);
when(filterScriptFactory.fromScript(Mockito.any())).thenReturn(filterScript);
when(filterScript.execute(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(portalResponse);
this.resourceService = mock(ResourceService.class);
final Resource resourceNotFound = mock(Resource.class);
when(resourceNotFound.exists()).thenReturn(false);
final Resource resource = mock(Resource.class);
when(resource.exists()).thenReturn(true);
when(this.resourceService.getResource(ResourceKey.from("demo:/services/test"))).thenReturn(resource);
this.contentService = mock(ContentService.class);
this.rendererDelegate = mock(RendererDelegate.class);
this.siteService = mock(SiteService.class);
this.handler = new MappingHandler(resourceService, controllerScriptFactory, filterScriptFactory, rendererDelegate, new ControllerMappingsResolver(siteService), new ContentResolver(contentService));
this.request.setMethod(HttpMethod.GET);
}
Aggregations