CCM NG/ccm-cms: JavaDoc for the ContentItemManagerTest
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4372 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
5707402240
commit
325c6fbc80
|
|
@ -79,9 +79,6 @@ public class ContentItemManagerTest {
|
||||||
@Inject
|
@Inject
|
||||||
private ContentItemManager itemManager;
|
private ContentItemManager itemManager;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private CategoryRepository categoryRepo;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private FolderRepository folderRepo;
|
private FolderRepository folderRepo;
|
||||||
|
|
||||||
|
|
@ -120,8 +117,8 @@ public class ContentItemManagerTest {
|
||||||
public static WebArchive createDeployment() {
|
public static WebArchive createDeployment() {
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.librecms.contentsection.ContentItemManagerTest.war")
|
"LibreCCM-org.librecms.contentsection.ContentItemManagerTest.war").
|
||||||
.addPackage(org.libreccm.auditing.CcmRevision.class.getPackage())
|
addPackage(org.libreccm.auditing.CcmRevision.class.getPackage())
|
||||||
.addPackage(org.libreccm.categorization.Categorization.class
|
.addPackage(org.libreccm.categorization.Categorization.class
|
||||||
.getPackage())
|
.getPackage())
|
||||||
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||||
|
|
@ -143,14 +140,14 @@ public class ContentItemManagerTest {
|
||||||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||||
.addClass(com.arsdigita.runtime.CCMResourceManager.class)
|
.addClass(com.arsdigita.runtime.CCMResourceManager.class)
|
||||||
.addClass(
|
.addClass(
|
||||||
com.arsdigita.ui.admin.applications.AbstractAppInstanceForm.class)
|
com.arsdigita.ui.admin.applications.AbstractAppInstanceForm.class).
|
||||||
.addClass(
|
addClass(
|
||||||
com.arsdigita.ui.admin.applications.AbstractAppSettingsPane.class)
|
com.arsdigita.ui.admin.applications.AbstractAppSettingsPane.class).
|
||||||
.addClass(
|
addClass(
|
||||||
com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm.class)
|
com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm.class).
|
||||||
.addClass(
|
addClass(
|
||||||
com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane.class)
|
com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane.class).
|
||||||
.addClass(com.arsdigita.cms.dispatcher.ItemResolver.class)
|
addClass(com.arsdigita.cms.dispatcher.ItemResolver.class)
|
||||||
.addPackage(com.arsdigita.util.Lockable.class.getPackage())
|
.addPackage(com.arsdigita.util.Lockable.class.getPackage())
|
||||||
.addPackage(com.arsdigita.web.BaseServlet.class.getPackage())
|
.addPackage(com.arsdigita.web.BaseServlet.class.getPackage())
|
||||||
.addPackage(org.librecms.Cms.class.getPackage())
|
.addPackage(org.librecms.Cms.class.getPackage())
|
||||||
|
|
@ -160,8 +157,8 @@ public class ContentItemManagerTest {
|
||||||
.addPackage(org.librecms.lifecycle.Lifecycle.class.getPackage())
|
.addPackage(org.librecms.lifecycle.Lifecycle.class.getPackage())
|
||||||
.addPackage(org.librecms.contentsection.ContentSection.class
|
.addPackage(org.librecms.contentsection.ContentSection.class
|
||||||
.getPackage())
|
.getPackage())
|
||||||
.addPackage(org.librecms.contenttypes.Article.class.getPackage())
|
.addPackage(org.librecms.contenttypes.Article.class.getPackage()).
|
||||||
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
|
addClass(com.arsdigita.kernel.security.SecurityConfig.class)
|
||||||
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.getPackage())
|
.getPackage())
|
||||||
// .addAsLibraries(getModuleDependencies())
|
// .addAsLibraries(getModuleDependencies())
|
||||||
|
|
@ -176,14 +173,25 @@ public class ContentItemManagerTest {
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
|
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the injection points work.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(10)
|
@InSequence(10)
|
||||||
public void checkInjections() {
|
public void checkInjections() {
|
||||||
assertThat(sectionRepo, is(not(nullValue())));
|
assertThat(sectionRepo, is(not(nullValue())));
|
||||||
|
assertThat(itemRepo, is(not(nullValue())));
|
||||||
assertThat(itemManager, is(not(nullValue())));
|
assertThat(itemManager, is(not(nullValue())));
|
||||||
|
assertThat(folderRepo, is(not(nullValue())));
|
||||||
assertThat(shiro, is(not(nullValue())));
|
assertThat(shiro, is(not(nullValue())));
|
||||||
|
assertThat(workflowTemplateRepo, is(not(nullValue())));
|
||||||
|
assertThat(lifecycleDefinitionRepo, is(not(nullValue())));
|
||||||
|
assertThat(entityManager, is(not(nullValue())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify that Shiro is working.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(20)
|
@InSequence(20)
|
||||||
public void checkShiro() {
|
public void checkShiro() {
|
||||||
|
|
@ -191,6 +199,10 @@ public class ContentItemManagerTest {
|
||||||
assertThat(shiro.getSystemUser(), is(not(nullValue())));
|
assertThat(shiro.getSystemUser(), is(not(nullValue())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to create a new content item using
|
||||||
|
* {@link ContentItemManager#createContentItem(java.lang.String, org.librecms.contentsection.ContentSection, org.librecms.contentsection.Folder, java.lang.Class)}.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(1100)
|
@InSequence(1100)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -237,9 +249,10 @@ public class ContentItemManagerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an {@link IllegalArgumentException} is thrown when the content
|
* Checks if an {@link IllegalArgumentException} is thrown if
|
||||||
* type of the item to create is not registered with the provided content
|
* {@link ContentItemManager#createContentItem(java.lang.String, org.librecms.contentsection.ContentSection, org.librecms.contentsection.Folder, java.lang.Class)}
|
||||||
* section.
|
* is called for a content type which is not registered for the provided
|
||||||
|
* content section.
|
||||||
*/
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(1200)
|
@InSequence(1200)
|
||||||
|
|
@ -255,6 +268,11 @@ public class ContentItemManagerTest {
|
||||||
itemManager.createContentItem("Test", section, folder, Event.class);
|
itemManager.createContentItem("Test", section, folder, Event.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that an {@link IllegalArgumentException} is thrown if
|
||||||
|
* {@link ContentItemManager#createContentItem(java.lang.String, org.librecms.contentsection.ContentSection, org.librecms.contentsection.Folder, java.lang.Class)}
|
||||||
|
* is called with {@code null} for the name of the new item.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(1300)
|
@InSequence(1300)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -269,6 +287,11 @@ public class ContentItemManagerTest {
|
||||||
itemManager.createContentItem(null, section, folder, Article.class);
|
itemManager.createContentItem(null, section, folder, Article.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that an {@link IllegalArgumentException} is thrown if
|
||||||
|
* {@link ContentItemManager#createContentItem(java.lang.String, org.librecms.contentsection.ContentSection, org.librecms.contentsection.Folder, java.lang.Class)}
|
||||||
|
* is called with an empty string for the name of the new content item.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(1400)
|
@InSequence(1400)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -283,6 +306,12 @@ public class ContentItemManagerTest {
|
||||||
itemManager.createContentItem(" ", section, folder, Article.class);
|
itemManager.createContentItem(" ", section, folder, Article.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that an {@link IllegalArgumentException} is thrown if
|
||||||
|
* {@link ContentItemManager#createContentItem(java.lang.String, org.librecms.contentsection.ContentSection, org.librecms.contentsection.Folder, java.lang.Class)}
|
||||||
|
* is called with {@code null} for the folder in which the new item is
|
||||||
|
* created.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(1500)
|
@InSequence(1500)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -296,6 +325,10 @@ public class ContentItemManagerTest {
|
||||||
itemManager.createContentItem("Test", section, null, Article.class);
|
itemManager.createContentItem("Test", section, null, Article.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to create a new content item with an alternative workflow using
|
||||||
|
* {@link ContentItemManager#createContentItem(java.lang.String, org.librecms.contentsection.ContentSection, org.librecms.contentsection.Folder, org.libreccm.workflow.WorkflowTemplate, java.lang.Class)}.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(2100)
|
@InSequence(2100)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -348,9 +381,10 @@ public class ContentItemManagerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an {@link IllegalArgumentException} is thrown when the content
|
* Verifies that
|
||||||
* type of the item to create is not registered with the provided content
|
* {@link ContentItemManager#createContentItem(java.lang.String, org.librecms.contentsection.ContentSection, org.librecms.contentsection.Folder, org.libreccm.workflow.WorkflowTemplate, java.lang.Class)}
|
||||||
* section.
|
* throws an {@link IllegalArgumentException} if the provided type of the
|
||||||
|
* item to create is not registered with the provided content section.
|
||||||
*/
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(2200)
|
@InSequence(2200)
|
||||||
|
|
@ -373,6 +407,12 @@ public class ContentItemManagerTest {
|
||||||
Event.class);
|
Event.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#createContentItem(java.lang.String, org.librecms.contentsection.ContentSection, org.librecms.contentsection.Folder, org.libreccm.workflow.WorkflowTemplate, java.lang.Class)}
|
||||||
|
* throws an {@link IllegalArgumentException} if called with {@code null}
|
||||||
|
* for the name of the new item.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(2300)
|
@InSequence(2300)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -394,6 +434,12 @@ public class ContentItemManagerTest {
|
||||||
Article.class);
|
Article.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#createContentItem(java.lang.String, org.librecms.contentsection.ContentSection, org.librecms.contentsection.Folder, org.libreccm.workflow.WorkflowTemplate, java.lang.Class)}
|
||||||
|
* throws an {@link IllegalArgumentException} if called with {@code null}
|
||||||
|
* for the name of the new item and for thw workflow of the new item.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(2400)
|
@InSequence(2400)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -412,6 +458,12 @@ public class ContentItemManagerTest {
|
||||||
Article.class);
|
Article.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#createContentItem(java.lang.String, org.librecms.contentsection.ContentSection, org.librecms.contentsection.Folder, org.libreccm.workflow.WorkflowTemplate, java.lang.Class)}
|
||||||
|
* throws an {@link IllegalArgumentException} if called with {@code null}
|
||||||
|
* for the folder in which the new item is created.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(2600)
|
@InSequence(2600)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -432,6 +484,10 @@ public class ContentItemManagerTest {
|
||||||
Article.class);
|
Article.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to move an item a folder in the same content section using
|
||||||
|
* {@link ContentItemManager#move(org.librecms.contentsection.ContentItem, org.librecms.contentsection.Folder)}.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(3100)
|
@InSequence(3100)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -458,6 +514,36 @@ public class ContentItemManagerTest {
|
||||||
itemManager.move(item.get(), targetFolder);
|
itemManager.move(item.get(), targetFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to move an item a folder in another content section using
|
||||||
|
* {@link ContentItemManager#move(org.librecms.contentsection.ContentItem, org.librecms.contentsection.Folder)}.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@InSequence(3110)
|
||||||
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
+ "ContentItemManagerTest/data.xml")
|
||||||
|
@ShouldMatchDataSet(
|
||||||
|
value = "datasets/org/librecms/contentsection/"
|
||||||
|
+ "ContentItemManagerTest/after-move-to-other-section.xml",
|
||||||
|
excludeColumns = {"categorization_id",
|
||||||
|
"lifecycle_id",
|
||||||
|
"object_id",
|
||||||
|
"object_order",
|
||||||
|
"phase_id",
|
||||||
|
"task_id",
|
||||||
|
"uuid",
|
||||||
|
"workflow_id"
|
||||||
|
})
|
||||||
|
public void moveToOtherContentSection() {
|
||||||
|
fail("Not implemented yet");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#move(org.librecms.contentsection.ContentItem, org.librecms.contentsection.Folder)}
|
||||||
|
* throws an {@link IllegalArgumentException} if called with {@code null}
|
||||||
|
* for the item to move.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(3200)
|
@InSequence(3200)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -472,6 +558,12 @@ public class ContentItemManagerTest {
|
||||||
itemManager.move(null, targetFolder);
|
itemManager.move(null, targetFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#move(org.librecms.contentsection.ContentItem, org.librecms.contentsection.Folder)}
|
||||||
|
* throws an {@link IllegalArgumentException} if called with {@code null}
|
||||||
|
* for target folder.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(3200)
|
@InSequence(3200)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -486,6 +578,10 @@ public class ContentItemManagerTest {
|
||||||
itemManager.move(item.get(), null);
|
itemManager.move(item.get(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to copy an item to another folder in the same content section using
|
||||||
|
* {@link ContentItemManager#copy(org.librecms.contentsection.ContentItem, org.librecms.contentsection.Folder)}.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(4100)
|
@InSequence(4100)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -516,6 +612,40 @@ public class ContentItemManagerTest {
|
||||||
itemManager.copy(item.get(), targetFolder);
|
itemManager.copy(item.get(), targetFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to copy an item to another folder in another content section using
|
||||||
|
* {@link ContentItemManager#copy(org.librecms.contentsection.ContentItem, org.librecms.contentsection.Folder)}.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@InSequence(4110)
|
||||||
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
+ "ContentItemManagerTest/data.xml")
|
||||||
|
@ShouldMatchDataSet(
|
||||||
|
value = "datasets/org/librecms/contentsection/"
|
||||||
|
+ "ContentItemManagerTest/after-copy-to-folder-in-other-section.xml",
|
||||||
|
excludeColumns = {"categorization_id",
|
||||||
|
"id",
|
||||||
|
"item_uuid",
|
||||||
|
"lifecycle_id",
|
||||||
|
"object_id",
|
||||||
|
"object_order",
|
||||||
|
"phase_id",
|
||||||
|
"rev",
|
||||||
|
"task_id",
|
||||||
|
"uuid",
|
||||||
|
"timestamp",
|
||||||
|
"workflow_id"
|
||||||
|
})
|
||||||
|
public void copyToFolderInOtherSection() {
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to create a copy of an item it its folder by using
|
||||||
|
* {@link ContentItemManager#copy(org.librecms.contentsection.ContentItem, org.librecms.contentsection.Folder)}.
|
||||||
|
* The method should append a number as suffix to the name of the item to
|
||||||
|
* make the name unique inside the folder.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(4200)
|
@InSequence(4200)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -546,6 +676,12 @@ public class ContentItemManagerTest {
|
||||||
itemManager.copy(item.get(), targetFolder);
|
itemManager.copy(item.get(), targetFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#move(org.librecms.contentsection.ContentItem, org.librecms.contentsection.Folder)}
|
||||||
|
* throws an {@link IllegalArgumentException} if called with {@code null}
|
||||||
|
* for the item to copy.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(4300)
|
@InSequence(4300)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -561,6 +697,12 @@ public class ContentItemManagerTest {
|
||||||
itemManager.copy(null, targetFolder);
|
itemManager.copy(null, targetFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#move(org.librecms.contentsection.ContentItem, org.librecms.contentsection.Folder)}
|
||||||
|
* throws an {@link IllegalArgumentException} if called with {@code null}
|
||||||
|
* for the target folder.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(4400)
|
@InSequence(4400)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -576,6 +718,13 @@ public class ContentItemManagerTest {
|
||||||
itemManager.copy(item.get(), null);
|
itemManager.copy(item.get(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to publish an item using
|
||||||
|
* {@link ContentItemManager#publish(org.librecms.contentsection.ContentItem)}.
|
||||||
|
* This test only verifies to basic functionality of the {@code publish}
|
||||||
|
* method. For complex content items it is recommended to create additional
|
||||||
|
* tests to verify that the item is published correctly.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(5100)
|
@InSequence(5100)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -604,6 +753,13 @@ public class ContentItemManagerTest {
|
||||||
assertThat(live.getVersion(), is(ContentItemVersion.LIVE));
|
assertThat(live.getVersion(), is(ContentItemVersion.LIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to publish an item with an alternative lifecycle using
|
||||||
|
* {@link ContentItemManager#publish(org.librecms.contentsection.ContentItem, org.librecms.lifecycle.LifecycleDefinition)}.
|
||||||
|
* This test only verifies to basic functionality of the {@code publish}
|
||||||
|
* method. For complex content items it is recommended to create additional
|
||||||
|
* tests to verify that the item is published correctly.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(5200)
|
@InSequence(5200)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -635,6 +791,10 @@ public class ContentItemManagerTest {
|
||||||
assertThat(live.getVersion(), is(ContentItemVersion.LIVE));
|
assertThat(live.getVersion(), is(ContentItemVersion.LIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to republish an item using
|
||||||
|
* {@link ContentItemManager#publish(org.librecms.contentsection.ContentItem)}.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(5300)
|
@InSequence(5300)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -669,6 +829,12 @@ public class ContentItemManagerTest {
|
||||||
itemManager.publish(draft.get());
|
itemManager.publish(draft.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#publish(org.librecms.contentsection.ContentItem)}
|
||||||
|
* throws an {@link IllegalArgumentException} if called with {@code null}
|
||||||
|
* for the item to publish.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(5400)
|
@InSequence(5400)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -682,6 +848,12 @@ public class ContentItemManagerTest {
|
||||||
itemManager.publish(item);
|
itemManager.publish(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#publish(org.librecms.contentsection.ContentItem, org.librecms.lifecycle.LifecycleDefinition)}
|
||||||
|
* throws an {@link IllegalArgumentException} if called with {@code null}
|
||||||
|
* for the lifecycle to use.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(5500)
|
@InSequence(5500)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -695,6 +867,10 @@ public class ContentItemManagerTest {
|
||||||
itemManager.publish(draft.get(), null);
|
itemManager.publish(draft.get(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to unpublish (delete the live version) an item using
|
||||||
|
* {@link ContentItemManager#unpublish(org.librecms.contentsection.ContentItem)}.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(6000)
|
@InSequence(6000)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -721,6 +897,11 @@ public class ContentItemManagerTest {
|
||||||
itemManager.unpublish(item.get());
|
itemManager.unpublish(item.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#unpublish(org.librecms.contentsection.ContentItem)}
|
||||||
|
* does nothing if called for an item which is not live.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(6100)
|
@InSequence(6100)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -734,6 +915,12 @@ public class ContentItemManagerTest {
|
||||||
itemManager.unpublish(item.get());
|
itemManager.unpublish(item.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#unpublish(org.librecms.contentsection.ContentItem)}
|
||||||
|
* throws an {@link IllegalArgumentException} if called with {@code null}
|
||||||
|
* for the item to unpublish.
|
||||||
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
@InSequence(6200)
|
@InSequence(6200)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -746,6 +933,11 @@ public class ContentItemManagerTest {
|
||||||
itemManager.unpublish(item);
|
itemManager.unpublish(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that
|
||||||
|
* {@link ContentItemManager#isLive(org.librecms.contentsection.ContentItem)}
|
||||||
|
* returns the expected value for the items in the test database.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(7000)
|
@InSequence(7000)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -769,6 +961,13 @@ public class ContentItemManagerTest {
|
||||||
assertThat(itemManager.isLive(item4.get()), is(false));
|
assertThat(itemManager.isLive(item4.get()), is(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to retrieve the live versions of the items in the test database
|
||||||
|
* using
|
||||||
|
* {@link ContentItemManager#getLiveVersion(org.librecms.contentsection.ContentItem, java.lang.Class)}.
|
||||||
|
* The method returns an {@link Optional} which is empty if there is not
|
||||||
|
* live version.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(8000)
|
@InSequence(8000)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
@ -815,6 +1014,11 @@ public class ContentItemManagerTest {
|
||||||
is(ContentItemVersion.LIVE));
|
is(ContentItemVersion.LIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to retrieve the draft version of the items in the test database
|
||||||
|
* from draft or live versions of the items in the test database using
|
||||||
|
* {@link ContentItemManager#getDraftVersion(org.librecms.contentsection.ContentItem, java.lang.Class)}.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
@InSequence(8100)
|
@InSequence(8100)
|
||||||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue