@Test public void testTypeLinkToLayout() throws Exception { initExport(); Map<String, List<StagedModel>> dependentStagedModelsMap = new HashMap<>(); Layout linkedLayout = LayoutTestUtil.addLayout(stagingGroup); List<LayoutFriendlyURL> linkedLayoutFriendlyURLs = LayoutFriendlyURLLocalServiceUtil.getLayoutFriendlyURLs(linkedLayout.getPlid()); addDependentStagedModel(dependentStagedModelsMap, Layout.class, linkedLayout); addDependentLayoutFriendlyURLs(dependentStagedModelsMap, linkedLayout); Layout layout = LayoutTestUtil.addTypeLinkToLayoutLayout( stagingGroup.getGroupId(), linkedLayout.getLayoutId()); List<LayoutFriendlyURL> layoutFriendlyURLs = LayoutFriendlyURLLocalServiceUtil.getLayoutFriendlyURLs(layout.getPlid()); addDependentLayoutFriendlyURLs(dependentStagedModelsMap, layout); StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, layout); validateExport(portletDataContext, layout, dependentStagedModelsMap); initImport(); Layout exportedLayout = (Layout) readExportedStagedModel(layout); StagedModelDataHandlerUtil.importStagedModel(portletDataContext, exportedLayout); LayoutLocalServiceUtil.getLayoutByUuidAndGroupId( linkedLayout.getUuid(), liveGroup.getGroupId(), false); LayoutFriendlyURL linkedLayoutFriendlyURL = linkedLayoutFriendlyURLs.get(0); LayoutFriendlyURLLocalServiceUtil.getLayoutFriendlyURLByUuidAndGroupId( linkedLayoutFriendlyURL.getUuid(), liveGroup.getGroupId()); LayoutLocalServiceUtil.getLayoutByUuidAndGroupId( layout.getUuid(), liveGroup.getGroupId(), false); LayoutFriendlyURL layoutFriendlyURL = layoutFriendlyURLs.get(0); LayoutFriendlyURLLocalServiceUtil.getLayoutFriendlyURLByUuidAndGroupId( layoutFriendlyURL.getUuid(), liveGroup.getGroupId()); }
@Override protected void validateImport( Map<String, List<StagedModel>> dependentStagedModelsMap, Group group) throws Exception { List<StagedModel> dependentStagedModels = dependentStagedModelsMap.get(Layout.class.getSimpleName()); Assert.assertEquals(1, dependentStagedModels.size()); Layout parentLayout = (Layout) dependentStagedModels.get(0); LayoutLocalServiceUtil.getLayoutByUuidAndGroupId( parentLayout.getUuid(), group.getGroupId(), false); List<LayoutFriendlyURL> parentLayoutFriendlyURLs = LayoutFriendlyURLLocalServiceUtil.getLayoutFriendlyURLs(parentLayout.getPlid()); LayoutFriendlyURL parentLayoutFriendlyURL = parentLayoutFriendlyURLs.get(0); LayoutFriendlyURLLocalServiceUtil.getLayoutFriendlyURLByUuidAndGroupId( parentLayoutFriendlyURL.getUuid(), group.getGroupId()); }