Search in sources :

Example 1 with PageDescriptors

use of com.enonic.xp.page.PageDescriptors in project xp by enonic.

the class ApplicationInfoServiceImplTest method mockPageDescriptors.

private void mockPageDescriptors(final ApplicationKey applicationKey) {
    final PageDescriptor pageDescriptor1 = PageDescriptor.create().displayName("Landing page").config(Form.create().build()).regions(RegionDescriptors.create().build()).key(DescriptorKey.from("module:landing-page")).build();
    final PageDescriptor pageDescriptor2 = PageDescriptor.create().displayName("Log out").config(Form.create().build()).regions(RegionDescriptors.create().build()).key(DescriptorKey.from("module:logout-page")).build();
    final PageDescriptors pageDescriptors = PageDescriptors.from(pageDescriptor1, pageDescriptor2);
    Mockito.when(pageDescriptorService.getByApplication(applicationKey)).thenReturn(pageDescriptors);
}
Also used : PageDescriptor(com.enonic.xp.page.PageDescriptor) PageDescriptors(com.enonic.xp.page.PageDescriptors)

Example 2 with PageDescriptors

use of com.enonic.xp.page.PageDescriptors in project xp by enonic.

the class PageDescriptorServiceTest method testGetByApplication.

@Test
public void testGetByApplication() throws Exception {
    final PageDescriptors result = this.service.getByApplication(ApplicationKey.from("myapp1"));
    assertNotNull(result);
    assertEquals(1, result.getSize());
}
Also used : PageDescriptors(com.enonic.xp.page.PageDescriptors) Test(org.junit.jupiter.api.Test)

Example 3 with PageDescriptors

use of com.enonic.xp.page.PageDescriptors in project xp by enonic.

the class PageDescriptorServiceTest method testGetByApplications.

@Test
public void testGetByApplications() throws Exception {
    final PageDescriptors result = this.service.getByApplications(ApplicationKeys.from("myapp1", "myapp2"));
    assertNotNull(result);
    assertEquals(2, result.getSize());
}
Also used : PageDescriptors(com.enonic.xp.page.PageDescriptors) Test(org.junit.jupiter.api.Test)

Example 4 with PageDescriptors

use of com.enonic.xp.page.PageDescriptors in project xp by enonic.

the class ApplicationInfoServiceImplTest method testPages.

@Test
public void testPages() {
    mockPageDescriptors(this.applicationKey);
    final PageDescriptors pageDescriptors = this.service.getPageDescriptors(this.applicationKey);
    assertEquals(pageDescriptors.getSize(), 2);
}
Also used : PageDescriptors(com.enonic.xp.page.PageDescriptors) Test(org.junit.jupiter.api.Test)

Aggregations

PageDescriptors (com.enonic.xp.page.PageDescriptors)4 Test (org.junit.jupiter.api.Test)3 PageDescriptor (com.enonic.xp.page.PageDescriptor)1