Search in sources :

Example 1 with MacroServiceImpl

use of com.enonic.xp.impl.macro.MacroServiceImpl in project xp by enonic.

the class AbstractPortalUrlServiceImplTest method setup.

@BeforeEach
public void setup() {
    final ApplicationKey applicationKey = ApplicationKey.from("myapplication");
    final Application application = Mockito.mock(Application.class);
    when(application.getKey()).thenReturn(applicationKey);
    req = mock(HttpServletRequest.class);
    this.portalRequest = new PortalRequest();
    this.portalRequest.setBranch(Branch.from("draft"));
    this.portalRequest.setApplicationKey(applicationKey);
    this.portalRequest.setBaseUri("/site");
    this.portalRequest.setContentPath(ContentPath.from("context/path"));
    this.portalRequest.setRawRequest(req);
    this.service = new PortalUrlServiceImpl();
    this.service.setMacroService(new MacroServiceImpl());
    this.contentService = Mockito.mock(ContentService.class);
    this.service.setContentService(this.contentService);
    this.styleDescriptorService = Mockito.mock(StyleDescriptorService.class);
    when(this.styleDescriptorService.getByApplications(Mockito.any())).thenReturn(StyleDescriptors.empty());
    this.service.setStyleDescriptorService(this.styleDescriptorService);
    this.applicationService = Mockito.mock(ApplicationService.class);
    when(this.applicationService.getInstalledApplication(applicationKey)).thenReturn(application);
    this.resourceService = Mockito.mock(ResourceService.class);
    this.service.setResourceService(this.resourceService);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ApplicationKey(com.enonic.xp.app.ApplicationKey) MacroServiceImpl(com.enonic.xp.impl.macro.MacroServiceImpl) StyleDescriptorService(com.enonic.xp.style.StyleDescriptorService) ResourceService(com.enonic.xp.resource.ResourceService) ContentService(com.enonic.xp.content.ContentService) Application(com.enonic.xp.app.Application) PortalRequest(com.enonic.xp.portal.PortalRequest) ApplicationService(com.enonic.xp.app.ApplicationService) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Application (com.enonic.xp.app.Application)1 ApplicationKey (com.enonic.xp.app.ApplicationKey)1 ApplicationService (com.enonic.xp.app.ApplicationService)1 ContentService (com.enonic.xp.content.ContentService)1 MacroServiceImpl (com.enonic.xp.impl.macro.MacroServiceImpl)1 PortalRequest (com.enonic.xp.portal.PortalRequest)1 ResourceService (com.enonic.xp.resource.ResourceService)1 StyleDescriptorService (com.enonic.xp.style.StyleDescriptorService)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1