@Override protected void validateExport( PortletDataContext portletDataContext, StagedModel stagedModel, Map<String, List<StagedModel>> dependentStagedModelsMap) throws Exception { ManifestSummary manifestSummary = portletDataContext.getManifestSummary(); Map<String, LongWrapper> modelAdditionCounters = manifestSummary.getModelAdditionCounters(); Assert.assertEquals(4, modelAdditionCounters.size()); Assert.assertEquals( 1, manifestSummary.getModelAdditionCount(DDMStructure.class, JournalArticle.class)); Assert.assertEquals( 1, manifestSummary.getModelAdditionCount(DDMTemplate.class, DDMStructure.class)); Assert.assertEquals(1, manifestSummary.getModelAdditionCount(JournalArticle.class)); Assert.assertEquals(1, manifestSummary.getModelAdditionCount(JournalFolder.class)); Document document = SAXReaderUtil.createDocument(); Element rootElement = document.addElement("root"); Element headerElement = rootElement.addElement("header"); _exportDate = new Date(); headerElement.addAttribute("export-date", Time.getRFC822(_exportDate)); ExportImportHelperUtil.writeManifestSummary(document, manifestSummary); zipWriter.addEntry("/manifest.xml", document.asXML()); }
@Override protected void validateImport( StagedModel stagedModel, StagedModelAssets stagedModelAssets, Map<String, List<StagedModel>> dependentStagedModelsMap, Group group) throws Exception { ManifestSummary manifestSummary = ExportImportHelperUtil.getManifestSummary(portletDataContext); Map<String, LongWrapper> modelAdditionCounters = manifestSummary.getModelAdditionCounters(); Assert.assertEquals(4, modelAdditionCounters.size()); Assert.assertEquals( 1, manifestSummary.getModelAdditionCount(DDMStructure.class, JournalArticle.class)); Assert.assertEquals( 1, manifestSummary.getModelAdditionCount(DDMTemplate.class, DDMStructure.class)); Assert.assertEquals(1, manifestSummary.getModelAdditionCount(JournalArticle.class)); Assert.assertEquals(1, manifestSummary.getModelAdditionCount(JournalFolder.class)); Assert.assertTrue(DateUtil.equals(_exportDate, manifestSummary.getExportDate(), true)); }