Example usage for com.liferay.portal.kernel.model LayoutTypePortlet getAllPortlets

List of usage examples for com.liferay.portal.kernel.model LayoutTypePortlet getAllPortlets

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model LayoutTypePortlet getAllPortlets.

Prototype

public List<Portlet> getAllPortlets();

Source Link

Usage

From source file:com.liferay.exportimport.resources.importer.test.ResourcesImporterTest.java

License:Open Source License

protected void validateLayouts(Group importedGroup) throws Exception {
    long privateLayoutsCount = LayoutLocalServiceUtil.getLayoutsCount(importedGroup, true);

    Assert.assertEquals(1, privateLayoutsCount);

    long publicLayoutsCount = LayoutLocalServiceUtil.getLayoutsCount(importedGroup, false);

    Assert.assertEquals(9, publicLayoutsCount);

    Layout layout = LayoutLocalServiceUtil.getFriendlyURLLayout(importedGroup.getGroupId(), false, "/home");

    Map<Locale, String> nameMap = layout.getNameMap();

    Assert.assertTrue(nameMap.containsValue("Bienvenue"));

    Assert.assertTrue(layout.isTypePortlet());

    LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout.getLayoutType();

    List<Portlet> portlets = layoutTypePortlet.getAllPortlets();

    Assert.assertEquals(portlets.toString(), 7, portlets.size());

    UnicodeProperties layoutTypeSettingsProperties = layout.getTypeSettingsProperties();

    String nestedColumnIds = layoutTypeSettingsProperties.get(LayoutTypePortletConstants.NESTED_COLUMN_IDS);

    Assert.assertTrue((nestedColumnIds != null) && nestedColumnIds.contains("column-1")
            && nestedColumnIds.contains("column-2"));

    layout = LayoutLocalServiceUtil.getFriendlyURLLayout(importedGroup.getGroupId(), false,
            "/layout-prototypes-page-1");

    Assert.assertTrue(layout.isLayoutPrototypeLinkActive());
    Assert.assertEquals("371647ba-3649-4039-bfe6-ae32cf404737", layout.getLayoutPrototypeUuid());

    layout = LayoutLocalServiceUtil.getFriendlyURLLayout(importedGroup.getGroupId(), false,
            "/layout-prototypes-page-2");

    Assert.assertFalse(layout.isLayoutPrototypeLinkActive());
    Assert.assertEquals("c98067d0-fc10-9556-7364-238d39693bc4", layout.getLayoutPrototypeUuid());

    layout = LayoutLocalServiceUtil.getFriendlyURLLayout(importedGroup.getGroupId(), false, "/url-page");

    Assert.assertTrue(layout.isTypeURL());

    layout = LayoutLocalServiceUtil.getFriendlyURLLayout(importedGroup.getGroupId(), false, "/hidden-page");

    Assert.assertTrue(layout.isHidden());
}