From 642ae171692cad3824a7dee9b31e98d7df8a33b2 Mon Sep 17 00:00:00 2001 From: jensp Date: Sun, 30 Oct 2016 17:50:09 +0000 Subject: [PATCH] CCM NG/ccm-cms: AttachmentListManager current status git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4416 8810af33-2d31-482b-a856-94f89814c4df --- .../librecms/attachments/AttachmentList.java | 10 + ...anager.java => AttachmentListManager.java} | 173 ++--- .../attachments/ItemAttachmentManager.java | 106 +++ .../org/librecms/assets/AssetManagerTest.java | 7 +- .../AttachmentListManagerTest.java | 687 ++++++++++++++++++ .../librecms/attachments/DatasetsTest.java | 95 +++ .../after-create-after-last.xml | 508 +++++++++++++ .../after-create-with-negative-position.xml | 508 +++++++++++++ .../after-create.xml | 515 +++++++++++++ .../after-move-down.xml | 508 +++++++++++++ .../after-move-to-first.xml | 508 +++++++++++++ .../after-move-to-last.xml | 508 +++++++++++++ .../after-move-to.xml | 508 +++++++++++++ .../after-move-up.xml | 508 +++++++++++++ .../after-remove.xml | 508 +++++++++++++ .../AttachmentListManagerTest/data.xml | 508 +++++++++++++ 16 files changed, 6075 insertions(+), 90 deletions(-) rename ccm-cms/src/main/java/org/librecms/attachments/{AttachmentManager.java => AttachmentListManager.java} (53%) create mode 100644 ccm-cms/src/main/java/org/librecms/attachments/ItemAttachmentManager.java create mode 100644 ccm-cms/src/test/java/org/librecms/attachments/AttachmentListManagerTest.java create mode 100644 ccm-cms/src/test/java/org/librecms/attachments/DatasetsTest.java create mode 100644 ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create-after-last.xml create mode 100644 ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create-with-negative-position.xml create mode 100644 ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create.xml create mode 100644 ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-down.xml create mode 100644 ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to-first.xml create mode 100644 ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to-last.xml create mode 100644 ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to.xml create mode 100644 ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-up.xml create mode 100644 ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-remove.xml create mode 100644 ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/data.xml diff --git a/ccm-cms/src/main/java/org/librecms/attachments/AttachmentList.java b/ccm-cms/src/main/java/org/librecms/attachments/AttachmentList.java index 99f36fc58..8816aeef6 100644 --- a/ccm-cms/src/main/java/org/librecms/attachments/AttachmentList.java +++ b/ccm-cms/src/main/java/org/librecms/attachments/AttachmentList.java @@ -39,6 +39,8 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -55,6 +57,14 @@ import static org.librecms.CmsConstants.*; @Entity @Table(name = "ATTACHMENT_LISTS", schema = DB_SCHEMA) @Audited +@NamedQueries({ + @NamedQuery( + name = "AttachmentList.findForItemAndName", + query = "SELECT l FROM AttachmentList l " + + "WHERE l.name = :name " + + "AND l.item = :item " + + "ORDER BY l.order") +}) public class AttachmentList implements Comparable, Identifiable, Serializable { diff --git a/ccm-cms/src/main/java/org/librecms/attachments/AttachmentManager.java b/ccm-cms/src/main/java/org/librecms/attachments/AttachmentListManager.java similarity index 53% rename from ccm-cms/src/main/java/org/librecms/attachments/AttachmentManager.java rename to ccm-cms/src/main/java/org/librecms/attachments/AttachmentListManager.java index 771bff4bc..ad0fac7df 100644 --- a/ccm-cms/src/main/java/org/librecms/attachments/AttachmentManager.java +++ b/ccm-cms/src/main/java/org/librecms/attachments/AttachmentListManager.java @@ -18,20 +18,39 @@ */ package org.librecms.attachments; -import org.librecms.assets.Asset; +import org.libreccm.security.PermissionChecker; import org.librecms.contentsection.ContentItem; +import org.librecms.contentsection.ContentItemManager; +import org.librecms.contentsection.privileges.ItemPrivileges; +import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import javax.transaction.Transactional; /** - * Provides methods for managing the assets attached to an item. + * Provides methods for managing the {@link AttachmentList}s of an + * {@link ContentItem}. * * @author Jens Pelzetter */ @RequestScoped -public class AttachmentManager { +public class AttachmentListManager { + + @Inject + private ContentItemManager itemManager; + + @Inject + private PermissionChecker permissionChecker; + + @Inject + private EntityManager entityManager; /** * Retrieves the names of all {@link AttachmentList}s of an @@ -42,8 +61,30 @@ public class AttachmentManager { * @return A list containing the names all the attachment lists of the item, * in the order of the attachment lists. */ + @Transactional(Transactional.TxType.REQUIRED) public List getAttachmentListNames(final ContentItem item) { - throw new UnsupportedOperationException("Not implemented yet"); + if (item == null) { + throw new IllegalArgumentException( + "Can't get AttachmentList(s) from null."); + } + + //We have to distinguish between live and draft versions, therefore + //we can't use the CDI interceptor here. + if (itemManager.isLive(item)) { + permissionChecker.checkPermission(ItemPrivileges.VIEW_PUBLISHED, + item); + } else { + permissionChecker.checkPermission(ItemPrivileges.PREVIEW, item); + } + + final List lists = item.getAttachments(); + final List names = lists.stream() + .map(list -> list.getName()) + .collect(Collectors.toList()); + + Collections.sort(names); + + return names; } /** @@ -53,7 +94,7 @@ public class AttachmentManager { * @param item The item from which the lists are retrieved. * @param name The name of the lists to retrieve. * - * @return A list of the attachment list with the specified name. If no + * @return A list of the attachment lists with the specified name. If no * attachment list of the {@code item} does match the provided * {@code name} an empty list is returned. */ @@ -61,7 +102,31 @@ public class AttachmentManager { final ContentItem item, final String name) { - throw new UnsupportedOperationException("Not implemented yet"); + if (item == null) { + throw new IllegalArgumentException( + "Can't get attachments lists from null."); + } + + if (name == null || name.trim().isEmpty()) { + throw new IllegalArgumentException( + "An AttachmentList can't have an empty name."); + } + + //We have to distinguish between live and draft versions, therefore + //we can't use the CDI interceptor here. + if (itemManager.isLive(item)) { + permissionChecker.checkPermission(ItemPrivileges.VIEW_PUBLISHED, + item); + } else { + permissionChecker.checkPermission(ItemPrivileges.PREVIEW, item); + } + + final TypedQuery query = entityManager.createNamedQuery( + "AttachmentList.findForItemAndName", AttachmentList.class); + query.setParameter("name", name); + query.setParameter("item", item); + + return query.getResultList(); } /** @@ -75,7 +140,20 @@ public class AttachmentManager { */ public AttachmentList createAttachmentList(final ContentItem item, final String name) { - throw new UnsupportedOperationException("Not implemented yet"); + + final List lists = item.getAttachments(); + Collections.sort(lists, + (list1, list2) -> Long.compare(list1.getOrder(), + list2.getOrder())); + + final long lastOrder = lists.get(lists.size() - 1).getOrder(); + + final AttachmentList newList = new AttachmentList(); + newList.setItem(item); + newList.setName(name); + newList.setOrder(lastOrder + 1); + +// item.addAttachmentList(newList); } /** @@ -97,14 +175,12 @@ public class AttachmentManager { } /** - * Removes an {@link AttachentList} from an item. All non shared assets - * assigned to the {@code attachmentList} are deleted. + * Removes an {@link AttachentList} from the owning item. All non shared + * assets assigned to the {@code attachmentList} are deleted. * - * @param item The item from the attachment list is removed. * @param attachmentList The attachment list to remove. */ - public void removeAttachmentList(final ContentItem item, - final AttachmentList attachmentList) { + public void removeAttachmentList(final AttachmentList attachmentList) { throw new UnsupportedOperationException("Not implemented yet"); } @@ -140,77 +216,4 @@ public class AttachmentManager { throw new UnsupportedOperationException("Not implemented yet"); } - /** - * Adds the provided {@link Asset} to the provided {@link AttachmentList}. - * - * @param asset The {@link Asset} to add. - * @param attachmentList The attachment list to which the asset is added. - */ - public void attachAsset(final Asset asset, - final AttachmentList attachmentList) { - throw new UnsupportedOperationException("Not implemented yet"); - } - - /** - * Removes the provided {@link Asset} from the provided - * {@link AttachmentList}. If the asset is a non shared asset the asset is - * deleted. - * - * @param asset The {@link Asset} to remove. - * @param attachmentList The attachment list to which the asset is removed - * from. - */ - public void unattachAsset(final Asset asset, - final AttachmentList attachmentList) { - throw new UnsupportedOperationException("Not implemented yet"); - } - - /** - * Moves the {@link Asset} one position up in the provided - * {@link AttachmentList}. - * - * @param asset The asset to move up. If the asset is not part of - * the provided {@link AttachmentList} an - * {@link IllegalArgumentException} is thrown. - * @param attachmentList The attachment list in which the item is moved. - */ - public void moveUp(final Asset asset, - final AttachmentList attachmentList) { - throw new UnsupportedOperationException("Not implemented yet"); - } - - /** - * Moves the {@link Asset} one position down in the provided - * {@link AttachmentList}. - * - * @param asset The asset to move down. If the asset is not part of - * the provided {@link AttachmentList} an - * {@link IllegalArgumentException} is thrown. - * @param attachmentList The attachment list in which the item is moved. - */ - public void moveDown(final Asset asset, - final AttachmentList attachmentList) { - throw new UnsupportedOperationException("Not implemented yet"); - } - - /** - * Moves the {@link Asset} to the specified position in the provided - * {@link AttachmentList}. - * - * @param asset The asset to move. If the asset is not part of the - * provided {@link AttachmentList} an - * {@link IllegalArgumentException} is thrown. - * @param attachmentList The attachment list in which the item is moved. - * @param position The position to which the asset is moved. The asset - * occupying the provided index is moved down. If the - * provided position is larger than the size of the - * attachment list the item is moved to the end of the - * list. - */ - public void moveTo(final Asset asset, - final AttachmentList attachmentList, - final long position) { - throw new UnsupportedOperationException("Not implemented yet"); - } - } diff --git a/ccm-cms/src/main/java/org/librecms/attachments/ItemAttachmentManager.java b/ccm-cms/src/main/java/org/librecms/attachments/ItemAttachmentManager.java new file mode 100644 index 000000000..93cf683a4 --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/attachments/ItemAttachmentManager.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2016 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.librecms.attachments; + +import org.librecms.assets.Asset; + +import javax.enterprise.context.RequestScoped; + +/** + * Provides methods for managing the {@link Asset} of an {@link AttachmentList}. + * + * @author Jens Pelzetter + */ +@RequestScoped +public class ItemAttachmentManager { + + /** + * Adds the provided {@link Asset} to the provided {@link AttachmentList}. + * + * @param asset The {@link Asset} to add. + * @param attachmentList The attachment list to which the asset is added. + */ + public void attachAsset(final Asset asset, + final AttachmentList attachmentList) { + throw new UnsupportedOperationException("Not implemented yet"); + } + + /** + * Removes the provided {@link Asset} from the provided + * {@link AttachmentList}. If the asset is a non shared asset the asset is + * deleted. + * + * @param asset The {@link Asset} to remove. + * @param attachmentList The attachment list to which the asset is removed + * from. + */ + public void unattachAsset(final Asset asset, + final AttachmentList attachmentList) { + throw new UnsupportedOperationException("Not implemented yet"); + } + + /** + * Moves the {@link Asset} one position up in the provided + * {@link AttachmentList}. + * + * @param asset The asset to move up. If the asset is not part of + * the provided {@link AttachmentList} an + * {@link IllegalArgumentException} is thrown. + * @param attachmentList The attachment list in which the item is moved. + */ + public void moveUp(final Asset asset, + final AttachmentList attachmentList) { + throw new UnsupportedOperationException("Not implemented yet"); + } + + /** + * Moves the {@link Asset} one position down in the provided + * {@link AttachmentList}. + * + * @param asset The asset to move down. If the asset is not part of + * the provided {@link AttachmentList} an + * {@link IllegalArgumentException} is thrown. + * @param attachmentList The attachment list in which the item is moved. + */ + public void moveDown(final Asset asset, + final AttachmentList attachmentList) { + throw new UnsupportedOperationException("Not implemented yet"); + } + + /** + * Moves the {@link Asset} to the specified position in the provided + * {@link AttachmentList}. + * + * @param asset The asset to move. If the asset is not part of the + * provided {@link AttachmentList} an + * {@link IllegalArgumentException} is thrown. + * @param attachmentList The attachment list in which the item is moved. + * @param position The position to which the asset is moved. The asset + * occupying the provided index is moved down. If the + * provided position is larger than the size of the + * attachment list the item is moved to the end of the + * list. + */ + public void moveTo(final Asset asset, + final AttachmentList attachmentList, + final long position) { + throw new UnsupportedOperationException("Not implemented yet"); + } + +} diff --git a/ccm-cms/src/test/java/org/librecms/assets/AssetManagerTest.java b/ccm-cms/src/test/java/org/librecms/assets/AssetManagerTest.java index fc15f3121..8d0dc6bf5 100644 --- a/ccm-cms/src/test/java/org/librecms/assets/AssetManagerTest.java +++ b/ccm-cms/src/test/java/org/librecms/assets/AssetManagerTest.java @@ -73,9 +73,6 @@ import static org.junit.Assert.*; @CreateSchema({"create_ccm_cms_schema.sql"}) public class AssetManagerTest { - @Inject - private ContentItemRepository itemRepo; - @Inject private AssetRepository assetRepo; @@ -112,8 +109,8 @@ public class AssetManagerTest { return ShrinkWrap .create(WebArchive.class, "LibreCCM-org.librecms.assets.AssetManagerTest.war") - .addPackage(org.libreccm.auditing.CcmRevision.class.getPackage()). - addPackage(org.libreccm.categorization.Categorization.class + .addPackage(org.libreccm.auditing.CcmRevision.class.getPackage()) + .addPackage(org.libreccm.categorization.Categorization.class .getPackage()) .addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage()) .addPackage(org.libreccm.configuration.Configuration.class diff --git a/ccm-cms/src/test/java/org/librecms/attachments/AttachmentListManagerTest.java b/ccm-cms/src/test/java/org/librecms/attachments/AttachmentListManagerTest.java new file mode 100644 index 000000000..e3227e8fd --- /dev/null +++ b/ccm-cms/src/test/java/org/librecms/attachments/AttachmentListManagerTest.java @@ -0,0 +1,687 @@ +/* + * Copyright (C) 2016 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.librecms.attachments; + +import static org.libreccm.testutils.DependenciesHelpers.*; + +import org.apache.shiro.subject.Subject; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.ShouldThrowException; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; +import org.jboss.arquillian.persistence.CreateSchema; +import org.jboss.arquillian.persistence.PersistenceTest; +import org.jboss.arquillian.persistence.ShouldMatchDataSet; +import org.jboss.arquillian.persistence.UsingDataSet; +import org.jboss.arquillian.transaction.api.annotation.TransactionMode; +import org.jboss.arquillian.transaction.api.annotation.Transactional; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.libreccm.security.Shiro; +import org.libreccm.tests.categories.IntegrationTest; +import org.librecms.assets.Asset; +import org.librecms.contentsection.ContentItem; +import org.librecms.contentsection.ContentItemRepository; + +import java.util.List; +import java.util.Optional; + +import javax.inject.Inject; + +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; + +/** + * Tests for the {@link AttachmentListManager}. + * + * @author Jens Pelzetter + */ +@org.junit.experimental.categories.Category(IntegrationTest.class) +@RunWith(Arquillian.class) +@PersistenceTest +@Transactional(TransactionMode.COMMIT) +@CreateSchema({"create_ccm_cms_schema.sql"}) +public class AttachmentListManagerTest { + + @Inject + private ContentItemRepository itemRepo; + + @Inject + private AttachmentListManager listManager; + + @Inject + private Shiro shiro; + + public AttachmentListManagerTest() { + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Deployment + public static WebArchive createDeployment() { + return ShrinkWrap + .create(WebArchive.class, + "LibreCCM-org.librecms.assets.AssetManagerTest.war") + .addPackage(org.libreccm.auditing.CcmRevision.class.getPackage()) + .addPackage(org.libreccm.categorization.Categorization.class + .getPackage()) + .addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage()) + .addPackage(org.libreccm.configuration.Configuration.class + .getPackage()) + .addPackage(org.libreccm.core.CcmCore.class.getPackage()) + .addPackage(org.libreccm.jpa.EntityManagerProducer.class + .getPackage()) + .addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class + .getPackage()) + .addPackage(org.libreccm.l10n.LocalizedString.class + .getPackage()) + .addPackage(org.libreccm.security.Permission.class.getPackage()) + .addPackage(org.libreccm.web.CcmApplication.class.getPackage()) + .addPackage(org.libreccm.workflow.Workflow.class.getPackage()) + .addPackage(com.arsdigita.bebop.Component.class.getPackage()) + .addPackage(com.arsdigita.bebop.util.BebopConstants.class + .getPackage()) + .addClass(com.arsdigita.kernel.KernelConfig.class) + .addClass(com.arsdigita.runtime.CCMResourceManager.class) + .addClass( + com.arsdigita.ui.admin.applications.AbstractAppInstanceForm.class) + .addClass( + com.arsdigita.ui.admin.applications.AbstractAppSettingsPane.class) + .addClass( + com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm.class) + .addClass( + com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane.class) + .addClass(com.arsdigita.cms.dispatcher.ItemResolver.class) + .addPackage(com.arsdigita.util.Lockable.class.getPackage()) + .addPackage(com.arsdigita.web.BaseServlet.class.getPackage()) + .addPackage(org.librecms.Cms.class.getPackage()) + .addPackage(org.librecms.assets.Asset.class.getPackage()) + .addPackage(org.librecms.attachments.AttachmentList.class + .getPackage()) + .addPackage(org.librecms.lifecycle.Lifecycle.class.getPackage()) + .addPackage(org.librecms.contentsection.ContentSection.class + .getPackage()) + .addPackage(org.librecms.contenttypes.Article.class.getPackage()). + addClass(com.arsdigita.kernel.security.SecurityConfig.class) + .addPackage(org.libreccm.tests.categories.IntegrationTest.class + .getPackage()) + // .addAsLibraries(getModuleDependencies()) + .addAsLibraries(getCcmCoreDependencies()) + .addAsResource("configs/shiro.ini", "shiro.ini") + .addAsResource( + "configs/org/librecms/contentsection/ContentItemManagerTest/log4j2.xml", + "log4j2.xml") + .addAsResource("test-persistence.xml", + "META-INF/persistence.xml") + .addAsWebInfResource("test-web.xml", "web.xml") + .addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml"); + } + + /** + * Verify that all dependencies have injected. + */ + @Test + @InSequence(1) + public void checkInjections() { + assertThat(itemRepo, (is(not(nullValue())))); + assertThat(listManager, is(not(nullValue()))); + assertThat(shiro, is(not(nullValue()))); + } + + /** + * Verify that Shiro is working. + */ + @Test + @InSequence(20) + public void checkShiro() { + assertThat(shiro.getSecurityManager(), is(not(nullValue()))); + assertThat(shiro.getSystemUser(), is(not(nullValue()))); + } + + /** + * Tries to retrieve the names of the {@link AttachmentList}s of some + * {@link ContentItem}s using + * {@link AttachmentListManager#getAttachmentListNames(org.librecms.contentsection.ContentItem)} + * and verifies that the names match the expected values. + */ + @Test + @InSequence(100) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + public void getAttachmentListNames() { + shiro.getSystemUser().execute(() -> { + final Optional article1 = itemRepo.findById(-510); + final Optional article2 = itemRepo.findById(-520); + + assertThat(article1.isPresent(), is(true)); + assertThat(article2.isPresent(), is(true)); + + final List names1 = listManager.getAttachmentListNames( + article1.get()); + final List names2 = listManager.getAttachmentListNames( + article2.get()); + + assertThat(names1, is(not(nullValue()))); + assertThat(names1.size(), is(3)); + assertThat(names1.get(0), is("list1")); + assertThat(names1.get(1), is("list2")); + assertThat(names1.get(2), is("list3")); + + assertThat(names2, is(not(nullValue()))); + assertThat(names2.size(), is(2)); + assertThat(names2.get(0), is("list1")); + assertThat(names2.get(1), is("list2")); + }); + } + + /** + * Verifies that + * {@link AttachmentListManager#getAttachmentListNames(org.librecms.contentsection.ContentItem)} + * throws an {@link IllegalArgumentException} if called for {@code null}. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(110) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void getAttachmentListNamesFromNull() { + final ContentItem item = null; + + shiro.getSystemUser().execute(() -> { + listManager.getAttachmentListNames(item); + }); + } + + /** + * Tries to retrieve various {@link AttachmentList}s by there name from some + * {@link ContentItem}s using + * {@link AttachmentListManager#getAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String)} + * and verifies that the list have the expected size. + */ + @Test + @InSequence(200) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + public void getAttachmentList() { + final Subject systemUser = shiro.getSystemUser(); + + final Optional article1 = systemUser + .execute(() -> itemRepo.findById(-510)); + final Optional article2 = systemUser + .execute(() -> itemRepo.findById(-520)); + + assertThat(article1.isPresent(), is(true)); + assertThat(article2.isPresent(), is(true)); + + final List article1List1 = systemUser.execute( + () -> listManager.getAttachmentList(article1.get(), "list1")); + assertThat(article1List1, is(not(nullValue()))); + assertThat(article1List1.size(), is(2)); + + final List article1List2 = systemUser.execute( + () -> listManager.getAttachmentList(article1.get(), "list2")); + assertThat(article1List2, is(not(nullValue()))); + assertThat(article1List2.size(), is(1)); + + final List article1List3 = systemUser.execute( + () -> listManager.getAttachmentList(article1.get(), "list3")); + assertThat(article1List3, is(not(nullValue()))); + assertThat(article1List3.isEmpty(), is(true)); + + final List article2List1 = systemUser.execute( + () -> listManager.getAttachmentList(article2.get(), "list1")); + assertThat(article2List1, is(not(nullValue()))); + assertThat(article2List1.size(), is(1)); + + final List article2List2 = systemUser.execute( + () -> listManager.getAttachmentList(article2.get(), "list2")); + assertThat(article2List2, is(not(nullValue()))); + assertThat(article2List2.size(), is(1)); + } + + /** + * Verifies that + * {@link AttachmentListManager#getAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String)} + * throws an {@link IllegalArgumentException} if called for item + * {@code null}. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(210) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void getAttachmentListFromItemNull() { + final Subject systemUser = shiro.getSystemUser(); + + final ContentItem item = null; + + listManager.getAttachmentList(item, "list1"); + } + + /** + * Verifies that + * {@link AttachmentListManager#getAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String)} + * throws an {@link IllegalArgumentException} if called with {@code null} + * for then {@code name} of the attachment list to retrieve. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(220) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void getAttachmentListNameIsNull() { + final Subject systemUser = shiro.getSystemUser(); + + final Optional item = systemUser + .execute(() -> itemRepo.findById(-510)); + + assertThat(item.isPresent(), is(true)); + + listManager.getAttachmentList(item.get(), null); + } + + /** + * Verifies that + * {@link AttachmentListManager#getAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String)} + * throws an {@link IllegalArgumentException} if called with and empty + * string for then {@code name} of the attachment list to retrieve. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(230) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void getAttachmentListWithEmptyName() { + final Subject systemUser = shiro.getSystemUser(); + + final Optional item = systemUser + .execute(() -> itemRepo.findById(-510)); + + assertThat(item.isPresent(), is(true)); + + listManager.getAttachmentList(item.get(), " "); + + } + + /** + * Tries to create a new {@link AttachmentList} for an {@link ContentItem} + * using + * {@link AttachmentListManager#createAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String)}. + */ + @Test + @InSequence(300) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + value = "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "after-create.xml", + excludeColumns = {"timestamp", + "list_id", + "uuid"}) + public void createAttachmentList() { + final Optional item = itemRepo.findById(-520); + assertThat(item.isPresent(), is(true)); + + listManager.createAttachmentList(item.get(), "newList"); + } + + /** + * Verifies that + * {@link AttachmentListManager#createAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String)} + * throw new an {@link IllegalArgumentException} if the {@code item} is + * {@code null}. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(310) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void createAttachmentListForItemNull() { + fail("Not implemented yet"); + } + + /** + * Verifies that + * {@link AttachmentListManager#createAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String)} + * throws an {@link IllegalArgumentException} if the name of the new list + * {@code null}. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(320) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + public void createAttachmentListNameIsNull() { + fail("Not implemented yet"); + } + + /** + * Verifies that + * {@link AttachmentListManager#createAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String)} + * throws an {@link IllegalArgumentException} if the name of the new list an + * empty string. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(330) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + public void createAttachmentListNameIsEmpty() { + fail("Not implemented yet"); + } + + /** + * Tries to create a new {@link AttachmentList} for an {@link ContentItem} + * using + * {@link AttachmentListManager#createAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String, long) }. + */ + @Test + @InSequence(400) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "after-create.xml") + public void createAttachmentListAfterPosition() { + fail("Not implemented yet"); + } + + /** + * Tries to create a new {@link AttachmentList} for an {@link ContentItem} + * using + * {@link AttachmentListManager#createAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String, long) } + * with a negative position. The new attachment list should be the first one + * in the list of attachment lists. + */ + @Test + @InSequence(410) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "after-create-with-negative-position.xml") + public void createAttachmentListNegativePosition() { + fail("Not implemented yet"); + } + + /** + * Tries to create a new {@link AttachmentList} for an {@link ContentItem} + * using + * {@link AttachmentListManager#createAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String, long) } + * with position larger then the number of attachment lists of the item. The + * new attachment list should be the last one in the list of attachment + * lists. + */ + @Test + @InSequence(420) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "after-create-after-last.xml") + public void createAttachmentListAfterLastPosition() { + fail("Not implemented yet"); + } + + /** + * Verifies that + * {@link AttachmentListManager#createAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String, long) }. + * throw new an {@link IllegalArgumentException} if the {@code item} is + * {@code null}. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(430) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void createAttachmentListAfterPositionForItemNull() { + fail("Not implemented yet"); + } + + /** + * Verifies that + * {@link AttachmentListManager#createAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String, long) }. + * throws an {@link IllegalArgumentException} if the name of the new list + * {@code null}. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(440) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void createAttachmentListAfterPositionNameIsNull() { + fail("Not implemented yet"); + } + + /** + * Verifies that + * {@link AttachmentListManager#createAttachmentList(org.librecms.contentsection.ContentItem, java.lang.String, long) }. + * throws an {@link IllegalArgumentException} if the name of the new list an + * empty string. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(450) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void createAttachmentListAfterPositionNameIsEmpty() { + fail("Not implemented yet"); + } + + /** + * Tries to remove an {@link AttchmentList} from the owning + * {@link ContentItem} using + * {@link AttachmentListManager#removeAttachmentList(org.librecms.attachments.AttachmentList)}. + * Verifies that all non shared {@link Asset} in the list have been deleted. + */ + @Test + @InSequence(500) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "after-remove.xml") + public void removeAttachmentList() { + fail("Not implemented yet"); + } + + /** + * Verifies that + * {@link AttachmentListManager#removeAttachmentList(org.librecms.attachments.AttachmentList)} + * throws an {@link IllegalArgumentException} if called for {@code null}. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(510) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void removeAttachmentListNull() { + fail("Not implemented yet"); + } + + /** + * Tries to move an {@link AttachmentList} up one position up using + * {@link AttachmentListManager#moveUp(org.librecms.attachments.AttachmentList)}. + */ + @Test + @InSequence(600) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "after-move-up.xml") + public void moveUp() { + fail("Not implemented yet"); + } + + /** + * Verifies that + * {@link AttachmentListManager#moveUp(org.librecms.attachments.AttachmentList)} + * throws an {@link IllegalArgumentException} if called for {@code null}. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(510) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void moveUpListNull() { + fail("Not implemented yet"); + } + + /** + * Tries to move an {@link AttachmentList} up one position down using + * {@link AttachmentListManager#moveUp(org.librecms.attachments.AttachmentList)}. + */ + @Test + @InSequence(600) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "after-move-down.xml") + public void moveDown() { + fail("Not implemented yet"); + } + + /** + * Verifies that + * {@link AttachmentListManager#moveDown(org.librecms.attachments.AttachmentList)} + * throws an {@link IllegalArgumentException} if called for {@code null}. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(510) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void moveDownListNull() { + fail("Not implemented yet"); + } + + /** + * Tries to move an {@link AttachmentList} to an specific position using + * {@link AttachmentListManager#moveTo(org.librecms.attachments.AttachmentList, long)}. + */ + @Test + @InSequence(600) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "after-move-to.xml") + public void moveTo() { + fail("Not implemented yet"); + } + + /** + * Tries to move an {@link AttachmentList} to the first position using + * {@link AttachmentListManager#moveTo(org.librecms.attachments.AttachmentList, long)} + * with a negative value for {@code position}. + */ + @Test + @InSequence(600) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "after-move-to-first.xml") + public void moveToNegativePosition() { + fail("Not implemented yet"); + } + + /** + * Tries to move an {@link AttachmentList} to the last position using + * {@link AttachmentListManager#moveTo(org.librecms.attachments.AttachmentList, long)} + * with a value larger than the number of attachment lists. + */ + @Test + @InSequence(600) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "after-move-to-last.xml") + public void moveToLargerThanLast() { + fail("Not implemented yet"); + } + + /** + * Verifies that + * {@link AttachmentListManager#moveTo(org.librecms.attachments.AttachmentList, long)} + * throws an {@link IllegalArgumentException} if called with {@code null} + * for the attachment list to move. + */ + @Test(expected = IllegalArgumentException.class) + @InSequence(510) + @UsingDataSet("datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldMatchDataSet( + "datasets/org/librecms/attachments/AttachmentListManagerTest/" + + "data.xml") + @ShouldThrowException(IllegalArgumentException.class) + public void moveToListNull() { + fail("Not implemented yet"); + } + +} diff --git a/ccm-cms/src/test/java/org/librecms/attachments/DatasetsTest.java b/ccm-cms/src/test/java/org/librecms/attachments/DatasetsTest.java new file mode 100644 index 000000000..e3a16a662 --- /dev/null +++ b/ccm-cms/src/test/java/org/librecms/attachments/DatasetsTest.java @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2016 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.librecms.attachments; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.libreccm.tests.categories.UnitTest; +import org.libreccm.testutils.DatasetType; +import org.libreccm.testutils.DatasetsVerifier; + +import java.util.Arrays; +import java.util.Collection; + +/** + * Verify the datasets for the tests in {@code org.librecms.attachments}. + * + * @author Jens Pelzetter + */ +@RunWith(Parameterized.class) +@Category(UnitTest.class) +public class DatasetsTest extends DatasetsVerifier { + + @Parameterized.Parameters(name = "Dataset {0}") + public static Collection data() { + return Arrays.asList(new String[]{ + "/datasets/org/librecms/attachments/AttachmentListManagerTest/data.xml", + "/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create-after-last.xml", + "/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create-with-negative-position.xml", + "/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create.xml", + "/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-down.xml", + "/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to-first.xml", + "/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to-last.xml", + "/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to.xml", + "/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-up.xml", + "/datasets/org/librecms/attachments/AttachmentListManagerTest/after-remove.xml" + }); + } + + public DatasetsTest(final String datasetPath) { + super(datasetPath); + } + + @Override + public DatasetType getDatasetType() { + return DatasetType.FLAT_XML; + } + + @Override + public String[] getSchemas() { + return new String[]{"ccm_core", "ccm_cms"}; + } + + @Override + public String[] getDdlFiles() { + return new String[]{"/datasets/create_ccm_cms_schema.sql"}; + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + +} diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create-after-last.xml b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create-after-last.xml new file mode 100644 index 000000000..d174d5026 --- /dev/null +++ b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create-after-last.xml @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create-with-negative-position.xml b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create-with-negative-position.xml new file mode 100644 index 000000000..d174d5026 --- /dev/null +++ b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create-with-negative-position.xml @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create.xml b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create.xml new file mode 100644 index 000000000..cbbc3ba3d --- /dev/null +++ b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-create.xml @@ -0,0 +1,515 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-down.xml b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-down.xml new file mode 100644 index 000000000..d174d5026 --- /dev/null +++ b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-down.xml @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to-first.xml b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to-first.xml new file mode 100644 index 000000000..d174d5026 --- /dev/null +++ b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to-first.xml @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to-last.xml b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to-last.xml new file mode 100644 index 000000000..d174d5026 --- /dev/null +++ b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to-last.xml @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to.xml b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to.xml new file mode 100644 index 000000000..d174d5026 --- /dev/null +++ b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-to.xml @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-up.xml b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-up.xml new file mode 100644 index 000000000..d174d5026 --- /dev/null +++ b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-move-up.xml @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-remove.xml b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-remove.xml new file mode 100644 index 000000000..d174d5026 --- /dev/null +++ b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/after-remove.xml @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/data.xml b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/data.xml new file mode 100644 index 000000000..09622fe0b --- /dev/null +++ b/ccm-cms/src/test/resources/datasets/org/librecms/attachments/AttachmentListManagerTest/data.xml @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +